diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2023-06-08 18:19:13 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2023-06-08 18:19:13 +0300 |
commit | 7c32ee49af5c84dde672b63b007caab615087d8e (patch) | |
tree | b276188c24ad221f231b39c0b4256f560f44e0eb | |
parent | 9332a219b62dbe5cea9413a6dd5d2c44c8eb9df9 (diff) |
Complete support for bfdir in pkg-bindist for Fedorabuildfile-install
-rw-r--r-- | bpkg/system-package-manager-fedora.cxx | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/bpkg/system-package-manager-fedora.cxx b/bpkg/system-package-manager-fedora.cxx index 6862e93..5537f7a 100644 --- a/bpkg/system-package-manager-fedora.cxx +++ b/bpkg/system-package-manager-fedora.cxx @@ -2645,6 +2645,7 @@ namespace bpkg dir_path docdir; dir_path mandir; dir_path licensedir; + dir_path build2dir; // Note that the ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} // directory paths used by rpmbuild are actually defined as the @@ -2765,7 +2766,8 @@ namespace bpkg mandir = pop_dir (); docdir = pop_dir () / pd; sharedir = pop_dir (); - bfdir = sharedir / dir_path ("build2/export"); + build2dir = sharedir / dir_path ("build2"); + bfdir = build2dir / dir_path ("export"); sharedir /= pd; libdir = pop_dir () / pd; pkgdir = libdir / dir_path ("pkgconfig"); @@ -4036,7 +4038,7 @@ namespace bpkg // We cannot just do usr/share/* since it will clash with doc/, man/, // and licenses/ below. So we have to list all the top-level entries - // in usr/share/ that are not doc/, man/, or licenses/. + // in usr/share/ that are not doc/, man/, licenses/, or build2/. // if (gen_main) { @@ -4044,8 +4046,6 @@ namespace bpkg // establish ownership of the sharedir/<private>/ directory (similar // to what we do for libdir/<private>/ above). // - // @@ TODO: same for bfdir? - // string* private_owner (nullptr); string& fs (!st.common.empty () ? common : main); @@ -4054,7 +4054,10 @@ namespace bpkg { const path& f ((p.first++)->first); - if (f.sub (docdir) || f.sub (mandir) || f.sub (licensedir)) + if (f.sub (docdir) || + f.sub (mandir) || + f.sub (licensedir) || + f.sub (build2dir)) continue; path l (f.leaf (sharedir)); @@ -4093,6 +4096,42 @@ namespace bpkg *private_owner += "%dir %{_datadir}/" + pd + '\n'; } + // Note that we only consider the bfdir/<project>/* sub-entries, + // adding the bfdir/<project>/ subdirectories to the %files + // section. This way no additional directory ownership entry needs to + // be added. Any immediate sub-entries of bfdir/, if present, will be + // ignored, which will end up with the 'unpackaged files' rpmbuild + // error. + // + // Also note that the bfdir/ directory is not owned by any package. + // + if (gen_main) + { + for (auto p (ies.find_sub (bfdir)); p.first != p.second; ) + { + const path& f ((p.first++)->first); + + path l (f.leaf (bfdir)); + + if (!l.simple ()) + { + // Let's keep things tidy and use a sub-directory rather than + // listing all its sub-entries verbatim. + // + dir_path sd (*l.begin ()); + + main += "%{_datadir}/build2/export/" + sd.string () + '/' + '\n'; + + // Skip all the other entries in this subdirectory (in the + // prefix map they will all be in a contiguous range). + // + dir_path d (bfdir / sd); + while (p.first != p.second && p.first->first.sub (d)) + ++p.first; + } + } + } + // Should we put the documentation into -common if there is no -doc? // While there doesn't seem to be anything explicit in the policy, // there are packages that do it this way (e.g., mariadb-common). And |