The following commit has been merged in the 2.27.57/master branch:
commit f80ebb7a7524cb2e75429385e3d27d1559fed1b7
Author: Sylvain Le Gall <gil...@debian.org>
Date:   Sat Feb 27 19:31:44 2010 +0100

    Auto-generate manpage

diff --git a/debian/generate-manpage.ml b/debian/generate-manpage.ml
new file mode 100644
index 0000000..361f860
--- /dev/null
+++ b/debian/generate-manpage.ml
@@ -0,0 +1,115 @@
+
+#load "str.cma"
+
+let option_no_arg opt hlp =
+ List.iter print_endline 
+   [
+     ".TP";
+     ".B \\"^opt;
+     hlp
+   ]
+
+let option_arg opt arg hlp = 
+ List.iter print_endline 
+   [
+     ".TP";
+     ".B \\"^opt^" "^arg;
+     hlp
+   ]
+
+let () =
+  let fn = 
+    Filename.temp_file "unison-" ".txt"
+  in
+    begin
+      try 
+        let cmd = 
+          (String.concat " " (List.tl (Array.to_list Sys.argv)))^
+          " -help > "^
+          (Filename.quote fn)
+        in
+          match Sys.command cmd with 
+            | 2 ->
+                begin
+                  let actions = 
+                    (* *)
+                    (List.map
+                       (fun (s, f) -> Str.regexp s, f)
+                       [
+                         " *\\(-[a-z_-]+\\) xxx +\\(.*\\)", 
+                         (fun s -> 
+                            option_arg
+                              (Str.matched_group 1 s)
+                              "xxx"
+                              (Str.matched_group 2 s));
+
+                         " *\\(-[a-z_-]+\\) n +\\(.*\\)", 
+                         (fun s -> 
+                            option_arg
+                              (Str.matched_group 1 s)
+                              "n"
+                              (Str.matched_group 2 s));
+
+                         " *\\(-[a-z_-]+\\) +\\(.*\\)", 
+                         (fun s ->
+                            option_no_arg
+                              (Str.matched_group 1 s)
+                              (Str.matched_group 2 s));
+                       ])
+                    @
+                    (List.map 
+                       (fun s -> Str.regexp s, ignore)
+                       [
+                         "Options:";
+                         "Usage: unison \\[options\\]";
+                         " *or unison root1 root2 \\[options\\]";
+                         " *or unison profilename \\[options\\]";
+                         "^$";
+                       ])
+                  in
+                  let chn =
+                    open_in fn
+                  in
+                    begin
+                      try 
+                        while true do 
+                          let line =
+                            input_line chn
+                          in
+                            try 
+                              let (r, a) =
+                                List.find
+                                  (fun (r, a) -> 
+                                     Str.string_match r line 0)
+                                  actions
+                              in
+                              let _b : bool =
+                                (* Ensure that we run string_match just
+                                   before calling a, to fill the good 
+                                   variable in Str
+                                 *)
+                                Str.string_match r line 0
+                              in
+                                a line
+
+                            with Not_found ->
+                              failwith 
+                                (Printf.sprintf
+                                   "No matching regexp for '%s'"
+                                   line)
+                        done
+                      with End_of_file ->
+                        ()
+                    end;
+                    close_in chn
+                end
+            | n ->
+                Printf.eprintf "Command '%s' exited with code %d"
+                  cmd
+                  n
+      with e ->
+        Sys.remove fn;
+        raise e
+    end;
+    Sys.remove fn
+
diff --git a/debian/rules b/debian/rules
index eaba14c..9687017 100755
--- a/debian/rules
+++ b/debian/rules
@@ -105,7 +105,6 @@ clean::
 build/$(UNISON_PACKAGE)::
        $(MAKE) UISTYLE=text NATIVE=$(NATIVE) $(MY_MAKE_FLAGS) CFLAGS=
        mv '$(CURDIR)/unison' '$(CURDIR)/$(UNISON)'
-       env HOME='$(CURDIR)' '$(CURDIR)/$(UNISON)' -doc all > 
'$(CURDIR)/unison-manual.txt'
 
 build/$(UNISON_GTK_PACKAGE):: debian/$(UNISON_GTK_PACKAGE).xpm
        $(MAKE) UISTYLE=$(UISTYLE) NATIVE=$(NATIVE) $(MY_MAKE_FLAGS) CFLAGS=
@@ -113,16 +112,28 @@ build/$(UNISON_GTK_PACKAGE):: 
debian/$(UNISON_GTK_PACKAGE).xpm
        if test 'x$(OCAML_HAVE_OCAMLOPT)' = 'xyes'; then /usr/bin/chrpath -d 
'$(CURDIR)/$(UNISON_GTK)'; fi
 
 clean::
-       -$(RM) '$(CURDIR)/unison-manual.txt'
        -$(RM) '$(CURDIR)/$(UNISON_GTK)'
        -$(RM) '$(CURDIR)/$(UNISON)'
        $(MAKE) clean
 
+debian/unison-manual.txt: build/$(UNISON_PACKAGE)
+       env HOME='$(CURDIR)' '$(CURDIR)/$(UNISON)' -doc all > 
'$(CURDIR)/unison-manual.txt'
+
+debian/unison.1.in: build/$(UNISON_PACKAGE)
+       cp debian/unison-intro.1.in debian/unison.1.in
+       env HOME='$(CURDIR)' ocaml debian/generate-manpage.ml 
'$(CURDIR)/$(UNISON)' >> debian/unison.1.in
+       cat debian/unison-outro.1.in >> debian/unison.1.in
+
+clean::
+       -$(RM) unison-manual.txt
+       -$(RM) debian/unison.1.in
+
+common-binary-arch:: debian/unison-manual.txt debian/unison.1.in
+
 #
 # Unison icons
 #
 
-
 debian/$(UNISON_GTK_PACKAGE).png: debian/unison-gtk.svg.in
         rsvg -f png -w 32 -h 32 $^ $@
 
diff --git a/debian/unison-intro.1.in b/debian/unison-intro.1.in
new file mode 100644
index 0000000..7766e32
--- /dev/null
+++ b/debian/unison-intro.1.in
@@ -0,0 +1,68 @@
+.\"                                      Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH @UNISON_MAJ@ 1 "September 23, 2001"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh        disable hyphenation
+.\" .hy        enable hyphenation
+.\" .ad l      left justify
+.\" .ad b      justify to both left and right margins
+.\" .nf        disable filling
+.\" .fi        enable filling
+.\" .br        insert line break
+.\" .sp <n>    insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+@UNISON@ \- a file-synchronization tool for Unix and Windows
+.SH SYNOPSIS
+.B @UNISON@
+.RI [ options ]
+.br
+.B @UNISON@
+root1 root2
+.RI [ options ]
+.br
+.B @UNISON@
+profilename
+.RI [ options ]
+.br
+.B @UNISON@-gtk
+.RI [ options ]
+.SH DESCRIPTION
+This manual page briefly documents Unison, and was written for the
+Debian GNU/Linux distribution because the original program does not
+have a manual page. For a full description, please refer to the
+inbuilt documentation or the manuals in /usr/share/doc/@UNISON_PACKAGE@/. The
+@UNISON_GTK@ binary has similar command-line options, but allows the user
+to select and create profiles and configure options from within the
+program.
+.PP
+Unison is a file-synchronization tool for Unix and Windows. It allows
+two replicas of a collection of files and directories to be stored on
+different hosts (or different disks on the same host), modified
+separately, and then brought up to date by propagating the changes in
+each replica to the other.
+.PP
+Unison offers several advantages over various synchronization methods
+such as CVS, Coda, rsync, Intellisync, etc. Unison can run on and
+synchronize between Windows and many UNIX platforms. Unison requires
+no root privileges, system access or kernel changes to function. Unison
+can synchronize changes to files and directories in both directions,
+on the same machine, or across a network using ssh or a direct
+socket connection.
+.PP
+Transfers are optimised using a version of the rsync protocol, making
+it ideal for slower links. Unison has a clear and precise specification,
+and is resilient to failure due to its careful handling of the replicas
+and its private structures.
+.PP
+The two roots can be specified using an URI or a path. The URI must follow the
+convention: protocol://[user@][host][:port][/path]. The protocol part can be
+file, socket, ssh or rsh.
+.SH OPTIONS
+All Unison options are long, starting with one dash (`-') only.
+A summary of options is included here. For a complete description,
+see the inbuilt documentation or the manuals in 
/usr/share/doc/@UNISON_PACKAGE@/.
diff --git a/debian/unison-outro.1.in b/debian/unison-outro.1.in
new file mode 100644
index 0000000..35dd3cd
--- /dev/null
+++ b/debian/unison-outro.1.in
@@ -0,0 +1,12 @@
+.PP
+Some preferences are just boolean flags. Others take numeric or string
+arguments, indicated in the preferences list by n or xxx. Most of the
+string preferences can be given several times; the arguments are
+accumulated into a list internally.
+.SH SEE ALSO
+The program is documented fully in the in-built documentation and the
+manual, available as text in /usr/share/doc/@UNISON_PACKAGE@/.
+.SH AUTHOR
+Options are automatically extracted from `unison -help'. The rest of this
+manual page was written by Robert McQueen <robot...@debian.org>, for the Debian
+GNU/Linux system (but may be used by others).
diff --git a/debian/unison.1.in b/debian/unison.1.in
deleted file mode 100644
index 3d9f5da..0000000
--- a/debian/unison.1.in
+++ /dev/null
@@ -1,219 +0,0 @@
-.\"                                      Hey, EMACS: -*- nroff -*-
-.\" First parameter, NAME, should be all caps
-.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
-.\" other parameters are allowed: see man(7), man(1)
-.TH @UNISON_MAJ@ 1 "September 23, 2001"
-.\" Please adjust this date whenever revising the manpage.
-.\"
-.\" Some roff macros, for reference:
-.\" .nh        disable hyphenation
-.\" .hy        enable hyphenation
-.\" .ad l      left justify
-.\" .ad b      justify to both left and right margins
-.\" .nf        disable filling
-.\" .fi        enable filling
-.\" .br        insert line break
-.\" .sp <n>    insert n+1 empty lines
-.\" for manpage-specific macros, see man(7)
-.SH NAME
-@UNISON@ \- a file-synchronization tool for Unix and Windows
-.SH SYNOPSIS
-.B @UNISON@
-.RI [ options ]
-.br
-.B @UNISON@
-root1 root2
-.RI [ options ]
-.br
-.B @UNISON@
-profilename
-.RI [ options ]
-.br
-.B @UNISON@-gtk
-.RI [ options ]
-.SH DESCRIPTION
-This manual page briefly documents Unison, and was written for the
-Debian GNU/Linux distribution because the original program does not
-have a manual page. For a full description, please refer to the
-inbuilt documentation or the manuals in /usr/share/doc/@UNISON_PACKAGE@/. The
-@UNISON_GTK@ binary has similar command-line options, but allows the user
-to select and create profiles and configure options from within the
-program.
-.PP
-Unison is a file-synchronization tool for Unix and Windows. It allows
-two replicas of a collection of files and directories to be stored on
-different hosts (or different disks on the same host), modified
-separately, and then brought up to date by propagating the changes in
-each replica to the other.
-.PP
-Unison offers several advantages over various synchronization methods
-such as CVS, Coda, rsync, Intellisync, etc. Unison can run on and
-synchronize between Windows and many UNIX platforms. Unison requires
-no root privileges, system access or kernel changes to function. Unison
-can synchronize changes to files and directories in both directions,
-on the same machine, or across a network using ssh or a direct
-socket connection.
-.PP
-Transfers are optimised using a version of the rsync protocol, making
-it ideal for slower links. Unison has a clear and precise specification,
-and is resilient to failure due to its careful handling of the replicas
-and its private structures.
-.SH OPTIONS
-All Unison options are long, starting with one dash (`-') only.
-A summary of options is included here. For a complete description,
-see the inbuilt documentation or the manuals in 
/usr/share/doc/@UNISON_PACKAGE@/.
-.TP
-.B \-addprefsto
-specify a file to add new preferences to in interactive mode
-.TP
-.B \-addversionno
-add version number to name of @UNISON@ executable on server
-.TP
-.B \-auto
-automatically accept default actions
-.TP
-.B \-backup xxx
-add a regexp to the backup list
-.TP
-.B \-backups
-keep backup copies of files (deprecated: use 'backup')
-.TP
-.B \-batch
-batch mode: ask no questions at all
-.TP
-.B \-contactquietly
-suppress the 'contacting server' message during startup
-.TP
-.B \-debug xxx
-debug module xxx ('all' -> everything, 'verbose' -> more)
-.TP
-.B \-doc xxx
-show documentation ('-doc topics' lists topics)
-.TP
-.B \-dumbtty
-do not try to change terminal settings in text UI
-.TP
-.B \-editor xxx
-command for displaying the output of the -merge program
-.TP
-.B \-fastcheck
-do fast (and slightly unsafe) update detection on windows
-.TP
-.B \-follow xxx
-add a regexp to the follow list
-.TP
-.B \-force xxx
-force changes from this replica to the other
-.TP
-.B \-group
-synchronize group
-.TP
-.B \-height n
-height (in lines) of main window in graphical interface
-.TP
-.B \-ignore xxx
-add a regexp to the ignore list
-.TP
-.B \-ignorecase
-ignore upper/lowercase spelling of filenames
-.TP
-.B \-ignorenot xxx
-add a regexp to the ignorenot list
-.TP
-.B \-killserver
-kill server when done (even when using sockets)
-.TP
-.B \-log
-record actions in file specified by logfile preference
-.TP
-.B \-logfile xxx
-log file name
-.TP
-.B \-maxbackups n
-number of backed up versions of a file to keep
-.TP
-.B \-merge xxx
-command for merging conflicting files
-.TP
-.B \-merge2 xxx
-command for merging files (when no common version exists)
-.TP
-.B \-numericids
-don't map uid/gid values by user/group names
-.TP
-.B \-owner
-synchronize owner
-.TP
-.B \-path xxx
-path to synchronize
-.TP
-.B \-perms n
-part of the permissions which is synchronized
-.TP
-.B \-prefer xxx
-choose this replica's version in case of conflict
-.TP
-.B \-root xxx
-root of a replica
-.TP
-.B \-rootalias xxx
-register alias for canonical root names
-.TP
-.B \-rshargs xxx
-other arguments (if any) for remote shell command
-.TP
-.B \-rshcmd xxx
-path to the rsh executable
-.TP
-.B \-servercmd xxx
-name of unison executable on remote server
-.TP
-.B \-silent
-print nothing (except error messages)
-.TP
-.B \-socket xxx
-act as a server on a socket
-.TP
-.B \-sortbysize
-list changed files by size, not name
-.TP
-.B \-sortfirst xxx
-add a regexp to the sortfirst list
-.TP
-.B \-sortlast xxx
-add a regexp to the sortlast list
-.TP
-.B \-sortnewfirst
-list new before changed files
-.TP
-.B \-sshcmd xxx
-path to the ssh executable
-.TP
-.B \-statusdepth n
-status display depth for local files
-.TP
-.B \-terse
-suppress status messages
-.TP
-.B \-testserver
-exit immediately after the connection to the server
-.TP
-.B \-times
-synchronize modification times
-.TP
-.B \-ui xxx
-select user interface ('text' or 'graphic')
-.TP
-.B \-version
-print version and exit
-.PP
-Some preferences are just boolean flags. Others take numeric or string
-arguments, indicated in the preferences list by n or xxx. Most of the
-string preferences can be given several times; the arguments are
-accumulated into a list internally.
-.SH SEE ALSO
-The program is documented fully in the in-built documentation and the
-manual, available as text in /usr/share/doc/@UNISON_PACKAGE@/.
-.SH AUTHOR
-This manual page was written by Robert McQueen <robot...@debian.org>,
-for the Debian GNU/Linux system (but may be used by others).

-- 
unison packaging

_______________________________________________
Pkg-ocaml-maint-commits mailing list
Pkg-ocaml-maint-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ocaml-maint-commits

Reply via email to