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 ==========================================================================
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 $lastversion =~ s/(\d+)cvs$/ $1 - 1 /e;
80 $version =~ s/cvs/pre1/ || $version =~ s/pre(\d+)/ 'pre' . ($1 + 1) /e;
82 print $break, "\nPlease enter the version number of this release: [$version] ";
85 $version =~ s/pre\d+//;
89 $version =~ s/[-.]*pre[-.]*/pre/;
91 $lastversion =~ s/(\d+)pre\d+$/ $1 - 1 /e unless $version =~ /pre/;
93 my $cvstag = "release-$version";
95 $cvstag =~ s/pre/-pre/;
97 print "Enter the previous version to produce a patch against: [$lastversion] ";
99 $lastversion = $_ if $_ ne '';
100 $lastversion =~ s/[-.]*pre[-.]*/pre/;
103 print "Please enter the RPM release number of this release: [$release] ";
105 $release = $_ if $_ ne '';
109 if ($lastversion =~ /pre/) {
110 if ($version !~ /pre/) {
111 die "You should not diff a release version against a pre-release version.\n";
113 $diffdir = "$dest/old-previews";
114 $skipping2 = ' ** SKIPPING **';
115 } elsif ($version =~ /pre/) {
117 $skipping2 = ' ** SKIPPING **';
119 $diffdir = "$dest/old-versions";
123 print "\n", $break, <<EOT;
124 \$version is "$version"
125 \$lastversion is "$lastversion"
126 \$cvstag is "$cvstag"
128 \$releasedir is "$releasedir"
129 \$diffdir is "$diffdir"
130 \$release is "$release"
133 - make sure that configure, config.h.in, and proto.h are updated
134 - tweak the version in configure.in, configure, and the spec files
135 - tweak NEWS and OLDNEWS to update the release date$skipping2
136 - tweak the date in the *.yo files and re-generate the man pages
137 - make sure that the patches dir has been updated
138 - page through the "cvs diff" output
141 print "<Press Enter to continue> ";
143 my $f_opt = /f/ ? ' -f' : '';
146 system "./prepare-source && touch proto.h";
148 my @tweak_files = ( glob('packaging/*.spec'), glob('packaging/*/*.spec'),
149 glob('*.yo'), qw( configure.in configure ) );
150 if ($version !~ /pre/) {
151 push(@tweak_files, qw( NEWS OLDNEWS ));
153 foreach my $fn (@tweak_files) {
154 open(IN, '<', $fn) or die $!;
155 undef $/; $_ = <IN>; $/ = "\n";
157 if ($fn =~ /configure/) {
158 s/^RSYNC_VERSION.*/RSYNC_VERSION=$version/m;
159 } elsif ($fn =~ /\.spec/) {
160 s/^(Version:) .*/$1 $version/m;
161 s/^(Release:) .*/$1 $release/m;
162 } elsif ($fn =~ /\.yo/) {
163 s/^(manpage\([^)]+\)\(\d+\)\()[^)]+(\).*)/$1$today$2/m;
164 s/^(This man ?page is current for version) \S+ (of rsync)/$1 $version $2/m;
166 s/^(NEWS for rsync \Q$version\E) \(UNRELEASED\)\s*\n/$1 ($today)\n/m;
167 s/^\t\S\S\s\S\S\S\s\d\d\d\d(\t\Q$version\E)/\t$ztoday$1/m;
169 open(OUT, '>', $fn) or die $!;
174 system "yodl2man -o rsync.1 rsync.yo";
175 system "yodl2man -o rsyncd.conf.5 rsyncd.conf.yo";
176 #system "perl -pi -e \"s/\\\\\\'/\\\\&'/g\" rsync.1 rsyncd.conf.5";
178 mkdir('patches/tmp') or die $!;
179 system "rsync -a --exclude=patches/ --exclude-from=.cvsignore . patches/tmp/cvsdir/";
181 print "\n", $break, $note, $break;
182 system "patches/verify-patches -n -an$f_opt";
185 system "cvs -q diff | egrep -v '^(===============|RCS file: |retrieving revision |Index: )' | less -p '^diff .*'";
190 - "cvs commit" all changes$skipping
191 - "cvs tag" this release as $cvstag$skipping
192 - change the diffs in the patches dir to include generated files
195 print "<Press Enter to continue> ";
199 system "cvs commit -m 'Preparing for release of $version'";
200 system "cvs tag -F $cvstag .";
204 print "\n", $break, $note, $break;
205 system "patches/verify-patches -pun -an";
208 my $tar_name = "rsync-$version.tar.gz";
209 my $diff_name = "rsync-$lastversion-$version.diffs.gz";
210 my $tar_file = "$dest/$tar_name";
211 my $diff_file = "$dest/$diff_name";
215 About to do the following in the samba-rsync-ftp dir:
216 - move the old tar/diff files into the appropriate old-* dirs
217 - copy the moved tar/diff files on samba.org$skipping
218 - create release tar, "$tar_name"
219 - create release diffs, "$diff_name"
220 - update README, *NEWS, TODO, and cvs.log
221 - update rsync*.html man pages
222 - gpg-sign the release files$skipping
225 print "<Press Enter to continue> ";
228 chdir($releasedir) or die $!;
231 system "rm -rf rsync-$version";
232 rename('rsync', "rsync-$version") or die $!;
234 # When creating a pre-release after a normal release, there's nothing to move.
235 if ($diffdir ne $dest) {
236 chdir($dest) or die $!;
238 print "Shuffling old files ...\n";
240 # We need to run this regardless of $lastversion's "pre"ness.
242 foreach my $fn (glob('rsync*pre*.tar.gz*'), glob('rsync*pre*-NEWS')) {
243 my $new_fn = "old-previews/$fn";
244 rename($fn, $new_fn) or die $!;
245 push(@moved_files, $new_fn);
248 if ($version !~ /pre/) {
249 foreach my $fn (glob('rsync*.tar.gz*'), glob('rsync*-NEWS')) {
250 next if $fn =~ /^rsync.*pre/;
251 my $new_fn = "old-versions/$fn";
252 rename($fn, $new_fn) or die $!;
253 push(@moved_files, $new_fn);
256 foreach my $fn (glob('rsync*.diffs.gz*')) {
257 next if $fn =~ /^rsync.*pre/;
258 my $new_fn = "old-patches/$fn";
259 rename($fn, $new_fn) or die $!;
260 push(@moved_files, $new_fn);
264 # Optimize our future upload (in the absence of --detect-renamed) by
265 # copying the above moved files on the remote server.
268 foreach (@moved_files) {
269 my($path, $fn) = m#(.*)/([^/]+)$#;
270 $remote_cmd .= "cp -p /home/ftp/pub/rsync/{$fn,$path};";
272 system "ssh samba.org '$remote_cmd'";
274 foreach (glob("rsync*pre*.diffs.gz*")) {
278 chdir($releasedir) or die $!;
281 print "Creating $tar_file ...\n";
282 system "fakeroot tar czf $tar_file rsync-$version";
283 open(TAR, '|-', "fakeroot tar --files-from=- --no-recursion --mode=g+w -czf $tar_file rsync-$version") or die $!;
285 print TAR "rsync-$version/$_\n";
289 print "Creating $diff_file ...\n";
290 system "rm -rf rsync-$version rsync-$lastversion";
291 system "tar xzf $tar_file; tar xzf $diffdir/rsync-$lastversion.tar.gz";
292 ## TWEAK THE VERSIONS AS DESIRED HERE ##
293 #mkdir("rsync-$lastversion/support", 0755) or die $!;
294 #rename("rsync-$lastversion/rsyncstats", "rsync-$lastversion/support/rsyncstats");
295 #unlink("rsync-$lastversion/.ignore");
297 system "diff -urN --exclude=patches rsync-$lastversion rsync-$version| gzip -9 >$diff_file";
299 print "Updating the other files in $dest ...\n";
300 system "rsync -a rsync-$version/{README,NEWS,OLDNEWS,TODO} $dest";
301 unlink("$dest/rsync-$version-NEWS");
302 link("$dest/NEWS", "$dest/rsync-$version-NEWS");
303 system "rsync -a $cvsroot/CVSROOT/rsync.updates $dest/cvs.log";
305 system "yodl2html -o $dest/rsync.html rsync-$version/rsync.yo";
306 system "yodl2html -o $dest/rsyncd.conf.html rsync-$version/rsyncd.conf.yo";
308 system "rm -rf rsync-*";
311 chdir($dest) or die $!;
312 system "gpg -ba $tar_name; gpg -ba $diff_name";
315 All done. Remember to announce the release on *BOTH*
316 rsync-announce\@lists.samba.org and rsync\@lists.samba.org!
319 print $break, "All done.\n";