aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Lepied <flepied@mandriva.com>2000-02-18 17:21:24 +0000
committerFrederic Lepied <flepied@mandriva.com>2000-02-18 17:21:24 +0000
commitbaa561791594af0e0c98cfc1c9f77fc450db4149 (patch)
tree75c23aff57743a4971613bde748a7396106166a4
parent1ab1ac710b440b016419cf06e9f18a2df979a24e (diff)
downloadrpmtools-baa561791594af0e0c98cfc1c9f77fc450db4149.tar
rpmtools-baa561791594af0e0c98cfc1c9f77fc450db4149.tar.gz
rpmtools-baa561791594af0e0c98cfc1c9f77fc450db4149.tar.bz2
rpmtools-baa561791594af0e0c98cfc1c9f77fc450db4149.tar.xz
rpmtools-baa561791594af0e0c98cfc1c9f77fc450db4149.zip
* new way to retrieve file names in 3.0.4.
-rw-r--r--gendepslist.cc28
-rw-r--r--hdlist2files.cc21
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);