35 static char * lastUname = NULL;
36 static size_t lastUnameLen = 0;
37 static size_t lastUnameAlloced;
39 struct passwd * pwent =
nullptr;
40 size_t thisUnameLen = 0;
45 }
else if (strcmp(thisUname,
"root") == 0) {
52 thisUnameLen = strlen(thisUname);
53 if (lastUname == NULL || thisUnameLen != lastUnameLen ||
54 strcmp(thisUname, lastUname) != 0)
56 if (lastUnameAlloced < thisUnameLen + 1) {
57 lastUnameAlloced = thisUnameLen + 10;
58 lastUname = (
char *)realloc(lastUname, lastUnameAlloced);
61 strcpy(lastUname, thisUname);
64 pwent = getpwnam(thisUname);
69 pwent = getpwnam(thisUname);
70 if (pwent == NULL)
return -1;
73 lastUid = pwent->pw_uid;
85 static char * lastGname = NULL;
86 static size_t lastGnameLen = 0;
87 static size_t lastGnameAlloced;
89 size_t thisGnameLen = 0;
90 struct group * grent =
nullptr;
92 if (thisGname == NULL) {
95 }
else if (strcmp(thisGname,
"root") == 0) {
102 thisGnameLen = strlen(thisGname);
103 if (lastGname == NULL || thisGnameLen != lastGnameLen ||
104 strcmp(thisGname, lastGname) != 0)
106 if (lastGnameAlloced < thisGnameLen + 1) {
107 lastGnameAlloced = thisGnameLen + 10;
108 lastGname = (
char *)realloc(lastGname, lastGnameAlloced);
111 strcpy(lastGname, thisGname);
114 grent = getgrnam(thisGname);
119 grent = getgrnam(thisGname);
122 if (strcmp(thisGname,
"lock") == 0) {
128 if (strcmp(thisGname,
"mail") == 0) {
137 lastGid = grent->gr_gid;
424 rpmTag kindFlags = rpmTag(0);
425 rpmTag kindVersion = rpmTag(0);
429 case RPMTAG_REQUIRENAME:
430 kindFlags = RPMTAG_REQUIREFLAGS;
431 kindVersion = RPMTAG_REQUIREVERSION;
433 case RPMTAG_PROVIDENAME:
434 kindFlags = RPMTAG_PROVIDEFLAGS;
435 kindVersion = RPMTAG_PROVIDEVERSION;
437 case RPMTAG_OBSOLETENAME:
438 kindFlags = RPMTAG_OBSOLETEFLAGS;
439 kindVersion = RPMTAG_OBSOLETEVERSION;
441 case RPMTAG_CONFLICTNAME:
442 kindFlags = RPMTAG_CONFLICTFLAGS;
443 kindVersion = RPMTAG_CONFLICTVERSION;
445#ifdef RPMTAG_OLDSUGGESTS
446 case RPMTAG_OLDENHANCESNAME:
447 kindFlags = RPMTAG_OLDENHANCESFLAGS;
448 kindVersion = RPMTAG_OLDENHANCESVERSION;
450 case RPMTAG_OLDSUGGESTSNAME:
451 kindFlags = RPMTAG_OLDSUGGESTSFLAGS;
452 kindVersion = RPMTAG_OLDSUGGESTSVERSION;
454 case RPMTAG_RECOMMENDNAME:
455 kindFlags = RPMTAG_RECOMMENDFLAGS;
456 kindVersion = RPMTAG_RECOMMENDVERSION;
458 case RPMTAG_SUPPLEMENTNAME:
459 kindFlags = RPMTAG_SUPPLEMENTFLAGS;
460 kindVersion = RPMTAG_SUPPLEMENTVERSION;
462 case RPMTAG_SUGGESTNAME:
463 kindFlags = RPMTAG_SUGGESTFLAGS;
464 kindVersion = RPMTAG_SUGGESTVERSION;
466 case RPMTAG_ENHANCENAME:
467 kindFlags = RPMTAG_ENHANCEFLAGS;
468 kindVersion = RPMTAG_ENHANCEVERSION;
471 case RPMTAG_ENHANCESNAME:
472 kindFlags = RPMTAG_ENHANCESFLAGS;
473 kindVersion = RPMTAG_ENHANCESVERSION;
475 case RPMTAG_SUGGESTSNAME:
476 kindFlags = RPMTAG_SUGGESTSFLAGS;
477 kindVersion = RPMTAG_SUGGESTSVERSION;
481 INT <<
"Illegal RPMTAG_dependencyNAME " << tag_r << endl;
497 for (
unsigned i = 0; i < count; ++i )
500 std::string n( names[i] );
503 int32_t f = flags[i];
504 std::string v = versions[i];
517 switch ( f & RPMSENSE_SENSEMASK )
522 case RPMSENSE_LESS|RPMSENSE_EQUAL:
525 case RPMSENSE_GREATER:
528 case RPMSENSE_GREATER|RPMSENSE_EQUAL:
537 if ((pre && (f & RPMSENSE_PREREQ))
538 || ((! pre) && !(f & RPMSENSE_PREREQ)))
547 WAR <<
"Invalid capability: " << n <<
" " << op <<
" "
925 std::list<std::string> ret;
933 int_list( RPMTAG_DIRINDEXES, dirindexes );
934 for (
unsigned i = 0; i < basenames.
size(); ++ i )
936 ret.push_back( dirnames[dirindexes[i]] + basenames[i] );
953 std::list<FileInfo> ret;
961 int_list( RPMTAG_DIRINDEXES, dirindexes );
963 int_list( RPMTAG_FILESIZES, filesizes );
975 int_list( RPMTAG_FILEMODES, filemodes );
977 int_list( RPMTAG_FILEMTIMES, filemtimes );
979 int_list( RPMTAG_FILEFLAGS, fileflags );
983 for (
unsigned i = 0; i < basenames.
size(); ++ i )
988 uid =
unameToUid( usernames[i].c_str(), &uid );
998 gid =
gnameToGid( groupnames[i].c_str(), &gid );
1006 dirnames[dirindexes[i]] + basenames[i],
1011 mode_t(filemodes[i]),
1013 bool(fileflags[i] & RPMFILE_GHOST),
1017 ret.push_back( info );
Single entry in a change log.