OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall
Root: /e/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-src Date: 21-Jan-2003 15:00:29
Branch: OPENPKG_1_STABLE Handle: 2003012114002700
Modified files: (Branch: OPENPKG_1_STABLE)
openpkg-src/openpkg-tool
openpkg-build.pl openpkg-index.pl
openpkg-tool.spec openpkg.pod
Log:
MFC: latest openpkg-tool
Summary:
Revision Changes Path
1.39.2.1 +64 -38 openpkg-src/openpkg-tool/openpkg-build.pl
1.11.2.1 +7 -2 openpkg-src/openpkg-tool/openpkg-index.pl
1.27.2.4 +2 -2 openpkg-src/openpkg-tool/openpkg-tool.spec
1.10.2.1 +16 -9 openpkg-src/openpkg-tool/openpkg.pod
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-src/openpkg-tool/openpkg-build.pl
============================================================================
$ cvs diff -u -r1.39 -r1.39.2.1 openpkg-build.pl
--- openpkg-src/openpkg-tool/openpkg-build.pl 16 Jan 2003 14:59:51 -0000 1.39
+++ openpkg-src/openpkg-tool/openpkg-build.pl 21 Jan 2003 14:00:27 -0000
1.39.2.1
@@ -33,8 +33,8 @@
$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 $opt_q $opt_s $opt_S $opt_X $opt_M $opt_L
- $opt_W/;
-my $getopts = 'R:r:f:uUaAzZP:N:E:iD:p:qsSXMLW';
+ $opt_W $opt_K/;
+my $getopts = 'R:r:f:uUaAzZP:N:E:iD:p:qsSXMLWK';
getopts($getopts);
##########################################################################
@@ -150,7 +150,7 @@
##########################################################################
-my($RPM,$RPM_PRIV,$RPM_NPRIV,$CURL,$PROG);
+my($RPM,$CURL,$PROG);
$RPM = $opt_R || $env{''}->{'R'} || '@l_prefix@/bin/rpm';
$RPM = (`which $RPM` =~ m{^(/.*)})[0];
@@ -163,14 +163,26 @@
}
}
-$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 cmd ($$) {
+ my($w,$s) = @_;
+ if (!defined $w) {
+ return $s;
+ } elsif ($w =~ /^-(.*)/) {
+ return "$1 '$s'";
+ } else {
+ return "$w $s";
+ }
+}
+sub priv ($) { cmd($opt_P,$_[0]); }
+sub npriv ($) { cmd($opt_N,$_[0]); }
+sub run ($) { my($c) = cmd($opt_N,$_[0]); `$c` }
+
sub version_cmp ($$) {
my($a,$b) = @_;
my(@a,@b,$c);
@@ -243,7 +255,7 @@
{
my($c,@q,@g);
- $c = `$RPM_NPRIV --eval '%{_rpmdir} %{_rpmfilename} %{_target_os}
%{_target_cpu} %{_target_platform} %{_prefix}'`;
+ $c = run("$RPM --eval '%{_rpmdir} %{_rpmfilename} %{_target_os} %{_target_cpu}
%{_prefix}'");
chomp($c);
(@q) = split(/\s+/,$c);
@@ -251,14 +263,14 @@
$q[1] =~ s/%{ARCH}/$q[3]/;
- $c = `$RPM_NPRIV --showrc`;
+ $c = run("$RPM --showrc");
@g = $c =~ /\%\{l_tool_locate\s+([^\s\}]+)/g;
return {
rpmdir => $q[0],
template => $q[1],
- platform => $q[4],
- prefix => $q[5],
+ platform => '',
+ prefix => $q[4],
optreg => '(?:'.join('|', map { "\Qwith_$_\E" } @g).')'
};
}
@@ -266,16 +278,13 @@
sub get_release () {
my($rel,$url);
- ($rel) =`$RPM_NPRIV -qi openpkg` =~ /Version:\s*(\S+)/m;
-
+ ($rel) = run("$RPM -qi openpkg") =~ /Version:\s*(\S+)/m;
if ($rel =~ /^\d+$/) {
print "# $PROG current($rel)\n";
- print "# using '$RPM_NPRIV' (build) and '$RPM_PRIV' (install)\n";
$url = "ftp://ftp.openpkg.org/current/";
} elsif ($rel =~ /^(\d+\.\d+)/) {
$rel = $1;
print "# $PROG release($rel)\n";
- print "# using '$RPM_NPRIV' (build) and '$RPM_PRIV' (install)\n";
$url = "ftp://ftp.openpkg.org/release/$rel/";
} else {
die "FATAL: don't know how to handle this release\n";
@@ -416,7 +425,7 @@
#
sub get_installed () {
my(%map);
- my(@l) = `$RPM_NPRIV --provides -qa`;
+ my(@l) = run("$RPM --provides -qa");
my($p);
my($nam,$val,%options);
@@ -548,9 +557,9 @@
$opt = $t->{OPTIONS};
} else {
if (defined $fn) {
- @l = `$RPM_NPRIV -qi -p $fn`;
+ @l = run("$RPM -qi -p $fn");
} else {
- @l = `$RPM_NPRIV -qi $t->{name}`;
+ @l = run("$RPM -qi $t->{name}");
}
$opt = parse_options(\@l);
$t->{OPTIONS} = $opt if $env;
@@ -633,8 +642,14 @@
return \@out;
}
-sub simple_text_parser ($$$$) {
- my($fh,$url,$with,$map) = @_;
+sub goodpf ($$) {
+ my($l,$p) = @_;
+ return 1 if $l eq '';
+ return $l =~ /(?:^|\s)\Q$p\E(?:\s|$)/;
+}
+
+sub simple_text_parser ($$$$$) {
+ my($fh,$url,$with,$map,$pfmatch) = @_;
my(@include);
my($section);
@@ -671,8 +686,12 @@
@nosource = ();
}
- if (!(defined $href) && /<Repository.*?href="([^"]*)"/) {
- push(@include, $1);
+ if (!(defined $href) &&
+ /<Repository.*?href="([^"]*)"(?:\s*platform="([^"]*)")?/
+ ) {
+ if (goodpf($2,$pfmatch)) {
+ push(@include, $1)
+ }
next;
}
@@ -809,8 +828,8 @@
return \@include;
}
-sub xml_parser ($$$$) {
- my($fh, $url, $with, $map) = @_;
+sub xml_parser ($$$$$) {
+ my($fh, $url, $with, $map,$pfmatch) = @_;
my(@include);
my($xml,$desc,$sub);
@@ -885,7 +904,11 @@
}
if ($sub) {
- @include = map { $_->{href} } @$sub;
+ @include = map {
+ goodpf($_->{platform},$pfmatch)
+ ? ( $_->{href} )
+ : ( )
+ } @$sub;
}
return \@include;
@@ -929,8 +952,8 @@
# fetch index from file or URL
# recursively fetch sub-indexes
#
-sub get_index ($$$$) {
- my($url,$fn,$with,$noxml) = @_;
+sub get_index ($$$$$) {
+ my($url,$fn,$with,$noxml,$pfmatch) = @_;
my(%map,$include);
open_index($url,$fn);
@@ -943,9 +966,9 @@
}
if ($noxml) {
- $include = simple_text_parser(\*RFH, $url, $with, \%map);
+ $include = simple_text_parser(\*RFH, $url, $with, \%map, $pfmatch);
} else {
- $include = xml_parser(\*RFH, $url, $with, \%map);
+ $include = xml_parser(\*RFH, $url, $with, \%map, $pfmatch);
}
close(RFH)
@@ -958,7 +981,7 @@
foreach (@$include) {
my($submap);
my($suburl,$subfn) = relurl($url,$fn,$_);
- $submap = get_index($suburl,$subfn,$with,$noxml);
+ $submap = get_index($suburl,$subfn,$with,$noxml,$pfmatch);
while (my($name,$vmap) = each %$submap) {
while (my($vs,$recs) = each %$vmap) {
push @{$map{$name}->{$vs}}, @$recs;
@@ -1522,7 +1545,7 @@
}
%keep = map { $_ => 1 } @keeps;
- @bonly = grep {
+ @bonly = reverse grep {
!$keep{$_} && !$env->{installed}->{$_->{name}}->{vs($_)};
} @targets;
@@ -1628,7 +1651,7 @@
#
sub find_proxy ($$) {
my($t,$bpkg) = @_;
- my(@l) = `$RPM_NPRIV -ql $t->{name}`;
+ my(@l) = run("$RPM -ql $t->{name}");
my($link) = (grep { $_ =~ /\/\.prefix-$t->{name}$/ } @l)[0];
return unless defined $link;
chomp $link;
@@ -1727,13 +1750,15 @@
#
# rpm doesn't support additional parameters to the
# mkproxy script
- # $cmd1 = "$RPM_NPRIV$opt --makeproxy $ppkg -- -o $bpkg";
+ # $cmd1 = npriv("$RPM$opt --makeproxy $ppkg -- -o $bpkg");
#
- $cmd1 = "( cd $c->{rpmdir} && $RPM_NPRIV$opt --makeproxy $ppkg )";
+ $cmd1 = "( cd $c->{rpmdir} && ".
+ npriv("$RPM$opt --makeproxy $ppkg").
+ " )";
} elsif (defined $_->{prefix}) {
- $cmd1 = "$CURL -q -s -o $bpkg $spkg";
+ $cmd1 = npriv("$CURL -q -s -o $bpkg $spkg");
} else {
- $cmd1 = "$RPM_NPRIV$opt --rebuild $spkg";
+ $cmd1 = npriv("$RPM$opt --rebuild $spkg");
}
}
@@ -1743,7 +1768,7 @@
# files
#
$opt = $_->{REBUILD} ? ' --force' : '';
- $cmd2 = "$RPM_PRIV$opt -Uvh $bpkg";
+ $cmd2 = priv("$RPM$opt -Uvh $bpkg");
if ($ignore) {
$cmd2 = "$cmd1 && \\\n$cmd2" if defined $cmd1;
@@ -1770,7 +1795,7 @@
foreach (@$list) {
$pkg = "$_->{name}-$_->{version}-$_->{release}";
- print "$RPM_PRIV -e $pkg\n";
+ print priv("$RPM -e $pkg\n");
}
}
@@ -1910,7 +1935,8 @@
$url.'00INDEX.rdf',
$opt_f,
($opt_W ? undef : \%with),
- $opt_X);
+ $opt_X,
+ $config->{platform});
$env = {
config => $config,
@@ -1953,7 +1979,7 @@
}
print_list1($list,$config,$opt_a || $opt_u || $opt_U,\%with,$opt_i);
- print_list2($bonly,$config);
+ print_list2($bonly,$config) unless $opt_K;
}
}
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/openpkg-tool/openpkg-index.pl
============================================================================
$ cvs diff -u -r1.11 -r1.11.2.1 openpkg-index.pl
--- openpkg-src/openpkg-tool/openpkg-index.pl 14 Jan 2003 12:00:55 -0000 1.11
+++ openpkg-src/openpkg-tool/openpkg-index.pl 21 Jan 2003 14:00:27 -0000
1.11.2.1
@@ -683,6 +683,10 @@
my($q,$pipe,%a);
my($t,$v);
+ unless (defined $platform) {
+ die "FATAL: indexing binary package '$fn' requires -p option\n";
+ }
+
$q = <<EOFEOF;
Name %{Name}
Version %{Version}
@@ -753,7 +757,9 @@
if ($a{'SigMD5'} eq '(unknown type)') {
delete $a{'SigMD5'};
}
- $a{'Platform'} = "$a{'Arch'}-$platform-$a{'Os'}";
+ if (defined $platform) {
+ $a{'Platform'} = $platform;
+ }
$a{'PreReq'} =~ s/^rpmlib\(.*$//mg;
$a{'Description'} = [ $a{'Description'} ];
@@ -924,7 +930,6 @@
}
$opt_r = 'OpenPKG-CURRENT/Source/' unless defined $opt_r;
-$opt_p = 'unknown' unless defined $opt_p;
if (defined $opt_o) {
$tmpo = $opt_o . '.tmp';
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/openpkg-tool/openpkg-tool.spec
============================================================================
$ cvs diff -u -r1.27.2.3 -r1.27.2.4 openpkg-tool.spec
--- openpkg-src/openpkg-tool/openpkg-tool.spec 20 Jan 2003 12:38:45 -0000
1.27.2.3
+++ openpkg-src/openpkg-tool/openpkg-tool.spec 21 Jan 2003 14:00:27 -0000
1.27.2.4
@@ -32,8 +32,8 @@
Distribution: OpenPKG [PLUS]
Group: Bootstrapping
License: GPL
-Version: 1.20030120
-Release: 1.20030120
+Version: 1.20030121
+Release: 1.20030121
# list of sources
Source0: openpkg.sh
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/openpkg-tool/openpkg.pod
============================================================================
$ cvs diff -u -r1.10 -r1.10.2.1 openpkg.pod
--- openpkg-src/openpkg-tool/openpkg.pod 15 Jan 2003 12:15:46 -0000 1.10
+++ openpkg-src/openpkg-tool/openpkg.pod 21 Jan 2003 14:00:27 -0000
1.10.2.1
@@ -63,6 +63,7 @@
[B<-L>]
[B<-W>]
[B<-X>]
+[B<-K>]
[B<-P> I<priv-cmd>]
[B<-N> I<non-priv-cmd>]
[B<-p> I<platform>]
@@ -97,12 +98,9 @@
=item B<-p> I<platform>
-B<openpkg index> adds a platform attribute for binary RPMs. The
-attribute is built as I<%{arch}>C<->I<platform>C<->I<%{os}> where
-I<%{arch}> and I<%{os}> are taken from the RPM header and I<platform> is
-the value of the B<-p> option. The default value is "C<unknown>". This
-must be used to distinguish between platforms that support the same
-Architecture and OS name like various Linux distributions.
+B<openpkg index> adds a platform attribute for binary RPMs. This
+must be unique to correctly identify a specific architecture, OS
+and build environment.
=item B<-C> I<cache.db>
@@ -275,20 +273,29 @@
Ignore an installed XML parser module but use the internal
simple text parser instead.
+=item B<-K>
+
+Keep packages that were installed temporarily during the build process.
+
=item B<-P> I<priv-cmd>
Command prefix to use for install commands that require elevated
-privileges. The most common tool for this is sudo(8).
+privileges. The most common tool for this is sudo(8). If I<priv-cmd>
+starts with a dash it will be run without the dash and the command
+line it should execute is passed as a single quoted string.
=item B<-N> I<non-priv-cmd>
Command prefix to use for install commands that do not require elevated
-privileges. The most common tool for this is sudo(8).
+privileges. The most common tool for this is sudo(8). If I<priv-cmd>
+starts with a dash it will be run without the dash and the command
+line it should execute is passed as a single quoted string.
=item B<-p> I<platform>
The platform string that is matched against the index for binary
-packages. Default is to use the I<%{_target_platform}> variable.
+packages. Default is an empty string so that no binary packages
+are matched.
=item B<-D>I<var>=I<val>
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]