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 # Where the local copy of /home/ftp/pub/rsync/nightly should be updated.
18 our $dest = $ENV{HOME
} . '/samba-rsync-ftp/nightly';
19 our $nightly_symlink = "$dest/rsync-HEAD.tar.gz";
21 our($make_tar, $upload, $help_opt);
22 &Getopt
::Long
::Configure
('bundling');
23 &usage
if !&GetOptions
(
24 'make-tar|t' => \
$make_tar,
25 'upload|u' => \
$upload,
26 'help|h' => \
$help_opt,
29 our $name = time2str
('rsync-HEAD-%Y%m%d-%H%M%Z', time, 'GMT');
30 our $ztoday = time2str
('%d %b %Y', time);
33 die "$dest does not exist\n" unless -d
$dest;
34 die "There is no .git dir in the current directory.\n" unless -d
'.git';
35 die "There is no rsync checkout in the current directory.\n" unless -f
'rsyncd.conf.yo';
38 open(IN
, '-|', 'git-status') or die $!;
39 my $status = join('', <IN
>);
41 die "The checkout is not clean:\n", $status unless $status =~ /\nnothing to commit \(working directory clean\)/;
42 die "The checkout is not on the master branch.\n" unless $status =~ /^# On branch master\n/;
44 open(IN
, '<', 'prepare-source.mak') or die "Couldn't open prepare-source.mak: $!\n";
48 my @extra_files = m{\n([^\s:]+):.*\n\t\S}g;
49 map { s
#^#$name/# } @extra_files;
51 print "Creating $name.tar.gz\n";
52 system "./prepare-source && touch proto.h";
54 system "git-archive --format=tar --prefix=$name/ HEAD >$dest/$name.tar";
55 system "fakeroot tar rf $dest/$name.tar @extra_files; gzip -9 $dest/$name.tar";
57 unlink($nightly_symlink);
58 symlink("$name.tar.gz", $nightly_symlink);
61 foreach my $fn (qw( rsync.yo rsyncd.conf.yo )) {
62 my $yo_tmp = "$dest/$fn";
63 (my $html_fn = "$dest/$fn") =~ s
/\
.yo
/.html/;
65 open(IN
, '<', $fn) or die $!;
66 undef $/; $_ = <IN>; $/ = "\n";
69 s/^(manpage\([^)]+\)\(\d+\)\()[^)]+(\).*)/$1$today$2/m;
70 #s/^(This man ?page is current for version) \S+ (of rsync)/$1 $version $2/m;
72 open(OUT
, '>', $yo_tmp) or die $!;
76 system 'yodl2html', '-o', $html_fn, $yo_tmp;
81 chdir($dest) or die $!;
84 open(PIPE
, '-|', 'ls -1t rsync-HEAD-*') or die $!;
96 if (defined $ENV{RSYNC_PARTIAL_DIR
}) {
97 $opt = " -f 'R $ENV{RSYNC_PARTIAL_DIR}'";
99 system "rsync$opt -aviHP --delete-after . samba.org:/home/ftp/pub/rsync/nightly";
107 Usage: nightly-rsync [OPTIONS]
109 -t, --make-tar create a new tar file in $dest
110 -u, --upload upload the revised nightly dir to samba.org
111 -h, --help display this help