16#include <zypp/AutoDispose.h>
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;
153#include <zypp/base/Easy.h>
154#include <zypp/base/Logger.h>
155#include <zypp/base/Exception.h>
160#include <zypp/PathInfo.h>
233 ERR <<
"Not a file: " << file << endl;
238 if (
fd == 0 || ::Ferror(
fd) )
240 ERR <<
"Can't open file for reading: " << file <<
" (" << ::Fstrerror(
fd) <<
")" << endl;
252 WAR <<
"Error reading header from " <<
path_r <<
" error(" <<
res <<
")" << endl;
260 return std::make_pair(
h,
res );
278 << (
isSrc() ?
".src}" :
"}");
445#ifdef RPMTAG_OLDSUGGESTS
481 INT <<
"Illegal RPMTAG_dependencyNAME " <<
tag_r << endl;
497 for (
unsigned i = 0;
i <
count; ++
i )
547 WAR <<
"Invalid capability: " <<
n <<
" " << op <<
" "
631#ifdef RPMTAG_OLDSUGGESTS
648#ifdef RPMTAG_OLDSUGGESTS
665#ifdef RPMTAG_OLDSUGGESTS
682#ifdef RPMTAG_OLDSUGGESTS
897 std::string
sigInfo =
format(
"%|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{%|SIGGPG?{%{SIGGPG:pgpsig}}:{%|SIGPGP?{%{SIGPGP:pgpsig}}:{(none)}|}|}|}|");
901 return std::string();
903 std::vector<std::string>
words;
905 if (
words.size() < 3)
906 return std::string();
910 return std::string();
925 std::list<std::string>
ret;
953 std::list<FileInfo>
ret;
1017 ret.push_back( info );
1043 for (
unsigned i = 0;
i <
times.size(); ++
i )
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Store and operate with byte count.
Single entry in a change log.
Store and operate on date (time_t).
Edition represents [epoch:]version[-release]
Base class for Exception.
Wrapper class for stat/lstat.
const std::string & asString() const
Return current Pathname as String.
static bool globalInit()
Initialize lib librpm (read configfiles etc.).
String related utilities and Regular expression matching.
bool startsWith(const C_Str &str_r, const C_Str &prefix_r)
alias for hasPrefix
std::string toUpper(const std::string &s)
Return uppercase version of s.
unsigned split(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \t", const Trim trim_r=NO_TRIM)
Split line_r into words.
Easy-to use interface to the ZYPP dependency resolver.
std::unordered_set< Capability > CapabilitySet
std::list< ChangelogEntry > Changelog
List of ChangelogEntry.
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).