OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Michael van Elst
Root: /e/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-re Date: 21-Nov-2002 17:06:31
Branch: HEAD Handle: 2002112116063100
Modified files:
openpkg-re openpkg-build
Log:
support for using binary packages
option p selects platfrom different from local rpm target_platform
Summary:
Revision Changes Path
1.46 +69 -38 openpkg-re/openpkg-build
____________________________________________________________________________
Index: openpkg-re/openpkg-build
============================================================
$ cvs diff -u -r1.45 -r1.46 openpkg-build
--- openpkg-re/openpkg-build 21 Nov 2002 14:27:44 -0000 1.45
+++ openpkg-re/openpkg-build 21 Nov 2002 16:06:31 -0000 1.46
@@ -30,7 +30,7 @@
$|=1; # autoflush
use strict;
-use vars qw/$opt_R $opt_r $opt_f $opt_u $opt_U $opt_a $opt_A $opt_z $opt_Z $opt_P
$opt_N $opt_E $opt_i $opt_D/;
+use vars qw/$opt_R $opt_r $opt_f $opt_u $opt_U $opt_a $opt_A $opt_z $opt_Z $opt_P
$opt_N $opt_E $opt_i $opt_D $opt_p/;
##########################################################################
@@ -101,8 +101,8 @@
close(FH);
}
-getopts('R:r:f:uUaAzZP:N:E:iD:');
-die "usage: $0 [-R rpm] [-r repository] [-f index.rdf] [-uUzZEi] [-P priv-cmd] [-N
non-priv-cmd] [-Dwith ...] [-Ename ...] ( [-aA] | patternlist )\n"
+getopts('R:r:f:uUaAzZP:N:E:iD:p:');
+die "usage: $0 [-R rpm] [-r repository] [-f index.rdf] [-uUzZEi] [-P priv-cmd] [-N
non-priv-cmd] [-p platform] [-Dwith ...] [-Ename ...] ( [-aA] | patternlist )\n"
unless $#ARGV >= 0 || ($#ARGV == -1 && ($opt_a || $opt_A));
##########################################################################
@@ -141,7 +141,7 @@
##########################################################################
-my($RPM,$RPM_PRIV,$RPM_NPRIV,$PROG);
+my($RPM,$RPM_PRIV,$RPM_NPRIV,$CURL,$PROG);
$RPM = $opt_R || $env{''}->{opt}->{'R'} || 'rpm';
$RPM = (`which $RPM` =~ m{^(/.*)})[0];
@@ -156,6 +156,10 @@
$RPM_PRIV = ($opt_P ? $opt_P." ".$RPM : $RPM);
$RPM_NPRIV = ($opt_N ? $opt_N." ".$RPM : $RPM);
+$CURL = $RPM;
+$CURL =~ s/bin\/rpm$/lib\/openpkg\/curl/
+ or die "FATAL: cannot deduce curl path from $RPM\n";
+
($PROG) = $0 =~ /(?:.*\/)?(.*)/;
sub version_cmp ($$) {
@@ -225,7 +229,7 @@
{
my($c,@q);
- $c = `$RPM_NPRIV --eval '%{_rpmdir} %{_rpmfilename} %{_target_os}
%{_target_cpu}'`;
+ $c = `$RPM_NPRIV --eval '%{_rpmdir} %{_rpmfilename} %{_target_os}
%{_target_cpu} %{_target_platform} %{_prefix}'`;
chomp($c);
(@q) = split(/\s+/,$c);
@@ -234,7 +238,9 @@
return {
rpmdir => $q[0],
- template => $q[1]
+ template => $q[1],
+ platform => $q[4],
+ prefix => $q[5]
};
}
@@ -383,7 +389,7 @@
sub get_index ($$$) {
my($url,$fn,$with) = @_;
my($ua,$req,$res,$rdf);
- my($bzip2,$curl,$path);
+ my($bzip2,$path);
my(%map,@include);
my($fetch);
@@ -397,17 +403,12 @@
or die "FATAL: $bzip2 not found\n";
if ($fetch =~ /^\w+:/) { # looks like URL scheme
- $curl = $RPM;
- $curl =~ s/bin\/rpm$/lib\/openpkg\/curl/
- or die "FATAL: cannot deduce curl path from $RPM\n";
- -x $curl
- or die "FATAL: $curl not found\n";
print "# curling index $fetch\n";
if ($fetch =~ /\.bz2$/) {
- $path = "$curl -q -s -o - \"$fetch\" | $bzip2 -dc |";
+ $path = "$CURL -q -s -o - \"$fetch\" | $bzip2 -dc |";
} else {
- $path = "$curl -q -s -o - \"$fetch\" |";
+ $path = "$CURL -q -s -o - \"$fetch\" |";
}
} else {
print "# reading index file $fn\n";
@@ -498,7 +499,7 @@
$release = $body;
} elsif ($tag eq 'Platform') {
$platform = $body;
- } elsif ($tag eq 'Prefix') {
+ } elsif ($tag eq 'Prefixes') {
$prefix = $body;
} elsif ($tag eq 'rdf:li') {
if ($section eq 'prereq') {
@@ -603,7 +604,7 @@
version => $version,
release => $release,
platform => $_->{'Platform'}->[0],
- prefix => $_->{'Prefix'}->[0],
+ prefix => $_->{'Prefixes'}->[0],
depends =>
( $_->{'BuildPreReq'}->[0]->{'rdf:bag'}->[0]->{'rdf:li'}
|| [] ),
@@ -624,7 +625,8 @@
}
}
- close(RFH);
+ close(RFH)
+ or die "FATAL: an I/O error occured\n";
#
# cannot do real recursions on file handles, so we simply append
@@ -659,34 +661,47 @@
#
sub chose_source ($$@) {
my($env, $name, $vmap, @vers) = @_;
- my(@recs,$rec);
+ my(@recs,@nrecs,$rec);
return unless @vers;
- @recs = grep { !defined $_->{'platform'} }
- map { @{$vmap->{$_}} }
- @vers;
+ @recs = grep {
+ $env->{sourceonly} ? (
+ !(defined $_->{'platform'})
+ ) : (
+ !(defined $_->{'platform'}) || (
+ defined $_->{'prefix'} &&
+ $_->{'platform'} eq $env->{config}->{platform} &&
+ $_->{'prefix'} eq $env->{config}->{prefix}
+ )
+ )
+ } map { @{$vmap->{$_}} } @vers;
return unless @recs;
if (scalar(@recs) > 1) {
+ @nrecs = grep {
+ $env->{built}->{$_->{name}} ||
+ $env->{installed}->{$_->{name}}
+ } @recs;
+ @recs = @nrecs if @nrecs;
+ }
- $rec = undef;
- foreach (@recs) {
- if ($env->{built}->{$_->{name}} ||
- $env->{installed}->{$_->{name}}) {
- $rec = $_;
- }
- }
+ if (scalar(@recs) > 1 && !$env->{sourceonly}) {
+ @nrecs = grep {
+ defined $_->{'platform'}
+ } @recs;
+ @recs = @nrecs if @nrecs;
+ }
- unless (defined $rec) {
- print "# ambigous sources for $name\n";
- my($i) = 0;
- foreach (@recs) {
- print "# $i: ".vsn($_)."\n";
- $i++;
- }
- die "ERROR: ambigous dependency\n";
+ if (scalar(@recs) > 1) {
+
+ print "# ambigous sources for $name\n";
+ my($i) = 0;
+ foreach (@recs) {
+ print "# $i: ".vsn($_)." = $_->{href}\n";
+ $i++;
}
+ die "ERROR: ambigous dependency\n";
} else {
if ($env->{upgrade}) {
@@ -1151,7 +1166,12 @@
!target_suitable(binary_target($_, $bpkg),$with)) {
$opt = make_defines($_->{OPTIONS}, $with);
- $cmd1 = "$RPM_NPRIV$opt --rebuild $spkg";
+
+ if (defined $_->{platform}) {
+ $cmd1 = "$CURL -q -s -o $bpkg $spkg";
+ } else {
+ $cmd1 = "$RPM_NPRIV$opt --rebuild $spkg";
+ }
}
#
@@ -1209,6 +1229,10 @@
$config = get_config();
+if (defined $opt_p) {
+ $config->{platform} = $opt_p;
+}
+
if (defined $opt_r) {
$url = $opt_r;
$url .= '/' unless $url =~ /\/$/;
@@ -1230,6 +1254,7 @@
$repository = get_index($url.'00INDEX.rdf',$opt_f,\%with);
($list,$bonly) = build_list($pattern, {
+ config => $config,
installed => $installed,
repository => $repository,
built => {},
@@ -1237,7 +1262,13 @@
with => \%with,
exclude => \%exclude,
upgrade => ($opt_a || $opt_U),
- zero => ($opt_z || $opt_Z)
+ zero => ($opt_z || $opt_Z),
+ sourceonly => (
+ $opt_u ||
+ $opt_U ||
+ $opt_z ||
+ $opt_Z ||
+ scalar(%with) > 0 )
});
die "FATAL: cannot find package\n" unless defined $list;
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]