aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bpkg/rep-fetch.cxx39
-rw-r--r--bpkg/rep-info.cxx23
-rw-r--r--tests/repository/1/math/testing/repositories1
-rw-r--r--tests/repository/1/math/unstable/repositories1
-rw-r--r--tests/repository/1/misc/testing/repositories1
5 files changed, 53 insertions, 12 deletions
diff --git a/bpkg/rep-fetch.cxx b/bpkg/rep-fetch.cxx
index 641efb2..04e09f8 100644
--- a/bpkg/rep-fetch.cxx
+++ b/bpkg/rep-fetch.cxx
@@ -51,7 +51,9 @@ namespace bpkg
for (repository_manifest& rm: rms)
{
- if (rm.location.empty ())
+ repository_role rr (rm.effective_role ());
+
+ if (rr == repository_role::base)
continue; // Entry for this repository.
// If the location is relative, complete it using this repository
@@ -89,12 +91,37 @@ namespace bpkg
if (!pr->fetched)
rep_fetch (co, t, pr);
- level4 ([&]{trace << pr->name () << " prerequisite of " << r->name ();});
-
- if (!r->prerequisites.insert (lazy_weak_ptr<repository> (db, pr)).second)
+ // @@ What if we have duplicated? Ideally, we would like to check
+ // this once and as early as possible. The original idea was to
+ // do it during manifest parsing and serialization. But at that
+ // stage we have no way of completing relative locations (which
+ // is required to calculate canonical names). Current thinking is
+ // that we should have something like rep-verify (similar to
+ // pkg-verify) that performs (potentially expensive) repository
+ // verifications, including making sure prerequisites can be
+ // satisfied from the listed repositories, etc. Perhaps we can
+ // also re-use some of that functionality here. I.e., instead of
+ // calling the "naked" fetch_repositories() above, we will call
+ // a function from rep-verify that will perform extra verifications.
+ //
+ switch (rr)
{
- fail << "duplicate prerequisite repository " << pr->location << " "
- << "in " << r->name ();
+ case repository_role::complement:
+ {
+ level4 ([&]{trace << pr->name () << " complement of "
+ << r->name ();});
+ r->complements.insert (lazy_shared_ptr<repository> (db, pr));
+ break;
+ }
+ case repository_role::prerequisite:
+ {
+ level4 ([&]{trace << pr->name () << " prerequisite of "
+ << r->name ();});
+ r->prerequisites.insert (lazy_weak_ptr<repository> (db, pr));
+ break;
+ }
+ case repository_role::base:
+ assert (false);
}
}
diff --git a/bpkg/rep-info.cxx b/bpkg/rep-info.cxx
index 224866c..8bb3c7d 100644
--- a/bpkg/rep-info.cxx
+++ b/bpkg/rep-info.cxx
@@ -61,14 +61,25 @@ namespace bpkg
{
for (const repository_manifest& rm: rms)
{
- if (rm.location.empty ())
- continue; // Itself.
+ repository_role rr (rm.effective_role ());
- repository_location l (rm.location, rl); // Complete.
+ if (rr == repository_role::base)
+ continue; // Entry for this repository.
- //@@ Handle complements.
- //
- cout << "prerequisite " << l.canonical_name () << " " << l << endl;
+ repository_location l (rm.location, rl); // Complete.
+ const string& n (l.canonical_name ());
+
+ switch (rr)
+ {
+ case repository_role::complement:
+ cout << "complement " << n << " " << l << endl;
+ break;
+ case repository_role::prerequisite:
+ cout << "prerequisite " << n << " " << l << endl;
+ break;
+ case repository_role::base:
+ assert (false);
+ }
}
}
}
diff --git a/tests/repository/1/math/testing/repositories b/tests/repository/1/math/testing/repositories
index 9165f28..5210aa4 100644
--- a/tests/repository/1/math/testing/repositories
+++ b/tests/repository/1/math/testing/repositories
@@ -4,4 +4,5 @@
location: ../../misc/testing
:
location: ../stable
+role: complement
:
diff --git a/tests/repository/1/math/unstable/repositories b/tests/repository/1/math/unstable/repositories
index acad591..4c9d2bf 100644
--- a/tests/repository/1/math/unstable/repositories
+++ b/tests/repository/1/math/unstable/repositories
@@ -4,4 +4,5 @@
location: ../../misc/testing
:
location: ../testing
+role: complement
:
diff --git a/tests/repository/1/misc/testing/repositories b/tests/repository/1/misc/testing/repositories
index 6be28f1..8f5e35c 100644
--- a/tests/repository/1/misc/testing/repositories
+++ b/tests/repository/1/misc/testing/repositories
@@ -2,4 +2,5 @@
#
: 1
location: ../stable
+role: complement
: