16 GetOptions("help|?" => \$help,
18 "tagpoint=s" => \$tagPoint,
20 "dir=s" => \$outDir) or pod2usage(2);
22 pod2usage(1) if $help;
23 pod2usage(-exitstatus => 0, -verbose => 2) if $man;
28 pod2usage(2) if !defined($tagName);
33 system ("git tag -s $tagName $tagPoint") == 0
34 or die "git tag failed with : $!";
36 # Push the tag upstream
37 system ("git push ssh://gerrit.openafs.org:29418/openafs tag $tagName") == 0
38 or die "git push failed with : $!";
41 $version = `git describe --abbrev=4 $tagName`;
43 $version=~s/openafs-[^-]*-//;
46 # Grab the tagged code into a temporary directory
48 my $name = "openafs-".$version;
50 my $tempDir = File::Temp::tempdir();
51 system ("git archive --format=tar --prefix=$name/ $tagName ".
52 " | tar -C $tempDir -x") == 0
53 or die "Git archive failed with: $?";
55 # Construct the ChangeLog
57 system("git log $last..$tagName > $outDir/ChangeLog");
59 system("git log $tagName > $outDir/ChangeLog");
63 system("git describe --abbrev=4 $tagName > $tempDir/$name/.version");
65 # Run regen.sh to create the rest of the tree
66 system ("cd $tempDir/$name && ./regen.sh") == 0
69 # A list of files to compress
72 # Create the documentation tarball
73 system("tar -cf $outDir/$name-doc.tar -C $tempDir $name/doc") == 0
74 or die "Unable to create documentation tarball : $!";
75 push @toCompress, "$outDir/$name-doc.tar";
77 # Remove the docs directory (we've already build a tarball for it)
78 File::Path::rmtree("$tempDir/$name/doc");
80 # Create the source tarball (both .gz and .bz2)
81 system("tar -cf $outDir/$name-src.tar -C $tempDir $name") == 0
82 or die "Unable to create documentation tarball : $!";
83 push @toCompress, "$outDir/$name-src.tar";
85 # Construct the diffs, and zip them
87 system("git diff $last..$tagName > $outDir/$name.diff") == 0
88 or die "Unable to create diff : $!";
89 push @toCompress, "$outDir/$name.diff";
92 my @toMD5 = @toCompress;
94 # Compress everything that needs squashing
95 foreach my $file (@toCompress) {
96 system("gzip < $file > $file.gz") == 0
97 or die "Unable to create gzip file of '$file' : $!";
98 push @toMD5, "$file.gz";
100 system("bzip2 < $file > $file.bz2") == 0
101 or die "Unable to create bzip file of '$file' : $!";
102 push @toMD5, "$file.bz2";
105 foreach my $file (@toMD5) {
106 if (-x "/sbin/md5") {
107 system("/sbin/md5 -q $file > $file.md5");
108 } elsif (-x "/usr/bin/md5sum") {
109 system("/usr/bin/md5sum $file > $file.md5");
111 print STDERR "No md5 utiltiy found. Not producing checksums\n";
120 make_release - Make an OpenAFS release from git
124 make_release [options] <tag> [<version>]
127 --help brief help message
128 --man full documentation
129 --tagpoint <object> create new tag
130 --last <object> generate changelog and diffs from this point
131 --dir <dir> output results into this directory
135 make_release constructs an OpenAFS release from a local git clone. If run
136 with just the standard arguments, it will extract the contents of the
137 specified tag into the current directory, creating src and doc tarballs,
138 gziping and bziping them, and generating md5 hashes. It will also create a
139 ChangeLog file, listing all of the changes in that release.
141 This standard behaviour may be modified by the following options
147 =item B<--last> I<object>
149 Generate the ChangeLog starting from I<object>. Also generate a
150 openafs-$version.diff file in the output directory containing all of the
151 changes between I<object> and the current tag
153 =item B<--dir> I<directory>
155 Instead of generating all of the output in the current directory, place it
156 in <directory>, which must already exist.
158 =item B<--tagpoint> I<commit|branch>
160 Rather than using an existing tag, create a new one on the specified commit,
161 or on the tip of the specified branch. This will GPG sign the new tag, and