diff options
author | rjray <devnull@localhost> | 2000-11-11 09:24:32 +0000 |
---|---|---|
committer | rjray <devnull@localhost> | 2000-11-11 09:24:32 +0000 |
commit | e94ee3fa1b5714e6eeed381912d8263cc560875a (patch) | |
tree | 45de7c45295b6113794666387eeeefc3d4e6614e /Perl-RPM/RPM | |
parent | f7db7be14f8b08f1c949da3a7d891cc2d6ec6036 (diff) | |
download | librpm-tizen-e94ee3fa1b5714e6eeed381912d8263cc560875a.tar.gz librpm-tizen-e94ee3fa1b5714e6eeed381912d8263cc560875a.tar.bz2 librpm-tizen-e94ee3fa1b5714e6eeed381912d8263cc560875a.zip |
All changes in before 0.292 release
CVS patchset: 4253
CVS date: 2000/11/11 09:24:32
Diffstat (limited to 'Perl-RPM/RPM')
-rw-r--r-- | Perl-RPM/RPM/Database.pm | 20 | ||||
-rw-r--r-- | Perl-RPM/RPM/Database.xs | 31 |
2 files changed, 33 insertions, 18 deletions
diff --git a/Perl-RPM/RPM/Database.pm b/Perl-RPM/RPM/Database.pm index ca7ba2c8f..37691cd0d 100644 --- a/Perl-RPM/RPM/Database.pm +++ b/Perl-RPM/RPM/Database.pm @@ -5,7 +5,7 @@ # ############################################################################### # -# $Id: Database.pm,v 1.13 2000/11/10 09:55:51 rjray Exp $ +# $Id: Database.pm,v 1.14 2000/11/11 09:24:32 rjray Exp $ # # Description: The RPM::Database class provides access to the RPM database # as a tied hash, whose keys are taken as the names of @@ -36,7 +36,7 @@ require RPM; require RPM::Header; $VERSION = '0.292'; -$revision = do { my @r=(q$Revision: 1.13 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r }; +$revision = do { my @r=(q$Revision: 1.14 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r }; 1; @@ -183,17 +183,18 @@ claiming ownership of the file "file". Returns of a list of headers for all packages flagged as being in the group specified. -=item find_by_provides(provides) +=item find_what_provides(provides) -Search as above, but based on which packages provide the file/object +Search as above, but based on which package(s) provide the functionality specified as "provides". -=item find_by_required_by(requires) +=item find_what_requires(requires) Return a list of headers for the packages that directly depend on the -specified package for installation and operation. +specified package for installation and operation. The specified package should +be just the name, no version or release information. -=item find_by_conflicts(conflicts) +=item find_what_conflicts(conflicts) List those packages that have conflicts based on the value of "conflicts". @@ -205,6 +206,11 @@ in fact more than one matching record, all are returned. =back +Any of the C<find_*> routines can take an B<RPM::Header> object as an argument, +in which case the package name will be retrieved and used for the argument. In +some cases (such as C<find_by_file>), this is probably not what you want. But +in other cases such as C<find_what_requires>, it may be exactly what you want. + =head2 Importable Defaults Given that there may be only one concurrent process with the rpm database diff --git a/Perl-RPM/RPM/Database.xs b/Perl-RPM/RPM/Database.xs index bfbd6a3ef..9ed27dadf 100644 --- a/Perl-RPM/RPM/Database.xs +++ b/Perl-RPM/RPM/Database.xs @@ -5,7 +5,7 @@ #include <fcntl.h> #include "RPM.h" -static char * const rcsid = "$Id: Database.xs,v 1.9 2000/11/10 08:49:57 rjray Exp $"; +static char * const rcsid = "$Id: Database.xs,v 1.10 2000/11/11 09:24:32 rjray Exp $"; /* rpmdb_TIEHASH @@ -332,7 +332,6 @@ int rpmdb_rebuild(SV* class, const char* root) AV* rpmdb_find_by_whatever(pTHX_ RPM__Database self, SV* string, int idx) { const char* str = NULL; /* For the actual string out of (SV *)string */ - STRLEN len; /* Arg for SvPV(..., len) */ RPM_Database* dbstruct; /* This is the struct used to hold C-level data */ AV* return_val; int result, loop; @@ -345,11 +344,22 @@ AV* rpmdb_find_by_whatever(pTHX_ RPM__Database self, SV* string, int idx) return_val = newAV(); struct_from_object_ret(RPM_Database, dbstruct, self, return_val); - /* De-reference key, if it is a reference */ - if (SvROK(string)) - string = SvRV(string); - /* Get the string */ - str = SvPV(string, len); + if (sv_derived_from(string, "RPM::Header")) + { + SV* fetch_string = rpmhdr_FETCH(aTHX_ (RPM__Header)SvRV(string), + sv_2mortal(newSVpvn("NAME", 4)), + Nullch, 0, 0); + + str = SvPV(fetch_string, PL_na); + } + else + { + /* De-reference key, if it is a reference */ + if (SvROK(string)) + string = SvRV(string); + /* Get the string */ + str = SvPV(string, PL_na); + } #if RPM_MAJOR < 4 /* Create an index set if we don't already have one */ @@ -563,11 +573,10 @@ rpmdb_find_by_file(self, string) SV* string; PROTOTYPE: $$ ALIAS: - # These should not be hard-coded, fix in later rev find_by_group = RPMTAG_GROUP - find_by_provides = RPMTAG_PROVIDENAME - find_by_required_by = RPMTAG_REQUIRENAME - find_by_conflicts = RPMTAG_CONFLICTNAME + find_what_provides = RPMTAG_PROVIDENAME + find_what_requires = RPMTAG_REQUIRENAME + find_what_conflicts = RPMTAG_CONFLICTNAME find_by_package = RPMTAG_NAME PPCODE: { |