4 # This script expects the directory ~/samba-rsync-ftp to exist and to
5 # be a copy of the /home/ftp/pub/rsync dir on samba.org. If it is run
6 # in test mode, it instead expects a dir named ~/tmp/samba-rsync-ftp
7 # (e.g. copy ~/samba-rsync-ftp into ~/tmp and you can do a trial-run of
8 # a release without affecting the files in the ~/samba-rsync-ftp dir).
10 # Run this as "release-rsync live" to affect ~/samba-rsync-ftp instead
11 # of ~/tmp/samba-rsync-ftp.
15 my $dest = $ENV{HOME} . '/samba-rsync-ftp';
16 my $releasedir = $ENV{HOME} . '/release';
17 my $cvsroot = $ENV{CVSROOT} = 'samba.org:/data/cvs';
19 my $ztoday = time2str('%d %b %Y', time);
24 .........................................................................
29 ** Note: type "-a u,n" if you want to auto-accept the U,N suggestions. **
37 print "This will release a new version of rsync onto an unsuspecting world.\n";
39 print "**** TESTMODE **** (add \"live\" arg to avoid this)\n";
40 $dest =~ s#([^/]+$)#tmp/$1#;
41 $skipping = ' ** SKIPPING **';
43 die "$dest does not exist\n" unless -d $dest;
45 print "Checking out the latest rsync into $releasedir...\n";
47 mkdir($releasedir, 0755) or die $! unless -d $releasedir;
48 chdir($releasedir) or die $!;
50 system "rm -rf rsync rsync-*";
52 system "cvs checkout -P rsync";
54 chdir('rsync') or die $!;
56 my($version, $lastversion);
57 open(IN, 'configure.in') or die $!;
59 if (/^RSYNC_VERSION=(.*)/) {
60 $version = $lastversion = $1;
66 $lastversion =~ s/(\d+)cvs$/ $1 - 1 /e;
67 $version =~ s/cvs/pre1/ || $version =~ s/pre(\d+)/ 'pre' . ($1 + 1) /e;
69 print "\nPlease enter the version number of this release: [$version] ";
72 $version =~ s/pre\d+//;
76 $version =~ s/[-.]*pre[-.]*/pre/;
78 $lastversion =~ s/(\d+)pre\d+$/ $1 - 1 /e unless $version =~ /pre/;
80 my $cvstag = "release-$version";
82 $cvstag =~ s/pre/-pre/;
84 print "Enter the previous version to produce a patch against: [$lastversion] ";
86 $lastversion = $_ if $_ ne '';
87 $lastversion =~ s/[-.]*pre[-.]*/pre/;
90 print "Please enter the RPM release number of this release: [$release] ";
92 $release = $_ if $_ ne '';
95 if ($lastversion =~ /pre/) {
96 if ($version !~ /pre/) {
97 die "You should not diff a release version against a pre-release version.\n";
99 $diffdir = "$dest/old-previews";
100 } elsif ($version =~ /pre/) {
103 $diffdir = "$dest/old-versions";
106 my $tarfile = "$dest/rsync-$version.tar.gz";
110 \$version is "$version"
111 \$lastversion is "$lastversion"
112 \$cvstag is "$cvstag"
114 \$releasedir is "$releasedir"
115 \$diffdir is "$diffdir"
116 \$release is "$release"
119 - tweak NEWS and OLDNEWS to update the release date
120 - tweak the version in configure.in, configure, and the spec files
121 - tweak the date in the *.yo files and re-generate the man pages
122 - make sure that the patches dir has been updated
123 - page through the "cvs diff" output
126 print "<Press Enter to continue> ";
131 system "./prepare-source && touch proto.h";
133 my @tweak_files = ( glob('packaging/*.spec'), glob('packaging/*/*.spec'),
134 glob('*.yo'), qw( configure.in configure ) );
135 if ($version !~ /pre/) {
136 push(@tweak_files, qw( NEWS OLDNEWS ));
138 foreach my $fn (@tweak_files) {
139 open(IN, '<', $fn) or die $!;
140 undef $/; $_ = <IN>; $/ = "\n";
142 if ($fn =~ /configure/) {
143 s/^RSYNC_VERSION.*/RSYNC_VERSION=$version/m;
144 } elsif ($fn =~ /\.spec/) {
145 s/^(Version:) .*/$1 $version/m;
146 s/^(Release:) .*/$1 $release/m;
147 } elsif ($fn =~ /\.yo/) {
148 s/^(manpage\([^)]+\)\(\d+\)\()[^)]+(\).*)/$1$today$2/m;
149 s/^(This man ?page is current for version) \S+ (of rsync)/$1 $version $2/m;
151 s/^(NEWS for rsync \Q$version\E) \(UNRELEASED\)\s*$/$1 ($today)\n/m;
152 s/^\t\S\S\s\S\S\S\s\d\d\d\d(\t\Q$version\E)/\t$ztoday$1/m;
154 open(OUT, '>', $fn) or die $!;
159 system "yodl2man -o rsync.1 rsync.yo";
160 system "yodl2man -o rsyncd.conf.5 rsyncd.conf.yo";
161 #system "perl -pi -e \"s/\\\\\\'/\\\\&'/g\" rsync.1 rsyncd.conf.5";
163 mkdir('patches/tmp') or die $!;
164 system "rsync -a --exclude=patches/ --exclude-from=.cvsignore . patches/tmp/cvsdir/";
168 system "patches/verify-patches -un -an";
170 system "cvs -q diff | egrep -v '^(===============|RCS file: |retrieving revision |Index: )' | less -p '^diff .*'";
175 - "cvs commit" all changes$skipping
176 - "cvs tag" this release as $cvstag$skipping
180 print "<Press Enter to continue> ";
183 system "cvs commit -m 'Preparing for release of $version'";
184 system "cvs tag -F $cvstag .";
186 print "** Skipping prompt in TESTMODE **\n";
191 About to do the following in the samba-rsync-ftp dir:
192 - change the diffs in the patches dir to include generated files
193 - move the old tar/diff files into the appropriate old-* dirs
194 - hard-link the new tar/diff files to the old files on samba.org$skipping
195 - create release tar "$tarfile"
196 - create release diffs
197 - update README, *NEWS, TODO, and cvs.log
198 - update rsync*.html man pages
201 print "<Press Enter to continue> ";
206 system "patches/verify-patches -pun -an";
208 chdir($releasedir) or die $!;
212 mkdir("rsync-$version", 0755) or die $!;
213 system "rsync -aC --exclude=.cvsignore rsync/ rsync-$version";
215 # When creating a pre-release after a normal release, there's nothing to move.
216 if ($diffdir ne $dest) {
217 chdir($dest) or die $!;
219 # We need to run this regardless of $lastversion's "pre"ness.
221 foreach my $fn (glob('rsync*pre*.tar.gz*'), glob('rsync*pre*-NEWS')) {
222 link($fn, "old-previews/$fn") or die $!;
223 push(@moved_files, $fn);
226 if ($version !~ /pre/) {
227 foreach my $fn (glob('rsync*.tar.gz*'), glob('rsync*-NEWS')) {
228 next if $fn =~ /^rsync.*pre/;
229 link($fn, "old-versions/$fn") or die $!;
230 push(@moved_files, $fn);
233 foreach my $fn (glob('rsync*.diffs.gz*')) {
234 next if $fn =~ /^rsync.*pre/;
235 link($fn, "old-patches/$fn") or die $!;
236 push(@moved_files, $fn);
240 # Optimize our future upload (in the absence of --detect-renamed) by
241 # uploading the above hard-linked files that we are about to delete.
243 system "rsync -avHC --include='rsync*.gz*' --include='old-*/' --exclude='*' . samba.org:/home/ftp/pub/rsync";
245 foreach (@moved_files, glob("rsync*pre*.diffs.gz*")) {
249 chdir($releasedir) or die $!;
251 system "fakeroot tar czf $tarfile rsync-$version";
253 system "tar xzf $diffdir/rsync-$lastversion.tar.gz";
254 ## TWEAK THE VERSIONS AS DESIRED HERE ##
255 #mkdir("rsync-$lastversion/support", 0755) or die $!;
256 #rename("rsync-$lastversion/rsyncstats", "rsync-$lastversion/support/rsyncstats");
258 system "diff -urN --exclude=patches rsync-$lastversion rsync-$version"
259 . "| gzip -9 >$dest/rsync-$lastversion-$version.diffs.gz";
261 system "rsync -a rsync/{README,NEWS,OLDNEWS,TODO} $dest";
262 unlink("$dest/rsync-$version-NEWS");
263 link("$dest/NEWS", "$dest/rsync-$version-NEWS");
264 system "rsync -a $cvsroot/CVSROOT/rsync.updates $dest/cvs.log";
266 system "yodl2html -o $dest/rsync.html rsync/rsync.yo";
267 system "yodl2html -o $dest/rsyncd.conf.html rsync/rsyncd.conf.yo";
269 system "rm -rf rsync rsync-*";
272 chdir($dest) or die $!;
273 system "gpg -ba rsync-$version.tar.gz";
274 system "gpg -ba rsync-$lastversion-$version.diffs.gz";
279 All done. Remember to announce the release on *BOTH*
280 rsync-announce\@lists.samba.org and rsync\@lists.samba.org!