fix for #167
[koha_fer] / misc / buildrelease
index ba4f63a..eaa0ad4 100644 (file)
@@ -7,6 +7,7 @@ sub guess_kohahtmldir ($;$);
 my $kohadir=`pwd`;
 chomp $kohadir;
 my $kohahtmldir=guess_kohahtmldir($kohadir, "/koha/koha/koha-html/");
+my $kohatmpldir=guess_kohatmpldir($kohadir, "/koha/koha/koha-tmpl/");
 my $roothomedir=(getpwuid(0))[7];      # ~root is traditionally just /
 $roothomedir='/root' unless defined $roothomedir;
 
@@ -22,6 +23,9 @@ if (-e "$roothomedir/.kohaautobuild.conf") {
        if (/kohahtmldir=(.*)/) {
            $kohahtmldir=$1;
        }
+       if (/kohatmpldir=(.*)/) {
+           $kohatmpldir=$1;
+       }
     }
     $has_kohaautobuild_conf = 1;
 }
@@ -54,17 +58,24 @@ if ($input) {
     $kohahtmldir=$input;
 }
 
+print "\nWhere is the 'koha-tmpl' cvs module located [$kohatmpldir]: ";
+chomp($input = <STDIN>);
+if ($input) {
+    $kohatmpldir=$input;
+}
+
 open (C, ">$roothomedir/.kohaautobuild.conf");
 print C qq|
 kohadir=$kohadir
 kohahtmldir=$kohahtmldir
+kohatmpldir=$kohatmpldir
 |;
 
 #----------------------------------------------------------
 # which VERSION are we building ?
 #----------------------------------------------------------
 print "\n\nGuessing at next release version.  You may need to enter your SourceForge password...\n";
-open (CVSLOG, "cvs log buildrelease|");
+open (CVSLOG, "cvs log misc/buildrelease|");
 my $symbolicnamessection=0;
 my $symbolicnames;
 my $highestversion;
@@ -241,6 +252,25 @@ Tagging koha-html with tag R_$tagname
 #----------------------------------------------------------
 # MOVE files to /tmp and build tar.gz
 #----------------------------------------------------------
+
+print qq|
+Updating your checked-out copy of the 'koha-tmpl' CVS files.
+You may need to enter your SourceForge password.
+Using $kohatmpldir.
+|;
+chdir($kohatmpldir) || die "$kohatmpldir: $!\n";
+system("cvs update");
+
+if ($cvstag) {
+    print qq|
+Tagging koha-tmpl with tag R_$tagname
+|;
+    system("cvs tag -F R_$tagname");
+}
+
+
+
+
 my $rootdir="/tmp/koha-".$releaseversion;
 system("rm -rf $rootdir");
 mkdir ($rootdir, 0700);
@@ -319,9 +349,9 @@ system("find $rootdir/intranet-cgi -name '*.pl' -exec chmod a+x \\{\\} \\;");
 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");
+# Copy koha-tmpl files
+system("cp -a $kohatmpldir/opac-tmpl/* $rootdir/opac-html");
+system("cp -a $kohatmpldir/intranet-tmpl/* $rootdir/intranet-html");
 system("rm -rf $rootdir/intranet-cgi/koha-tmpl");
 
 # Remove extraneous files from opac-html
@@ -351,7 +381,7 @@ if (-e "$roothomedir/docs") {
 
 chdir("/tmp");
 system("tar czf /tmp/koha-$releaseversion.tar.gz koha-".$releaseversion);
-#system("rm -rf $rootdir");
+system("rm -rf $rootdir");
 
 print qq|
 ============
@@ -390,3 +420,16 @@ sub guess_kohahtmldir ($;$) {
     }
     return $kohahtmldir;
 }
+
+sub guess_kohatmpldir ($;$) {
+    my($kohadir, $default) = @_;
+    my $kohatmpldir;
+    # It probably makes sense to assume that the 'koha' and 'koha-tmpl'
+    # modules are checked out within the same parent directory
+    if (-d $kohadir && $kohadir =~ /^(.*)\/[^\/]+$/) {
+       $kohatmpldir = "$1/koha-tmpl"
+    } else {
+       $kohatmpldir = $default;
+    }
+    return $kohatmpldir;
+}