diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2023-06-13 21:05:35 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2023-06-16 11:10:04 +0300 |
commit | 32e4cffb444d4ad936c9037eecea9bd78f81f3d0 (patch) | |
tree | bbbb4452a88f47449c86a7ff85b9617ab7b621da /bpkg/package.cxx | |
parent | c98f1215387f993329a96785a2a9102d93cb0328 (diff) |
Add --mask-repository pkg-build optionmask-repos-old
Diffstat (limited to 'bpkg/package.cxx')
-rw-r--r-- | bpkg/package.cxx | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/bpkg/package.cxx b/bpkg/package.cxx index c98e7a4..c19f95d 100644 --- a/bpkg/package.cxx +++ b/bpkg/package.cxx @@ -17,6 +17,41 @@ namespace bpkg { const version wildcard_version (0, "0", nullopt, nullopt, 0); + // repository + // + bool + masked_repository (const lazy_weak_ptr<repository>& rf) + { + // Optimize for the common case when no repositories are masked to avoid + // an unnecessary load of the lazy pointer. + // + return masked_repositories () && masked_repository (rf.load ()->location); + } + + bool + masked_repository (const shared_ptr<repository>& rf) + { + return masked_repository (rf->location); + } + + // repository_fragment + // + bool + masked_repository_fragment (const lazy_shared_ptr<repository_fragment>& rf) + { + // Optimize for the common case when no repositories are masked to avoid + // an unnecessary load of the lazy pointer. + // + return masked_repositories () && + masked_repository_fragment (rf.load ()->location); + } + + bool + masked_repository_fragment (const shared_ptr<repository_fragment>& rf) + { + return masked_repository_fragment (rf->location); + } + // configuration // configuration:: @@ -373,7 +408,8 @@ namespace bpkg { const shared_ptr<repository_fragment>& rf (prf.repository_fragment); - if (rf->location.directory_based ()) + if (!masked_repository_fragment (rf) && + rf->location.directory_based ()) fail << "external package " << n << '/' << v << " is already available from " << rf->location.canonical_name (); |