From 649fc52c6728bb8b1788a5ae74d4002781a88fce Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 31 Oct 2016 12:01:40 +0000 Subject: [PATCH] Rename source directory and files. This renames the source directory from virt-top to src/ and removes the unnecessary virt_top_* prefix from many source files. This is entirely refactoring and makes no functional change. Also this fixes the MANIFEST file and removes old Transifex configuration, fixing commit defe5bdd4a32e0206a786d279e0f9cfc238e5e17. --- .gitignore | 72 +++++++++------------- .tx/config | 8 --- ChangeLog | 30 +++++++++ MANIFEST | 41 +++++++----- Makefile.in | 15 ++--- README | 2 +- configure.ac | 29 ++++----- src/.depend | 20 ++++++ {virt-top => src}/Makefile.in | 18 +++--- {virt-top => src}/README | 22 ++++--- virt-top/virt_top_main.ml => src/main.ml | 4 +- .../virt_top_calendar1.ml => src/opt_calendar1.ml | 4 +- .../virt_top_calendar2.ml => src/opt_calendar2.ml | 4 +- virt-top/virt_top_csv.ml => src/opt_csv.ml | 6 +- virt-top/virt_top_xml.ml => src/opt_xml.ml | 4 +- virt-top/virt_top.ml => src/top.ml | 8 +-- virt-top/virt_top.mli => src/top.mli | 0 virt-top/virt_top_utils.ml => src/utils.ml | 2 +- virt-top/virt_top_utils.mli => src/utils.mli | 0 .../virt_top_version.ml.in => src/version.ml.in | 0 {virt-top => src}/virt-top.pod | 0 virt-top/.depend | 20 ------ 22 files changed, 163 insertions(+), 146 deletions(-) delete mode 100644 .tx/config create mode 100644 src/.depend rename {virt-top => src}/Makefile.in (91%) rename {virt-top => src}/README (77%) rename virt-top/virt_top_main.ml => src/main.ml (98%) rename virt-top/virt_top_calendar1.ml => src/opt_calendar1.ml (97%) rename virt-top/virt_top_calendar2.ml => src/opt_calendar2.ml (97%) rename virt-top/virt_top_csv.ml => src/opt_csv.ml (94%) rename virt-top/virt_top_xml.ml => src/opt_xml.ml (97%) rename virt-top/virt_top.ml => src/top.ml (99%) rename virt-top/virt_top.mli => src/top.mli (100%) rename virt-top/virt_top_utils.ml => src/utils.ml (99%) rename virt-top/virt_top_utils.mli => src/utils.mli (100%) rename virt-top/virt_top_version.ml.in => src/version.ml.in (100%) rename {virt-top => src}/virt-top.pod (100%) delete mode 100644 virt-top/.depend diff --git a/.gitignore b/.gitignore index d08e9e2..e3f77e7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,50 +1,36 @@ -aclocal.m4 -META -ocaml-libvirt-*.tar.gz -ocaml-libvirt-*.exe -html -configure -config.log -config.status -config.h -config.cache -Makefile -Make.rules -*/Makefile -autom4te.cache -core -core.* +*.a +*.cma *.cmi *.cmo *.cmx -*.cma *.cmxa -*.o -*.so -*.a -*.opt *.dll *.exe -*~ -libvirt/libvirt_version.ml -examples/list_domains -examples/node_info -mlvirsh/mlvirsh -virt-ctrl/virt-ctrl -virt-top/virt-top -virt-df/virt-df -wininstaller.nsis +*.o +*.opt *.orig -mlvirsh/mlvirsh_gettext.ml -virt-ctrl/virt_ctrl_gettext.ml -virt-df/virt_df_gettext.ml -virt-top/virt_top_gettext.ml -virt-top/virt_top_version.ml -po/*.mo -po/*.po.bak -virt-df/virt_df_lvm2_lexer.ml -virt-df/virt_df_lvm2_parser.ml -virt-df/virt_df_lvm2_parser.mli -virt-top-*.tar.gz -virt-top/virt-top.1 -virt-top/virt-top.txt \ No newline at end of file +*.so +*~ + +META +Makefile +aclocal.m4 +config.cache +config.h +config.log +config.status +configure +core +core.* +html + +/Make.rules +/autom4te.cache +/po/*.mo +/po/*.po.bak +/src/opt_gettext.ml +/src/version.ml +/src/virt-top +/src/virt-top.1 +/src/virt-top.txt +/virt-top-*.tar.gz diff --git a/.tx/config b/.tx/config deleted file mode 100644 index 3e17770..0000000 --- a/.tx/config +++ /dev/null @@ -1,8 +0,0 @@ -[main] -host = https://www.transifex.net - -[virttop.virttoppot] -file_filter = po/.po -source_file = po/virt-top.pot -source_lang = en - diff --git a/ChangeLog b/ChangeLog index 8daca45..1b3999a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +2016-10-31 Richard W.M. Jones + + Rename source directory and files. + This renames the source directory from virt-top to src/ and removes + the unnecessary virt_top_* prefix from many source files. + + This is entirely refactoring and makes no functional change. + + Also this fixes the MANIFEST file and removes old Transifex + configuration, fixing commit defe5bdd4a32e0206a786d279e0f9cfc238e5e17. + +2016-01-04 Richard W.M. Jones + + build: Add -g flag to ocamlopt. + Modern ocamlopt supports the -g flag fine (very old versions did not). + +2015-02-21 Richard W.M. Jones + + Update translations from Zanata. + + Move upstream translations from Tranifex to Zanata. + This is at the request of the Fedora localization team. + For further information see: + + https://www.redhat.com/archives/libguestfs/2015-February/msg00168.html + +2014-08-02 Richard W.M. Jones + + Disable warning about immutable strings (for OCaml 4.02). + 2012-10-12 Richard W.M. Jones Version 1.0.8. diff --git a/MANIFEST b/MANIFEST index c5958d7..2cf377f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -14,12 +14,17 @@ Make.rules.in MANIFEST m4/ocaml.m4 po/as.po +po/ca.po po/de.po po/es.po +po/eu.po po/fr.po po/gu.po +po/hu.po +po/id.po po/it.po po/ja.po +po/ka.po po/kn.po po/LINGUAS po/Makefile.in @@ -27,30 +32,36 @@ po/ml.po po/mr.po po/nl.po po/or.po +po/pa.po po/pl.po po/pt_BR.po po/pt.po po/POTFILES po/ru.po +po/sr.po +po/sv.po po/te.po +po/tg.po +po/tr.po po/uk.po po/virt-top.pot +po/zanata-pull.sh +po/zanata.xml po/zh_CN.po po/zh_TW.po README TODO -.tx/config -virt-top/.depend -virt-top/Makefile.in -virt-top/README -virt-top/virt-top.pod -virt-top/virt_top.ml -virt-top/virt_top.mli -virt-top/virt_top_calendar1.ml -virt-top/virt_top_calendar2.ml -virt-top/virt_top_csv.ml -virt-top/virt_top_main.ml -virt-top/virt_top_utils.ml -virt-top/virt_top_utils.mli -virt-top/virt_top_version.ml.in -virt-top/virt_top_xml.ml +src/.depend +src/Makefile.in +src/README +src/main.ml +src/opt_calendar1.ml +src/opt_calendar2.ml +src/opt_csv.ml +src/opt_xml.ml +src/top.ml +src/top.mli +src/utils.ml +src/utils.mli +src/version.ml.in +src/virt-top.pod diff --git a/Makefile.in b/Makefile.in index b310e58..d0aec17 100644 --- a/Makefile.in +++ b/Makefile.in @@ -22,25 +22,22 @@ INSTALL = @INSTALL@ MAKENSIS = @MAKENSIS@ -SUBDIRS = virt-top +SUBDIRS = src all opt depend install: - for d in $(SUBDIRS); do \ - $(MAKE) -C $$d $@; \ - if [ $$? -ne 0 ]; then exit 1; fi; \ - done + $(MAKE) -C src $@ clean: for d in . $(SUBDIRS); do \ (cd $$d; rm -f *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a *.so *.opt *~ *.dll *.exe core); \ done - rm -f virt-top/virt-top + rm -f src/virt-top distclean: clean rm -f config.h config.log config.status configure rm -rf autom4te.cache rm -f Makefile - rm -f virt-top/Makefile + rm -f src/Makefile # Distribution. @@ -51,8 +48,8 @@ dist: ChangeLog tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf - $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/ $(INSTALL) -m 0644 aclocal.m4 $(PACKAGE)-$(VERSION)/ - $(INSTALL) -m 0644 virt-top/virt-top.1 $(PACKAGE)-$(VERSION)/virt-top/ - $(INSTALL) -m 0644 virt-top/virt-top.txt $(PACKAGE)-$(VERSION)/virt-top/ + $(INSTALL) -m 0644 src/virt-top.1 $(PACKAGE)-$(VERSION)/src/ + $(INSTALL) -m 0644 src/virt-top.txt $(PACKAGE)-$(VERSION)/src/ tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION) rm -rf $(PACKAGE)-$(VERSION) ls -l $(PACKAGE)-$(VERSION).tar.gz diff --git a/README b/README index 5a8bc87..d97fa62 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ virt-top ---------------------------------------------------------------------- -Copyright (C) 2007-2012 Richard W.M. Jones, Red Hat Inc. +Copyright (C) 2007-2016 Richard W.M. Jones, Red Hat Inc. http://et.redhat.com/~rjones/virt-top/ http://libvirt.org/ocaml/ http://libvirt.org/ diff --git a/configure.ac b/configure.ac index 0d41cda..ad65465 100644 --- a/configure.ac +++ b/configure.ac @@ -84,26 +84,24 @@ AC_CHECK_PROG(MSGFMT,msgfmt,msgfmt) dnl Write gettext modules for the programs. dnl http://www.le-gall.net/sylvain+violaine/documentation/ocaml-gettext/html/reference-manual/ch03s04.html -for d in virt-top; do - f=`echo $d | tr - _`_gettext.ml - AC_MSG_NOTICE([creating $d/$f]) - rm -f $d/$f - echo "(* This file is generated automatically by ./configure. *)" > $d/$f - if test "x$OCAML_PKG_gettext" != "xno"; then - # Gettext module is available, so use it. - cat <>$d/$f +AC_MSG_NOTICE([creating src/opt_gettext.ml]) +rm -f src/opt_gettext.ml +echo "(* This file is generated automatically by ./configure. *)" > src/opt_gettext.ml +if test "x$OCAML_PKG_gettext" != "xno"; then + # Gettext module is available, so use it. + cat <>src/opt_gettext.ml module Gettext = Gettext.Program ( struct - let textdomain = "$d" + let textdomain = "virt-top" let codeset = None let dir = None let dependencies = [[]] end ) (GettextStub.Native) EOT - else - # No gettext module is available, so fake the translation functions. - cat <>$d/$f +else + # No gettext module is available, so fake the translation functions. + cat <>src/opt_gettext.ml module Gettext = struct external s_ : string -> string = "%identity" external f_ : ('a -> 'b, 'c, 'd) format -> ('a -> 'b, 'c, 'd) format @@ -115,8 +113,7 @@ module Gettext = struct = fun s p n -> if n = 1 then s else p end EOT - fi -done +fi dnl Summary. echo "------------------------------------------------------------" @@ -128,7 +125,7 @@ AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile Make.rules po/Makefile - virt-top/Makefile - virt-top/virt_top_version.ml + src/Makefile + src/version.ml ]) AC_OUTPUT diff --git a/src/.depend b/src/.depend new file mode 100644 index 0000000..5325c54 --- /dev/null +++ b/src/.depend @@ -0,0 +1,20 @@ +main.cmo: top.cmi opt_gettext.cmo +main.cmx: top.cmx opt_gettext.cmx +opt_calendar1.cmo: top.cmi opt_gettext.cmo +opt_calendar1.cmx: top.cmx opt_gettext.cmx +opt_calendar2.cmo: top.cmi opt_gettext.cmo +opt_calendar2.cmx: top.cmx opt_gettext.cmx +opt_csv.cmo: top.cmi opt_gettext.cmo +opt_csv.cmx: top.cmx opt_gettext.cmx +opt_gettext.cmo: +opt_gettext.cmx: +opt_xml.cmo: top.cmi opt_gettext.cmo +opt_xml.cmx: top.cmx opt_gettext.cmx +top.cmi: +top.cmo: version.cmo utils.cmi opt_gettext.cmo top.cmi +top.cmx: version.cmx utils.cmx opt_gettext.cmx top.cmi +utils.cmi: +utils.cmo: opt_gettext.cmo utils.cmi +utils.cmx: opt_gettext.cmx utils.cmi +version.cmo: +version.cmx: diff --git a/virt-top/Makefile.in b/src/Makefile.in similarity index 91% rename from virt-top/Makefile.in rename to src/Makefile.in index e149b26..d29f2e8 100755 --- a/virt-top/Makefile.in +++ b/src/Makefile.in @@ -39,28 +39,28 @@ OCAMLCPACKAGES += -package gettext-stub endif OBJS := \ - virt_top_version.cmo \ - virt_top_gettext.cmo \ - virt_top_utils.cmo \ - virt_top.cmo + version.cmo \ + opt_gettext.cmo \ + utils.cmo \ + top.cmo ifneq ($(OCAML_PKG_xml_light),no) -OBJS += virt_top_xml.cmo +OBJS += opt_xml.cmo OCAMLCPACKAGES += -package xml-light endif ifneq ($(OCAML_PKG_csv),no) -OBJS += virt_top_csv.cmo +OBJS += opt_csv.cmo OCAMLCPACKAGES += -package csv endif ifneq ($(OCAML_PKG_calendar),no) ifeq ($(is_calendar2),no) -OBJS += virt_top_calendar1.cmo +OBJS += opt_calendar1.cmo OCAMLCPACKAGES += -package calendar else -OBJS += virt_top_calendar2.cmo +OBJS += opt_calendar2.cmo OCAMLCPACKAGES += -package calendar endif endif -OBJS += virt_top_main.cmo +OBJS += main.cmo XOBJS := $(OBJS:.cmo=.cmx) diff --git a/virt-top/README b/src/README similarity index 77% rename from virt-top/README rename to src/README index b594f95..47382a5 100755 --- a/virt-top/README +++ b/src/README @@ -1,11 +1,11 @@ The code is structured into these files: - virt_top_utils.mli / virt_top_utils.ml + utils.mli, utils.ml String functions and other small utility functions. This is included directly into virt_top.ml. - virt_top.mli / virt_top.ml + top.mli, top.ml This is the virt-top program. @@ -22,7 +22,11 @@ The code is structured into these files: The function 'main_loop' runs the main loop and has sub-functions to deal with keypresses, help screens and so on. - virt_top_xml.ml + opt_gettext.ml + A generated file which adds gettext support if ocaml-gettext + was found at configure time, or else stubs it out. + + opt_xml.ml Any code which needs the optional xml-light library goes in here. Mainly for parsing domain XML descriptions to get @@ -31,21 +35,21 @@ The code is structured into these files: The reason for having it in a separate file is so that we don't depend on xml-light. - virt_top_csv.ml + opt_csv.ml Any code which needs the optional ocaml-csv library goes in here. This implements the --csv command line option. - virt_top_calendar.ml + opt_calendar1.ml, opt_calendar2.ml Any code which needs the optional ocaml-calendar library - goes in here. This implements the --end-time command line - option. + (v1 or v2) goes in here. This implements the --end-time + command line option. - virt_top_main.ml + main.ml This is just a small bit of code to glue the modules together - Virt_top + Virt_top_xml? + Virt_top_csv? + Virt_top_calendar? + Top + Opt_xml? + Opt_csv? + Opt_calendar{1,2}? The man-page is generated from the single file: diff --git a/virt-top/virt_top_main.ml b/src/main.ml similarity index 98% rename from virt-top/virt_top_main.ml rename to src/main.ml index e8c4425..34d13c8 100644 --- a/virt-top/virt_top_main.ml +++ b/src/main.ml @@ -21,8 +21,8 @@ open Curses -open Virt_top_gettext.Gettext -open Virt_top +open Opt_gettext.Gettext +open Top (* Note: make sure we catch any exceptions and clean up the display. * diff --git a/virt-top/virt_top_calendar1.ml b/src/opt_calendar1.ml similarity index 97% rename from virt-top/virt_top_calendar1.ml rename to src/opt_calendar1.ml index 534465c..2c459fe 100755 --- a/virt-top/virt_top_calendar1.ml +++ b/src/opt_calendar1.ml @@ -22,9 +22,9 @@ open Printf open ExtString -open Virt_top_gettext.Gettext ;; +open Opt_gettext.Gettext ;; -Virt_top.parse_date_time := +Top.parse_date_time := fun time -> let cal : Calendar.t = if String.starts_with time "+" then ( (* +something *) diff --git a/virt-top/virt_top_calendar2.ml b/src/opt_calendar2.ml similarity index 97% rename from virt-top/virt_top_calendar2.ml rename to src/opt_calendar2.ml index cc82eec..fd93704 100755 --- a/virt-top/virt_top_calendar2.ml +++ b/src/opt_calendar2.ml @@ -24,9 +24,9 @@ open CalendarLib open Printf open ExtString -open Virt_top_gettext.Gettext ;; +open Opt_gettext.Gettext ;; -Virt_top.parse_date_time := +Top.parse_date_time := fun time -> let cal : Calendar.t = if String.starts_with time "+" then ( (* +something *) diff --git a/virt-top/virt_top_csv.ml b/src/opt_csv.ml similarity index 94% rename from virt-top/virt_top_csv.ml rename to src/opt_csv.ml index e048856..6c3b2be 100644 --- a/virt-top/virt_top_csv.ml +++ b/src/opt_csv.ml @@ -19,16 +19,16 @@ This file contains all code which requires CSV support. *) -open Virt_top_gettext.Gettext +open Opt_gettext.Gettext (* Output channel, or None if CSV output not enabled. *) let chan = ref None ;; -Virt_top.csv_start := +Top.csv_start := fun filename -> chan := Some (open_out filename) ;; -Virt_top.csv_write := +Top.csv_write := fun row -> match !chan with | None -> () (* CSV output not enabled. *) diff --git a/virt-top/virt_top_xml.ml b/src/opt_xml.ml similarity index 97% rename from virt-top/virt_top_xml.ml rename to src/opt_xml.ml index ab291d3..bb83780 100644 --- a/virt-top/virt_top_xml.ml +++ b/src/opt_xml.ml @@ -21,13 +21,13 @@ open ExtList -open Virt_top_gettext.Gettext +open Opt_gettext.Gettext module C = Libvirt.Connect module D = Libvirt.Domain module N = Libvirt.Network ;; -Virt_top.parse_device_xml := +Top.parse_device_xml := fun id dom -> try let xml = D.get_xml_desc dom in diff --git a/virt-top/virt_top.ml b/src/top.ml similarity index 99% rename from virt-top/virt_top.ml rename to src/top.ml index 0aae24e..38658c6 100644 --- a/virt-top/virt_top.ml +++ b/src/top.ml @@ -21,8 +21,8 @@ open Printf open ExtList open Curses -open Virt_top_gettext.Gettext -open Virt_top_utils +open Opt_gettext.Gettext +open Utils module C = Libvirt.Connect module D = Libvirt.Domain @@ -159,7 +159,7 @@ let start_up () = and set_end_time time = end_time := Some ((!parse_date_time) time) and display_version () = printf "virt-top %s ocaml-libvirt %s\n" - Virt_top_version.version Libvirt_version.version; + Version.version Libvirt_version.version; exit 0 in let argspec = Arg.align [ @@ -1723,7 +1723,7 @@ and show_help (_, _, _, _, _, _, hostname, (* Banner at the top of the screen. *) let banner = sprintf (f_"virt-top %s ocaml-libvirt %s libvirt %d.%d.%d by Red Hat") - Virt_top_version.version + Version.version Libvirt_version.version libvirt_major libvirt_minor libvirt_release in let banner = pad cols banner in diff --git a/virt-top/virt_top.mli b/src/top.mli similarity index 100% rename from virt-top/virt_top.mli rename to src/top.mli diff --git a/virt-top/virt_top_utils.ml b/src/utils.ml similarity index 99% rename from virt-top/virt_top_utils.ml rename to src/utils.ml index c5dc97d..3dc637d 100644 --- a/virt-top/virt_top_utils.ml +++ b/src/utils.ml @@ -21,7 +21,7 @@ open Printf -open Virt_top_gettext.Gettext +open Opt_gettext.Gettext module C = Libvirt.Connect module D = Libvirt.Domain diff --git a/virt-top/virt_top_utils.mli b/src/utils.mli similarity index 100% rename from virt-top/virt_top_utils.mli rename to src/utils.mli diff --git a/virt-top/virt_top_version.ml.in b/src/version.ml.in similarity index 100% rename from virt-top/virt_top_version.ml.in rename to src/version.ml.in diff --git a/virt-top/virt-top.pod b/src/virt-top.pod similarity index 100% rename from virt-top/virt-top.pod rename to src/virt-top.pod diff --git a/virt-top/.depend b/virt-top/.depend deleted file mode 100644 index 46099b7..0000000 --- a/virt-top/.depend +++ /dev/null @@ -1,20 +0,0 @@ -virt_top_calendar1.cmo: virt_top_gettext.cmo virt_top.cmi -virt_top_calendar1.cmx: virt_top_gettext.cmx virt_top.cmx -virt_top_calendar2.cmo: virt_top_gettext.cmo virt_top.cmi -virt_top_calendar2.cmx: virt_top_gettext.cmx virt_top.cmx -virt_top.cmi: -virt_top.cmo: virt_top_version.cmo virt_top_utils.cmi virt_top_gettext.cmo virt_top.cmi -virt_top.cmx: virt_top_version.cmx virt_top_utils.cmx virt_top_gettext.cmx virt_top.cmi -virt_top_csv.cmo: virt_top_gettext.cmo virt_top.cmi -virt_top_csv.cmx: virt_top_gettext.cmx virt_top.cmx -virt_top_gettext.cmo: -virt_top_gettext.cmx: -virt_top_main.cmo: virt_top_gettext.cmo virt_top.cmi -virt_top_main.cmx: virt_top_gettext.cmx virt_top.cmx -virt_top_utils.cmi: -virt_top_utils.cmo: virt_top_gettext.cmo virt_top_utils.cmi -virt_top_utils.cmx: virt_top_gettext.cmx virt_top_utils.cmi -virt_top_version.cmo: -virt_top_version.cmx: -virt_top_xml.cmo: virt_top_gettext.cmo virt_top.cmi -virt_top_xml.cmx: virt_top_gettext.cmx virt_top.cmx -- 1.8.3.1