summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2012-08-01 16:00:16 +0300
committerPanu Matilainen <pmatilai@redhat.com>2012-08-01 16:25:43 +0300
commitd6775a746bbaf8ddc8a91c9fae68ae91af1cc570 (patch)
treea77fd5cf763efe3e7d8ed4dcaaf4741af024a4c1 /build
parent24ad8291bbcdb523f1aa58d75e29f9ffeb484b52 (diff)
downloadrpm-d6775a746bbaf8ddc8a91c9fae68ae91af1cc570.tar.gz
rpm-d6775a746bbaf8ddc8a91c9fae68ae91af1cc570.tar.bz2
rpm-d6775a746bbaf8ddc8a91c9fae68ae91af1cc570.zip
Permit non-existent %ghost directories to be packaged (RhBug:839656)
- Directories can be explicitly specified via either %dir or trailing slash in the %files manifest, take this into account for %ghosts that dont exist in the buildroot. Otherwise we still assume regular file. - Dont require explicit %attr() for missing %ghosts, let them fall back to %defattr() instead. If %defattr() doesn't specify a mode the file will be seen without any permissions at all, but that's not strictly an error (and same can happen with %dev() already)
Diffstat (limited to 'build')
-rw-r--r--build/files.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/build/files.c b/build/files.c
index f74863bec..1cfe7c4d4 100644
--- a/build/files.c
+++ b/build/files.c
@@ -1320,16 +1320,16 @@ static rpmRC addFile(FileList fl, const char * diskPath,
int is_ghost = fl->cur.attrFlags & RPMFILE_GHOST;
if (lstat(diskPath, statp)) {
- if (is_ghost) { /* the file is %ghost missing from build root, assume regular file */
- if (fl->cur.ar.ar_fmodestr != NULL) {
- statp->st_mode = S_IFREG | (fl->cur.ar.ar_fmode & 0777);
- } else {
- rpmlog(RPMLOG_ERR, _("Explicit file attributes required in spec for: %s\n"), diskPath);
- goto exit;
- }
+ if (is_ghost) {
+ /* non-existing %ghost file or directory */
+ statp->st_mode = fl->cur.isDir ? S_IFDIR : S_IFREG;
+ statp->st_mode |= (fl->cur.ar.ar_fmode & 0777);
statp->st_atime = now;
statp->st_mtime = now;
statp->st_ctime = now;
+ /* can't recurse into non-existing directory */
+ if (fl->cur.isDir)
+ fl->cur.isDir = 1;
} else {
int lvl = RPMLOG_ERR;
const char *msg = fl->cur.isDir ?