OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Steffen Weinreich
Root: /v/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-tools Date: 08-Jun-2006 21:20:57
Branch: HEAD Handle: 2006060820205700
Modified files:
openpkg-tools/cmd makeproxy.pl
Log:
Added functionality to build proxy packages from the master RPM database
instead of a binary RPM. Fixed POD documentation to reflect the aktual
usage as openpkg subcommand.
Summary:
Revision Changes Path
1.5 +45 -24 openpkg-tools/cmd/makeproxy.pl
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-tools/cmd/makeproxy.pl
============================================================================
$ cvs diff -u -r1.4 -r1.5 makeproxy.pl
--- openpkg-tools/cmd/makeproxy.pl 1 Jan 2006 14:04:50 -0000 1.4
+++ openpkg-tools/cmd/makeproxy.pl 8 Jun 2006 19:20:57 -0000 1.5
@@ -26,20 +26,26 @@
use strict;
use Getopt::Long;
use IO;
+use OpenPKG::Ctx;
my $progname = "makeproxy";
-my $progvers = "0.9.4";
+my $progvers = "0.9.5";
+
+my $ctx = new OpenPKG::Ctx;
+
# parameters (defaults)
my $version = 0;
my $verbose = 0;
my $debug = 0;
my $help = 0;
-my $rpm = 'rpm';
+my $rpm = $ctx->prefix() . '/bin/openpkg rpm';
my $tmpdir = ($ENV{TMPDIR} || "/tmp") . "/$progname";
my $output = '.';
my $input = '-';
my $prefix = '';
+my $masterrpm = '';
+my $masteropt = '';
# cleanup support
my @cleanup = ();
@@ -162,10 +168,14 @@
}
&verbose("-- $tmpdir");
-# determine RPM program
-if (not -x $rpm) {
- $rpm = &fullpath($rpm);
+if ($prefix ne '') {
+ $masterrpm = $prefix . "/bin/openpkg --prefix=$prefix rpm";
+} else {
+ $masterrpm = $rpm;
}
+&verbose("-- rpm $rpm");
+&verbose("-- masterrpm $masterrpm");
+
my $rpmvers = `$rpm --version 2>/dev/null`;
$rpmvers =~ s|^OpenPKG\s+RPM\s+([0-9.]+)\s*$|$1|s || die "program '$rpm'
seems to be not RPM";
&verbose("++ determining RPM program");
@@ -179,10 +189,16 @@
$input = "$tmpdir/input.rpm";
&runcmd("cat >$input");
}
-if (not -f $input) {
+
+if (($masterrpm eq $rpm) && (not -f $input)) {
die "input RPM does not exist: '$input'";
}
+if (-f $input) {
+ $masteropt="-p";
+}
+
+
# helper function for parsing the query outputs
sub parseresponse {
my ($r, $o) = @_;
@@ -213,7 +229,12 @@
}
$q .= "[M-PREREQ:<%{REQUIRENAME} %|REQUIREFLAGS?{%{REQUIREFLAGS:depflags}
%{REQUIREVERSION}}:{}|>\n]";
$q .= "[M-PREFIXES:<%{PREFIXES}>\n]";
-my $o = `$rpm -qp --qf "$q" $input`;
+&verbose("-- $masterrpm -q $masteropt --qf \"$q\" $input");
+my $o = `$masterrpm -q $masteropt --qf "$q" $input`;
+if ($o =~ /package .* is not installed/) {
+ die "input package $input is not installed in $prefix"
+}
+&verbose("-- $o");
$o =~ s|M-PREREQ:<rpmlib\(.*?\).*?>\n||gs;
my $r = {};
$r = &parseresponse($r, $o);
@@ -303,7 +324,7 @@
# creating shadow tree of original contents
&verbose("++ creating shadow tree from original contents");
-my @FL = `$rpm -qp --qf '[%{FILEMODES:perms} %{FILENAMES}\n]' $input`;
+my @FL = `$masterrpm -q $masteropt --qf '[%{FILEMODES:perms}
%{FILENAMES}\n]' $input`;
my $FD = [];
my $FR = [];
foreach my $fl (@FL) {
@@ -350,11 +371,11 @@
=head1 NAME
-B<mkproxyrpm> -- Make OpenPKG Proxy RPM Package
+B<openpkg makeproxy> -- Make OpenPKG Proxy RPM Package
=head1 SYNOPSIS
-B<mkproxyrpm>
+B<openpkg makeproxy>
[B<--verbose>]
[B<--debug>]
[B<--help>]
@@ -366,7 +387,7 @@
=head1 DESCRIPTION
-B<mkproxyrpm> creates an B<OpenPKG> proxy package by translating a
+B<openpkg makeproxy> creates an B<OpenPKG> proxy package by translating a
binary RPM file into a proxy binary RPM file. A proxy package contains
(virtually) the same contents as the original package in the form
of a shadow tree. Such a shadow tree consists of the same physical
@@ -467,22 +488,22 @@
all three locations, but only once physically.
# build and install binary RPM for /usr/opkg instance
- $ /usr/opkg/bin/rpm --rebuild \
- ftp://ftp.openpkg.org/release/1.0/SRC/bash-2.05a-1.0.0.src.rpm
- $ /usr/opkg/bin/rpm -Uvh \
- /usr/opkg/RPM/PKG/bash-2.05a-1.0.0.*.rpm
+ $ /usr/opkg/bin/openpkg rpm --rebuild \
+ ftp://ftp.openpkg.org/release/1.0/SRC/bash-2.05a-2.5.0.src.rpm
+ $ /usr/opkg/bin/openpkg rpm -Uvh \
+ /usr/opkg/RPM/PKG/bash-2.05a-2.5.0.*.rpm
# build and install proxy RPM for /e/foo/sw instance
- $ mkproxyrpm --rpm=/e/foo/sw/bin/rpm --output=/e/foo/RPM/PKG/ \
- /usr/opkg/RPM/PKG/bash-2.05a-1.0.0.*.rpm
+ $ /e/foo/sw/bin/openpkg makeproxy --rpm=/e/foo/sw/bin/rpm
--output=/e/foo/RPM/PKG/ \
+ /usr/opkg/RPM/PKG/bash-2.05a-2.5.0.*.rpm
$ /e/foo/sw/bin/rpm -Uvh \
- /e/foo/RPM/PKG/bash-2.05a-1.0.0+PROXY.*.rpm
+ /e/foo/RPM/PKG/bash-2.05a-2.5.0+PROXY.*.rpm
+
+ # build and install proxy RPM for /e/bar/sw instance from the master RPM
database
+ $ /e/bar/sw/bin/openpkg makeproxy --prefix=/usr/opkg
--output=/e/bar/RPM/PKG/ bash
+ $ /e/bar/sw/bin/openpkg rpm -Uvh \
+ /e/bar/RPM/PKG/bash-2.05a-2.5.0+PROXY.*.rpm
- # build and install proxy RPM for /e/bar/sw instance
- $ mkproxyrpm --rpm=/e/bar/sw/bin/rpm --output=/e/bar/RPM/PKG/ \
- /usr/opkg/RPM/PKG/bash-2.05a-1.0.0.*.rpm
- $ /e/bar/sw/bin/rpm -Uvh \
- /e/bar/RPM/PKG/bash-2.05a-1.0.0+PROXY.*.rpm
=head1 SEE ALSO
@@ -491,7 +512,7 @@
=head1 HISTORY
-B<mkproxyrpm> was developed in February 2002 by Ralf S.
+B<openpkg makeproxy> was developed in February 2002 by Ralf S.
Engelschall E<lt>[EMAIL PROTECTED]<gt> for the B<OpenPKG>
project after an idea for virtual packages by Thomas Lotterer
E<lt>[EMAIL PROTECTED]<gt>.
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [email protected]