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 "\nPlease enter the version number of this release: ";
44 my $version = <STDIN>;
46 $version =~ s/[-.]*pre[-.]*/pre/;
48 my $cvstag = "release-$version";
50 $cvstag =~ s/pre/-pre/;
52 print "Enter the previous version to produce a patch against: ";
53 my $lastversion = <STDIN>;
55 $lastversion =~ s/[-.]*pre[-.]*/pre/;
57 print "Please enter the RPM release number of this release (default 1): ";
58 my $release = <STDIN>;
60 $release = 1 if $release eq '';
63 if ($lastversion =~ /pre/) {
64 if ($version !~ /pre/) {
65 die "You should not diff a release version against a pre-release version.\n";
67 $diffdir = "$dest/old-previews";
68 } elsif ($version =~ /pre/) {
71 $diffdir = "$dest/old-versions";
74 my $tarfile = "$dest/rsync-$version.tar.gz";
78 \$version is "$version"
79 \$lastversion is "$lastversion"
82 \$releasedir is "$releasedir"
83 \$diffdir is "$diffdir"
84 \$release is "$release"
87 - create and/or clean the \$releasedir
88 - checkout rsync into \$releasedir
89 - tweak NEWS and OLDNEWS to update the release date
90 - tweak the version in configure.in, configure, and the spec files
91 - tweak the date in the *.yo files and re-generate the man pages
92 - make sure that the patches dir has been updated
93 - page through the "cvs diff" output
96 print "<Press Enter to continue> ";
99 mkdir($releasedir, 0755) or die $! unless -d $releasedir;
100 chdir($releasedir) or die $!;
102 system "rm -rf rsync rsync-$version rsync-$lastversion";
104 system "cvs checkout -P rsync";
106 chdir('rsync') or die $!;
110 system "./prepare-source && touch proto.h";
112 my @tweak_files = ( glob('packaging/*.spec'), glob('packaging/*/*.spec'),
113 glob('*.yo'), qw( configure.in configure ) );
114 if ($version !~ /pre/) {
115 push(@tweak_files, qw( NEWS OLDNEWS ));
117 foreach my $fn (@tweak_files) {
118 open(IN, '<', $fn) or die $!;
119 undef $/; $_ = <IN>; $/ = "\n";
121 if ($fn =~ /configure/) {
122 s/^RSYNC_VERSION.*/RSYNC_VERSION=$version/m;
123 } elsif ($fn =~ /\.spec/) {
124 s/^(Version:) .*/$1 $version/m;
125 s/^(Release:) .*/$1 $release/m;
126 } elsif ($fn =~ /\.yo/) {
127 s/^(manpage\([^)]+\)\(\d+\)\()[^)]+(\).*)/$1$today$2/m;
128 s/^(This man ?page is current for version) \S+ (of rsync)/$1 $version $2/m;
130 s/^(NEWS for rsync \Q$version\E) \(UNRELEASED\)\s*$/$1 ($today)\n/m;
131 s/^\t\S\S\s\S\S\S\s\d\d\d\d(\t\Q$version\E)/\t$ztoday$1/m;
133 open(OUT, '>', $fn) or die $!;
138 system "yodl2man -o rsync.1 rsync.yo";
139 system "yodl2man -o rsyncd.conf.5 rsyncd.conf.yo";
140 #system "perl -pi -e \"s/\\\\\\'/\\\\&'/g\" rsync.1 rsyncd.conf.5";
142 mkdir('patches/tmp') or die $!;
143 system "rsync -a --exclude=patches/ --exclude-from=.cvsignore . patches/tmp/cvsdir/";
147 system "patches/verify-patches -un -an";
149 system "cvs -q diff | egrep -v '^(===============|RCS file: |retrieving revision |Index: )' | less -p '^diff .*'";
154 - "cvs commit" all changes
155 - "cvs tag" this release as $cvstag
159 print "<Press Enter to continue> ";
162 system "cvs commit -m 'Preparing for release of $version'";
163 system "cvs tag -F $cvstag .";
165 print "\n**** Skipping cvs commit and tagging in TESTMODE ****\n";
170 About to do the following in the samba-rsync-ftp dir:
171 - change the diffs in the patches dir to include generated files
172 - create release tar "$tarfile"
173 - create release diffs
174 - update README, *NEWS, TODO, and cvs.log
175 - update rsync*.html man pages
178 print "<Press Enter to continue> ";
183 system "patches/verify-patches -pun -an";
185 chdir($releasedir) or die $!;
189 mkdir("rsync-$version", 0755) or die $!;
190 system "rsync -aC --exclude=.cvsignore rsync/ rsync-$version";
192 # When creating a pre-release after a normal release, there's nothing to move.
193 if ($diffdir ne $dest) {
194 chdir($dest) or die $!;
196 # We need to run this regardless of $lastversion's "pre"ness. */
197 foreach my $fn (glob('rsync*pre*.tar.gz*'), glob('rsync*pre*-NEWS')) {
198 rename($fn, "old-previews/$fn");
200 system "rm -f rsync*pre*.diffs.gz*";
202 if ($version !~ /pre/) {
203 foreach my $fn (glob('rsync*.tar.gz*'), glob('rsync*-NEWS')) {
204 rename($fn, "old-versions/$fn");
207 foreach my $fn (glob('rsync*.diffs.gz*')) {
208 rename($fn, "old-patches/$fn");
212 chdir($releasedir) or die $!;
214 system "fakeroot tar czf $tarfile rsync-$version";
216 system "tar xzf $diffdir/rsync-$lastversion.tar.gz";
217 ## TWEAK THE VERSIONS AS DESIRED HERE ##
218 #mkdir("rsync-$lastversion/support", 0755) or die $!;
219 #rename("rsync-$lastversion/rsyncstats", "rsync-$lastversion/support/rsyncstats");
221 system "diff -urN --exclude=patches rsync-$lastversion rsync-$version"
222 . "| gzip -9 >$dest/rsync-$lastversion-$version.diffs.gz";
224 system "rsync -a rsync/{README,NEWS,OLDNEWS,TODO} $dest";
225 unlink("$dest/rsync-$version-NEWS");
226 link("$dest/NEWS", "$dest/rsync-$version-NEWS");
227 system "rsync -a $cvsroot/CVSROOT/rsync.updates $dest/cvs.log";
229 system "yodl2html -o $dest/rsync.html rsync/rsync.yo";
230 system "yodl2html -o $dest/rsyncd.conf.html rsync/rsyncd.conf.yo";
232 system "rm -rf rsync rsync-$version rsync-$lastversion";
235 chdir($dest) or die $!;
236 system "gpg -ba rsync-$version.tar.gz";
237 system "gpg -ba rsync-$lastversion-$version.diffs.gz";
242 All done. Remember to announce the release on *BOTH*
243 rsync-announce\@lists.samba.org and rsync\@lists.samba.org!