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;
134 print "What should the new version be? [$releaseversion]: ";
135 chomp ($input=<STDIN>);
137 $releaseversion=$input;
142 print "\nWould you like to tag the CVS repository?\n(answer yes if releasing tarball) [Y]/N: ";
143 chomp ($input=<STDIN>);
151 if ($cvsroot=$ENV{'CVSROOT'}) {
152 $cvsroot=~m#(.*)\@cvs#;
155 $ENV{'CVS_RSH'}='ssh';
156 print "\nWhat is your userid at SourceForge: ";
157 chomp($input = <STDIN>);
161 $ENV{'CVSROOT'}="$sfuserid\@cvs.koha.sourceforge.net:/cvsroot/koha";
163 my $tagname=$releaseversion;
167 Updating the 'koha' CVS files. You may need to enter your SourceForge password.
171 system("cvs update");
173 Tagging koha with tag R_$tagname
175 ($cvstag) && (system("cvs tag -F R_$tagname"));
177 Updating the 'koha-html' CVS files. You may need to enter your SourceForge password.
181 system("cvs update");
183 Tagging koha-html with tag R_$tagname
185 ($cvstag) && (system("cvs tag -F R_$tagname"));
190 my $rootdir="/tmp/koha-".$releaseversion;
191 system("rm -rf $rootdir");
192 mkdir ($rootdir, 0700);
195 mkdir("intranet-cgi", 0755);
196 mkdir("intranet-html", 0755);
197 mkdir("opac-cgi", 0755);
198 mkdir("opac-html", 0755);
199 mkdir("scripts", 0755);
200 mkdir("scripts/z3950daemon", 0755);
201 mkdir("modules", 0755);
204 # Create koha.versin file
206 open (KV, ">$rootdir/koha.version");
207 print KV "$releaseversion\n";
210 # Copy all CVS files to intranet-cgi
211 system("cp -a $kohadir/* $rootdir/intranet-cgi");
213 # Move C4 to modules directory
214 system("mv $rootdir/intranet-cgi/C4 $rootdir/modules");
216 # Move files from intranet-cgi to root of tarball
217 system("mv $rootdir/intranet-cgi/INSTALL $rootdir");
218 system("mv $rootdir/intranet-cgi/ChangeLog* $rootdir");
219 system("mv $rootdir/intranet-cgi/Hints $rootdir");
220 system("mv $rootdir/intranet-cgi/LICENSE $rootdir");
221 system("mv $rootdir/intranet-cgi/News $rootdir");
222 system("mv $rootdir/intranet-cgi/README $rootdir");
223 system("mv $rootdir/intranet-cgi/TODO $rootdir");
224 system("mv $rootdir/intranet-cgi/installer.pl $rootdir");
225 system("mv $rootdir/intranet-cgi/koha.upgrade $rootdir");
226 chmod 0770, "$rootdir/installer.pl";
227 chmod 0770, "$rootdir/koha.upgrade";
228 system("mv $rootdir/intranet-cgi/koha.conf $rootdir");
229 system("mv $rootdir/intranet-cgi/koha.mysql $rootdir");
230 system("mv $rootdir/intranet-cgi/sampledata-1.2 $rootdir");
231 system("gzip -9 $rootdir/sampledata-1.2");
233 # Copy files from intranet-cgi to opac-cgi
234 system("cp $rootdir/intranet-cgi/detail.pl $rootdir/opac-cgi");
235 system("cp $rootdir/intranet-cgi/moredetail.pl $rootdir/opac-cgi");
236 system("cp $rootdir/intranet-cgi/search.pl $rootdir/opac-cgi");
239 # Move files from intranet-cgi to /scripts/ directory
240 system("mv $rootdir/intranet-cgi/telnet $rootdir/scripts");
241 system("mv $rootdir/intranet-cgi/tkperl $rootdir/scripts");
242 system("mv $rootdir/intranet-cgi/translator $rootdir/scripts");
243 system("mv $rootdir/intranet-cgi/updater $rootdir/scripts");
244 system("mv $rootdir/intranet-cgi/misc $rootdir/scripts");
245 system("mv $rootdir/intranet-cgi/acqui.simple/processz3950queue $rootdir/scripts/z3950daemon/");
246 system("mv $rootdir/intranet-cgi/acqui.simple/z3950-daemon-launch.sh $rootdir/scripts/z3950daemon/");
247 system("mv $rootdir/intranet-cgi/acqui.simple/z3950-daemon-shell.sh $rootdir/scripts/z3950daemon/");
250 # Remove extraneous files from intranet-cgi
251 system("rm -f $rootdir/intranet-cgi/ChangeLog.bak");
252 system("rm -f $rootdir/intranet-cgi/ChangeLog.bak");
253 system("rm -f $rootdir/intranet-cgi/SendMessages");
254 system("rm -f $rootdir/intranet-cgi/buildrelease");
255 system("rm -f $rootdir/intranet-cgi/database.mysql");
256 system("rm -f $rootdir/intranet-cgi/installer-lite.pl");
257 system("rm -f $rootdir/intranet-cgi/koha-1.2.0.tar.gz");
258 system("rm -f $rootdir/intranet-cgi/rel-1-2");
259 system("rm -f $rootdir/intranet-cgi/testKoha.pl");
260 system("rm -rf $rootdir/intranet-cgi/html-template");
261 system("rm -rf $rootdir/intranet-cgi/t");
263 # Copy all CVS files to intranet-html and opac-html
264 system("cp -a $kohahtmldir/intranet-html/* $rootdir/intranet-html");
265 system("cp -a $kohahtmldir/opac-html/* $rootdir/opac-html");
267 # Remove extraneous files from opac-html
268 system("rm -f $rootdir/opac-html/koha.mo");
269 system("rm -f $rootdir/opac-html/koha.pot");
270 system("rm -f $rootdir/opac-html/test");
272 # Remove extraneous files from intranet-html
273 system("rm -f $rootdir/intranet-html/koha.pot");
274 system("rm -f $rootdir/intranet-html/results.html");
275 system("rm -f $rootdir/intranet-html/test");
277 # Remove junk from directory
278 system("find $rootdir -name CVS -exec rm -rf \\{\\} \\; 2>/dev/null");
279 system("find $rootdir -name *~ -exec rm -rf \\{\\} \\; 2>/dev/null");
280 system("find $rootdir -name .#* -exec rm -rf \\{\\} \\; 2>/dev/null");
282 if (-e "/root/docs") {
283 print "Copying docs folder from /root/docs...";
284 system("cp -r /root/docs/* $rootdir/docs/");
286 print "I would have copied the docs from from /root/docs, but I couldn't find it.\n";
287 print "Press <ENTER> to continue...\n";
292 system("tar czf /tmp/koha-$releaseversion.tar.gz koha-".$releaseversion);
293 system("rm -rf $rootdir");
300 Your new tarball is located in /tmp/koha-$releaseversion.tar.gz
308 my @v1=split(/\./, $v1);
309 my @v2=split(/\./, $v2);
311 ($#v2>$count) && ($count=$#v2);
312 for (my $index=0; $index<$count; $index++) {
313 if ($v1[$index]>$v2[$index]) {