aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--rpmtools.pm12
-rw-r--r--rpmtools.spec6
-rw-r--r--rpmtools.xs51
4 files changed, 48 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index a9b903f..8b0eee9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION = 2.2
+VERSION = 2.3
NAME = rpmtools
FROMC = parsehdlist rpm2header #rpm-find-leaves
FROMCC = #gendepslist2 hdlist2names hdlist2files hdlist2prereq hdlist2groups
diff --git a/rpmtools.pm b/rpmtools.pm
index 418e81a..0dd885d 100644
--- a/rpmtools.pm
+++ b/rpmtools.pm
@@ -6,7 +6,7 @@ use vars qw($VERSION @ISA);
require DynaLoader;
@ISA = qw(DynaLoader);
-$VERSION = '0.04';
+$VERSION = '2.3';
bootstrap rpmtools $VERSION;
@@ -26,10 +26,10 @@ rpmtools - Mandrake perl tools to handle rpm files and hdlist files
$params->compute_depslist();
my $db = $params->db_open("");
- $params->db_traverse_names($db,
- [ qw(name version release) ],
- \@names,
- sub {
+ $params->db_traverse_tag($db,
+ "name", \@names,
+ [ qw(name version release) ],
+ sub {
my ($p) = @_;
print "$p->{name}-$p->{version}-$p->{release}\n";
});
@@ -83,7 +83,7 @@ sub new {
bless {
use_base_flag => 0,
flags => [ qw(name version release size arch group requires provides),
- grep { exists $tags{$_} } qw(sense files obsoletes conflicts) ],
+ grep { exists $tags{$_} } qw(sense files obsoletes conflicts conffiles) ],
info => {},
depslist => [],
provides => {},
diff --git a/rpmtools.spec b/rpmtools.spec
index 3be4046..c31d191 100644
--- a/rpmtools.spec
+++ b/rpmtools.spec
@@ -2,7 +2,7 @@
%define release 1mdk
# do not modify here, see Makefile in the CVS
-%define version 2.2
+%define version 2.3
Summary: Contains various rpm command-line tools
Name: %{name}
@@ -51,6 +51,10 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/perl5/man/*/*
%changelog
+* Wed Feb 14 2001 François Pons <fpons@mandrakesoft.com> 2.3-1mdk
+- changed db_traverse_name to more generic db_traverse_tag.
+- rpmtools.pm to 2.3 to match package version.
+
* Sat Feb 10 2001 François Pons <fpons@mandrakesoft.com> 2.2-1mdk
- added faster method to access rpm db to rpmtools.xs
as in DrakX.
diff --git a/rpmtools.xs b/rpmtools.xs
index 1b80442..1ae05c0 100644
--- a/rpmtools.xs
+++ b/rpmtools.xs
@@ -24,8 +24,7 @@
#define HDFLAGS_OBSOLETES 0x00400000
#define HDFLAGS_CONFLICTS 0x00800000
#define HDFLAGS_FILES 0x01000000
-#define HDFLAGS_DIRSIND 0x02000000
-#define HDFLAGS_FILESIND 0x04000000
+#define HDFLAGS_CONFFILES 0x02000000
char *get_name(Header header, int_32 tag) {
@@ -71,16 +70,15 @@ int get_bflag(AV* flag) {
case 7:
if (!strncmp(str, "version", 7)) bflag |= HDFLAGS_VERSION;
else if (!strncmp(str, "release", 7)) bflag |= HDFLAGS_RELEASE;
- else if (!strncmp(str, "dirsind", 7)) bflag |= HDFLAGS_DIRSIND;
break;
case 8:
if (!strncmp(str, "requires", 8)) bflag |= HDFLAGS_REQUIRES;
else if (!strncmp(str, "provides", 8)) bflag |= HDFLAGS_PROVIDES;
- else if (!strncmp(str, "filesind", 8)) bflag |= HDFLAGS_FILESIND;
break;
case 9:
if (!strncmp(str, "obsoletes", 9)) bflag |= HDFLAGS_OBSOLETES;
else if (!strncmp(str, "conflicts", 9)) bflag |= HDFLAGS_CONFLICTS;
+ else if (!strncmp(str, "conffiles", 9)) bflag |= HDFLAGS_CONFFILES;
break;
}
}
@@ -192,15 +190,17 @@ HV* get_info(Header header, int bflag, HV* provides) {
hv_store(header_info, "conflicts", 9, get_table_sense(header, RPMTAG_CONFLICTNAME,
bflag & HDFLAGS_SENSE ? RPMTAG_CONFLICTFLAGS : 0,
bflag & HDFLAGS_SENSE ? RPMTAG_CONFLICTVERSION : 0, 0), 0);
- if (provides || (bflag & HDFLAGS_FILES)) {
+ if (provides || (bflag & (HDFLAGS_FILES | HDFLAGS_CONFFILES))) {
/* at this point, there is a need to parse all files to update provides of needed files,
or to store them. */
AV* table_files = bflag & HDFLAGS_FILES ? newAV() : 0;
+ AV* table_conffiles = bflag & HDFLAGS_CONFFILES ? newAV() : 0;
char ** baseNames, ** dirNames;
int_32 * dirIndexes;
- headerGetEntry(header, RPMTAG_OLDFILENAMES, &type, (void **) &list, &count);
+ headerGetEntry(header, RPMTAG_FILEFLAGS, &type, (void **) &flags, &count);
+ headerGetEntry(header, RPMTAG_OLDFILENAMES, &type, (void **) &list, &count);
if (list) {
for (i = 0; i < count; i++) {
SV** isv;
@@ -219,15 +219,14 @@ HV* get_info(Header header, int bflag, HV* provides) {
hv_store(provides, list[i], len, newSVpv(name, 0), 0); */
if (table_files)
av_push(table_files, newSVpv(list[i], len));
+ if (table_conffiles && flags && flags[i] & RPMFILE_CONFIG)
+ av_push(table_conffiles, newSVpv(list[i], len));
}
}
- headerGetEntry(header, RPMTAG_BASENAMES, &type, (void **) &baseNames,
- &count);
- headerGetEntry(header, RPMTAG_DIRINDEXES, &type, (void **) &dirIndexes,
- NULL);
+ headerGetEntry(header, RPMTAG_BASENAMES, &type, (void **) &baseNames, &count);
+ headerGetEntry(header, RPMTAG_DIRINDEXES, &type, (void **) &dirIndexes, NULL);
headerGetEntry(header, RPMTAG_DIRNAMES, &type, (void **) &dirNames, NULL);
-
if (baseNames && dirNames && dirIndexes) {
char buff[4096];
char *p;
@@ -252,11 +251,15 @@ HV* get_info(Header header, int bflag, HV* provides) {
}
if (table_files)
av_push(table_files, newSVpv(buff, p - buff));
+ if (table_conffiles && flags && flags[i] & RPMFILE_CONFIG)
+ av_push(table_conffiles, newSVpv(buff, p - buff));
}
}
if (table_files)
hv_store(header_info, "files", 5, newRV_noinc((SV*)table_files), 0);
+ if (table_conffiles)
+ hv_store(header_info, "conffiles", 9, newRV_noinc((SV*)table_conffiles), 0);
}
if (provides) {
/* we have to examine provides to update the hash here. */
@@ -312,10 +315,11 @@ _exit(code)
int code
int
-db_traverse_names(db, flags, names, callback)
+db_traverse_tag(db, tag, names, flags, callback)
void *db
- SV *flags
+ char *tag
SV *names
+ SV *flags
SV *callback
PREINIT:
int count = 0;
@@ -328,16 +332,33 @@ db_traverse_names(db, flags, names, callback)
int len = av_len(names_av);
HV* info;
SV** isv;
- int i;
+ int i, rpmtag;
STRLEN str_len;
char *name;
Header header;
rpmdbMatchIterator mi;
+ if (!strcmp(tag, "name"))
+ rpmtag = RPMTAG_NAME;
+ else if (!strcmp(tag, "whatprovides"))
+ rpmtag = RPMTAG_PROVIDENAME;
+ else if (!strcmp(tag, "whatrequires"))
+ rpmtag = RPMTAG_REQUIRENAME;
+ else if (!strcmp(tag, "group"))
+ rpmtag = RPMTAG_GROUP;
+ else if (!strcmp(tag, "triggeredby"))
+ rpmtag = RPMTAG_BASENAMES;
+ else if (!strcmp(tag, "path"))
+ rpmtag = RPMTAG_BASENAMES;
+ else {
+ croak("unknown tag");
+ len = 0;
+ }
+
for (i = 0; i <= len; ++i) {
isv = av_fetch(names_av, i, 0);
name = SvPV(*isv, str_len);
- mi = rpmdbInitIterator((rpmdb)db, RPMTAG_NAME, name, str_len);
+ mi = rpmdbInitIterator((rpmdb)db, rpmtag, name, str_len);
while (header = rpmdbNextIterator(mi)) {
count++;
info = get_info(header, bflag, NULL);