9 ***************************************
10 * Welcome to the Koha Release Builder *
11 ***************************************
13 This script will automatically build a release tarball.
15 The script assumes that you already have the koha and koha-html modules checked
16 out for the release that you want to build, although it will update the modules
20 print "\nWhere is the 'koha' cvs module located [$kohadir]: ";
21 chomp($input = <STDIN>);
27 my $kohahtmldir="/koha/koha/koha-html/";
28 print "\nWhere is the 'koha-html' cvs module located [$kohahtmldir]: ";
29 chomp($input = <STDIN>);
35 print "\n\nGuessing at next release version. You may need to enter your SourceForge password...\n";
37 open (CVSLOG, "cvs log buildrelease|");
38 my $symbolicnamessection=0;
44 if (/^symbolic names:/) {
45 $symbolicnamessection=1;
47 if ($symbolicnamessection && (/^\s+([^:]*):/)) {
54 if ($id =~/(.*)RC(.*)/) {
57 if (versioncompare($version, $highestversion)) {
58 $highestversion=$version;
64 if (versioncompare($version, $highestversion)) {
65 $highestversion=$version;
70 $symbolicnames->{$version}->{$rc}=1;
76 my $releaseversion='';
77 my $currentversion='';
80 $releaseversion=($highestversion+1)."RC1";
81 $currentversion=$highestversion;
83 $releaseversion="$highestversion\RC".($highestrc+1);
84 $currentversion="$highestversion\RC$highestrc";
87 print "Current release tag is $currentversion.\n";
88 print "Would you like to bump that up to $releaseversion? [Y]/N: ";
89 chomp($input = <STDIN>);
90 if ($input =~ /^n/i) {
91 print "Would you like to rebuild the $currentversion tarball? Y/[N]: ";
92 chomp($input = <STDIN>);
93 if ($input =~ /^y/i) {
94 $releaseversion=$currentversion;
95 print "Do not do this if you have released the tarball to anybody, as it will\n";
96 print "overwrite the tag marking the files that were in the tarball.\n\n";
97 print "Confirm that you want to overwrite the tag for $releaseversion? Y/[N]: ";
98 chomp($input = <STDIN>);
99 if ($input =~ /^n/i || $input eq '') {
100 print "\nStopping. Please re-run buildrelease now.\n";
104 print "What should the new version be? [$releaseversion]: ";
105 chomp ($input=<STDIN>);
107 $releaseversion=$input;
114 if ($cvsroot=$ENV{'CVSROOT'}) {
115 $cvsroot=~m#(.*)\@cvs#;
118 $ENV{'CVS_RSH'}='ssh';
119 print "\nWhat is your userid at SourceForge: ";
120 chomp($input = <STDIN>);
124 $ENV{'CVSROOT'}="$sfuserid\@cvs.koha.sourceforge.net:/cvsroot/koha";
126 my $tagname=$releaseversion;
130 Updating the 'koha' CVS files. You may need to enter your SourceForge password.
134 system("cvs update");
136 Tagging koha with tag release-$tagname
138 system("cvs tag -F R_$tagname");
140 Updating the 'koha-html' CVS files. You may need to enter your SourceForge password.
144 system("cvs update");
146 Tagging koha-html with tag release-$tagname
148 system("cvs tag -F R_$tagname");
153 my $rootdir="/tmp/koha-".$releaseversion;
154 system("rm -rf $rootdir");
155 mkdir ($rootdir, 0700);
158 mkdir("intranet-cgi", 0755);
159 mkdir("intranet-html", 0755);
160 mkdir("opac-cgi", 0755);
161 mkdir("opac-html", 0755);
162 mkdir("scripts", 0755);
163 mkdir("modules", 0755);
166 # Copy all CVS files to intranet-cgi
167 system("cp -a $kohadir/* $rootdir/intranet-cgi");
169 # Move C4 to modules directory
170 system("mv $rootdir/intranet-cgi/C4 $rootdir/modules");
172 # Move files from intranet-cgi to root of tarball
173 system("mv $rootdir/intranet-cgi/INSTALL $rootdir");
174 system("mv $rootdir/intranet-cgi/ChangeLog $rootdir");
175 system("mv $rootdir/intranet-cgi/Hints $rootdir");
176 system("mv $rootdir/intranet-cgi/LICENSE $rootdir");
177 system("mv $rootdir/intranet-cgi/News $rootdir");
178 system("mv $rootdir/intranet-cgi/README $rootdir");
179 system("mv $rootdir/intranet-cgi/TODO $rootdir");
180 system("mv $rootdir/intranet-cgi/databaseinstall.sh $rootdir");
181 system("mv $rootdir/intranet-cgi/installer.pl $rootdir");
182 system("mv $rootdir/intranet-cgi/koha.conf $rootdir");
183 system("mv $rootdir/intranet-cgi/koha.mysql $rootdir");
184 system("mv $rootdir/intranet-cgi/sampledata-1.2 $rootdir");
185 system("gzip -9 $rootdir/sampledata-1.2");
187 # Copy files from intranet-cgi to opac-cgi
188 system("cp $rootdir/intranet-cgi/detail.pl $rootdir/opac-cgi");
189 system("cp $rootdir/intranet-cgi/moredetail.pl $rootdir/opac-cgi");
190 system("cp $rootdir/intranet-cgi/search.pl $rootdir/opac-cgi");
193 # Move files from intranet-cgi to /scripts/ directory
194 system("mv $rootdir/intranet-cgi/telnet $rootdir/scripts");
195 system("mv $rootdir/intranet-cgi/tkperl $rootdir/scripts");
196 system("mv $rootdir/intranet-cgi/translator $rootdir/scripts");
197 system("mv $rootdir/intranet-cgi/updater $rootdir/scripts");
198 system("mv $rootdir/intranet-cgi/misc $rootdir/scripts");
201 # Remove extraneous files from intranet-cgi
202 system("rm -f $rootdir/intranet-cgi/ChangeLog.bak");
203 system("rm -f $rootdir/intranet-cgi/ChangeLog.bak");
204 system("rm -f $rootdir/intranet-cgi/SendMessages");
205 system("rm -f $rootdir/intranet-cgi/buildrelease");
206 system("rm -f $rootdir/intranet-cgi/database.mysql");
207 system("rm -f $rootdir/intranet-cgi/installer-lite.pl");
208 system("rm -f $rootdir/intranet-cgi/koha-1.2.0.tar.gz");
209 system("rm -f $rootdir/intranet-cgi/rel-1-2");
210 system("rm -f $rootdir/intranet-cgi/testKoha.pl");
211 system("rm -rf $rootdir/intranet-cgi/html-template");
212 system("rm -rf $rootdir/intranet-cgi/t");
214 # Copy all CVS files to intranet-html and opac-html
215 system("cp -a $kohahtmldir/intranet-html/* $rootdir/intranet-html");
216 system("cp -a $kohahtmldir/opac-html/* $rootdir/opac-html");
218 # Remove extraneous files from opac-html
219 system("rm -f $rootdir/opac-html/koha.mo");
220 system("rm -f $rootdir/opac-html/koha.pot");
221 system("rm -f $rootdir/opac-html/test");
223 # Remove extraneous files from intranet-html
224 system("rm -f $rootdir/intranet-html/koha.pot");
225 system("rm -f $rootdir/intranet-html/results.html");
226 system("rm -f $rootdir/intranet-html/test");
228 # Remove junk from directory
229 system("find $rootdir -name CVS -exec rm -rf \\{\\} \\; 2>/dev/null");
230 system("find $rootdir -name *~ -exec rm -rf \\{\\} \\; 2>/dev/null");
231 system("find $rootdir -name .#* -exec rm -rf \\{\\} \\; 2>/dev/null");
235 system("tar czf /tmp/koha-$releaseversion.tar.gz koha-".$releaseversion);
241 my @v1=split(/\./, $v1);
242 my @v2=split(/\./, $v2);
244 ($#v2>$count) && ($count=$#v2);
245 for (my $index=0; $index<$count; $index++) {
246 if ($v1[$index]>$v2[$index]) {