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='';
98 $releaseversion=($highestversion+1)."RC1";
99 $currentversion=$highestversion;
101 $releaseversion="$highestversion\RC".($highestrc+1);
102 $currentversion="$highestversion\RC$highestrc";
105 print "Current release tag is $currentversion.\n";
106 print "\nWould you like to bump that up to $releaseversion? [Y]/N: ";
107 chomp($input = <STDIN>);
108 if ($input =~ /^n/i) {
109 print "\nWould you like to rebuild the $currentversion tarball? Y/[N]: ";
110 chomp($input = <STDIN>);
111 if ($input =~ /^y/i) {
112 $releaseversion=$currentversion;
114 print "Do not do this if you have released the tarball to anybody, as it will\n";
115 print "overwrite the tag marking the files that were in the tarball.\n\n";
116 print "Confirm that you want to overwrite the tag for $releaseversion? Y/[N]: ";
117 chomp($input = <STDIN>);
118 if ($input =~ /^n/i || $input eq '') {
119 print "\nStopping. Please re-run buildrelease now.\n";
123 print "What should the new version be? [$releaseversion]: ";
124 chomp ($input=<STDIN>);
126 $releaseversion=$input;
133 if ($cvsroot=$ENV{'CVSROOT'}) {
134 $cvsroot=~m#(.*)\@cvs#;
137 $ENV{'CVS_RSH'}='ssh';
138 print "\nWhat is your userid at SourceForge: ";
139 chomp($input = <STDIN>);
143 $ENV{'CVSROOT'}="$sfuserid\@cvs.koha.sourceforge.net:/cvsroot/koha";
145 my $tagname=$releaseversion;
149 Updating the 'koha' CVS files. You may need to enter your SourceForge password.
153 system("cvs update");
155 Tagging koha with tag R_$tagname
157 system("cvs tag -F R_$tagname");
159 Updating the 'koha-html' CVS files. You may need to enter your SourceForge password.
163 system("cvs update");
165 Tagging koha-html with tag R_$tagname
167 system("cvs tag -F R_$tagname");
172 my $rootdir="/tmp/koha-".$releaseversion;
173 system("rm -rf $rootdir");
174 mkdir ($rootdir, 0700);
177 mkdir("intranet-cgi", 0755);
178 mkdir("intranet-html", 0755);
179 mkdir("opac-cgi", 0755);
180 mkdir("opac-html", 0755);
181 mkdir("scripts", 0755);
182 mkdir("modules", 0755);
185 # Copy all CVS files to intranet-cgi
186 system("cp -a $kohadir/* $rootdir/intranet-cgi");
188 # Move C4 to modules directory
189 system("mv $rootdir/intranet-cgi/C4 $rootdir/modules");
191 # Move files from intranet-cgi to root of tarball
192 system("mv $rootdir/intranet-cgi/INSTALL $rootdir");
193 system("mv $rootdir/intranet-cgi/ChangeLog $rootdir");
194 system("mv $rootdir/intranet-cgi/Hints $rootdir");
195 system("mv $rootdir/intranet-cgi/LICENSE $rootdir");
196 system("mv $rootdir/intranet-cgi/News $rootdir");
197 system("mv $rootdir/intranet-cgi/README $rootdir");
198 system("mv $rootdir/intranet-cgi/TODO $rootdir");
199 system("mv $rootdir/intranet-cgi/databaseinstall.sh $rootdir");
200 system("mv $rootdir/intranet-cgi/installer.pl $rootdir");
201 system("mv $rootdir/intranet-cgi/koha.conf $rootdir");
202 system("mv $rootdir/intranet-cgi/koha.mysql $rootdir");
203 system("mv $rootdir/intranet-cgi/sampledata-1.2 $rootdir");
204 system("gzip -9 $rootdir/sampledata-1.2");
206 # Copy files from intranet-cgi to opac-cgi
207 system("cp $rootdir/intranet-cgi/detail.pl $rootdir/opac-cgi");
208 system("cp $rootdir/intranet-cgi/moredetail.pl $rootdir/opac-cgi");
209 system("cp $rootdir/intranet-cgi/search.pl $rootdir/opac-cgi");
212 # Move files from intranet-cgi to /scripts/ directory
213 system("mv $rootdir/intranet-cgi/telnet $rootdir/scripts");
214 system("mv $rootdir/intranet-cgi/tkperl $rootdir/scripts");
215 system("mv $rootdir/intranet-cgi/translator $rootdir/scripts");
216 system("mv $rootdir/intranet-cgi/updater $rootdir/scripts");
217 system("mv $rootdir/intranet-cgi/misc $rootdir/scripts");
218 system("mv $rootdir/intranet-cgi/acqui.simple/processz3950queue $rootdir/scripts");
219 system("mv $rootdir/intranet-cgi/acqui.simple/z3950-daemon-launch.sh $rootdir/scripts");
220 system("mv $rootdir/intranet-cgi/acqui.simple/z3950-daemon-shell.sh $rootdir/scripts");
223 # Remove extraneous files from intranet-cgi
224 system("rm -f $rootdir/intranet-cgi/ChangeLog.bak");
225 system("rm -f $rootdir/intranet-cgi/ChangeLog.bak");
226 system("rm -f $rootdir/intranet-cgi/SendMessages");
227 system("rm -f $rootdir/intranet-cgi/buildrelease");
228 system("rm -f $rootdir/intranet-cgi/database.mysql");
229 system("rm -f $rootdir/intranet-cgi/installer-lite.pl");
230 system("rm -f $rootdir/intranet-cgi/koha-1.2.0.tar.gz");
231 system("rm -f $rootdir/intranet-cgi/rel-1-2");
232 system("rm -f $rootdir/intranet-cgi/testKoha.pl");
233 system("rm -rf $rootdir/intranet-cgi/html-template");
234 system("rm -rf $rootdir/intranet-cgi/t");
236 # Copy all CVS files to intranet-html and opac-html
237 system("cp -a $kohahtmldir/intranet-html/* $rootdir/intranet-html");
238 system("cp -a $kohahtmldir/opac-html/* $rootdir/opac-html");
240 # Remove extraneous files from opac-html
241 system("rm -f $rootdir/opac-html/koha.mo");
242 system("rm -f $rootdir/opac-html/koha.pot");
243 system("rm -f $rootdir/opac-html/test");
245 # Remove extraneous files from intranet-html
246 system("rm -f $rootdir/intranet-html/koha.pot");
247 system("rm -f $rootdir/intranet-html/results.html");
248 system("rm -f $rootdir/intranet-html/test");
250 # Remove junk from directory
251 system("find $rootdir -name CVS -exec rm -rf \\{\\} \\; 2>/dev/null");
252 system("find $rootdir -name *~ -exec rm -rf \\{\\} \\; 2>/dev/null");
253 system("find $rootdir -name .#* -exec rm -rf \\{\\} \\; 2>/dev/null");
257 system("tar czf /tmp/koha-$releaseversion.tar.gz koha-".$releaseversion);
258 system("rm -rf $rootdir");
265 Your new tarball is located in /tmp/koha-$releaseversion.tar.gz
273 my @v1=split(/\./, $v1);
274 my @v2=split(/\./, $v2);
276 ($#v2>$count) && ($count=$#v2);
277 for (my $index=0; $index<$count; $index++) {
278 if ($v1[$index]>$v2[$index]) {