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: 26-Aug-2003 14:37:50
Branch: OPENPKG_UPGRADE_RPM42 Handle: 2003082613374900
Modified files: (Branch: OPENPKG_UPGRADE_RPM42)
openpkg-src/openpkg openpkg.spec rpmmacros rpmpopt rpmx.pl
Log:
final polishing and cleanups
Summary:
Revision Changes Path
1.192.2.21 +1 -1 openpkg-src/openpkg/openpkg.spec
1.40.2.3 +4 -1 openpkg-src/openpkg/rpmmacros
1.5.8.3 +22 -17 openpkg-src/openpkg/rpmpopt
1.14.2.1 +1 -342 openpkg-src/openpkg/rpmx.pl
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-src/openpkg/openpkg.spec
============================================================================
$ cvs diff -u -r1.192.2.20 -r1.192.2.21 openpkg.spec
--- openpkg-src/openpkg/openpkg.spec 26 Aug 2003 11:12:27 -0000 1.192.2.20
+++ openpkg-src/openpkg/openpkg.spec 26 Aug 2003 12:37:49 -0000 1.192.2.21
@@ -494,7 +494,7 @@
) || exit $?
# display verbosity header
- VERBOSE "BUILD: Build cURL (URL Fetching Library)"
+ VERBOSE "BUILD: Build cURL (URL Fetching Tool)"
# build cURL tool
( cd curl-%{V_curl}
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/openpkg/rpmmacros
============================================================================
$ cvs diff -u -r1.40.2.2 -r1.40.2.3 rpmmacros
--- openpkg-src/openpkg/rpmmacros 25 Aug 2003 18:55:22 -0000 1.40.2.2
+++ openpkg-src/openpkg/rpmmacros 26 Aug 2003 12:37:49 -0000 1.40.2.3
@@ -155,6 +155,8 @@
%_srcrpmdir %{l_root_rpm}/PKG
%_repackage_dir %{l_root_rpm}/PKG
%_cache_dbpath %{l_root_rpm}/PKG
+%_solve_dbpath %{l_root_rpm}/PKG
+%_solve_pkgsdir %{l_root_rpm}/PKG
%_defaultdocdir %{l_docdir}
# complement the %{SOURCE<n>} and %{PATCH<n>} with %{SOURCE <file>} and %{PATCH
<file>}
@@ -251,7 +253,7 @@
%l_files_defattr '%defattr(-,%{l_musr},%{l_mgrp})'
%l_files_all '%{l_prefix}'
%l_files_noshared '%not %dir
{%{l_prefix},%{l_prefix}/*,%{l_prefix}/etc/rc.d,%{l_prefix}/man/*}'
-%l_files_std(o:g:) %l_files_defattr %l_files_all %l_files_noshared
+%l_files_std() %l_files_defattr %l_files_all %l_files_noshared
# path to local build root
%l_buildroot %{_tmppath}/%{name}-%{version}-root
@@ -267,6 +269,7 @@
%_rpmfilename [EMAIL PROTECTED]@.rpm
%_build_name_fmt [EMAIL PROTECTED]@.rpm
%_repackage_name_fmt [EMAIL PROTECTED]@.rpm
+%_solve_name_fmt %{_solve_pkgsdir}/[EMAIL PROTECTED]@.rpm
# override the payload compression for the CPIO parts of an RPM
# (we use the equivalent of "bzip2 -9")
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/openpkg/rpmpopt
============================================================================
$ cvs diff -u -r1.5.8.2 -r1.5.8.3 rpmpopt
--- openpkg-src/openpkg/rpmpopt 23 Aug 2003 20:56:26 -0000 1.5.8.2
+++ openpkg-src/openpkg/rpmpopt 26 Aug 2003 12:37:49 -0000 1.5.8.3
@@ -1,18 +1,23 @@
-# link extension into "rpm" command line
-rpm alias -r --repo
-rpm alias -s --smart
-rpm exec --stowaway rpmx.sh --stowaway
-rpm exec --makeindex rpmx.sh --makeindex
-rpm exec --makeproxy rpmx.sh --makeproxy
-rpm exec --update rpmx.sh --update
-rpm exec --fetch rpmx.sh --fetch
-rpm exec --repo rpmx.sh --repo
-rpm exec --smart rpmx.sh --smart
-rpm alias --restriction --define "restriction yes"
-rpm alias --norestriction --define "restriction no"
+# RPM extensions: "rpm --stowaway"
+rpm exec --stowaway rpmx.sh --stowaway \
+ --POPTdesc=$"show files not covered by RPM database"
-# override --with/--without
+# RPM extensions: "rpm --makeproxy"
+rpm exec --makeproxy rpmx.sh --makeproxy \
+ --POPTdesc=$"build proxy binary RPM from foreign binary RPM"
+
+# RPM extensions: "rpm --stowaway"
+rpm exec --fetch rpmx.sh --fetch \
+ --POPTdesc=$"fetch all Source/Patch files of a package"
+
+# RPM exentsion: "rpm -bs --[no]restriction"
+rpm alias --restriction --define "restriction yes" \
+ --POPTdesc=$"exclude %NoSource files in .src.rpm"
+rpm alias --norestriction --define "restriction no" \
+ --POPTdesc=$"include %NoSource files in .src.rpm"
+
+# RPM extension: "rpm --with[out] <name>"
rpm alias --with --define "with_!#:+ yes" \
--POPTdesc=$"set '%option <name> yes'" \
--POPTargs=$"<name>"
@@ -20,12 +25,12 @@
--POPTdesc=$"set '%option with_<name> no'" \
--POPTargs=$"<name>"
-# provide more generalized --option
+# RPM extension: "rpm --option <name> <value>"
rpm alias --option --define "!#:+ !#:+" \
- --POPTdesc=$"set '%option <option> <value>'" \
- --POPTargs=$"<option> <value>"
+ --POPTdesc=$"set '%option <name> <value>'" \
+ --POPTargs=$"<name> <value>"
-# override -i/--info display
+# RPM adjustment: improved and cleaned up "rpm -i/--info"
rpmq alias --info --qf '\
Name: %-25{NAME} Source RPM: %{SOURCERPM}\n\
Version: %-25{VERSION} Build Host: %{BUILDHOST}\n\
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/openpkg/rpmx.pl
============================================================================
$ cvs diff -u -r1.14 -r1.14.2.1 rpmx.pl
--- openpkg-src/openpkg/rpmx.pl 15 Jul 2003 10:08:26 -0000 1.14
+++ openpkg-src/openpkg/rpmx.pl 26 Aug 2003 12:37:49 -0000 1.14.2.1
@@ -7,36 +7,12 @@
## list all files in the hierarchy which are not listed in RPM database
## $ rpm --stowaway
##
-## generate repository information (on server only)
-## $ rpm --makeindex <pkgdir>
-##
-## update local database with latest repository information
-## $ rpm --update
-##
## update the package sources by downloading missing files
## $ rpm --fetch <spec-file>
##
## make a proxy package
## $ rpm --makeproxy <binary-rpm>
##
-## query repository information
-## $ rpm -rqa
-## $ rpm -rqai
-## $ rpm -rqal
-## $ rpm -rqalv
-## $ rpm -rqi package
-## $ rpm -rql package
-## $ rpm -rqlv package
-##
-## update already installed packages
-## $ rpm -Uvhs '*'
-##
-## install/update a particular package and its dependencies
-## $ rpm -Uvhs file-pattern
-##
-## erase a particular package and its dependencies
-## $ rpm -es file-pattern
-##
require 5.000;
@@ -113,7 +89,7 @@
$isdef = 0;
next;
}
- if ($arg =~ m/^--(stowaway|makeindex|update|fetch|makeproxy|repo|smart)$/) {
+ if ($arg =~ m/^--(stowaway|fetch|makeproxy)$/) {
$op = $1;
next;
}
@@ -150,85 +126,17 @@
if ($op eq 'stowaway') {
$rc = &op_stowaway($CFG);
}
- elsif ($op eq 'makeindex') {
- $rc = &op_makeindex($CFG);
- }
- elsif ($op eq 'update') {
- $rc = &op_update($CFG);
- }
elsif ($op eq 'fetch') {
$rc = &op_fetch($CFG);
}
elsif ($op eq 'makeproxy') {
$rc = &op_makeproxy($CFG);
}
- elsif ($op eq 'repo') {
- $rc = &op_repo($CFG);
- }
- elsif ($op eq 'smart') {
- $rc = &op_smart($CFG);
- }
exit($rc);
}
## ______________________________________________________________________
##
-## Database Handling
-## ______________________________________________________________________
-##
-
-# read database file from disk
-sub db_load {
- my ($dbfile) = @_;
-
- if (not -f $dbfile) {
- my $DB = {};
- return $DB;
- }
- my $fp = new IO::File ("<$dbfile") || die "cannot read from Database file
`$dbfile'";
- my $db = '';
- my $buf;
- $db .= $buf while ($fp->read($buf, 128*1024));
- $fp->close;
-
- my $DB = {};
- $db =~ s|<rpm\s+(\S+)>\n(.+?)</rpm>|&load_rpm($DB, $2, $1), ''|isge;
- sub load_rpm {
- my ($DB, $db, $rpm) = @_;
- $DB->{$rpm} = {};
- $db =~ s/<(repos|info|files|requires)>\n(.+?)<\/\1>/$DB->{$rpm}->{uc($1)} =
$2, ''/isge;
- }
- return $DB;
-}
-
-# write database file to disk
-sub db_store {
- my ($dbfile, $DB) = @_;
-
- my $fp = new IO::File (">$dbfile") || die "cannot store to Database file
`$dbfile'";
- my $rpm;
- foreach $rpm (sort(keys(%{$DB}))) {
- print $fp "<rpm $rpm>\n" .
- "<repos>\n" .
- $DB->{$rpm}->{REPOS} .
- "</repos>\n" .
- "<requires>\n" .
- $DB->{$rpm}->{REQUIRES} .
- "</requires>\n" .
- "<info>\n" .
- $DB->{$rpm}->{INFO} .
- "</info>\n" .
- "<files>\n" .
- $DB->{$rpm}->{FILES} .
- "</files>\n" .
- "</rpm>\n";
- }
- $fp->close;
- return;
-}
-
-## ______________________________________________________________________
-##
## Fetch an URL
## ______________________________________________________________________
##
@@ -335,181 +243,6 @@
## ______________________________________________________________________
##
-## Generate Repository Index
-## ______________________________________________________________________
-##
-
-sub op_makeindex {
- my ($CFG) = @_;
-
- if ($#{$CFG->{ARG}} ne 0) {
- print STDERR "rpm: option --makeindex requires an argument\n";
- return 1;
- }
- my $dir = $CFG->{ARG}->[0];
- if (not -d $dir) {
- print STDERR "rpm: --makeindex argument `$dir' is not a directory\n";
- return 1;
- }
- my $index = '';
- my $file;
- my $rpm = $CFG->{PRG}->{"rpm"};
- foreach $file (sort(glob("$dir/*.rpm"))) {
- $file =~ s|^$dir/*||;
- $index .= "<rpm $file>\n";
- $index .= "<requires>\n";
- $index .= `$rpm -qp --qf '[%{REQUIRENAME} %{REQUIREFLAGS:depflags}
%{REQUIREVERSION}\n]' $dir/$file`;
- $index .= "</requires>\n";
- $index .= "<info>\n";
- $index .= `$rpm -qpi $dir/$file`;
- $index .= "</info>\n";
- $index .= "<files>\n";
- $index .= `$rpm -qplv $dir/$file`;
- $index .= "</files>\n";
- $index .= "</rpm>\n";
- }
- open(FP, "|".$CFG->{PRG}->{"bzip2"}.">$dir/INDEX.bz2");
- print FP $index;
- close(FP);
- return 0;
-}
-
-## ______________________________________________________________________
-##
-## Fetch Repository Indices
-## ______________________________________________________________________
-##
-
-sub op_update {
- my ($CFG) = @_;
-
- my $DB = {};
- my $tmpfile = $CFG->{RC}->{_tmppath}."/rpm.update.tmp.".$$;
-
- for ($i = 9; $i >= 0; $i--) {
- my $repo = $CFG->{RC}->{"l_repo_$i"};
- next if (not defined($repo) or $repo eq '' or $repo eq '-');
- $repo =~ s|([^/])$|$1/|;
-
- my $src = $repo."INDEX.bz2";
-
- my $prefix = $src;
- $prefix = substr($prefix, 0, 37)."..." if (length($prefix) > 40);
- printf(STDOUT "%-40s ", $prefix);
-
- if (($err = &fetch_url($CFG, $src, $tmpfile))) {
- $err = substr($err, 0, 37)."..." if (length($err) > 40);
- print STDOUT "FAILED: $err\n";
- next;
- }
-
- my $size = (stat($tmpfile))[7];
- print STDOUT "OK: $size bytes\n";
-
- my $fh = new IO::Handle;
- open($fh, $CFG->{PRG}->{"bzip2"}." -d -c $tmpfile|");
- my $db = '';
- my $buf;
- $db .= $buf while ($fh->read($buf, 128*1024));
- $fh->close;
-
- unlink($tmpfile);
-
- $db =~ s|<rpm\s+(\S+)>\n(.+?)</rpm>|&load_rpm2($DB, $repo, $2, $1), ''|isge;
- sub load_rpm2 {
- my ($DB, $repo, $db, $rpm) = @_;
- my $target = $CFG->{RC}->{_target};
- return if ($rpm !~ m|\.src\.rpm$| and $rpm !~ m|\.$target\.rpm$|);
- my $repos = '';
- if (defined($DB->{$rpm})) {
- $repos = $DB->{$rpm}->{REPOS};
- }
- $repos = $repo."\n".$repos;
- $DB->{$rpm} = {};
- $DB->{$rpm}->{REPOS} = $repos;
- $db =~ s/<(info|files|requires)>\n(.+?)<\/\1>/$DB->{$rpm}->{uc($1)} =
$2, ''/isge;
- }
- }
-
- my $dbfile = $CFG->{RC}->{_dbpath}."/Repository";
- &db_store($dbfile, $DB);
-
- return 0;
-}
-
-## ______________________________________________________________________
-##
-## Repository Queries
-## ______________________________________________________________________
-##
-
-sub op_repo {
- my ($CFG) = @_;
-
- # argument line consistency check
- if (not defined($CFG->{OPT_OPT}->{"-q"})) {
- print STDERR "rpm: option --repo always requires option -q\n";
- return 1;
- }
- my @optok = (qw(--rcfile -q --all -i --list --verbose));
- my $opt;
- my $check;
- foreach $opt (keys(%{$CFG->{OPT_OPT}})) {
- my $ok = 0;
- foreach $check (@optok) {
- if ($check eq $opt) {
- $ok = 1;
- last;
- }
- }
- if (not $ok) {
- print STDERR "rpm: option $opt not supported in conjunction with option
--repo\n";
- return 1;
- }
- }
-
- # load database
- my $dbfile = $CFG->{RC}->{_dbpath}."/Repository";
- if (not -f $dbfile) {
- print STDERR "rpm: option --repo requires local repository index.\n";
- print STDERR "rpm: run \"rpm --update\", first.\n";
- return 1;
- }
- my $DB = &db_load($dbfile);
-
- # perform query operation
- my $target = $CFG->{RC}->{_target};
- my $rpm;
- my $rpms = {};
- foreach $rpm (sort(keys(%{$DB}))) {
- my $name = $rpm;
- $name =~ s|\.src\.rpm$||;
- $name =~ s|\.${target}\.rpm$||;
- next if (defined($rpms->{$name}));
- $rpms->{$name} = 1;
- if ((defined($CFG->{ARG}->[0]) and $rpm =~ m|^$CFG->{ARG}->[0]|)
- or defined($CFG->{OPT_OPT}->{"--all"})) {
- if (not defined($CFG->{OPT_OPT}->{"--list"}) and not
defined($CFG->{OPT_OPT}->{"-i"})) {
- print "$name\n";
- }
- if (defined($CFG->{OPT_OPT}->{"-i"})) {
- print $DB->{$rpm}->{INFO};
- }
- if (defined($CFG->{OPT_OPT}->{"--list"})) {
- my $files = $DB->{$rpm}->{FILES};
- if (not defined($CFG->{OPT_OPT}->{"--verbose"})) {
- if (not ($files =~ s|^.*\s+(\S+\s+->\s+\S+)\s*$|$1|mg)) {
- $files =~ s|^.*\s+(\S+)\s*$|$1|mg;
- }
- }
- print "$files";
- }
- }
- }
-}
-
-## ______________________________________________________________________
-##
## Fetch Operation
## ______________________________________________________________________
##
@@ -660,79 +393,5 @@
unshift(@args, "--prefix=".$CFG->{OPT_ARG}->{"--prefix"});
}
exec $perl, "$prefix/lib/openpkg/mkproxyrpm.pl", "--rpm=$rpm",
"--tmpdir=$tmpdir", @args;
-}
-
-## ______________________________________________________________________
-##
-## Smart Operations
-## ______________________________________________________________________
-##
-
-sub op_smart {
- my ($CFG) = @_;
-
- if ($#{$CFG->{ARG}} ne 0) {
- print STDERR "rpm: option --smart requires one argument\n";
- return 1;
- }
- my $package = $CFG->{ARG}->[0];
-
- # load database
- my $dbfile = $CFG->{RC}->{_dbpath}."/Repository";
- if (not -f $dbfile) {
- print STDERR "rpm: option --smart requires local repository index.\n";
- print STDERR "rpm: run \"rpm --update\", first.\n";
- return 1;
- }
- my $DB = &db_load($dbfile);
-
- my $deps = [];
- &find_deps($CFG, $DB, $deps, $package, '=', 'ANY');
- sub find_deps {
- my ($CFG, $DB, $deps, $pkg, $op, $ver) = @_;
- push(@{$deps}, "$pkg $op $ver");
- my $rpm;
- foreach $rpm (keys(%{$DB})) {
- if (&match_rpm($CFG, $rpm, $pkg, $op, $ver)) {
- my $req;
- foreach $req (split(/\n/, $DB->{$rpm}->{REQUIRES})) {
- $req =~ s|^\s+||sg;
- $req =~ s|\s+$||sg;
- if ($req =~ m|^OpenPKG$| or
- $req =~ m|^rpmlib\(.+\)|) {
- next;
- }
- if ($req =~ m|^(\S+)$|) {
- $req .= " = ANY";
- }
- if ($req =~ m|^(\S+)\s+([=><]+)\s+(\S+)$|) {
- &find_deps($CFG, $DB, $deps, $1, $2, $3);
- }
- }
- }
- }
- }
- sub match_rpm {
- my ($CFG, $rpm, $name, $op, $ver) = @_;
- my $rc = 0;
- my $target = $CFG->{RC}->{_target};
- $rpm =~ s|\.src\.rpm$||;
- $rpm =~ s|\.${target}\.rpm$||;
- if ($rpm =~ m|^(\S+)-([^-]+-[^-]+)$|) {
- my ($tname, $tver) = ($1, $2);
- if ($name eq $tname and &match_version($ver, $op, $tver)) {
- $rc = 1;
- }
- }
- return $rc;
- }
- sub match_version {
- my ($ver, $op, $tver) = @_;
- return 1;
- }
- my $dep;
- foreach $dep (@{$deps}) {
- print "$dep\n";
- }
}
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]