Changeset 2021
- Timestamp:
- 02/22/08 08:41:58 (3 months ago)
- Files:
-
- swish_website/bin/swish-daily.pl (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
swish_website/bin/swish-daily.pl
r2008 r2021 18 18 my %config = ( 19 19 svnco => 'svn co http://svn.swish-e.org/swish-e/trunk/', 20 #svnco => 'svn co http://svn.swish-e.org/swish-e/branches/2.6/', # for 2.6/2.7 20 21 tar_keep_days => 15, # number of days to keep tarfiles 21 22 build_keep_days => 2, # number of days to keep previous build … … 25 26 symlink => 1, # create symlink 26 27 srpm => 1, # build srpms 28 latest => 1, # make 'latest.tar.gz' 29 verbose => 1, 27 30 ); 28 31 … … 45 48 symlink! 46 49 srpm! 50 latest! 47 51 help man options 48 52 config_options=s … … 73 77 74 78 75 76 79 pod2usage( { 77 80 -verbose => ($config{man} ? 2 : $config{options} ? 1 : 0), … … 160 163 #======================================================================= 161 164 # make_src_rpm( $c ) 162 # makes a .src.rpm from the source tree 163 # by setting up a rpmbuild environment and creating a special 164 # rpmrc file for rpmbuild. 165 # The version for rpm must look like '2.5.6', and we set 166 # the release of the rpm to the svn revision number. 167 # (This will need to be revisited for release .src.rpms) 165 # makes a .src.rpm from the source tree, by setting up a rpmbuild 166 # environment, creating a rpmrc file for rpmbuild, and 167 # using rpmbuild to make a .src.rpm from the source tree 168 # and tarball. 169 # The 'version' for rpm must look like '2.5.6', and we set 170 # the release of the rpm to the current date. 171 # (For release .src.rpms, use --no-timestamps to disable timestamps, 172 # and the revision will come straight from the .spec file) 168 173 # 169 174 # The .src.rpm is deposited into $builddir/rpmbuild/SRPMS … … 178 183 179 184 my ($rpmbuilddir, $rpmrcfile) = setup_rpmbuild_environment( $c ); 180 my $tarball = "$c->{tardir}/swish-e-$c->{version}.tar.gz"; # this should be factored out185 my $tarball_for_rpm = "$c->{tardir}/swish-e-$c->{version}.tar.gz"; # this should be factored out 181 186 my $srcdir = $c->{srcdir}; 182 187 my $builddir = $c->{builddir}; … … 191 196 # IE, from 2.5.6-2007-12-08 to 2.5.6 192 197 193 my $newtarball = $tarball ;198 my $newtarball = $tarball_for_rpm; 194 199 $newtarball =~ s/-\d+-\d+-\d+\.tar.gz$/.tar.gz/; # remove -2007-12-12 from tarball 195 200 196 201 die "$0: failed to figure out name of new tarball for .src.rpm\n" 197 unless ($newtarball ne $tarball );198 199 # create a new tarball that ext acts to the right dirname, and set $tarball to it200 _rewrite_tarball( $c, $tarball , $newtarball, "swish-e-$origspecversion", "swish-e-$specversion" );201 $tarball = $newtarball;202 } 203 204 run_command( "cp $tarball $rpmbuilddir/SOURCES/swish-e-$specversion.tar.gz" );205 run_command( "cp $srcdir/rpm/swish-e.xpm $rpmbuilddir/SOURCES " );206 run_command( "cp $builddir/rpm/swish-e.spec $rpmbuilddir/SPECS " );202 unless ($newtarball ne $tarball_for_rpm); 203 204 # create a new tarball that extracts to the right dirname, and set $tarball to it 205 _rewrite_tarball( $c, $tarball_for_rpm, $newtarball, "swish-e-$origspecversion", "swish-e-$specversion" ); 206 $tarball_for_rpm = $newtarball; 207 } 208 209 run_command( "cp $tarball_for_rpm $rpmbuilddir/SOURCES/swish-e-$specversion.tar.gz" ); 210 run_command( "cp $srcdir/rpm/swish-e.xpm $rpmbuilddir/SOURCES/" ); 211 run_command( "cp $builddir/rpm/swish-e.spec $rpmbuilddir/SPECS/" ); 207 212 208 213 # fixup the version string in the .spec file, IE, from 2.5.6-2007-12-08 to 2.5.6 … … 213 218 # also, if in timestamp mode, change the specrelease to be YYYYMMDD 214 219 if ($c->{timestamp}) { 215 chomp(my $specrelease = `date '+%Y%m%d'`); # normally this is a 1-2 digits220 chomp(my $specrelease = `date '+%Y%m%d'`); # normally for rpms this is 1-2 digits, not 8. 216 221 _apply_regexes( "$rpmbuilddir/SPECS/swish-e.spec", 217 222 qq{s/^%define[[:space:]]+release.*/%define release $specrelease/ims} ); 223 224 # also, remove our special tarball 225 run_command( "rm -f $tarball_for_rpm" ); 218 226 } 219 227 … … 258 266 close($fh) || die "$0: Failed to close $rpmmacrosfile: $!"; 259 267 260 # write our rpmrc file t hat getsrpmbuild to use our special $rpmmacros file268 # write our rpmrc file to get rpmbuild to use our special $rpmmacros file 261 269 my $rpmrcfile = "$rpmbuilddir/rpmrc"; 262 270 log_message( "Creating new $rpmrcfile" ); … … 330 338 331 339 run_command( "mv swish-e-$c->{version}.tar.gz $c->{tardir}" ); 332 333 run_command( "rm -f $latest" ); 334 run_command( "ln -s $c->{tardir}/swish-e-$c->{version}.tar.gz $latest"); 340 341 if ($c->{latest}) { # don't update our latest link unless we're supposed to 342 run_command( "rm -f $latest" ); 343 run_command( "ln -s $c->{tardir}/swish-e-$c->{version}.tar.gz $latest"); 344 } 335 345 336 346 } else { … … 424 434 log_message( $command ); 425 435 426 #return !system( $command );427 system( $command ) && die "$0: Command failed: $command: $!";436 system( $command ) && die "$0: Command failed: $command: $!"; 437 428 438 return 1; 429 439 } … … 600 610 601 611 # uncompress and recompress the tarball with a different dir name. 612 die "$0: Couldn't find tarball: $fromtarball\n" unless -f $fromtarball; 602 613 run_command( "tar -zxf $fromtarball" ); 603 614 die "$0: tarball didn't extract into $fromdir\n" unless -d $fromdir;
