summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-12-15 09:30:56 +0200
committerPanu Matilainen <pmatilai@redhat.com>2010-12-15 09:30:56 +0200
commita2d002a34bc567e8ce88c9ed30270d55d7c904fd (patch)
treef77d7ec761188431cb1321869a4e7586523d157c /build
parent2a54555aa2144f56a2ba518c48830c60da78c4d4 (diff)
downloadlibrpm-tizen-a2d002a34bc567e8ce88c9ed30270d55d7c904fd.tar.gz
librpm-tizen-a2d002a34bc567e8ce88c9ed30270d55d7c904fd.tar.bz2
librpm-tizen-a2d002a34bc567e8ce88c9ed30270d55d7c904fd.zip
Unify the user+group caching between librpm and librpmbuild
- The build version has getUidS() and getGidS() for which there is no counterpart in the rpmug api but there's not much point to them: they check whether the user/groupname exists but return our own string back to us even if it doesn't. - The build version also caches more than current rpmug, but has an ugly hardwired limit causing (in theory) errors that can't be nicely handled, and is the last piece relying on RPMLOG_CRIT actually terminating the process. The librpm version doesn't fail, in the worst case its just a bit slower. And that can be fixed anytime by making it to use hash tables for caching.
Diffstat (limited to 'build')
-rw-r--r--build/build.c3
-rw-r--r--build/files.c21
-rw-r--r--build/parsePrep.c3
3 files changed, 15 insertions, 12 deletions
diff --git a/build/build.c b/build/build.c
index 443cf94d6..aaca9b8ec 100644
--- a/build/build.c
+++ b/build/build.c
@@ -12,6 +12,7 @@
#include <rpm/rpmfileutil.h>
#include "build/rpmbuild_internal.h"
#include "build/rpmbuild_misc.h"
+#include "lib/rpmug.h"
#include "debug.h"
@@ -290,7 +291,7 @@ exit:
rpmlog(RPMLOG_NOTICE, _("\n\nRPM build errors:\n"));
rpmlogPrint(NULL);
}
- freeNames();
+ rpmugFree();
return rc;
}
diff --git a/build/files.c b/build/files.c
index fa47c77bd..276257818 100644
--- a/build/files.c
+++ b/build/files.c
@@ -25,6 +25,7 @@
#include "misc/fts.h"
#include "lib/cpio.h"
#include "lib/rpmfi_internal.h" /* XXX fi->apath */
+#include "lib/rpmug.h"
#include "build/rpmbuild_internal.h"
#include "build/rpmbuild_misc.h"
@@ -1423,21 +1424,21 @@ static rpmRC addFile(FileList fl, const char * diskPath,
fileMode |= fl->cur_ar.ar_fmode;
}
if (fl->cur_ar.ar_user) {
- fileUname = getUnameS(fl->cur_ar.ar_user);
+ fileUname = fl->cur_ar.ar_user;
} else {
- fileUname = getUname(fileUid);
+ fileUname = rpmugUname(fileUid);
}
if (fl->cur_ar.ar_group) {
- fileGname = getGnameS(fl->cur_ar.ar_group);
+ fileGname = fl->cur_ar.ar_group;
} else {
- fileGname = getGname(fileGid);
+ fileGname = rpmugGname(fileGid);
}
/* Default user/group to builder's user/group */
if (fileUname == NULL)
- fileUname = getUname(getuid());
+ fileUname = rpmugUname(getuid());
if (fileGname == NULL)
- fileGname = getGname(getgid());
+ fileGname = rpmugGname(getgid());
/* S_XXX macro must be consistent with type in find call at check-files script */
if (check_fileList && (S_ISREG(fileMode) || S_ISLNK(fileMode))) {
@@ -2027,14 +2028,14 @@ rpmRC processSourceFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags)
flp->fl_mode |= fl.def_ar.ar_fmode;
}
if (fl.def_ar.ar_user) {
- flp->uname = getUnameS(fl.def_ar.ar_user);
+ flp->uname = fl.def_ar.ar_user;
} else {
- flp->uname = getUname(flp->fl_uid);
+ flp->uname = rpmugUname(flp->fl_uid);
}
if (fl.def_ar.ar_group) {
- flp->gname = getGnameS(fl.def_ar.ar_group);
+ flp->gname = fl.def_ar.ar_group;
} else {
- flp->gname = getGname(flp->fl_gid);
+ flp->gname = rpmugGname(flp->fl_gid);
}
flp->langs = xstrdup("");
diff --git a/build/parsePrep.c b/build/parsePrep.c
index ac671cc48..1a9ee6abb 100644
--- a/build/parsePrep.c
+++ b/build/parsePrep.c
@@ -12,6 +12,7 @@
#include <rpm/rpmfileutil.h>
#include "build/rpmbuild_internal.h"
#include "build/rpmbuild_misc.h"
+#include "lib/rpmug.h"
#include "debug.h"
/**
@@ -28,7 +29,7 @@ static rpmRC checkOwners(const char * urlfn)
urlfn, strerror(errno));
return RPMRC_FAIL;
}
- if (!getUname(sb.st_uid) || !getGname(sb.st_gid)) {
+ if (!rpmugUname(sb.st_uid) || !rpmugGname(sb.st_gid)) {
rpmlog(RPMLOG_ERR, _("Bad owner/group: %s\n"), urlfn);
return RPMRC_FAIL;
}