koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha buildrelease,1.1.2.21,1.1.2.22


From: Steve Tonnesen
Subject: [Koha-cvs] CVS: koha buildrelease,1.1.2.21,1.1.2.22
Date: Tue, 17 Sep 2002 20:56:53 -0700

Update of /cvsroot/koha/koha
In directory usw-pr-cvs1:/tmp/cvs-serv7206

Modified Files:
      Tag: rel-1-2
        buildrelease 
Log Message:
Various fixes for buildrelease script contributed by a.c.li

(1) Guess the location of koha-html in a hopefully more sensible way

(2) Use getpwuid() to figure where root's home directory is; traditionally /root
is usually not right

(3) Check for the return code of chdir calls

(4) Removed compilation warning messages (replaced \RC with explicit use of
concatenation operator)

(5) The questions about tagging and updates could be quite confusing to the new
user (of buildrelease); I tried to reword a couple of sentences a bit, and
rearranged their orders a bit, to reduce the likelihood of getting confused.
Needless questions need not be asked (confirming whether to tag when the user
says he/she doesn't want to tag).

(6) Don't say it is tagging the CVS files when it is not.



Index: buildrelease
===================================================================
RCS file: /cvsroot/koha/koha/buildrelease,v
retrieving revision 1.1.2.21
retrieving revision 1.1.2.22
diff -C2 -r1.1.2.21 -r1.1.2.22
*** buildrelease        3 Sep 2002 21:59:48 -0000       1.1.2.21
--- buildrelease        18 Sep 2002 03:56:51 -0000      1.1.2.22
***************
*** 1,10 ****
  #!/usr/bin/perl
  
  my $kohadir=`pwd`;
  chomp $kohadir;
! my $kohahtmldir="/koha/koha/koha-html/";
  
! if (-e "/root/.kohaautobuild.conf") {
!     open C, "/root/.kohaautobuild.conf";
      while (<C>) {
        chomp;
--- 1,16 ----
  #!/usr/bin/perl
  
+ sub guess_kohahtmldir ($;$);
+ 
  my $kohadir=`pwd`;
  chomp $kohadir;
! my $kohahtmldir=guess_kohahtmldir($kohadir, "/koha/koha/koha-html/");
! my $roothomedir=(getpwuid(0))[7];     # ~root is traditionally just /
! $roothomedir='/root' unless defined $roothomedir;
! 
! my $has_kohaautobuild_conf = 0;
  
! if (-e "$roothomedir/.kohaautobuild.conf") {
!     open C, "<$roothomedir/.kohaautobuild.conf";
      while (<C>) {
        chomp;
***************
*** 16,19 ****
--- 22,26 ----
        }
      }
+     $has_kohaautobuild_conf = 1;
  }
  
***************
*** 36,39 ****
--- 43,47 ----
  if ($input) {
      $kohadir=$input;
+     $kohahtmldir=guess_kohahtmldir($kohadir, $kohahtmldir) unless 
$has_kohaautobuild_conf;
  }
  
***************
*** 45,49 ****
  }
  
! open (C, ">/root/.kohaautobuild.conf");
  print C qq|
  kohadir=$kohadir
--- 53,57 ----
  }
  
! open (C, ">$roothomedir/.kohaautobuild.conf");
  print C qq|
  kohadir=$kohadir
***************
*** 52,56 ****
  
  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;
--- 60,64 ----
  
  print "\n\nGuessing at next release version.  You may need to enter your 
SourceForge password...\n";
! chdir $kohadir || die "$kohadir: $!\n";
  open (CVSLOG, "cvs log buildrelease|");
  my $symbolicnamessection=0;
***************
*** 103,108 ****
      $currentversion=$highestversion;
  } else {
!     $releaseversion="$highestversion\RC".($highestrc+1);
!     $currentversion="$highestversion\RC$highestrc";
  }
  
--- 111,116 ----
      $currentversion=$highestversion;
  } else {
!     $releaseversion=$highestversion."RC".($highestrc+1);
!     $currentversion=$highestversion."RC$highestrc";
  }
  
***************
*** 110,127 ****
  print "\nWould you like to bump that up to $releaseversion (or manually enter 
version)?  [Y]/N: ";
  chomp($input = <STDIN>);
  if ($input =~ /^n/i) {
      print "\nWould you like to rebuild the $currentversion tarball?  Y/[N]: ";
      chomp($input = <STDIN>);
      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;
!       }
      } else {
        print "What should the new version be? [$releaseversion]: ";
--- 118,129 ----
  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;
!       $tagging_needs_confirmation = 1;
      } else {
        print "What should the new version be? [$releaseversion]: ";
***************
*** 143,146 ****
--- 145,149 ----
  chomp ($input=<STDIN>);
  my $cvstag=1;
+ # FIXME: This means anything other than n will tag; too dangerous?
  if ($input=~/^n/i) {
      $cvstag=0;
***************
*** 148,151 ****
--- 151,167 ----
  
  
+ 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;
+       }
+ }
+ 
+ 
  my $sfuserid='';
  if ($cvsroot=$ENV{'CVSROOT'}) {
***************
*** 165,187 ****
  
  print qq|
! Updating the 'koha' CVS files.  You may need to enter your SourceForge 
password.
  Using $kohadir.
  |;
  chdir($kohadir);
  system("cvs update");
! print qq|
  Tagging koha with tag R_$tagname
  |;
! ($cvstag) && (system("cvs tag -F R_$tagname"));
  print qq|
! Updating the 'koha-html' CVS files.  You may need to enter your SourceForge 
password.
  Using $kohahtmldir.
  |;
! chdir($kohahtmldir);
  system("cvs update");
! print qq|
  Tagging koha-html with tag R_$tagname
  |;
! ($cvstag) && (system("cvs tag -F R_$tagname"));
  
  
--- 181,210 ----
  
  print qq|
! 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");
! if ($cvstag) {
!     print qq|
  Tagging koha with tag R_$tagname
  |;
!     system("cvs tag -F R_$tagname");
! }
  print qq|
! Updating your checked-out copy of the 'koha-html' CVS files.
! You may need to enter your SourceForge password.
  Using $kohahtmldir.
  |;
! chdir($kohahtmldir) || die "$kohahtmldir: $!\n";
  system("cvs update");
! 
! if ($cvstag) {
!     print qq|
  Tagging koha-html with tag R_$tagname
  |;
!     system("cvs tag -F R_$tagname");
! }
  
  
***************
*** 191,195 ****
  system("rm -rf $rootdir");
  mkdir ($rootdir, 0700);
! chdir($rootdir);
  
  mkdir("intranet-cgi", 0755);
--- 214,218 ----
  system("rm -rf $rootdir");
  mkdir ($rootdir, 0700);
! chdir($rootdir) || die "$rootdir: $!\n";
  
  mkdir("intranet-cgi", 0755);
***************
*** 256,264 ****
  # 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");
--- 279,287 ----
  # Remove extraneous files from intranet-cgi
  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");
+ # 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");
***************
*** 288,296 ****
  system("find $rootdir -name .#* -exec rm -rf \\{\\} \\; 2>/dev/null");
  
! if (-e "/root/docs/manual") {
!     print "Copying docs folder from /root/docs...";
!     system("cp -r /root/docs/* $rootdir/docs/");
  } else {
!     print "I would have copied the docs from from /root/docs, but I couldn't 
find it.\n";
      print "Press <ENTER> to continue...\n";
      <STDIN>;
--- 311,320 ----
  system("find $rootdir -name .#* -exec rm -rf \\{\\} \\; 2>/dev/null");
  
!   
! 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 $roothomedir/docs, but I 
couldn't find it.\n";
      print "Press <ENTER> to continue...\n";
      <STDIN>;
***************
*** 324,326 ****
--- 348,363 ----
      }
      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;
  }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]