Hi,

attached are two patches.

debmirror-version.patch: version string and --version option (set to 2.27)
debmirror-trace.patch: additional trace info (needs version string)

new trace output:
Tue May 23 14:05:22 UTC 2017
Date: Tue, 23 May 2017 16:05:22 +0200
Date-Started: Tue, 23 May 2017 16:04:18 +0200
Used debmirror version: 2.27
Running on host: mybox.xyz.local
Architectures: amd64 i386
Distributions: stretch jessie
Upstream-mirror: ftp.ch.debian.org

Regards, Stefan
diff --git a/debmirror b/debmirror
index 7e9e669..26bea48 100755
--- a/debmirror
+++ b/debmirror
@@ -629,6 +629,7 @@ our $doing_meta=1;
 our $ignore_missing_release=0;
 our $ignore_release_gpg=0;
 our $start_time = time;
+our $start_date =`LC_ALL=C date -R`;
 our $dry_run=0;
 our $do_dry_run=0;
 our $rsync_options="-aIL --partial";
@@ -1566,6 +1567,13 @@ if (! $do_dry_run) {
   make_dir("project/trace");
   open OUT, ">$tracefile" or die "$tracefile: $!";
   print OUT `LC_ALL=C date -u`;
+  print OUT "Date: ".`LC_ALL=C date -R`;
+  print OUT "Date-Started: $start_date";
+  print OUT "Used debmirror version: $version\n";
+  print OUT "Running on host: $hostname\n";
+  print OUT "Architectures: ".join(" ", @arches)."\n";
+  print OUT "Distributions: ".join(" ", @dists)."\n";
+  print OUT "Upstream-mirror: $host\n";
   close OUT;
 }
 


diff --git a/debmirror b/debmirror
index 51fc92d..7e9e669 100755
--- a/debmirror
+++ b/debmirror
@@ -89,6 +89,10 @@ download debs and source files and only simulates cleanup.
 
 Display a usage summary.
 
+=item B<--version>
+
+Print version number and exit.
+
 =item B<-h>, B<--host>=I<remotehost>
 
 Specify the remote host to mirror from. Defaults to I<ftp.debian.org>,
@@ -592,6 +596,8 @@ use if $] lt "5.022", "Net::INET6Glue";
 use Net::FTP;
 use LWP::UserAgent;
 
+our $version="2.27";
+
 # Yeah, I use too many global variables in this program.
 our $mirrordir;
 our @config_files;
@@ -703,6 +709,7 @@ my $state_cache_exptime;
 my $files_cache_version = "1.0";
 
 my $help;
+my $print_version;
 Getopt::Long::Configure qw(no_pass_through);
 GetOptions('debug'                  => \$debug,
            'progress|p'             => \$progress,
@@ -757,9 +764,14 @@ GetOptions('debug'                  => \$debug,
            'retry-rsync-packages=s' => \$retry_rsync_packages,
            'keyring=s'              => \@keyrings,
            'help'                   => \$help,
+           'version'                => \$print_version,
 ) or usage;
 usage if $help;
 usage("invalid number of arguments") if $ARGV[1];
+if ($print_version) {
+  print "debmirror $version\n";
+  exit(0);
+}
 
 # This parameter is so important that it is the only required parameter,
 # unless specified in a configuration file.


Reply via email to