Update of /cvsroot/fink/scripts/bindist
In directory sc8-pr-cvs1:/tmp/cvs-serv8747
Modified Files:
Tag: remis-bindist
bdadd
Log Message:
Add splitoffs of given package, too. Various minor modifications
Index: bdadd
===================================================================
RCS file: /cvsroot/fink/scripts/bindist/bdadd,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -u -d -r1.10 -r1.10.2.1
--- bdadd 22 Sep 2002 12:58:39 -0000 1.10
+++ bdadd 21 Dec 2003 23:48:57 -0000 1.10.2.1
@@ -1,31 +1,39 @@
#!/usr/bin/perl
-$| = 1;
+$| = 1; # flush buffers
+$! = 1; # return value for die
require 5.006; # perl 5.6.0 or newer required
use strict;
+### check if the environment is set up properly
my $base = $ENV{BDBASE};
-chdir $base or die "bindist base \"$base\" is bogus, set env var BDBASE\n";
+chdir $base or die "bindist base \"$base\" is bogus, set environment variable
BDBASE\n";
-my ($currel, $dest);
-if (exists $ENV{CURREL} and defined $ENV{CURREL}) {
- $currel = $ENV{CURREL};
+### find the current release number
+my($currel);
+if (-r "$ENV{BDDATA}/current" ) {
+ chomp($currel = `cat $ENV{BDDATA}/current`);
} else {
- chomp($currel = `cat $ENV{BDDATA}/current`);
+ die "Cannot find the current release version. Set env var BDDATA properly.\n";
}
my $dest = "dists/fink-$currel/main";
my $dest_crypto = "dists/fink-$currel/crypto";
### now load the useful modules
-
use Fink::Services qw(&read_config &filename &execute);
use Fink::Config;
use Fink::Package;
use Fink::PkgVersion;
### read config
-
-my $config = &read_config("/sw/etc/fink.conf");
+my ($config, $configpath);
+$configpath = "$ENV{FINK_PREFIX}/etc/fink.conf";
+if (-f $configpath) {
+ $config = &Fink::Services::read_config($configpath);
+} else {
+ print "ERROR: Configuration file \"$configpath\" not found.\n";
+ exit 1;
+}
### read package info
@@ -33,54 +41,60 @@
### loop over packages
-my ($pkgspec, $pkgname, $po, $fn, $todir, $tofn, $linkpath, $i, $section);
+my ($pkgspec, $pkgname, $pkg, $packages, $po, $fn, $todir, $tofn, $linkpath, $i,
$section);
foreach $pkgspec (@ARGV) {
- $po = Fink::PkgVersion->match_package($pkgspec);
- if (not defined($po)) {
+ $pkg = Fink::PkgVersion->match_package($pkgspec);
+ if (not defined($pkg)) {
print "ERROR: can't resolve \"$pkgspec\"\n";
next;
}
- $pkgname = $po->get_fullname();
- $fn = $po->find_debfile();
- if (not defined($fn)) {
- print "ERROR: no binary package for $pkgname\n";
- next;
- }
- $section = $po->get_section();
- if ($section eq "crypto") {
- $todir = $dest_crypto."/binary-darwin-powerpc";
- } else {
- $todir = $dest."/binary-darwin-powerpc/".$section;
+### get debfiles for package and split-offs; copy them to the correct section
+ my @packages = ($pkg);
+
+ if (exists $pkg->{_relatives}) {
+ @packages = (@packages, @{$pkg->{_relatives}});
}
- $tofn = $todir."/".&filename($fn);
- if (not -d $todir) {
- &execute("mkdir -p $todir");
+
+ foreach $po (@packages) {
+ $pkgname = $po->get_fullname();
+ $fn = $po->find_debfile();
+ if (not defined($fn)) {
+ print "ERROR: no binary package for $pkgname\n";
+ next;
+ }
+ $section = $po->get_section();
+ if ($section eq "crypto") {
+ $todir = $dest_crypto."/binary-darwin-powerpc";
+ } else {
+ $todir = $dest."/binary-darwin-powerpc/".$section;
+ }
+ if (not -d $todir) {
+ &execute("mkdir -p $todir");
+ }
+ $tofn = $todir."/".&filename($fn);
+ if (-e $tofn) {
+ &execute("rm -f $tofn");
+ }
+ &execute("$ENV{BDCOPY} $fn $tofn");
}
-# HACK - we want to keep existing .debs for now
-# if (not -e $tofn) {
-# &execute("cp $fn $tofn");
-# }
- if (-e $tofn) {
- &execute("rm -f $tofn");
- }
- &execute("cp $fn $tofn");
+### copy source files and provide soft links
for ($i = 1; $i < 10; $i++) {
- $fn = $po->get_tarball($i);
+ $fn = $pkg->get_tarball($i);
last if not defined($fn);
last if $fn eq "-";
if (not -f "source/$fn") {
system('mkdir -p source');
- $fn = $po->find_tarball($i);
+ $fn = $pkg->find_tarball($i);
if (not defined($fn)) {
- print "WARNING: can't find source package \"".$po->get_tarball($i)."\" for
$pkgname\n";
+ print "WARNING: can't find source package \"".$pkg->get_tarball($i)."\" for
$pkgname\n";
next;
}
$tofn = "source/".&filename($fn);
- &execute("cp $fn $tofn");
+ &execute("$ENV{BDCOPY} $fn $tofn");
}
if ($section eq "crypto") {
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
Fink-commits mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-commits