4 # This script expects the directory ~/samba-rsync-ftp to exist and to be a
5 # copy of the /home/ftp/pub/rsync dir on samba.org. It also requires a
6 # pristine CVS checkout of rsync (don't use your normal rsync build dir
7 # unless you're 100% sure that there are not unchecked-in changes).
9 # If this is run with -ctu, it will make an updated "nightly" tar file in
10 # the nightly dir. It will also remove any old tar files, regenerate the
11 # HTML man pages in the nightly dir, and then rsync the changes to the
17 # Choose any dir where a pristine rsync has been checked out of CVS.
18 our $unpacked = $ENV{HOME} . '/release/nightly';
19 # Where the local copy of /home/ftp/pub/rsync/nightly should be updated.
20 our $nightly = $ENV{HOME} . '/samba-rsync-ftp/nightly';
22 our($cvs_update, $make_tar, $upload, $help_opt);
23 &Getopt::Long::Configure('bundling');
24 &usage if !&GetOptions(
25 'cvs-update|c' => \$cvs_update,
26 'make-tar|t' => \$make_tar,
27 'upload|u' => \$upload,
28 'help|h' => \$help_opt,
31 our $name = time2str('rsync-HEAD-%Y%m%d-%H%M%Z', time, 'GMT');
32 our $ztoday = time2str('%d %b %Y', time);
35 chdir($unpacked) or die $!;
38 print "Updating from cvs...\n";
39 system 'cvs -q up' and die $!;
43 print "Generating list of active CVS files...\n";
45 open(CVS, '-|', 'cvs status 2>&1') or die $!;
47 if (/^cvs status: Examining (.*)/) {
54 } elsif (/^File: (.*?)\s+Status: / && $1 ne '.cvsignore') {
55 push(@files, $dir . $1);
60 print "Creating $unpacked/$name.tar.gz\n";
61 chdir('..') or die $!;
62 rename($unpacked, $name) or die $!;
63 open(TAR, '|-', "fakeroot tar --files-from=- --no-recursion --mode=g-w -czf $nightly/$name.tar.gz $name") or die $!;
65 print TAR "$name/$_\n";
68 rename($name, $unpacked) or die $!;
71 chdir($nightly) or die $!;
73 foreach my $fn (qw( rsync.yo rsyncd.conf.yo )) {
75 $html_fn =~ s/\.yo/.html/;
77 open(IN, '<', "$unpacked/$fn") or die $!;
78 undef $/; $_ = <IN>; $/ = "\n";
81 s/^(manpage\([^)]+\)\(\d+\)\()[^)]+(\).*)/$1$today$2/m;
82 #s/^(This man ?page is current for version) \S+ (of rsync)/$1 $version $2/m;
84 open(OUT, '>', $fn) or die $!;
88 system "yodl2html -o $html_fn $fn";
93 system "find . -name 'rsync-HEAD-*' -daystart -mtime +14 | xargs rm -f";
97 $ENV{RSYNC_PARTIAL_DIR} = ''; # The rsync on samba.org is OLD.
98 system "rsync -aviHP --delete . samba.org:/home/ftp/pub/rsync/nightly";
106 Usage: nightly-rsync [OPTIONS]
108 -c, --cvs-update update $unpacked via CVS.
109 -t, --make-tar create a new tar file in $nightly
110 -u, --upload upload the revised nightly dir to samba.org
111 -h, --help display this help