X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/9578783a719e1eeb1c4765be697730bc243d3de5..f28bf7f401ee58704f7b77465faf3b7af3f5ee8c:/packaging/nightly-rsync diff --git a/packaging/nightly-rsync b/packaging/nightly-rsync index 58936a6b..af9f53a3 100755 --- a/packaging/nightly-rsync +++ b/packaging/nightly-rsync @@ -14,16 +14,13 @@ use strict; use Getopt::Long; use Date::Format; -# Choose any dir where a pristine rsync has been checked out of CVS. -our $unpacked = $ENV{HOME} . '/release/nightly'; -# Where the local copy of /home/ftp/pub/rsync/nightly should be updated. -our $nightly = $ENV{HOME} . '/samba-rsync-ftp/nightly'; -our $nightly_symlink = "$nightly/rsync-HEAD.tar.gz"; +# Where the local copy of /home/ftp/pub/rsync/dev/nightly should be updated. +our $dest = $ENV{HOME} . '/samba-rsync-ftp/dev/nightly'; +our $nightly_symlink = "$dest/rsync-HEAD.tar.gz"; -our($cvs_update, $make_tar, $upload, $help_opt); +our($make_tar, $upload, $help_opt); &Getopt::Long::Configure('bundling'); &usage if !&GetOptions( - 'cvs-update|c' => \$cvs_update, 'make-tar|t' => \$make_tar, 'upload|u' => \$upload, 'help|h' => \$help_opt, @@ -32,76 +29,82 @@ our($cvs_update, $make_tar, $upload, $help_opt); our $name = time2str('rsync-HEAD-%Y%m%d-%H%M%Z', time, 'GMT'); our $ztoday = time2str('%d %b %Y', time); our $today = $ztoday; +our $gen_target = $upload ? 'gensend' : 'gen'; -chdir($unpacked) or die $!; - -if ($cvs_update) { - print "Updating from cvs...\n"; - system 'cvs -q up' and die $!; -} +die "$dest does not exist\n" unless -d $dest; +die "There is no .git dir in the current directory.\n" unless -d '.git'; +die "There is no rsync checkout in the current directory.\n" unless -f 'rsyncd.conf.yo'; if ($make_tar) { - print "Generating list of active CVS files...\n"; - my($dir, @files); - open(CVS, '-|', 'cvs status 2>&1') or die $!; - while () { - if (/^cvs status: Examining (.*)/) { - if ($1 eq '.') { - $dir = ''; - } else { - push(@files, $1); - $dir = $1 . '/'; - } - } elsif (/^File: (.*?)\s+Status: (.*)/ && $1 ne '.cvsignore') { - push(@files, $dir . $1); - if ($2 ne 'Up-to-date') { - print "*** Not up-to-date: $dir$1\n"; + open(IN, '-|', 'git status') or die $!; + my $status = join('', ); + close IN; + die "The checkout is not clean:\n", $status unless $status =~ /\nnothing to commit \(working directory clean\)/; + die "The checkout is not on the master branch.\n" unless $status =~ /^# On branch master\n/; + system "make $gen_target" and die "make $gen_target failed!\n"; + + my @extra_files; + open(IN, '<', 'Makefile.in') or die "Couldn't open Makefile.in: $!\n"; + while () { + if (s/^GENFILES=//) { + while (s/\\$//) { + $_ .= ; } + @extra_files = split(' ', $_); + last; } } - close CVS; - - print "Creating $unpacked/$name.tar.gz\n"; - chdir('..') or die $!; - rename($unpacked, $name) or die $!; - open(TAR, '|-', "fakeroot tar --files-from=- --no-recursion --mode=g-w -czf $nightly/$name.tar.gz $name") or die $!; - foreach (@files) { - print TAR "$name/$_\n"; - } - close TAR; - rename($name, $unpacked) or die $!; + close IN; + + print "Creating $name.tar.gz\n"; + system "rsync -a @extra_files $name/"; + system "git archive --format=tar --prefix=$name/ HEAD | tar xf -"; + system "support/git-set-file-times --prefix=$name/"; + system "fakeroot tar czf $dest/$name.tar.gz $name; rm -rf $name"; + unlink($nightly_symlink); symlink("$name.tar.gz", $nightly_symlink); } -chdir($nightly) or die $!; - foreach my $fn (qw( rsync.yo rsyncd.conf.yo )) { - my $html_fn = $fn; - $html_fn =~ s/\.yo/.html/; + my $yo_tmp = "$dest/$fn"; + (my $html_fn = "$dest/$fn") =~ s/\.yo/.html/; - open(IN, '<', "$unpacked/$fn") or die $!; + open(IN, '<', $fn) or die $!; undef $/; $_ = ; $/ = "\n"; close IN; s/^(manpage\([^)]+\)\(\d+\)\()[^)]+(\).*)/$1$today$2/m; #s/^(This man ?page is current for version) \S+ (of rsync)/$1 $version $2/m; - open(OUT, '>', $fn) or die $!; + open(OUT, '>', $yo_tmp) or die $!; print OUT $_; close OUT; - system "yodl2html -o $html_fn $fn"; + system 'yodl2html', '-o', $html_fn, $yo_tmp; + + unlink($yo_tmp); +} + +chdir($dest) or die $!; - unlink($fn); +my $cnt = 0; +open(PIPE, '-|', 'ls -1t rsync-HEAD-*') or die $!; +while () { + chomp; + next if $cnt++ < 10; + unlink($_); } +close PIPE; -system "find . -name 'rsync-HEAD-*' -daystart -mtime +14 | xargs rm -f"; system 'ls -ltr'; if ($upload) { - $ENV{RSYNC_PARTIAL_DIR} = ''; # The rsync on samba.org is OLD. - system "rsync -aviHP --delete-after . samba.org:/home/ftp/pub/rsync/nightly"; + my $opt = ''; + if (defined $ENV{RSYNC_PARTIAL_DIR}) { + $opt = " -f 'R $ENV{RSYNC_PARTIAL_DIR}'"; + } + system "rsync$opt -aviHP --delete-after . samba.org:/home/ftp/pub/rsync/dev/nightly"; } exit; @@ -111,8 +114,7 @@ sub usage die <