diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2007-06-07 13:19:43 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2007-06-07 13:19:43 +0300 |
commit | f17f9a948aee4ba26511eabd255e55a22596e9b9 (patch) | |
tree | b5acdbe5348e4373b0b77476f23f568769654ea9 /build | |
parent | 22281cf90b1b684b765026bb817c4eb9edb87173 (diff) | |
download | rpm-f17f9a948aee4ba26511eabd255e55a22596e9b9.tar.gz rpm-f17f9a948aee4ba26511eabd255e55a22596e9b9.tar.bz2 rpm-f17f9a948aee4ba26511eabd255e55a22596e9b9.zip |
Add new srcdefattr macro (Michael Schroeder / OpenSuSE)
Helps avoiding useless warnings when installing src.rpm's etc.
(susebz#48870, rhbz#125515)
Diffstat (limited to 'build')
-rw-r--r-- | build/files.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/build/files.c b/build/files.c index 00633c843..e2ef2869c 100644 --- a/build/files.c +++ b/build/files.c @@ -2272,7 +2272,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 @@ -2323,6 +2331,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; @@ -2371,8 +2388,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; @@ -2396,6 +2425,7 @@ int processSourceFiles(Spec spec) sourceFiles = freeStringBuf(sourceFiles); fl.fileList = freeFileList(fl.fileList, fl.fileListRecsUsed); + freeAttrRec(&fl.def_ar); return fl.processingFailed; } |