Mentioned that the daemon now logs connections.
[rsync/rsync.git] / packaging / release-rsync
CommitLineData
6d12a859
WD
1#!/usr/bin/perl
2use strict;
3
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).
9#
10# Run this as "release-rsync live" to affect ~/samba-rsync-ftp instead
11# of ~/tmp/samba-rsync-ftp.
12
13use Date::Format;
14
15my $dest = $ENV{HOME} . '/samba-rsync-ftp';
16my $releasedir = $ENV{HOME} . '/release';
17my $cvsroot = $ENV{CVSROOT} = 'samba.org:/data/cvs';
18
19my $ztoday = time2str('%d %b %Y', time);
20my $today = $ztoday;
21$today =~ s/^0//;
22
23my $dots = <<EOT;
24.........................................................................
25EOT
26my $note = <<EOT;
27
28**
29** Note: type "-a u,n" if you want to auto-accept the U,N suggestions. **
30**
31EOT
32
33my $live = shift;
4d8639eb 34my $skipping = '';
6d12a859
WD
35
36if ($live) {
37 print "This will release a new version of rsync onto an unsuspecting world.\n";
38} else {
39 print "**** TESTMODE **** (add \"live\" arg to avoid this)\n";
40 $dest =~ s#([^/]+$)#tmp/$1#;
4d8639eb 41 $skipping = ' ** SKIPPING **';
6d12a859
WD
42}
43die "$dest does not exist\n" unless -d $dest;
44
519c8de1
WD
45print "Checking out the latest rsync into $releasedir...\n";
46
47mkdir($releasedir, 0755) or die $! unless -d $releasedir;
48chdir($releasedir) or die $!;
49
50system "rm -rf rsync rsync-*";
51
52system "cvs checkout -P rsync";
53
54chdir('rsync') or die $!;
55
56my($version, $lastversion);
57open(IN, 'configure.in') or die $!;
58while (<IN>) {
59 if (/^RSYNC_VERSION=(.*)/) {
60 $version = $lastversion = $1;
61 last;
62 }
63}
64close IN;
65
66$lastversion =~ s/(\d+)cvs$/ $1 - 1 /e;
67$version =~ s/cvs/pre1/ || $version =~ s/pre(\d+)/ 'pre' . ($1 + 1) /e;
68
69print "\nPlease enter the version number of this release: [$version] ";
70chomp($_ = <STDIN>);
71if ($_ eq '.') {
72 $version =~ s/pre\d+//;
73} elsif ($_ ne '') {
74 $version = $_;
75}
6d12a859
WD
76$version =~ s/[-.]*pre[-.]*/pre/;
77
519c8de1
WD
78$lastversion =~ s/(\d+)pre\d+$/ $1 - 1 /e unless $version =~ /pre/;
79
6d12a859
WD
80my $cvstag = "release-$version";
81$cvstag =~ s/[.]/-/g;
82$cvstag =~ s/pre/-pre/;
83
519c8de1
WD
84print "Enter the previous version to produce a patch against: [$lastversion] ";
85chomp($_ = <STDIN>);
86$lastversion = $_ if $_ ne '';
6d12a859
WD
87$lastversion =~ s/[-.]*pre[-.]*/pre/;
88
519c8de1
WD
89my $release = 1;
90print "Please enter the RPM release number of this release: [$release] ";
91chomp($_ = <STDIN>);
92$release = $_ if $_ ne '';
6d12a859
WD
93
94my $diffdir;
95if ($lastversion =~ /pre/) {
96 if ($version !~ /pre/) {
97 die "You should not diff a release version against a pre-release version.\n";
98 }
99 $diffdir = "$dest/old-previews";
100} elsif ($version =~ /pre/) {
101 $diffdir = $dest;
102} else {
103 $diffdir = "$dest/old-versions";
104}
105
106my $tarfile = "$dest/rsync-$version.tar.gz";
107
108print <<EOT;
109
110\$version is "$version"
111\$lastversion is "$lastversion"
112\$cvstag is "$cvstag"
113\$dest is "$dest"
114\$releasedir is "$releasedir"
115\$diffdir is "$diffdir"
116\$release is "$release"
117
118About to:
6d12a859
WD
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
124
125EOT
126print "<Press Enter to continue> ";
127$_ = <STDIN>;
128
6d12a859
WD
129print $dots;
130
131system "./prepare-source && touch proto.h";
132
133my @tweak_files = ( glob('packaging/*.spec'), glob('packaging/*/*.spec'),
134 glob('*.yo'), qw( configure.in configure ) );
135if ($version !~ /pre/) {
136 push(@tweak_files, qw( NEWS OLDNEWS ));
137}
138foreach my $fn (@tweak_files) {
139 open(IN, '<', $fn) or die $!;
140 undef $/; $_ = <IN>; $/ = "\n";
141 close IN;
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;
150 } else {
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;
153 }
154 open(OUT, '>', $fn) or die $!;
155 print OUT $_;
156 close OUT;
157}
158
159system "yodl2man -o rsync.1 rsync.yo";
160system "yodl2man -o rsyncd.conf.5 rsyncd.conf.yo";
161#system "perl -pi -e \"s/\\\\\\'/\\\\&'/g\" rsync.1 rsyncd.conf.5";
162
163mkdir('patches/tmp') or die $!;
164system "rsync -a --exclude=patches/ --exclude-from=.cvsignore . patches/tmp/cvsdir/";
165
166print $dots, $note;
167
168system "patches/verify-patches -un -an";
169
170system "cvs -q diff | egrep -v '^(===============|RCS file: |retrieving revision |Index: )' | less -p '^diff .*'";
171
73abdda4 172print <<EOT;
6d12a859
WD
173
174About to:
4d8639eb
WD
175 - "cvs commit" all changes$skipping
176 - "cvs tag" this release as $cvstag$skipping
6d12a859
WD
177
178EOT
73abdda4 179if ($live) {
6d12a859
WD
180 print "<Press Enter to continue> ";
181 $_ = <STDIN>;
182
183 system "cvs commit -m 'Preparing for release of $version'";
184 system "cvs tag -F $cvstag .";
185} else {
4d8639eb 186 print "** Skipping prompt in TESTMODE **\n";
6d12a859
WD
187}
188
189print <<EOT;
190
191About to do the following in the samba-rsync-ftp dir:
192 - change the diffs in the patches dir to include generated files
4d8639eb
WD
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
6d12a859
WD
195 - create release tar "$tarfile"
196 - create release diffs
197 - update README, *NEWS, TODO, and cvs.log
198 - update rsync*.html man pages
199
200EOT
201print "<Press Enter to continue> ";
202$_ = <STDIN>;
203
204print $note;
205
206system "patches/verify-patches -pun -an";
207
208chdir($releasedir) or die $!;
209
210print $dots;
211
212mkdir("rsync-$version", 0755) or die $!;
213system "rsync -aC --exclude=.cvsignore rsync/ rsync-$version";
214
215# When creating a pre-release after a normal release, there's nothing to move.
216if ($diffdir ne $dest) {
217 chdir($dest) or die $!;
218
519c8de1
WD
219 # We need to run this regardless of $lastversion's "pre"ness.
220 my @moved_files;
6d12a859 221 foreach my $fn (glob('rsync*pre*.tar.gz*'), glob('rsync*pre*-NEWS')) {
519c8de1
WD
222 link($fn, "old-previews/$fn") or die $!;
223 push(@moved_files, $fn);
6d12a859 224 }
6d12a859
WD
225
226 if ($version !~ /pre/) {
227 foreach my $fn (glob('rsync*.tar.gz*'), glob('rsync*-NEWS')) {
4d8639eb 228 next if $fn =~ /^rsync.*pre/;
519c8de1
WD
229 link($fn, "old-versions/$fn") or die $!;
230 push(@moved_files, $fn);
6d12a859
WD
231 }
232
233 foreach my $fn (glob('rsync*.diffs.gz*')) {
4d8639eb 234 next if $fn =~ /^rsync.*pre/;
519c8de1
WD
235 link($fn, "old-patches/$fn") or die $!;
236 push(@moved_files, $fn);
6d12a859
WD
237 }
238 }
239
519c8de1
WD
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.
242 if ($live) {
243 system "rsync -avHC --include='rsync*.gz*' --include='old-*/' --exclude='*' . samba.org:/home/ftp/pub/rsync";
244 }
245 foreach (@moved_files, glob("rsync*pre*.diffs.gz*")) {
246 unlink($_);
247 }
248
6d12a859
WD
249 chdir($releasedir) or die $!;
250}
251system "fakeroot tar czf $tarfile rsync-$version";
252
253system "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");
257## END ##
258system "diff -urN --exclude=patches rsync-$lastversion rsync-$version"
259 . "| gzip -9 >$dest/rsync-$lastversion-$version.diffs.gz";
260
261system "rsync -a rsync/{README,NEWS,OLDNEWS,TODO} $dest";
262unlink("$dest/rsync-$version-NEWS");
263link("$dest/NEWS", "$dest/rsync-$version-NEWS");
264system "rsync -a $cvsroot/CVSROOT/rsync.updates $dest/cvs.log";
265
266system "yodl2html -o $dest/rsync.html rsync/rsync.yo";
267system "yodl2html -o $dest/rsyncd.conf.html rsync/rsyncd.conf.yo";
268
4d8639eb 269system "rm -rf rsync rsync-*";
6d12a859
WD
270
271if ($live) {
272 chdir($dest) or die $!;
273 system "gpg -ba rsync-$version.tar.gz";
274 system "gpg -ba rsync-$lastversion-$version.diffs.gz";
275}
276
277print <<EOT;
278
279All done. Remember to announce the release on *BOTH*
280rsync-announce\@lists.samba.org and rsync\@lists.samba.org!
281EOT