summaryrefslogtreecommitdiffstats
path: root/autoirpm.update-all.cc
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2000-03-26 17:24:04 +0000
committerPascal Rigaux <pixel@mandriva.com>2000-03-26 17:24:04 +0000
commita982d562a19e1bf9d421cc64127635e403dd3f39 (patch)
tree0d50576692fb37646fb5c4fd837e55eab88f7f7f /autoirpm.update-all.cc
parente922549802d625842f87ce2e1857685074f6b344 (diff)
downloadurpmi-a982d562a19e1bf9d421cc64127635e403dd3f39.tar
urpmi-a982d562a19e1bf9d421cc64127635e403dd3f39.tar.gz
urpmi-a982d562a19e1bf9d421cc64127635e403dd3f39.tar.bz2
urpmi-a982d562a19e1bf9d421cc64127635e403dd3f39.tar.xz
urpmi-a982d562a19e1bf9d421cc64127635e403dd3f39.zip
no_comment
Diffstat (limited to 'autoirpm.update-all.cc')
-rw-r--r--autoirpm.update-all.cc44
1 files changed, 30 insertions, 14 deletions
diff --git a/autoirpm.update-all.cc b/autoirpm.update-all.cc
index 90b524e0..de96edd4 100644
--- a/autoirpm.update-all.cc
+++ b/autoirpm.update-all.cc
@@ -44,26 +44,42 @@ int main(int argc, char **argv) {
while ((header=headerRead(fd, HEADER_MAGIC_YES))) {
int_32 type, count;
unsigned short *p;
- char **f, *name, *s;
+ char **f, *name;
int printed = 0;
- headerGetEntry(header, RPMTAG_NAME, &type, (void **) &name, &count);
+ headerGetEntry(header, RPMTAG_NAME, &type, (void **) &name, NULL);
headerGetEntry(header, RPMTAG_FILEMODES, &type, (void **) &p, &count);
- headerGetEntry(header, RPMTAG_OLDFILENAMES, &type, (void **) &f, &count);
- for (; count--; *p++, *f++)
- if ((*p & 040111) == 0111 &&
- (s = strrchr(*f, '/')) &&
- s - 3 >= *f &&
- strncmp(s - 3, "bin", 3) == 0 &&
- (!allow || allow->count(s + 1)) &&
- (!deny || !deny->count(s + 1))) {
+ headerGetEntry(header, RPMTAG_OLDFILENAMES, &type, (void **) &f, NULL);
- if (!printed) {
- printed = 1;
- cout << name;
+ char ** baseNames, ** dirNames;
+ int_32 * dirIndexes;
+ headerGetEntry(header, RPMTAG_BASENAMES, &type, (void **) &baseNames, NULL);
+ headerGetEntry(header, RPMTAG_DIRINDEXES, &type, (void **) &dirIndexes, NULL);
+ headerGetEntry(header, RPMTAG_DIRNAMES, &type, (void **) &dirNames, NULL);
+
+ for (int i = 0; i < count; i++) {
+ if ((p[i] & 040111) == 0111) {
+ int ok;
+ if (f) {
+ char *s = strrchr(f[i], '/');
+ ok = s && s - 3 >= f[i] && strncmp(s - 3, "bin", 3) == 0 &&
+ (!allow || allow->count(s + 1)) &&
+ (!deny || !deny->count(s + 1));
+ } else {
+ char *d = dirNames[dirIndexes[i]];
+ ok = strlen(d) >= 4 && strncmp(d + strlen(d) - 4, "bin/", 4) == 0 &&
+ (!allow || allow->count(baseNames[i])) &&
+ (!deny || !deny->count(baseNames[i]));
+ }
+ if (ok) {
+ if (!printed) {
+ printed = 1;
+ cout << name;
+ }
+ if (f) cout << " " << f[i]; else cout << " " << dirNames[dirIndexes[i]] << baseNames[i];
}
- cout << " " << *f;
}
+ }
if (printed) cout << "\n";
}
fdClose(fd);