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. **
36 print "This will release a new version of rsync onto an unsuspecting world.\n";
38 print "**** TESTMODE **** (add \"live\" arg to avoid this)\n";
39 $dest =~ s#([^/]+$)#tmp/$1#;
41 die "$dest does not exist\n" unless -d $dest;
43 print "Checking out the latest rsync into $releasedir...\n";
45 mkdir($releasedir, 0755) or die $! unless -d $releasedir;
46 chdir($releasedir) or die $!;
48 system "rm -rf rsync rsync-*";
50 system "cvs checkout -P rsync";
52 chdir('rsync') or die $!;
54 my($version, $lastversion);
55 open(IN, 'configure.in') or die $!;
57 if (/^RSYNC_VERSION=(.*)/) {
58 $version = $lastversion = $1;
64 $lastversion =~ s/(\d+)cvs$/ $1 - 1 /e;
65 $version =~ s/cvs/pre1/ || $version =~ s/pre(\d+)/ 'pre' . ($1 + 1) /e;
67 print "\nPlease enter the version number of this release: [$version] ";
70 $version =~ s/pre\d+//;
74 $version =~ s/[-.]*pre[-.]*/pre/;
76 $lastversion =~ s/(\d+)pre\d+$/ $1 - 1 /e unless $version =~ /pre/;
78 my $cvstag = "release-$version";
80 $cvstag =~ s/pre/-pre/;
82 print "Enter the previous version to produce a patch against: [$lastversion] ";
84 $lastversion = $_ if $_ ne '';
85 $lastversion =~ s/[-.]*pre[-.]*/pre/;
88 print "Please enter the RPM release number of this release: [$release] ";
90 $release = $_ if $_ ne '';
93 if ($lastversion =~ /pre/) {
94 if ($version !~ /pre/) {
95 die "You should not diff a release version against a pre-release version.\n";
97 $diffdir = "$dest/old-previews";
98 } elsif ($version =~ /pre/) {
101 $diffdir = "$dest/old-versions";
104 my $tarfile = "$dest/rsync-$version.tar.gz";
108 \$version is "$version"
109 \$lastversion is "$lastversion"
110 \$cvstag is "$cvstag"
112 \$releasedir is "$releasedir"
113 \$diffdir is "$diffdir"
114 \$release is "$release"
117 - tweak NEWS and OLDNEWS to update the release date
118 - tweak the version in configure.in, configure, and the spec files
119 - tweak the date in the *.yo files and re-generate the man pages
120 - make sure that the patches dir has been updated
121 - page through the "cvs diff" output
124 print "<Press Enter to continue> ";
129 system "./prepare-source && touch proto.h";
131 my @tweak_files = ( glob('packaging/*.spec'), glob('packaging/*/*.spec'),
132 glob('*.yo'), qw( configure.in configure ) );
133 if ($version !~ /pre/) {
134 push(@tweak_files, qw( NEWS OLDNEWS ));
136 foreach my $fn (@tweak_files) {
137 open(IN, '<', $fn) or die $!;
138 undef $/; $_ = <IN>; $/ = "\n";
140 if ($fn =~ /configure/) {
141 s/^RSYNC_VERSION.*/RSYNC_VERSION=$version/m;
142 } elsif ($fn =~ /\.spec/) {
143 s/^(Version:) .*/$1 $version/m;
144 s/^(Release:) .*/$1 $release/m;
145 } elsif ($fn =~ /\.yo/) {
146 s/^(manpage\([^)]+\)\(\d+\)\()[^)]+(\).*)/$1$today$2/m;
147 s/^(This man ?page is current for version) \S+ (of rsync)/$1 $version $2/m;
149 s/^(NEWS for rsync \Q$version\E) \(UNRELEASED\)\s*$/$1 ($today)\n/m;
150 s/^\t\S\S\s\S\S\S\s\d\d\d\d(\t\Q$version\E)/\t$ztoday$1/m;
152 open(OUT, '>', $fn) or die $!;
157 system "yodl2man -o rsync.1 rsync.yo";
158 system "yodl2man -o rsyncd.conf.5 rsyncd.conf.yo";
159 #system "perl -pi -e \"s/\\\\\\'/\\\\&'/g\" rsync.1 rsyncd.conf.5";
161 mkdir('patches/tmp') or die $!;
162 system "rsync -a --exclude=patches/ --exclude-from=.cvsignore . patches/tmp/cvsdir/";
166 system "patches/verify-patches -un -an";
168 system "cvs -q diff | egrep -v '^(===============|RCS file: |retrieving revision |Index: )' | less -p '^diff .*'";
173 - "cvs commit" all changes
174 - "cvs tag" this release as $cvstag
178 print "<Press Enter to continue> ";
181 system "cvs commit -m 'Preparing for release of $version'";
182 system "cvs tag -F $cvstag .";
184 print "**** Skipping cvs commit and tagging in TESTMODE ****\n";
189 About to do the following in the samba-rsync-ftp dir:
190 - change the diffs in the patches dir to include generated files
191 - move the old tar/diff files into the appropriate old-* dir
192 - hard-link the new tar/diff files to the old on samba.org
193 - create release tar "$tarfile"
194 - create release diffs
195 - update README, *NEWS, TODO, and cvs.log
196 - update rsync*.html man pages
199 print "<Press Enter to continue> ";
204 system "patches/verify-patches -pun -an";
206 chdir($releasedir) or die $!;
210 mkdir("rsync-$version", 0755) or die $!;
211 system "rsync -aC --exclude=.cvsignore rsync/ rsync-$version";
213 # When creating a pre-release after a normal release, there's nothing to move.
214 if ($diffdir ne $dest) {
215 chdir($dest) or die $!;
217 # We need to run this regardless of $lastversion's "pre"ness.
219 foreach my $fn (glob('rsync*pre*.tar.gz*'), glob('rsync*pre*-NEWS')) {
220 link($fn, "old-previews/$fn") or die $!;
221 push(@moved_files, $fn);
224 if ($version !~ /pre/) {
225 foreach my $fn (glob('rsync*.tar.gz*'), glob('rsync*-NEWS')) {
226 link($fn, "old-versions/$fn") or die $!;
227 push(@moved_files, $fn);
230 foreach my $fn (glob('rsync*.diffs.gz*')) {
231 link($fn, "old-patches/$fn") or die $!;
232 push(@moved_files, $fn);
236 # Optimize our future upload (in the absence of --detect-renamed) by
237 # uploading the above hard-linked files that we are about to delete.
239 system "rsync -avHC --include='rsync*.gz*' --include='old-*/' --exclude='*' . samba.org:/home/ftp/pub/rsync";
241 foreach (@moved_files, glob("rsync*pre*.diffs.gz*")) {
245 chdir($releasedir) or die $!;
247 system "fakeroot tar czf $tarfile rsync-$version";
249 system "tar xzf $diffdir/rsync-$lastversion.tar.gz";
250 ## TWEAK THE VERSIONS AS DESIRED HERE ##
251 #mkdir("rsync-$lastversion/support", 0755) or die $!;
252 #rename("rsync-$lastversion/rsyncstats", "rsync-$lastversion/support/rsyncstats");
254 system "diff -urN --exclude=patches rsync-$lastversion rsync-$version"
255 . "| gzip -9 >$dest/rsync-$lastversion-$version.diffs.gz";
257 system "rsync -a rsync/{README,NEWS,OLDNEWS,TODO} $dest";
258 unlink("$dest/rsync-$version-NEWS");
259 link("$dest/NEWS", "$dest/rsync-$version-NEWS");
260 system "rsync -a $cvsroot/CVSROOT/rsync.updates $dest/cvs.log";
262 system "yodl2html -o $dest/rsync.html rsync/rsync.yo";
263 system "yodl2html -o $dest/rsyncd.conf.html rsync/rsyncd.conf.yo";
265 system "rm -rf rsync rsync-$version rsync-$lastversion";
268 chdir($dest) or die $!;
269 system "gpg -ba rsync-$version.tar.gz";
270 system "gpg -ba rsync-$lastversion-$version.diffs.gz";
275 All done. Remember to announce the release on *BOTH*
276 rsync-announce\@lists.samba.org and rsync\@lists.samba.org!