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 $cl_today = time2str('* %a %b %d %Y', time);
20 my $ztoday = time2str('%d %b %Y', time);
21 (my $today = $ztoday) =~ s/^0//;
24 ==========================================================================
27 == Note: type "-a u,n" if you want to auto-accept the U,N suggestions. ==
36 == This will release a new version of rsync onto an unsuspecting world. ==
40 == **** TESTMODE **** (Add "live" arg to avoid this.) ==
42 $dest =~ s#([^/]+$)#tmp/$1#;
43 $skipping = ' ** SKIPPING **';
45 die "$dest does not exist\n" unless -d $dest;
47 print $break, "\nChecking out the latest rsync into $releasedir ...\n";
49 mkdir($releasedir, 0755) or die $! unless -d $releasedir;
50 chdir($releasedir) or die $!;
52 system 'rm -rf rsync';
55 open(CVS, '-|', 'cvs checkout -P rsync') or die $!;
58 next if /\.(cvs)?ignore$/;
59 if (m#^[UP] rsync/(.*)#) {
61 my($dir) = $fn =~ m#^(.+)/#;
62 push(@files, $dir) if defined($dir) && !$dirs{$1}++;
67 chdir('rsync') or die $!;
69 my($version, $lastversion);
70 open(IN, '<', 'configure.in') or die $!;
72 if (/^RSYNC_VERSION=(.*)/) {
73 $version = $lastversion = $1;
79 if ($lastversion =~ /cvs$/) {
80 open(IN, '<', 'OLDNEWS') or die $!;
83 ($lastversion) = /(\d+\.\d+\.\d+)/;
86 $version =~ s/cvs/pre1/ || $version =~ s/pre(\d+)/ 'pre' . ($1 + 1) /e;
88 print $break, "\nPlease enter the version number of this release: [$version] ";
91 $version =~ s/pre\d+//;
95 $version =~ s/[-.]*pre[-.]*/pre/;
97 $lastversion =~ s/(\d+)pre\d+$/ $1 - 1 /e unless $version =~ /pre/;
99 my $cvstag = "release-$version";
100 $cvstag =~ s/[.]/-/g;
101 $cvstag =~ s/pre/-pre/;
103 print "Enter the previous version to produce a patch against: [$lastversion] ";
105 $lastversion = $_ if $_ ne '';
106 $lastversion =~ s/[-.]*pre[-.]*/pre/;
109 print "Please enter the RPM release number of this release: [$release] ";
111 $release = $_ if $_ ne '';
115 if ($lastversion =~ /pre/) {
116 if ($version !~ /pre/) {
117 die "You should not diff a release version against a pre-release version.\n";
119 $diffdir = "$dest/old-previews";
120 $skipping2 = ' ** SKIPPING **';
121 } elsif ($version =~ /pre/) {
123 $skipping2 = ' ** SKIPPING **';
125 $diffdir = "$dest/old-versions";
129 print "\n", $break, <<EOT;
130 \$version is "$version"
131 \$lastversion is "$lastversion"
132 \$cvstag is "$cvstag"
134 \$releasedir is "$releasedir"
135 \$diffdir is "$diffdir"
136 \$release is "$release"
139 - make sure that SUBPROTOCOL_VERSION is 0$skipping2
140 - tweak the version in configure.in, configure, and the spec files
141 - make sure that configure, config.h.in, and proto.h are updated
142 - tweak NEWS and OLDNEWS to update the release date$skipping2
143 - tweak the date in the *.yo files and re-generate the man pages
144 - make sure that the patches dir has been updated
145 - page through the "cvs diff" output
148 print "<Press Enter to continue> ";
150 my $f_opt = /f/ ? ' -f' : '';
153 system "./prepare-source && touch proto.h";
155 my @tweak_files = ( glob('packaging/*.spec'), glob('packaging/*/*.spec'),
156 glob('*.yo'), qw( configure.in configure ) );
157 if ($version !~ /pre/) {
158 push(@tweak_files, qw( rsync.h NEWS OLDNEWS ));
160 foreach my $fn (@tweak_files) {
161 open(IN, '<', $fn) or die $!;
162 undef $/; $_ = <IN>; $/ = "\n";
164 if ($fn =~ /configure/) {
165 s/^RSYNC_VERSION=.*/RSYNC_VERSION=$version/m;
166 } elsif ($fn =~ /\.spec/) {
167 s/^(Version:) .*/$1 $version/m;
168 s/^(Release:) .*/$1 $release/m;
169 s/^(Released) .*/$1 $version./m;
170 s/^\* \w\w\w \w\w\w \d\d \d\d\d\d (.*)/$cl_today $1/m;
171 } elsif ($fn =~ /\.yo/) {
172 s/^(manpage\([^)]+\)\(\d+\)\()[^)]+(\).*)/$1$today$2/m;
173 s/^(This man ?page is current for version) \S+ (of rsync)/$1 $version $2/m;
174 } elsif ($fn eq 'NEWS') {
175 s/^(NEWS for rsync \Q$version\E) \(UNRELEASED\)\s*\n/$1 ($today)\n/mi
176 or die "Couldn't update NEWS file with release date!\n";
177 } elsif ($fn eq 'rsync.h') {
178 s/(#define\s+SUBPROTOCOL_VERSION)\s+\d+/$1 0/;
179 } elsif ($fn eq 'OLDNEWS') {
180 s/^\t\S\S\s\S\S\S\s\d\d\d\d(\t\Q$version\E)/\t$ztoday$1/m
181 or die "Couldn't update OLDNEWS file with release date!\n";
183 die "Unrecognized file in \@tweak_files: $fn\n";
185 open(OUT, '>', $fn) or die $!;
190 system "yodl2man -o rsync.1 rsync.yo; ./tweak_manpage rsync.1";
191 system "yodl2man -o rsyncd.conf.5 rsyncd.conf.yo; ./tweak_manpage rsyncd.conf.5";
193 mkdir('patches/tmp') or die $!;
194 system "rsync -a --exclude=patches/ --exclude-from=.cvsignore . patches/tmp/cvsdir/";
196 print "\n", $break, $note, $break;
197 system "patches/verify-patches -n -an$f_opt";
200 system "cvs -q diff | egrep -v '^(===============|RCS file: |retrieving revision |Index: )' | less -p '^diff .*'";
205 - "cvs commit" all changes$skipping
206 - "cvs tag" this release as $cvstag$skipping
207 - change the diffs in the patches dir to include generated files
210 print "<Press Enter to continue> ";
214 system "cvs commit -m 'Preparing for release of $version'";
215 system "cvs tag -F $cvstag .";
219 print "\n", $break, $note, $break;
220 system "patches/verify-patches -pun -an";
223 my $tar_name = "rsync-$version.tar.gz";
224 my $diff_name = "rsync-$lastversion-$version.diffs.gz";
225 my $tar_file = "$dest/$tar_name";
226 my $diff_file = "$dest/$diff_name";
230 About to do the following in the samba-rsync-ftp dir:
231 - move the old tar/diff files into the appropriate old-* dirs
232 - hard-link the moved tar/diff files on samba.org$skipping
233 - create release tar, "$tar_name"
234 - create release diffs, "$diff_name"
235 - update README, *NEWS, TODO, and cvs.log
236 - update rsync*.html man pages
237 - gpg-sign the release files$skipping
240 print "<Press Enter to continue> ";
243 chdir($releasedir) or die $!;
246 system "rm -rf rsync-$version";
247 rename('rsync', "rsync-$version") or die $!;
249 # When creating a pre-release after a normal release, there's nothing to move.
250 if ($diffdir ne $dest) {
251 chdir($dest) or die $!;
253 print "Shuffling old files ...\n";
255 # We need to run this regardless of $lastversion's "pre"ness.
257 foreach my $fn (glob('rsync*pre*.tar.gz*'), glob('rsync*pre*-NEWS')) {
258 link($fn, "old-previews/$fn") or die $!;
259 push(@moved_files, $fn);
262 if ($version !~ /pre/) {
263 foreach my $fn (glob('rsync*.tar.gz*'), glob('rsync*-NEWS')) {
264 next if $fn =~ /^rsync.*pre/;
265 link($fn, "old-versions/$fn") or die $!;
266 push(@moved_files, $fn);
269 foreach my $fn (glob('rsync*pre*.diffs.gz*')) {
273 foreach my $fn (glob('rsync*.diffs.gz*')) {
274 link($fn, "old-patches/$fn") or die $!;
275 push(@moved_files, $fn);
279 # Optimize our future upload (in the absence of --detect-renamed) by
280 # using rsync to hard-link the above files on samba.org.
282 system "rsync -avHOC --include='rsync*.gz*' --include='old-*/' --exclude='*' . samba.org:/home/ftp/pub/rsync";
284 foreach (@moved_files) {
288 chdir($releasedir) or die $!;
291 print "Creating $tar_file ...\n";
292 system "fakeroot tar czf $tar_file rsync-$version";
293 open(TAR, '|-', "fakeroot tar --files-from=- --no-recursion --mode=g+w -czf $tar_file rsync-$version") or die $!;
295 print TAR "rsync-$version/$_\n";
299 print "Creating $diff_file ...\n";
300 system "rm -rf rsync-$version rsync-$lastversion";
301 system "tar xzf $tar_file; tar xzf $diffdir/rsync-$lastversion.tar.gz";
302 ## TWEAK THE VERSIONS AS DESIRED HERE ##
303 #mkdir("rsync-$lastversion/support", 0755) or die $!;
304 #rename("rsync-$lastversion/rsyncstats", "rsync-$lastversion/support/rsyncstats");
305 #unlink("rsync-$lastversion/.ignore");
307 system "diff -urN --exclude=patches rsync-$lastversion rsync-$version| gzip -9 >$diff_file";
309 print "Updating the other files in $dest ...\n";
310 system "rsync -a rsync-$version/{README,NEWS,OLDNEWS,TODO} $dest";
311 unlink("$dest/rsync-$version-NEWS");
312 link("$dest/NEWS", "$dest/rsync-$version-NEWS");
313 system "rsync -a $cvsroot/CVSROOT/rsync.updates $dest/cvs.log";
315 system "yodl2html -o $dest/rsync.html rsync-$version/rsync.yo";
316 system "yodl2html -o $dest/rsyncd.conf.html rsync-$version/rsyncd.conf.yo";
318 system "rm -rf rsync-*";
321 chdir($dest) or die $!;
322 system "gpg -ba $tar_name; gpg -ba $diff_name";
325 All done. Remember to announce the release on *BOTH*
326 rsync-announce\@lists.samba.org and rsync\@lists.samba.org!
329 print $break, "All done.\n";