19 "tagpoint=s" => \$tagPoint,
24 pod2usage(1) if $help;
25 pod2usage(-exitstatus => 0, -verbose => 2) if $man;
28 my $notused = shift; # Used to be "version".
30 pod2usage(2) if !defined($tagName);
31 if (defined $notused) {
32 warn "Warning: argument '$notused' is ignored.\n";
38 system ("git tag -s $tagName $tagPoint") == 0
39 or die "git tag failed with : $!";
41 # Push the tag upstream
42 system ("git push ssh://gerrit.openafs.org:29418/openafs tag $tagName") == 0
43 or die "git push failed with : $!";
46 my $version = `git describe --abbrev=4 $tagName`;
49 die "Failed to describe $tagName.\n";
51 my $suffix = $version;
52 $suffix =~ s/openafs-[^-]*-//;
54 my $name = "openafs-$suffix";
56 # Grab the tagged code into a temporary directory
58 my $tempDir = File::Temp::tempdir();
59 system ("git archive --format=tar --prefix=$name/ $tagName ".
60 " | tar -C $tempDir -x") == 0
61 or die "Git archive failed with: $?";
63 # Make the output path, if not already present.
64 File::Path::mkpath($outDir);
66 # Construct the ChangeLog
68 system("git log $last..$tagName > $outDir/ChangeLog");
70 system("git log $tagName > $outDir/ChangeLog");
74 open(my $fh, ">", "$tempDir/$name/.version") or
75 die "Failed to open $tempDir/$name/.version: $!\n";
76 print $fh "$version\n";
79 # Run regen.sh to create the rest of the tree
80 system ("cd $tempDir/$name && ./regen.sh") == 0
83 # A list of files to compress
86 # Create the documentation tarball
87 system("tar -cf $outDir/$name-doc.tar -C $tempDir $name/doc") == 0
88 or die "Unable to create documentation tarball : $!";
89 push @toCompress, "$outDir/$name-doc.tar";
91 # Remove the docs directory (we've already build a tarball for it)
92 File::Path::rmtree("$tempDir/$name/doc");
94 # Create the source tarball (both .gz and .bz2)
95 system("tar -cf $outDir/$name-src.tar -C $tempDir $name") == 0
96 or die "Unable to create source code tarball : $!";
97 push @toCompress, "$outDir/$name-src.tar";
99 # Construct the diffs, and zip them
101 system("git diff $last..$tagName > $outDir/$name.diff") == 0
102 or die "Unable to create diff : $!";
103 push @toCompress, "$outDir/$name.diff";
108 # Compress everything that needs squashing,
109 # and also set up a list for md5 checksumming.
110 foreach my $file (@toCompress) {
111 system("gzip < $file > $file.gz") == 0
112 or die "Unable to create gzip file of '$file' : $!";
113 push @toMD5, "$file.gz";
115 system("bzip2 < $file > $file.bz2") == 0
116 or die "Unable to create bzip file of '$file' : $!";
117 push @toMD5, "$file.bz2";
119 # Delete the uncompressed tar files.
120 if ($file =~ /\.tar$/) {
123 # Otherwise, queue this file for md5 checksumming.
128 foreach my $file (@toMD5) {
129 if (-x "/sbin/md5") {
130 system("/sbin/md5 -q $file > $file.md5");
131 } elsif (-x "/usr/bin/md5sum") {
132 system("/usr/bin/md5sum $file > $file.md5");
134 print STDERR "No md5 utility found. Not producing checksums\n";
143 make-release - Make an OpenAFS release from git
147 make-release [options] <tag>
150 --help brief help message
151 --man full documentation
152 --tagpoint <object> create new tag
153 --last <object> generate changelog and diffs from this point
154 --dir <dir> output results into this directory
158 make-release constructs an OpenAFS release from a local git clone. If run
159 with just the standard arguments, it will extract the contents of the
160 specified tag into the current directory, creating src and doc tarballs,
161 gzipping and bzipping them, and generating md5 hashes. It will also create a
162 ChangeLog file, listing all of the changes in that release.
164 This standard behaviour may be modified by the following options
170 =item B<--last> I<object>
172 Generate the ChangeLog starting from I<object>. Also generate a
173 openafs-$version.diff file in the output directory containing all of the
174 changes between I<object> and the current tag
176 =item B<--dir> I<directory>
178 Instead of generating all of the output in the current directory, place it
179 in <directory>, which is created if it does not already exist.
181 =item B<--tagpoint> I<commit|branch>
183 Rather than using an existing tag, create a new one on the specified commit,
184 or on the tip of the specified branch. This will GPG sign the new tag, and