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 open (CVSLOG
, "cvs log buildrelease|");
63 my $symbolicnamessection=0;
71 if (/^symbolic names:/) {
72 $symbolicnamessection=1;
74 if ($symbolicnamessection && (/^\s+([^:]*):/)) {
81 if ($id =~/(.*)RC(.*)/) {
84 $version=~m
#(\d+\.\d+)\.#;
85 if (versioncompare
($version, $majorversion->{$1})) {
86 $majorversion->{$1}=$version;
87 $majorversionrc->{$1}=$rc;
89 if (versioncompare
($version, $highestversion)) {
90 $highestversion=$version;
96 $version=~m
#(\d+\.\d+)\.#;
97 if (versioncompare
($version, $majorversion->{$1})) {
98 $majorversion->{$1}=$version;
99 $majorversionrc->{$1}=0;
101 if (versioncompare
($version, $highestversion)) {
102 $highestversion=$version;
107 $symbolicnames->{$version}->{$rc}=1;
113 my $releaseversion='';
114 my $currentversion='';
116 my $branchdata=`grep buildrelease CVS/Entries`;
118 my $branch=(split(m
#/#, $branchdata))[5];
120 if ($branch eq 'Trel-1-2') {
121 $highestversion=$majorversion->{'1.2'};
122 $highestrc=$majorversionrc->{'1.2'};
123 ($highestrc) ?
($released=0) : ($released=1);
127 my @components=split(/\./, $highestversion);
128 $components[$#components]++;
129 $nexthighestversion=join '.', @components;
130 my $minornumber=(split(/\./, $highestversion))[1];
131 if ($minornumber/2 == int($minornumber/2)) {
132 $releaseversion=$nexthighestversion."RC1";
134 $releaseversion=$nexthighestversion;
136 $currentversion=$highestversion;
138 $releaseversion=$highestversion."RC".($highestrc+1);
139 $currentversion=$highestversion."RC$highestrc";
143 print "Current release tag is $currentversion.\n";
144 print "\nWould you like to bump that up to $releaseversion (or manually enter version)? [Y]/N: ";
145 chomp($input = <STDIN
>);
146 my $tagging_needs_confirmation = 0;
147 if ($input =~ /^n/i) {
148 print "\nWould you like to rebuild the $currentversion tarball? Y/[N]: ";
149 chomp($input = <STDIN
>);
150 print STDERR
"releaseversion=($releaseversion), currentversion=($currentversion)\n";#XXXZZZ
151 if ($input =~ /^y/i) {
152 $releaseversion=$currentversion;
153 $tagging_needs_confirmation = 1;
155 print "What should the new version be? [$releaseversion]: ";
156 chomp ($input=<STDIN
>);
158 $releaseversion=$input;
162 print "What should the new version be? [$releaseversion]: ";
163 chomp ($input=<STDIN
>);
165 $releaseversion=$input;
170 print "\nWould you like to tag the CVS repository?\n(answer yes if releasing tarball) Y/[N]: ";
171 chomp ($input=<STDIN
>);
173 # FIXME: This means anything other than n will tag; too dangerous?
179 if ($cvstag && $tagging_needs_confirmation) {
181 print "Do not do this if you have released the tarball to anybody, as it will\n";
182 print "overwrite the tag marking the files that were in the tarball:\n\n";
183 print "Confirm that you want to overwrite the tag for $releaseversion? Y/[N]: ";
184 chomp($input = <STDIN
>);
185 if ($input =~ /^n/i || $input !~ /\S/) {
186 print "\nStopping. Please re-run buildrelease now.\n";
193 if ($cvsroot=$ENV{'CVSROOT'}) {
194 $cvsroot=~m
#(.*)\@cvs#;
197 $ENV{'CVS_RSH'}='ssh';
198 print "\nWhat is your userid at SourceForge: ";
199 chomp($input = <STDIN
>);
203 $ENV{'CVSROOT'}="$sfuserid\@cvs.koha.sourceforge.net:/cvsroot/koha";
205 my $tagname=$releaseversion;
209 Updating your checked
-out copy of the
'koha' CVS files
.
210 You may need to enter your SourceForge password
.
214 system("cvs update");
217 Tagging koha with tag R_
$tagname
219 system("cvs tag -F R_$tagname");
222 Updating your checked
-out copy of the
'koha-html' CVS files
.
223 You may need to enter your SourceForge password
.
226 chdir($kohahtmldir) || die "$kohahtmldir: $!\n";
227 system("cvs update");
231 Tagging koha
-html with tag R_
$tagname
233 system("cvs tag -F R_$tagname");
239 my $rootdir="/tmp/koha-".$releaseversion;
240 system("rm -rf $rootdir");
241 mkdir ($rootdir, 0700);
242 chdir($rootdir) || die "$rootdir: $!\n";
244 mkdir("intranet-cgi", 0755);
245 mkdir("intranet-html", 0755);
246 mkdir("opac-cgi", 0755);
247 mkdir("opac-html", 0755);
248 mkdir("scripts", 0755);
249 mkdir("scripts/z3950daemon", 0755);
250 mkdir("modules", 0755);
253 # Create koha.versin file
255 open (KV
, ">$rootdir/koha.version");
256 print KV
"$releaseversion\n";
259 # Copy all CVS files to intranet-cgi
260 system("cp -a $kohadir/* $rootdir/intranet-cgi");
262 # Move C4 to modules directory
263 system("mv $rootdir/intranet-cgi/C4 $rootdir/modules");
265 # Move files from intranet-cgi to root of tarball
266 system("mv $rootdir/intranet-cgi/INSTALL $rootdir");
267 system("mv $rootdir/intranet-cgi/ChangeLog* $rootdir");
268 system("mv $rootdir/intranet-cgi/Hints $rootdir");
269 system("mv $rootdir/intranet-cgi/LICENSE $rootdir");
270 system("mv $rootdir/intranet-cgi/News $rootdir");
271 system("mv $rootdir/intranet-cgi/README $rootdir");
272 system("mv $rootdir/intranet-cgi/TODO $rootdir");
273 system("mv $rootdir/intranet-cgi/installer.pl $rootdir");
274 system("mv $rootdir/intranet-cgi/koha.upgrade $rootdir");
275 system("mv $rootdir/intranet-cgi/Install.pm $rootdir");
276 system("mv $rootdir/intranet-cgi/kohareporter $rootdir");
277 chmod 0770, "$rootdir/installer.pl";
278 chmod 0770, "$rootdir/koha.upgrade";
279 system("mv $rootdir/intranet-cgi/koha.conf $rootdir");
280 system("mv $rootdir/intranet-cgi/koha.mysql $rootdir");
281 system("mv $rootdir/intranet-cgi/sampledata-1.2 $rootdir");
282 system("gzip -9 $rootdir/sampledata-1.2");
284 # Copy files from intranet-cgi to opac-cgi
285 system("cp $rootdir/intranet-cgi/detail.pl $rootdir/opac-cgi");
286 system("cp $rootdir/intranet-cgi/moredetail.pl $rootdir/opac-cgi");
287 system("cp $rootdir/intranet-cgi/search.pl $rootdir/opac-cgi");
288 system("cp $rootdir/intranet-cgi/subjectsearch.pl $rootdir/opac-cgi");
289 system("cp $rootdir/intranet-cgi/logout.pl $rootdir/opac-cgi");
290 system("mv $rootdir/intranet-cgi/opac/* $rootdir/opac-cgi");
291 system("rmdir $rootdir/intranet-cgi/opac");
294 # Move files from intranet-cgi to /scripts/ directory
295 system("mv $rootdir/intranet-cgi/telnet $rootdir/scripts");
296 system("mv $rootdir/intranet-cgi/tkperl $rootdir/scripts");
297 system("mv $rootdir/intranet-cgi/translator $rootdir/scripts");
298 system("mv $rootdir/intranet-cgi/updater $rootdir/scripts");
299 system("mv $rootdir/intranet-cgi/misc $rootdir/scripts");
300 system("mv $rootdir/intranet-cgi/marc $rootdir/scripts");
301 system("mv $rootdir/intranet-cgi/acqui.simple/bulkmarcimport.pl $rootdir/scripts/z3950daemon/");
302 system("mv $rootdir/intranet-cgi/acqui.simple/processz3950queue $rootdir/scripts/z3950daemon/");
303 system("mv $rootdir/intranet-cgi/acqui.simple/z3950-daemon-launch.sh $rootdir/scripts/z3950daemon/");
304 system("mv $rootdir/intranet-cgi/acqui.simple/z3950-daemon-shell.sh $rootdir/scripts/z3950daemon/");
307 # Remove extraneous files from intranet-cgi
308 system("rm -f $rootdir/intranet-cgi/ChangeLog.bak");
309 system("rm -f $rootdir/intranet-cgi/SendMessages");
310 system("rm -f $rootdir/intranet-cgi/buildrelease");
311 system("rm -f $rootdir/intranet-cgi/database.mysql");
312 system("rm -f $rootdir/intranet-cgi/installer-lite.pl");
313 system("rm -rf $rootdir/intranet-cgi/html-template");
315 # Move test scripts to scripts dir
316 system("mv $rootdir/intranet-cgi/testKoha.pl $rootdir/scripts");
317 system("mv $rootdir/intranet-cgi/t $rootdir/scripts");
319 # Set all .pl scripts executable
320 system("find $rootdir/intranet-cgi -name '*.pl' -exec chmod a+x \\{\\} \\;");
321 # Copy all CVS files to intranet-html and opac-html
322 system("cp -a $kohahtmldir/intranet-html/* $rootdir/intranet-html");
323 system("cp -a $kohahtmldir/opac-html/* $rootdir/opac-html");
325 # Move koha-tmpl files
326 system("mv $rootdir/intranet-cgi/koha-tmpl/opac-tmpl/* $rootdir/opac-html");
327 system("mv $rootdir/intranet-cgi/koha-tmpl/intranet-tmpl/* $rootdir/intranet-html");
328 system("rm -rf $rootdir/intranet-cgi/koha-tmpl");
330 # Remove extraneous files from opac-html
331 system("rm -f $rootdir/opac-html/koha.mo");
332 system("rm -f $rootdir/opac-html/koha.pot");
333 system("rm -f $rootdir/opac-html/test");
335 # Remove extraneous files from intranet-html
336 system("rm -f $rootdir/intranet-html/koha.pot");
337 system("rm -f $rootdir/intranet-html/results.html");
338 system("rm -f $rootdir/intranet-html/test");
340 # Remove junk from directory
341 system("find $rootdir -name CVS -exec rm -rf \\{\\} \\; 2>/dev/null");
342 system("find $rootdir -name *~ -exec rm -rf \\{\\} \\; 2>/dev/null");
343 system("find $rootdir -name .#* -exec rm -rf \\{\\} \\; 2>/dev/null");
346 if (-e
"$roothomedir/docs") {
347 print "Copying docs folder from $roothomedir/docs...";
348 system("cp -r $roothomedir/docs/* $rootdir/docs/");
350 print "I would have copied the docs from from $roothomedir/docs, but I couldn't find it.\n";
351 print "Press <ENTER> to continue...\n";
356 system("tar czf /tmp/koha-$releaseversion.tar.gz koha-".$releaseversion);
357 system("rm -rf $rootdir");
364 Your new tarball is located
in /tmp/koha
-$releaseversion.tar
.gz
372 my @v1=split(/\./, $v1);
373 my @v2=split(/\./, $v2);
375 ($#v2>$count) && ($count=$#v2);
376 for (my $index=0; $index<$count; $index++) {
377 if ($v1[$index]>$v2[$index]) {
384 sub guess_kohahtmldir
($;$) {
385 my($kohadir, $default) = @_;
387 # It probably makes sense to assume that the 'koha' and 'koha-html'
388 # modules are checked out within the same parent directory
389 if (-d
$kohadir && $kohadir =~ /^(.*)\/[^\
/]+$/) {
390 $kohahtmldir = "$1/koha-html"
392 $kohahtmldir = $default;