5 my $kohahtmldir="/koha/koha/koha-html/";
7 if (-e "/root/.kohaautobuild.conf") {
8 open C, "/root/.kohaautobuild.conf";
14 if (/kohahtmldir=(.*)/) {
23 ***************************************
24 * Welcome to the Koha Release Builder *
25 ***************************************
27 This script will automatically build a release tarball.
29 The script assumes that you already have the koha and koha-html modules checked
30 out for the release that you want to build, although it will update the modules
34 print "\nWhere is the 'koha' cvs module located [$kohadir]: ";
35 chomp($input = <STDIN>);
41 print "\nWhere is the 'koha-html' cvs module located [$kohahtmldir]: ";
42 chomp($input = <STDIN>);
47 open (C, ">/root/.kohaautobuild.conf");
50 kohahtmldir=$kohahtmldir
53 print "\n\nGuessing at next release version. You may need to enter your SourceForge password...\n";
55 open (CVSLOG, "cvs log buildrelease|");
56 my $symbolicnamessection=0;
62 if (/^symbolic names:/) {
63 $symbolicnamessection=1;
65 if ($symbolicnamessection && (/^\s+([^:]*):/)) {
72 if ($id =~/(.*)RC(.*)/) {
75 if (versioncompare($version, $highestversion)) {
76 $highestversion=$version;
82 if (versioncompare($version, $highestversion)) {
83 $highestversion=$version;
88 $symbolicnames->{$version}->{$rc}=1;
94 my $releaseversion='';
95 my $currentversion='';
99 my @components=split(/\./, $highestversion);
100 $components[$#components]++;
101 $nexthighestversion=join '.', @components;
102 $releaseversion=$nexthighestversion."RC1";
103 $currentversion=$highestversion;
105 $releaseversion="$highestversion\RC".($highestrc+1);
106 $currentversion="$highestversion\RC$highestrc";
109 print "Current release tag is $currentversion.\n";
110 print "\nWould you like to bump that up to $releaseversion (or manually enter version)? [Y]/N: ";
111 chomp($input = <STDIN>);
112 if ($input =~ /^n/i) {
113 print "\nWould you like to rebuild the $currentversion tarball? Y/[N]: ";
114 chomp($input = <STDIN>);
115 if ($input =~ /^y/i) {
116 $releaseversion=$currentversion;
118 print "Do not do this if you have released the tarball to anybody, as it will\n";
119 print "overwrite the tag marking the files that were in the tarball.\n\n";
120 print "Confirm that you want to overwrite the tag for $releaseversion? Y/[N]: ";
121 chomp($input = <STDIN>);
122 if ($input =~ /^n/i || $input eq '') {
123 print "\nStopping. Please re-run buildrelease now.\n";
127 print "What should the new version be? [$releaseversion]: ";
128 chomp ($input=<STDIN>);
130 $releaseversion=$input;
136 print "\nWould you like to tag the CVS repository?\n(answer yes if releasing tarball) [Y]/N: ";
137 chomp ($input=<STDIN>);
145 if ($cvsroot=$ENV{'CVSROOT'}) {
146 $cvsroot=~m#(.*)\@cvs#;
149 $ENV{'CVS_RSH'}='ssh';
150 print "\nWhat is your userid at SourceForge: ";
151 chomp($input = <STDIN>);
155 $ENV{'CVSROOT'}="$sfuserid\@cvs.koha.sourceforge.net:/cvsroot/koha";
157 my $tagname=$releaseversion;
161 Updating the 'koha' CVS files. You may need to enter your SourceForge password.
165 system("cvs update");
167 Tagging koha with tag R_$tagname
169 ($cvstag) && (system("cvs tag -F R_$tagname"));
171 Updating the 'koha-html' CVS files. You may need to enter your SourceForge password.
175 system("cvs update");
177 Tagging koha-html with tag R_$tagname
179 ($cvstag) && (system("cvs tag -F R_$tagname"));
184 my $rootdir="/tmp/koha-".$releaseversion;
185 system("rm -rf $rootdir");
186 mkdir ($rootdir, 0700);
189 mkdir("intranet-cgi", 0755);
190 mkdir("intranet-html", 0755);
191 mkdir("opac-cgi", 0755);
192 mkdir("opac-html", 0755);
193 mkdir("scripts", 0755);
194 mkdir("scripts/z3950daemon", 0755);
195 mkdir("modules", 0755);
198 # Create koha.versin file
200 open (KV, ">$rootdir/koha.version");
201 print KV "$releaseversion\n";
204 # Copy all CVS files to intranet-cgi
205 system("cp -a $kohadir/* $rootdir/intranet-cgi");
207 # Move C4 to modules directory
208 system("mv $rootdir/intranet-cgi/C4 $rootdir/modules");
210 # Move files from intranet-cgi to root of tarball
211 system("mv $rootdir/intranet-cgi/INSTALL $rootdir");
212 system("mv $rootdir/intranet-cgi/ChangeLog* $rootdir");
213 system("mv $rootdir/intranet-cgi/Hints $rootdir");
214 system("mv $rootdir/intranet-cgi/LICENSE $rootdir");
215 system("mv $rootdir/intranet-cgi/News $rootdir");
216 system("mv $rootdir/intranet-cgi/README $rootdir");
217 system("mv $rootdir/intranet-cgi/TODO $rootdir");
218 system("mv $rootdir/intranet-cgi/installer.pl $rootdir");
219 system("mv $rootdir/intranet-cgi/koha.upgrade $rootdir");
220 chmod 0770, "$rootdir/installer.pl";
221 chmod 0770, "$rootdir/koha.upgrade";
222 system("mv $rootdir/intranet-cgi/koha.conf $rootdir");
223 system("mv $rootdir/intranet-cgi/koha.mysql $rootdir");
224 system("mv $rootdir/intranet-cgi/sampledata-1.2 $rootdir");
225 system("gzip -9 $rootdir/sampledata-1.2");
227 # Copy files from intranet-cgi to opac-cgi
228 system("cp $rootdir/intranet-cgi/detail.pl $rootdir/opac-cgi");
229 system("cp $rootdir/intranet-cgi/moredetail.pl $rootdir/opac-cgi");
230 system("cp $rootdir/intranet-cgi/search.pl $rootdir/opac-cgi");
233 # Move files from intranet-cgi to /scripts/ directory
234 system("mv $rootdir/intranet-cgi/telnet $rootdir/scripts");
235 system("mv $rootdir/intranet-cgi/tkperl $rootdir/scripts");
236 system("mv $rootdir/intranet-cgi/translator $rootdir/scripts");
237 system("mv $rootdir/intranet-cgi/updater $rootdir/scripts");
238 system("mv $rootdir/intranet-cgi/misc $rootdir/scripts");
239 system("mv $rootdir/intranet-cgi/marc $rootdir/scripts");
240 system("mv $rootdir/intranet-cgi/acqui.simple/processz3950queue $rootdir/scripts/z3950daemon/");
241 system("mv $rootdir/intranet-cgi/acqui.simple/z3950-daemon-launch.sh $rootdir/scripts/z3950daemon/");
242 system("mv $rootdir/intranet-cgi/acqui.simple/z3950-daemon-shell.sh $rootdir/scripts/z3950daemon/");
245 # Remove extraneous files from intranet-cgi
246 system("rm -f $rootdir/intranet-cgi/ChangeLog.bak");
247 system("rm -f $rootdir/intranet-cgi/ChangeLog.bak");
248 system("rm -f $rootdir/intranet-cgi/SendMessages");
249 system("rm -f $rootdir/intranet-cgi/buildrelease");
250 system("rm -f $rootdir/intranet-cgi/database.mysql");
251 system("rm -f $rootdir/intranet-cgi/installer-lite.pl");
252 system("rm -f $rootdir/intranet-cgi/koha-1.2.0.tar.gz");
253 system("rm -f $rootdir/intranet-cgi/rel-1-2");
254 system("rm -f $rootdir/intranet-cgi/testKoha.pl");
255 system("rm -rf $rootdir/intranet-cgi/html-template");
256 system("rm -rf $rootdir/intranet-cgi/t");
258 # Copy all CVS files to intranet-html and opac-html
259 system("cp -a $kohahtmldir/intranet-html/* $rootdir/intranet-html");
260 system("cp -a $kohahtmldir/opac-html/* $rootdir/opac-html");
262 # Remove extraneous files from opac-html
263 system("rm -f $rootdir/opac-html/koha.mo");
264 system("rm -f $rootdir/opac-html/koha.pot");
265 system("rm -f $rootdir/opac-html/test");
267 # Remove extraneous files from intranet-html
268 system("rm -f $rootdir/intranet-html/koha.pot");
269 system("rm -f $rootdir/intranet-html/results.html");
270 system("rm -f $rootdir/intranet-html/test");
272 # Remove junk from directory
273 system("find $rootdir -name CVS -exec rm -rf \\{\\} \\; 2>/dev/null");
274 system("find $rootdir -name *~ -exec rm -rf \\{\\} \\; 2>/dev/null");
275 system("find $rootdir -name .#* -exec rm -rf \\{\\} \\; 2>/dev/null");
277 if (-e "/root/docs") {
278 print "Copying docs folder from /root/docs...";
279 system("cp -r /root/docs/* $rootdir/docs/");
281 print "I would have copied the docs from from /root/docs, but I couldn't find it.\n";
282 print "Press <ENTER> to continue...\n";
287 system("tar czf /tmp/koha-$releaseversion.tar.gz koha-".$releaseversion);
288 system("rm -rf $rootdir");
295 Your new tarball is located in /tmp/koha-$releaseversion.tar.gz
303 my @v1=split(/\./, $v1);
304 my @v2=split(/\./, $v2);
306 ($#v2>$count) && ($count=$#v2);
307 for (my $index=0; $index<$count; $index++) {
308 if ($v1[$index]>$v2[$index]) {