buildrelease now handles 1.2 and 1.3 branches automatically (for guessing next version)
This commit is contained in:
parent
b89587c218
commit
97ab8ca242
1 changed files with 121 additions and 38 deletions
159
buildrelease
159
buildrelease
|
@ -1,11 +1,17 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
sub guess_kohahtmldir ($;$);
|
||||
|
||||
my $kohadir=`pwd`;
|
||||
chomp $kohadir;
|
||||
my $kohahtmldir="/koha/koha/koha-html/";
|
||||
my $kohahtmldir=guess_kohahtmldir($kohadir, "/koha/koha/koha-html/");
|
||||
my $roothomedir=(getpwuid(0))[7]; # ~root is traditionally just /
|
||||
$roothomedir='/root' unless defined $roothomedir;
|
||||
|
||||
if (-e "$kohadir/.kohaautobuild.conf") {
|
||||
open C, "$kohadir/.kohaautobuild.conf";
|
||||
my $has_kohaautobuild_conf = 0;
|
||||
|
||||
if (-e "$roothomedir/.kohaautobuild.conf") {
|
||||
open C, "<$roothomedir/.kohaautobuild.conf";
|
||||
while (<C>) {
|
||||
chomp;
|
||||
if (/kohadir=(.*)/) {
|
||||
|
@ -15,6 +21,7 @@ if (-e "$kohadir/.kohaautobuild.conf") {
|
|||
$kohahtmldir=$1;
|
||||
}
|
||||
}
|
||||
$has_kohaautobuild_conf = 1;
|
||||
}
|
||||
|
||||
my $input;
|
||||
|
@ -35,6 +42,7 @@ print "\nWhere is the 'koha' cvs module located [$kohadir]: ";
|
|||
chomp($input = <STDIN>);
|
||||
if ($input) {
|
||||
$kohadir=$input;
|
||||
$kohahtmldir=guess_kohahtmldir($kohadir, $kohahtmldir) unless $has_kohaautobuild_conf;
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,20 +52,21 @@ if ($input) {
|
|||
$kohahtmldir=$input;
|
||||
}
|
||||
|
||||
open (C, "> $kohadir/.kohaautobuild.conf") || die "unable to create kohaautobuild file";
|
||||
open (C, ">$roothomedir/.kohaautobuild.conf");
|
||||
print C qq|
|
||||
kohadir=$kohadir
|
||||
kohahtmldir=$kohahtmldir
|
||||
|;
|
||||
|
||||
print "\n\nGuessing at next release version. You may need to enter your SourceForge password...\n";
|
||||
chdir $kohadir;
|
||||
open (CVSLOG, "cvs log buildrelease|");
|
||||
my $symbolicnamessection=0;
|
||||
my $symbolicnames;
|
||||
my $highestversion;
|
||||
my $highestrc;
|
||||
my $released;
|
||||
my $majorversion;
|
||||
my $majorversionrc;
|
||||
while (<CVSLOG>) {
|
||||
if (/^symbolic names:/) {
|
||||
$symbolicnamessection=1;
|
||||
|
@ -72,6 +81,11 @@ while (<CVSLOG>) {
|
|||
if ($id =~/(.*)RC(.*)/) {
|
||||
$version=$1;
|
||||
$rc=$2;
|
||||
$version=~m#(\d+\.\d+)\.#;
|
||||
if (versioncompare($version, $majorversion->{$1})) {
|
||||
$majorversion->{$1}=$version;
|
||||
$majorversionrc->{$1}=$rc;
|
||||
}
|
||||
if (versioncompare($version, $highestversion)) {
|
||||
$highestversion=$version;
|
||||
$released=0;
|
||||
|
@ -79,6 +93,11 @@ while (<CVSLOG>) {
|
|||
}
|
||||
} else {
|
||||
$version=$id;
|
||||
$version=~m#(\d+\.\d+)\.#;
|
||||
if (versioncompare($version, $majorversion->{$1})) {
|
||||
$majorversion->{$1}=$version;
|
||||
$majorversionrc->{$1}=0;
|
||||
}
|
||||
if (versioncompare($version, $highestversion)) {
|
||||
$highestversion=$version;
|
||||
$released=1;
|
||||
|
@ -94,35 +113,44 @@ while (<CVSLOG>) {
|
|||
my $releaseversion='';
|
||||
my $currentversion='';
|
||||
|
||||
my $branchdata=`grep buildrelease CVS/Entries`;
|
||||
chomp $branchdata;
|
||||
my $branch=(split(m#/#, $branchdata))[5];
|
||||
|
||||
if ($branch eq 'Trel-1-2') {
|
||||
$highestversion=$majorversion->{'1.2'};
|
||||
$highestrc=$majorversionrc->{'1.2'};
|
||||
($highestrc) ? ($released=0) : ($released=1);
|
||||
}
|
||||
|
||||
if ($released) {
|
||||
my @components=split(/\./, $highestversion);
|
||||
$components[$#components]++;
|
||||
$nexthighestversion=join '.', @components;
|
||||
$releaseversion=$nexthighestversion."RC1";
|
||||
my $minornumber=(split(/\./, $highestversion))[1];
|
||||
if ($minornumber/2 == int($minornumber/2)) {
|
||||
$releaseversion=$nexthighestversion."RC1";
|
||||
} else {
|
||||
$releaseversion=$nexthighestversion;
|
||||
}
|
||||
$currentversion=$highestversion;
|
||||
} else {
|
||||
$releaseversion="$highestversion\RC".($highestrc+1);
|
||||
$currentversion="$highestversion\RC$highestrc";
|
||||
$releaseversion=$highestversion."RC".($highestrc+1);
|
||||
$currentversion=$highestversion."RC$highestrc";
|
||||
}
|
||||
|
||||
|
||||
print "Current release tag is $currentversion.\n";
|
||||
print "\nWould you like to bump that up to $releaseversion (or manually enter version)? [Y]/N: ";
|
||||
chomp($input = <STDIN>);
|
||||
my $tagging_needs_confirmation = 0;
|
||||
if ($input =~ /^n/i) {
|
||||
print "\nWould you like to rebuild the $currentversion tarball? Y/[N]: ";
|
||||
chomp($input = <STDIN>);
|
||||
print STDERR "releaseversion=($releaseversion), currentversion=($currentversion)\n";#XXXZZZ
|
||||
if ($input =~ /^y/i) {
|
||||
$releaseversion=$currentversion;
|
||||
print "\n\n";
|
||||
print "Do not do this if you have released the tarball to anybody, as it will\n";
|
||||
print "overwrite the tag marking the files that were in the tarball.\n\n";
|
||||
print "Confirm that you want to overwrite the tag for $releaseversion? Y/[N]: ";
|
||||
chomp($input = <STDIN>);
|
||||
if ($input =~ /^n/i || $input eq '') {
|
||||
print "\nStopping. Please re-run buildrelease now.\n";
|
||||
exit;
|
||||
}
|
||||
$tagging_needs_confirmation = 1;
|
||||
} else {
|
||||
print "What should the new version be? [$releaseversion]: ";
|
||||
chomp ($input=<STDIN>);
|
||||
|
@ -130,14 +158,34 @@ if ($input =~ /^n/i) {
|
|||
$releaseversion=$input;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print "What should the new version be? [$releaseversion]: ";
|
||||
chomp ($input=<STDIN>);
|
||||
if ($input) {
|
||||
$releaseversion=$input;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print "\nWould you like to tag the CVS repository?\n(answer yes if releasing tarball) [Y]/N: ";
|
||||
print "\nWould you like to tag the CVS repository?\n(answer yes if releasing tarball) Y/[N]: ";
|
||||
chomp ($input=<STDIN>);
|
||||
my $cvstag=1;
|
||||
if ($input=~/^n/i) {
|
||||
$cvstag=0;
|
||||
my $cvstag=0;
|
||||
# FIXME: This means anything other than n will tag; too dangerous?
|
||||
if ($input=~/^y/i) {
|
||||
$cvstag=1;
|
||||
}
|
||||
|
||||
|
||||
if ($cvstag && $tagging_needs_confirmation) {
|
||||
print "\n\n";
|
||||
print "Do not do this if you have released the tarball to anybody, as it will\n";
|
||||
print "overwrite the tag marking the files that were in the tarball:\n\n";
|
||||
print "Confirm that you want to overwrite the tag for $releaseversion? Y/[N]: ";
|
||||
chomp($input = <STDIN>);
|
||||
if ($input =~ /^n/i || $input !~ /\S/) {
|
||||
print "\nStopping. Please re-run buildrelease now.\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -158,25 +206,32 @@ my $tagname=$releaseversion;
|
|||
$tagname=~s/\./-/g;
|
||||
|
||||
print qq|
|
||||
Updating the 'koha' CVS files. You may need to enter your SourceForge password.
|
||||
Updating your checked-out copy of the 'koha' CVS files.
|
||||
You may need to enter your SourceForge password.
|
||||
Using $kohadir.
|
||||
|;
|
||||
chdir($kohadir);
|
||||
system("cvs update");
|
||||
print qq|
|
||||
if ($cvstag) {
|
||||
print qq|
|
||||
Tagging koha with tag R_$tagname
|
||||
|;
|
||||
($cvstag) && (system("cvs tag -F R_$tagname"));
|
||||
system("cvs tag -F R_$tagname");
|
||||
}
|
||||
print qq|
|
||||
Updating the 'koha-html' CVS files. You may need to enter your SourceForge password.
|
||||
Updating your checked-out copy of the 'koha-html' CVS files.
|
||||
You may need to enter your SourceForge password.
|
||||
Using $kohahtmldir.
|
||||
|;
|
||||
chdir($kohahtmldir);
|
||||
chdir($kohahtmldir) || die "$kohahtmldir: $!\n";
|
||||
system("cvs update");
|
||||
print qq|
|
||||
|
||||
if ($cvstag) {
|
||||
print qq|
|
||||
Tagging koha-html with tag R_$tagname
|
||||
|;
|
||||
($cvstag) && (system("cvs tag -F R_$tagname"));
|
||||
system("cvs tag -F R_$tagname");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -184,7 +239,7 @@ Tagging koha-html with tag R_$tagname
|
|||
my $rootdir="/tmp/koha-".$releaseversion;
|
||||
system("rm -rf $rootdir");
|
||||
mkdir ($rootdir, 0700);
|
||||
chdir($rootdir);
|
||||
chdir($rootdir) || die "$rootdir: $!\n";
|
||||
|
||||
mkdir("intranet-cgi", 0755);
|
||||
mkdir("intranet-html", 0755);
|
||||
|
@ -215,8 +270,10 @@ system("mv $rootdir/intranet-cgi/LICENSE $rootdir");
|
|||
system("mv $rootdir/intranet-cgi/News $rootdir");
|
||||
system("mv $rootdir/intranet-cgi/README $rootdir");
|
||||
system("mv $rootdir/intranet-cgi/TODO $rootdir");
|
||||
system("mv $rootdir/intranet-cgi/installer.pl $rootdir");
|
||||
system("mv $rootdir/intranet-cgi/koha.upgrade $rootdir");
|
||||
system("mv $rootdir/intranet-cgi/installer.pl $rootdir");
|
||||
system("mv $rootdir/intranet-cgi/koha.upgrade $rootdir");
|
||||
system("mv $rootdir/intranet-cgi/Install.pm $rootdir");
|
||||
system("mv $rootdir/intranet-cgi/kohareporter $rootdir");
|
||||
chmod 0770, "$rootdir/installer.pl";
|
||||
chmod 0770, "$rootdir/koha.upgrade";
|
||||
system("mv $rootdir/intranet-cgi/koha.conf $rootdir");
|
||||
|
@ -228,6 +285,10 @@ system("gzip -9 $rootdir/sampledata-1.2");
|
|||
system("cp $rootdir/intranet-cgi/detail.pl $rootdir/opac-cgi");
|
||||
system("cp $rootdir/intranet-cgi/moredetail.pl $rootdir/opac-cgi");
|
||||
system("cp $rootdir/intranet-cgi/search.pl $rootdir/opac-cgi");
|
||||
system("cp $rootdir/intranet-cgi/subjectsearch.pl $rootdir/opac-cgi");
|
||||
system("cp $rootdir/intranet-cgi/logout.pl $rootdir/opac-cgi");
|
||||
system("mv $rootdir/intranet-cgi/opac/* $rootdir/opac-cgi");
|
||||
system("rmdir $rootdir/intranet-cgi/opac");
|
||||
|
||||
|
||||
# Move files from intranet-cgi to /scripts/ directory
|
||||
|
@ -237,6 +298,7 @@ system("mv $rootdir/intranet-cgi/translator $rootdir/scripts");
|
|||
system("mv $rootdir/intranet-cgi/updater $rootdir/scripts");
|
||||
system("mv $rootdir/intranet-cgi/misc $rootdir/scripts");
|
||||
system("mv $rootdir/intranet-cgi/marc $rootdir/scripts");
|
||||
system("mv $rootdir/intranet-cgi/acqui.simple/bulkmarcimport.pl $rootdir/scripts/z3950daemon/");
|
||||
system("mv $rootdir/intranet-cgi/acqui.simple/processz3950queue $rootdir/scripts/z3950daemon/");
|
||||
system("mv $rootdir/intranet-cgi/acqui.simple/z3950-daemon-launch.sh $rootdir/scripts/z3950daemon/");
|
||||
system("mv $rootdir/intranet-cgi/acqui.simple/z3950-daemon-shell.sh $rootdir/scripts/z3950daemon/");
|
||||
|
@ -244,21 +306,28 @@ system("mv $rootdir/intranet-cgi/acqui.simple/z3950-daemon-shell.sh $rootdir/scr
|
|||
|
||||
# Remove extraneous files from intranet-cgi
|
||||
system("rm -f $rootdir/intranet-cgi/ChangeLog.bak");
|
||||
system("rm -f $rootdir/intranet-cgi/ChangeLog.bak");
|
||||
system("rm -f $rootdir/intranet-cgi/SendMessages");
|
||||
system("rm -f $rootdir/intranet-cgi/buildrelease");
|
||||
system("rm -f $rootdir/intranet-cgi/database.mysql");
|
||||
system("rm -f $rootdir/intranet-cgi/installer-lite.pl");
|
||||
system("rm -f $rootdir/intranet-cgi/koha-1.2.0.tar.gz");
|
||||
system("rm -f $rootdir/intranet-cgi/rel-1-2");
|
||||
# FIXME: The following two lines look suspicious
|
||||
#system("rm -f $rootdir/intranet-cgi/koha-1.2.0.tar.gz");
|
||||
#system("rm -f $rootdir/intranet-cgi/rel-1-2");
|
||||
system("rm -f $rootdir/intranet-cgi/testKoha.pl");
|
||||
system("rm -rf $rootdir/intranet-cgi/html-template");
|
||||
system("rm -rf $rootdir/intranet-cgi/t");
|
||||
|
||||
# Set all .pl scripts executable
|
||||
system("find $rootdir/intranet-cgi -name '*.pl' -exec chmod a+x \\{\\} \\;");
|
||||
# Copy all CVS files to intranet-html and opac-html
|
||||
system("cp -a $kohahtmldir/intranet-html/* $rootdir/intranet-html");
|
||||
system("cp -a $kohahtmldir/opac-html/* $rootdir/opac-html");
|
||||
|
||||
# Move koha-tmpl files
|
||||
system("mv $rootdir/intranet-cgi/koha-tmpl/opac-tmpl/* $rootdir/opac-html");
|
||||
system("mv $rootdir/intranet-cgi/koha-tmpl/intranet-tmpl/* $rootdir/intranet-html");
|
||||
system("rm -rf $rootdir/intranet-cgi/koha-tmpl");
|
||||
|
||||
# Remove extraneous files from opac-html
|
||||
system("rm -f $rootdir/opac-html/koha.mo");
|
||||
system("rm -f $rootdir/opac-html/koha.pot");
|
||||
|
@ -274,11 +343,12 @@ system("find $rootdir -name CVS -exec rm -rf \\{\\} \\; 2>/dev/null");
|
|||
system("find $rootdir -name *~ -exec rm -rf \\{\\} \\; 2>/dev/null");
|
||||
system("find $rootdir -name .#* -exec rm -rf \\{\\} \\; 2>/dev/null");
|
||||
|
||||
if (-e "/root/docs") {
|
||||
print "Copying docs folder from /root/docs...";
|
||||
system("cp -r /root/docs/* $rootdir/docs/");
|
||||
|
||||
if (-e "$roothomedir/docs") {
|
||||
print "Copying docs folder from $roothomedir/docs...";
|
||||
system("cp -r $roothomedir/docs/* $rootdir/docs/");
|
||||
} else {
|
||||
print "I would have copied the docs from from /root/docs, but I couldn't find it.\n";
|
||||
print "I would have copied the docs from from $roothomedir/docs, but I couldn't find it.\n";
|
||||
print "Press <ENTER> to continue...\n";
|
||||
<STDIN>;
|
||||
}
|
||||
|
@ -311,3 +381,16 @@ sub versioncompare {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub guess_kohahtmldir ($;$) {
|
||||
my($kohadir, $default) = @_;
|
||||
my $kohahtmldir;
|
||||
# It probably makes sense to assume that the 'koha' and 'koha-html'
|
||||
# modules are checked out within the same parent directory
|
||||
if (-d $kohadir && $kohadir =~ /^(.*)\/[^\/]+$/) {
|
||||
$kohahtmldir = "$1/koha-html"
|
||||
} else {
|
||||
$kohahtmldir = $default;
|
||||
}
|
||||
return $kohahtmldir;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue