Update of /cvsroot/lxr/lxr-tools
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv19835
Modified Files:
makerelease.pl
Log Message:
First version - does complete test - export - tar - upload cycle
Index: makerelease.pl
===================================================================
RCS file: /cvsroot/lxr/lxr-tools/makerelease.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- makerelease.pl 25 Mar 2009 16:13:52 -0000 1.1
+++ makerelease.pl 25 Mar 2009 16:49:49 -0000 1.2
@@ -1,13 +1,16 @@
#!/usr/bin/perl -w
-# Make a release of the LXR tool. Steps are:
+# Does most of the automatic steps for making a release of the LXR tool.
+# Steps are:
# - Run all the tests & ensure they pass
# - Tag the release in CVS with a tag of the form release-x-y-z (e.g. release-0-9-4)
# - Export the tagged files to a new directory lxr-x-y-z
# - Create the Changelog: can use cvs2cl.pl script
# - tar up the files
# - upload to SF servers
-# - upload new changelog
+#
+# Manual steps afterwards:
+# - upload new changelog as release notes
# - send release notification
# - Update the tracker version numbers (bugs etc) so defects can be reported
@@ -25,7 +28,7 @@
my $TARBIN = 'tar';
-GetOptions(\%option, "help!", "tag=s", "noex");
+GetOptions(\%option, "help!", "tag=s", "noex", "notest");
if ($option{'help'}) {
print <<END_HELP;
@@ -35,7 +38,8 @@
Interactively releases the LXR project to SourceForge.
Script will tag the repository, create the release tarballs, then
-upload tarball and changelog to SourceForge.
+upload tarball to SourceForge. Creating the actual release on SF is a manual
+process - go to https://sourceforge.net/project/admin/editpackages.php?group_id=27350 to complete the release.
Must be run from the top-level directory of the lxr module (i.e. where
the "source" and "INSTALL" files are found).
@@ -60,17 +64,22 @@
my $tag;
check_environment();
-run_tests();
+if (!$option{'notest'}) {
+ run_tests();
+} else {
+ print "WARNING: Skipping tests\n";
+}
+
$tag = tag_release();
my $version = $tag;
$version =~ s/release-(\d+)-(\d+)-(\d+)/$1\.$2\.$3/;
create_changelog($tag, $version);
create_release_tarball($tag, $version);
-upload_release($version);
-upload_changelog($version);
-send_release_notification($version);
+upload_release($tag, $version);
-exit 1;
+print "\nRelease $version done - complete manual process on SF website\n\n";
+
+exit 0;
sub get_tags() {
@@ -98,7 +107,8 @@
sub tag_to_val {
my $tag = shift;
- my ($major, $minor, $point) = 0;
+ my ($major, $minor, $point);
+ $major = $minor = $point = 0;
if ($tag =~ m/release-(\d+)-(\d+)-(\d+)/) {
$major = $1;
@@ -170,6 +180,20 @@
# Run the tests and make sure they pass
sub run_tests {
print "Running tests...";
+ chdir("tests");
+
+ my ($fileh, $rtn);
+
+ $rtn = open($fileh, "-|", "./TestRunner.pl AllTests.pm 2>&1");
+ die "Failed to start tests" unless $rtn;
+ while (<$fileh>) {
+ if (/^Test was not successful\.$/) {
+ die "Tests did not pass, aborting.\nUse the --notest option if you want to release anyway";
+ }
+ }
+ close $fileh;
+
+ chdir($cwd);
print "Done\n";
}
@@ -246,8 +270,8 @@
do {system($cmd) == 0 or die "Command failed $?";} unless $NO;
# Copy the Changelog across
- system ("mv $cwd/ChangeLog lxr-$version") == 0
- or die "Couldn't copy ChangeLog";
+ do {system ("mv $cwd/ChangeLog lxr-$version") == 0
+ or die "Couldn't copy ChangeLog"; } unless $NO;
$cmd = "$TARBIN -czvf lxr-$version.tgz lxr-$version > /dev/null 2>&1";
@@ -268,13 +292,31 @@
my ($tag, $version) = @_;
print "Creating changelog...";
- my $cmd = "cvs2cl -T --gmt";
+ my $cmd = "cvs2cl -T --gmt > /dev/null 2>&1";
system($cmd) == 0 or die "Couldn't execute cvs2cl";
print "Done\n";
}
+## Upload the release to the SF servers
+# Uses the rsync over SSH protocol
+
+sub upload_release {
+ my ($tag, $version) = @_;
+
+ print "Uploading to SF...";
+ chdir("..");
+
+ my $cmd = "rsync -a -e ssh lxr-$version.tgz ".'mb...@fr...:uploads/';
+ print "[Not executing]" if $NO;
+ print " $cmd\n";
+
+ do {system($cmd) == 0 or die "Couldn't upload";} unless $NO;
+
+ chdir($cwd);
+ print "Done\n";
+}
|