diff options
-rw-r--r-- | gendepslist.cc | 28 | ||||
-rw-r--r-- | hdlist2files.cc | 21 |
2 files changed, 48 insertions, 1 deletions
diff --git a/gendepslist.cc b/gendepslist.cc index 60cb62a..53ded8d 100644 --- a/gendepslist.cc +++ b/gendepslist.cc @@ -40,6 +40,30 @@ vector<string> get_info(Header header, int_32 tag) { return r; } +vector<string> get_files(Header header) { + int_32 type, count, i; + vector<string> r; + char **list; + char ** baseNames, ** dirNames; + int_32 * dirIndexes; + + 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) { + r.reserve(count); + for(i = 0; i < count; i++) { + string s(dirNames[dirIndexes[i]]); + s += baseNames[i]; + r.push_back(s); + } + } + return r; +} + template<class V, class C> C sum(const V &v, const C &join = C()) { typename V::const_iterator p, q; C s = C(); @@ -105,6 +129,10 @@ struct pack { vector<string> files = get_info(header, RPMTAG_OLDFILENAMES); for (IT p = provide.begin(); p != provide.end(); p++) map_insert(provides, *p, name); for (IT p = files.begin(); p != files.end(); p++) map_insert(provides, *p, name); + + vector<string> newfiles = get_files(header); + for (IT p = newfiles.begin(); p != newfiles.end(); p++) map_insert(provides, *p, name); + headerFree(header); return 1; } diff --git a/hdlist2files.cc b/hdlist2files.cc index 1654886..fe905b9 100644 --- a/hdlist2files.cc +++ b/hdlist2files.cc @@ -35,10 +35,29 @@ int main(int argc, char **argv) Header header; int_32 type, count; char **list; + char ** baseNames, ** dirNames; + int_32 * dirIndexes; + while ((header=headerRead(fd, HEADER_MAGIC_YES))) { char *name = get_name(header, RPMTAG_NAME); + headerGetEntry(header, RPMTAG_OLDFILENAMES, &type, (void **) &list, &count); - if (list) for (i = 0; i < count; i++) printf("%s:%s\n", name, list[i]); + + if (list) { + for (i = 0; i < count; i++) printf("%s:%s\n", name, list[i]); + } + + 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) { + for(i = 0; i < count; i++) { + printf("%s:%s\n", name, dirNames[dirIndexes[i]], baseNames[i]); + } + } } } fdClose(fd); |