aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-02-29 15:02:38 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-02-29 21:03:22 +0300
commitc25afc11d509b3484e8b7fabb1008128ee9eea92 (patch)
tree74800a5c51f1d6035f0aac8e25f60b0dd1bbe460
parentacd8cb9bfeb0a1d25d38106afe8cb81eb0af4917 (diff)
Allow to unhold unknown orphaned selected package in pkg-build
-rw-r--r--bpkg/pkg-build.cxx44
1 files changed, 26 insertions, 18 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index b430c29..0ebe992 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -4857,36 +4857,44 @@ namespace bpkg
bool sys (arg_sys (pa));
- // Make sure that the package is known.
+ if (pdb != nullptr)
+ sp = pdb->find<selected_package> (pa.name);
+
+ // Make sure that the package is known. Only allow to unhold an
+ // unknown orphaned selected package.
//
if (!existing &&
find_available (repo_configs,
pa.name,
!sys ? pa.constraint : nullopt).empty ())
{
- string n (arg_string (pa, false /* options */));
-
- diag_record dr (fail);
- dr << "unknown package " << n;
- if (sys)
+ // Don't fail if the selected package is held and satisfies the
+ // constraints, if specified. Note that we may still fail later if
+ // the dependency is requested to be deorphaned and still have the
+ // dependents.
+ //
+ if (!(sp != nullptr &&
+ sp->hold_package &&
+ (!pa.constraint || satisfies (sp->version, pa.constraint))))
{
- // Feels like we can't end up here if the version was specified
- // explicitly.
- //
- dr << info << "consider specifying " << n << "/*";
+ string n (arg_string (pa, false /* options */));
+
+ diag_record dr (fail);
+ dr << "unknown package " << n;
+ if (sys)
+ {
+ // Feels like we can't end up here if the version was specified
+ // explicitly.
+ //
+ dr << info << "consider specifying " << n << "/*";
+ }
+ else
+ check_any_available (repo_configs, t, &dr);
}
- else
- check_any_available (repo_configs, t, &dr);
}
if (pdb != nullptr)
- {
- // Save before the name move.
- //
- sp = pdb->find<selected_package> (pa.name);
-
pkg_confs.emplace_back (*pdb, pa.name);
- }
bool hold_version (pa.constraint.has_value ());