[Rpm-maint] [Suse patch] %srcdefattr macro
Panu Matilainen
pmatilai at redhat.com
Mon Jun 4 13:16:30 UTC 2007
While I don't personally see a big deal in who's the owner of the files in
src.rpm's, various people apparently do, for various reasons. By the looks
of it, doesn't change existing behavior unless actually used so it's
harmless enough; I don't see why this couldn't go in.
Holler within a couple of days if you strongly disagree...
- Panu -
---
Add new srcdefattr macro. Usefull for assuring that all files
in the src rpms belong to root:root [#48870] rh#125515
--- ./build/files.c.orig 2005-12-14 19:22:43.000000000 +0000
+++ ./build/files.c 2006-02-17 13:57:25.000000000 +0000
@@ -2260,7 +2274,15 @@ int processSourceFiles(Spec spec)
struct FileList_s fl;
char *s, **files, **fp;
Package pkg;
+ static char *_srcdefattr;
+ static int oneshot;
+ if (!oneshot) {
+ _srcdefattr = rpmExpand("%{?_srcdefattr}", NULL);
+ if (_srcdefattr && !*_srcdefattr)
+ _srcdefattr = _free(_srcdefattr);
+ oneshot = 1;
+ }
sourceFiles = newStringBuf();
/* XXX
@@ -2311,6 +2333,15 @@ int processSourceFiles(Spec spec)
spec->sourceCpioList = NULL;
+ /* Init the file list structure */
+ memset(&fl, 0, sizeof(fl));
+ if (_srcdefattr) {
+ char *a = xmalloc(strlen(_srcdefattr) + 9 + 1);
+ strcpy(a, "%defattr ");
+ strcpy(a + 9, _srcdefattr);
+ parseForAttr(a, &fl);
+ a = _free(a);
+ }
fl.fileList = xcalloc((spec->numSources + 1), sizeof(*fl.fileList));
fl.processingFailed = 0;
fl.fileListRecsUsed = 0;
@@ -2359,8 +2390,20 @@ int processSourceFiles(Spec spec)
fl.processingFailed = 1;
}
- flp->uname = getUname(flp->fl_uid);
- flp->gname = getGname(flp->fl_gid);
+ if (fl.def_ar.ar_fmodestr) {
+ flp->fl_mode &= S_IFMT;
+ flp->fl_mode |= fl.def_ar.ar_fmode;
+ }
+ if (fl.def_ar.ar_user) {
+ flp->uname = getUnameS(fl.def_ar.ar_user);
+ } else {
+ flp->uname = getUname(flp->fl_uid);
+ }
+ if (fl.def_ar.ar_group) {
+ flp->gname = getGnameS(fl.def_ar.ar_group);
+ } else {
+ flp->gname = getGname(flp->fl_gid);
+ }
flp->langs = xstrdup("");
fl.totalFileSize += flp->fl_size;
@@ -2384,6 +2427,7 @@ int processSourceFiles(Spec spec)
sourceFiles = freeStringBuf(sourceFiles);
fl.fileList = freeFileList(fl.fileList, fl.fileListRecsUsed);
+ freeAttrRec(&fl.def_ar);
return fl.processingFailed;
}
More information about the Rpm-maint
mailing list