3 sub guess_kohahtmldir
($;$);
7 my $kohahtmldir=guess_kohahtmldir
($kohadir, "/koha/koha/koha-html/");
8 my $roothomedir=(getpwuid(0))[7]; # ~root is traditionally just /
9 $roothomedir='/root' unless defined $roothomedir;
11 my $has_kohaautobuild_conf = 0;
13 if (-e
"$roothomedir/.kohaautobuild.conf") {
14 open C
, "<$roothomedir/.kohaautobuild.conf";
20 if (/kohahtmldir=(.*)/) {
24 $has_kohaautobuild_conf = 1;
30 ***************************************
31 * Welcome to the Koha Release Builder
*
32 ***************************************
34 This script will automatically build a release tarball
.
36 The script assumes that you already have the koha
and koha
-html modules checked
37 out
for the release that you want to build
, although it will update the modules
41 print "\nWhere is the 'koha' cvs module located [$kohadir]: ";
42 chomp($input = <STDIN
>);
45 $kohahtmldir=guess_kohahtmldir
($kohadir, $kohahtmldir) unless $has_kohaautobuild_conf;
49 print "\nWhere is the 'koha-html' cvs module located [$kohahtmldir]: ";
50 chomp($input = <STDIN
>);
55 open (C
, ">$roothomedir/.kohaautobuild.conf");
58 kohahtmldir
=$kohahtmldir
61 print "\n\nGuessing at next release version. You may need to enter your SourceForge password...\n";
62 chdir $kohadir || die "$kohadir: $!\n";
63 open (CVSLOG
, "cvs log buildrelease|");
64 my $symbolicnamessection=0;
70 if (/^symbolic names:/) {
71 $symbolicnamessection=1;
73 if ($symbolicnamessection && (/^\s+([^:]*):/)) {
80 if ($id =~/(.*)RC(.*)/) {
83 if (versioncompare
($version, $highestversion)) {
84 $highestversion=$version;
90 if (versioncompare
($version, $highestversion)) {
91 $highestversion=$version;
96 $symbolicnames->{$version}->{$rc}=1;
102 my $releaseversion='';
103 my $currentversion='';
107 my @components=split(/\./, $highestversion);
108 $components[$#components]++;
109 $nexthighestversion=join '.', @components;
110 $releaseversion=$nexthighestversion."RC1";
111 $currentversion=$highestversion;
113 $releaseversion=$highestversion."RC".($highestrc+1);
114 $currentversion=$highestversion."RC$highestrc";
117 print "Current release tag is $currentversion.\n";
118 print "\nWould you like to bump that up to $releaseversion (or manually enter version)? [Y]/N: ";
119 chomp($input = <STDIN
>);
120 my $tagging_needs_confirmation = 0;
121 if ($input =~ /^n/i) {
122 print "\nWould you like to rebuild the $currentversion tarball? Y/[N]: ";
123 chomp($input = <STDIN
>);
124 print STDERR
"releaseversion=($releaseversion), currentversion=($currentversion)\n";#XXXZZZ
125 if ($input =~ /^y/i) {
126 $releaseversion=$currentversion;
127 $tagging_needs_confirmation = 1;
129 print "What should the new version be? [$releaseversion]: ";
130 chomp ($input=<STDIN
>);
132 $releaseversion=$input;
136 print "What should the new version be? [$releaseversion]: ";
137 chomp ($input=<STDIN
>);
139 $releaseversion=$input;
144 print "\nWould you like to tag the CVS repository?\n(answer yes if releasing tarball) Y/[N]: ";
145 chomp ($input=<STDIN
>);
147 # FIXME: This means anything other than n will tag; too dangerous?
153 if ($cvstag && $tagging_needs_confirmation) {
155 print "Do not do this if you have released the tarball to anybody, as it will\n";
156 print "overwrite the tag marking the files that were in the tarball:\n\n";
157 print "Confirm that you want to overwrite the tag for $releaseversion? Y/[N]: ";
158 chomp($input = <STDIN
>);
159 if ($input =~ /^n/i || $input !~ /\S/) {
160 print "\nStopping. Please re-run buildrelease now.\n";
167 if ($cvsroot=$ENV{'CVSROOT'}) {
168 $cvsroot=~m
#(.*)\@cvs#;
171 $ENV{'CVS_RSH'}='ssh';
172 print "\nWhat is your userid at SourceForge: ";
173 chomp($input = <STDIN
>);
177 $ENV{'CVSROOT'}="$sfuserid\@cvs.koha.sourceforge.net:/cvsroot/koha";
179 my $tagname=$releaseversion;
183 Updating your checked
-out copy of the
'koha' CVS files
.
184 You may need to enter your SourceForge password
.
188 system("cvs update");
191 Tagging koha with tag R_
$tagname
193 system("cvs tag -F R_$tagname");
196 Updating your checked
-out copy of the
'koha-html' CVS files
.
197 You may need to enter your SourceForge password
.
200 chdir($kohahtmldir) || die "$kohahtmldir: $!\n";
201 system("cvs update");
205 Tagging koha
-html with tag R_
$tagname
207 system("cvs tag -F R_$tagname");
213 my $rootdir="/tmp/koha-".$releaseversion;
214 system("rm -rf $rootdir");
215 mkdir ($rootdir, 0700);
216 chdir($rootdir) || die "$rootdir: $!\n";
218 mkdir("intranet-cgi", 0755);
219 mkdir("intranet-html", 0755);
220 mkdir("opac-cgi", 0755);
221 mkdir("opac-html", 0755);
222 mkdir("scripts", 0755);
223 mkdir("scripts/z3950daemon", 0755);
224 mkdir("modules", 0755);
227 # Create koha.versin file
229 open (KV
, ">$rootdir/koha.version");
230 print KV
"$releaseversion\n";
233 # Copy all CVS files to intranet-cgi
234 system("cp -a $kohadir/* $rootdir/intranet-cgi");
236 # Move C4 to modules directory
237 system("mv $rootdir/intranet-cgi/C4 $rootdir/modules");
239 # Move files from intranet-cgi to root of tarball
240 system("mv $rootdir/intranet-cgi/INSTALL $rootdir");
241 system("mv $rootdir/intranet-cgi/ChangeLog* $rootdir");
242 system("mv $rootdir/intranet-cgi/Hints $rootdir");
243 system("mv $rootdir/intranet-cgi/LICENSE $rootdir");
244 system("mv $rootdir/intranet-cgi/News $rootdir");
245 system("mv $rootdir/intranet-cgi/README $rootdir");
246 system("mv $rootdir/intranet-cgi/TODO $rootdir");
247 system("mv $rootdir/intranet-cgi/installer.pl $rootdir");
248 system("mv $rootdir/intranet-cgi/koha.upgrade $rootdir");
249 system("mv $rootdir/intranet-cgi/Install.pm $rootdir");
250 system("mv $rootdir/intranet-cgi/kohareporter $rootdir");
251 chmod 0770, "$rootdir/installer.pl";
252 chmod 0770, "$rootdir/koha.upgrade";
253 system("mv $rootdir/intranet-cgi/koha.conf $rootdir");
254 system("mv $rootdir/intranet-cgi/koha.mysql $rootdir");
255 system("mv $rootdir/intranet-cgi/sampledata-1.2 $rootdir");
256 system("gzip -9 $rootdir/sampledata-1.2");
258 # Copy files from intranet-cgi to opac-cgi
259 system("cp $rootdir/intranet-cgi/detail.pl $rootdir/opac-cgi");
260 system("cp $rootdir/intranet-cgi/moredetail.pl $rootdir/opac-cgi");
261 system("cp $rootdir/intranet-cgi/search.pl $rootdir/opac-cgi");
262 system("cp $rootdir/intranet-cgi/subjectsearch.pl $rootdir/opac-cgi");
263 system("cp $rootdir/intranet-cgi/logout.pl $rootdir/opac-cgi");
264 system("mv $rootdir/intranet-cgi/opac/* $rootdir/opac-cgi");
265 system("rmdir $rootdir/intranet-cgi/opac");
268 # Move files from intranet-cgi to /scripts/ directory
269 system("mv $rootdir/intranet-cgi/telnet $rootdir/scripts");
270 system("mv $rootdir/intranet-cgi/tkperl $rootdir/scripts");
271 system("mv $rootdir/intranet-cgi/translator $rootdir/scripts");
272 system("mv $rootdir/intranet-cgi/updater $rootdir/scripts");
273 system("mv $rootdir/intranet-cgi/misc $rootdir/scripts");
274 system("mv $rootdir/intranet-cgi/acqui.simple/processz3950queue $rootdir/scripts/z3950daemon/");
275 system("mv $rootdir/intranet-cgi/acqui.simple/z3950-daemon-launch.sh $rootdir/scripts/z3950daemon/");
276 system("mv $rootdir/intranet-cgi/acqui.simple/z3950-daemon-shell.sh $rootdir/scripts/z3950daemon/");
279 # Remove extraneous files from intranet-cgi
280 system("rm -f $rootdir/intranet-cgi/ChangeLog.bak");
281 system("rm -f $rootdir/intranet-cgi/SendMessages");
282 system("rm -f $rootdir/intranet-cgi/buildrelease");
283 system("rm -f $rootdir/intranet-cgi/database.mysql");
284 system("rm -f $rootdir/intranet-cgi/installer-lite.pl");
285 # FIXME: The following two lines look suspicious
286 #system("rm -f $rootdir/intranet-cgi/koha-1.2.0.tar.gz");
287 #system("rm -f $rootdir/intranet-cgi/rel-1-2");
288 system("rm -f $rootdir/intranet-cgi/testKoha.pl");
289 system("rm -rf $rootdir/intranet-cgi/html-template");
290 system("rm -rf $rootdir/intranet-cgi/t");
292 # Set all .pl scripts executable
293 system("find $rootdir/intranet-cgi -name '*.pl' -exec chmod a+x \\{\\} \\;");
294 # Copy all CVS files to intranet-html and opac-html
295 system("cp -a $kohahtmldir/intranet-html/* $rootdir/intranet-html");
296 system("cp -a $kohahtmldir/opac-html/* $rootdir/opac-html");
298 # Move koha-tmpl files
299 system("mv $rootdir/intranet-cgi/koha-tmpl/opac-tmpl/* $rootdir/opac-html");
300 system("mv $rootdir/intranet-cgi/koha-tmpl/intranet-tmpl/* $rootdir/intranet-html");
301 system("rm -rf $rootdir/intranet-cgi/koha-tmpl");
303 # Remove extraneous files from opac-html
304 system("rm -f $rootdir/opac-html/koha.mo");
305 system("rm -f $rootdir/opac-html/koha.pot");
306 system("rm -f $rootdir/opac-html/test");
308 # Remove extraneous files from intranet-html
309 system("rm -f $rootdir/intranet-html/koha.pot");
310 system("rm -f $rootdir/intranet-html/results.html");
311 system("rm -f $rootdir/intranet-html/test");
313 # Remove junk from directory
314 system("find $rootdir -name CVS -exec rm -rf \\{\\} \\; 2>/dev/null");
315 system("find $rootdir -name *~ -exec rm -rf \\{\\} \\; 2>/dev/null");
316 system("find $rootdir -name .#* -exec rm -rf \\{\\} \\; 2>/dev/null");
319 if (-e
"$roothomedir/docs") {
320 print "Copying docs folder from $roothomedir/docs...";
321 system("cp -r $roothomedir/docs/* $rootdir/docs/");
323 print "I would have copied the docs from from $roothomedir/docs, but I couldn't find it.\n";
324 print "Press <ENTER> to continue...\n";
329 system("tar czf /tmp/koha-$releaseversion.tar.gz koha-".$releaseversion);
330 system("rm -rf $rootdir");
337 Your new tarball is located
in /tmp/koha
-$releaseversion.tar
.gz
345 my @v1=split(/\./, $v1);
346 my @v2=split(/\./, $v2);
348 ($#v2>$count) && ($count=$#v2);
349 for (my $index=0; $index<$count; $index++) {
350 if ($v1[$index]>$v2[$index]) {
357 sub guess_kohahtmldir
($;$) {
358 my($kohadir, $default) = @_;
360 # It probably makes sense to assume that the 'koha' and 'koha-html'
361 # modules are checked out within the same parent directory
362 if (-d
$kohadir && $kohadir =~ /^(.*)\/[^\
/]+$/) {
363 $kohahtmldir = "$1/koha-html"
365 $kohahtmldir = $default;