From 06c76d48163efb5a6a9bb4340723baf7a3a0a41c Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 3 May 2018 17:19:19 +0300 Subject: Adapt to optional base repository manifest --- bpkg/rep-create.cxx | 13 ++++++++++--- bpkg/rep-fetch.cxx | 2 +- bpkg/rep-info.cxx | 6 ++---- tests/common/bar/stable/repositories.manifest | 2 +- tests/common/bar/testing/repositories.manifest | 1 + tests/common/bar/unstable/repositories.manifest | 1 + tests/common/prereq-cycle/extra/repositories.manifest | 1 + tests/common/prereq-cycle/math/repositories.manifest | 1 + tests/common/prereq-cycle/stable/repositories.manifest | 1 + tests/common/satisfy/t3/repositories.manifest | 2 +- tests/common/satisfy/t4b/repositories.manifest | 3 ++- tests/common/satisfy/t4c/repositories.manifest | 3 ++- tests/common/satisfy/t4d/repositories.manifest | 2 +- tests/pkg-status/extra/repositories.manifest | 1 + tests/pkg-status/testing/repositories.manifest | 1 + tests/pkg-system/t3/repositories.manifest | 1 + tests/rep-fetch/no-cycle/stable/repositories.manifest | 1 + tests/rep-info.test | 1 + tests/rep-info/testing/repositories.manifest | 1 + tests/rep-list/extra/repositories.manifest | 1 + tests/rep-list/math/repositories.manifest | 1 + tests/rep-list/stable/repositories.manifest | 1 + tests/rep-list/testing/repositories.manifest | 1 + tests/rep-remove/testing/repositories.manifest | 1 + 24 files changed, 36 insertions(+), 13 deletions(-) diff --git a/bpkg/rep-create.cxx b/bpkg/rep-create.cxx index 2de1de1..34aeb2c 100644 --- a/bpkg/rep-create.cxx +++ b/bpkg/rep-create.cxx @@ -5,6 +5,7 @@ #include #include +#include // count_if() #include // dir_iterator #include @@ -180,13 +181,19 @@ namespace bpkg l4 ([&]{trace << "creating repository in " << d;}); - // Load the repositories.manifest file to make sure it is there and is - // valid. + // Load the repositories.manifest file to obtain the certificate, if + // present, for signing the repository. // pkg_repository_manifests rms ( pkg_fetch_repositories (d, o.ignore_unknown ())); - l4 ([&]{trace << rms.size () - 1 << " prerequisite repository(s)";}); + l4 ([&]{trace << count_if (rms.begin(), rms.end(), + [] (const repository_manifest& i) + { + return i.effective_role () != + repository_role::base; + }) + << " prerequisite repository(s)";}); // While we could have serialized as we go along, the order of // packages will be pretty much random and not reproducible. By diff --git a/bpkg/rep-fetch.cxx b/bpkg/rep-fetch.cxx index def7cd0..daefc84 100644 --- a/bpkg/rep-fetch.cxx +++ b/bpkg/rep-fetch.cxx @@ -107,7 +107,7 @@ namespace bpkg authenticate_repository (co, conf, cert_pem, *cert, sm, rl); } - return rep_fetch_data {{move (fr)}, move (cert_pem), move (cert)}; + return rep_fetch_data {{move (fr)}, cert_pem, move (cert)}; } template diff --git a/bpkg/rep-info.cxx b/bpkg/rep-info.cxx index 1ffeee3..f136aad 100644 --- a/bpkg/rep-info.cxx +++ b/bpkg/rep-info.cxx @@ -168,11 +168,9 @@ namespace bpkg // Append the latest base repository manifest. // - // Note that there must be at least one fragment with at least a - // base repository being present. + // Note that there must be at least one fragment. // - assert (!rfd.fragments.empty () && - !rfd.fragments.back ().repositories.empty ()); + assert (!rfd.fragments.empty ()); rms.push_back ( find_base_repository (rfd.fragments.back ().repositories)); diff --git a/tests/common/bar/stable/repositories.manifest b/tests/common/bar/stable/repositories.manifest index b8ecc1f..f150c12 100644 --- a/tests/common/bar/stable/repositories.manifest +++ b/tests/common/bar/stable/repositories.manifest @@ -2,5 +2,5 @@ # : 1 location: ../../foo/stable +role: prerequisite : - diff --git a/tests/common/bar/testing/repositories.manifest b/tests/common/bar/testing/repositories.manifest index 5ab8cba..e62ea48 100644 --- a/tests/common/bar/testing/repositories.manifest +++ b/tests/common/bar/testing/repositories.manifest @@ -2,6 +2,7 @@ # : 1 location: ../../foo/testing +role: prerequisite : location: ../stable role: complement diff --git a/tests/common/bar/unstable/repositories.manifest b/tests/common/bar/unstable/repositories.manifest index d4ddcf5..8b016d6 100644 --- a/tests/common/bar/unstable/repositories.manifest +++ b/tests/common/bar/unstable/repositories.manifest @@ -2,6 +2,7 @@ # : 1 location: ../../foo/testing +role: prerequisite : location: ../testing role: complement diff --git a/tests/common/prereq-cycle/extra/repositories.manifest b/tests/common/prereq-cycle/extra/repositories.manifest index ecaa454..6224296 100644 --- a/tests/common/prereq-cycle/extra/repositories.manifest +++ b/tests/common/prereq-cycle/extra/repositories.manifest @@ -1,3 +1,4 @@ : 1 location: ../stable +role: prerequisite : diff --git a/tests/common/prereq-cycle/math/repositories.manifest b/tests/common/prereq-cycle/math/repositories.manifest index 14d6ce0..af013a1 100644 --- a/tests/common/prereq-cycle/math/repositories.manifest +++ b/tests/common/prereq-cycle/math/repositories.manifest @@ -1,3 +1,4 @@ : 1 location: ../extra +role: prerequisite : diff --git a/tests/common/prereq-cycle/stable/repositories.manifest b/tests/common/prereq-cycle/stable/repositories.manifest index b49d922..52bb197 100644 --- a/tests/common/prereq-cycle/stable/repositories.manifest +++ b/tests/common/prereq-cycle/stable/repositories.manifest @@ -1,3 +1,4 @@ : 1 location: ../math +role: prerequisite : diff --git a/tests/common/satisfy/t3/repositories.manifest b/tests/common/satisfy/t3/repositories.manifest index d65b272..3f9e6e3 100644 --- a/tests/common/satisfy/t3/repositories.manifest +++ b/tests/common/satisfy/t3/repositories.manifest @@ -1,4 +1,4 @@ : 1 location: ../t2 +role: prerequisite : - diff --git a/tests/common/satisfy/t4b/repositories.manifest b/tests/common/satisfy/t4b/repositories.manifest index 7b85e71..3fe7175 100644 --- a/tests/common/satisfy/t4b/repositories.manifest +++ b/tests/common/satisfy/t4b/repositories.manifest @@ -1,3 +1,4 @@ : 1 -location: ../t4a : +location: ../t4a +role: prerequisite diff --git a/tests/common/satisfy/t4c/repositories.manifest b/tests/common/satisfy/t4c/repositories.manifest index 26c0e93..191b026 100644 --- a/tests/common/satisfy/t4c/repositories.manifest +++ b/tests/common/satisfy/t4c/repositories.manifest @@ -1,3 +1,4 @@ : 1 -location: ../t4b : +location: ../t4b +role: prerequisite diff --git a/tests/common/satisfy/t4d/repositories.manifest b/tests/common/satisfy/t4d/repositories.manifest index 6277925..226065c 100644 --- a/tests/common/satisfy/t4d/repositories.manifest +++ b/tests/common/satisfy/t4d/repositories.manifest @@ -1,4 +1,4 @@ : 1 +: location: ../t4c role: complement -: diff --git a/tests/pkg-status/extra/repositories.manifest b/tests/pkg-status/extra/repositories.manifest index ecaa454..6224296 100644 --- a/tests/pkg-status/extra/repositories.manifest +++ b/tests/pkg-status/extra/repositories.manifest @@ -1,3 +1,4 @@ : 1 location: ../stable +role: prerequisite : diff --git a/tests/pkg-status/testing/repositories.manifest b/tests/pkg-status/testing/repositories.manifest index 7bd7269..7520683 100644 --- a/tests/pkg-status/testing/repositories.manifest +++ b/tests/pkg-status/testing/repositories.manifest @@ -3,4 +3,5 @@ location: ../stable role: complement : location: ../extra +role: prerequisite : diff --git a/tests/pkg-system/t3/repositories.manifest b/tests/pkg-system/t3/repositories.manifest index 2715634..2e98364 100644 --- a/tests/pkg-system/t3/repositories.manifest +++ b/tests/pkg-system/t3/repositories.manifest @@ -1,3 +1,4 @@ : 1 location: ../t2 +role: prerequisite : \ No newline at end of file diff --git a/tests/rep-fetch/no-cycle/stable/repositories.manifest b/tests/rep-fetch/no-cycle/stable/repositories.manifest index 14d6ce0..af013a1 100644 --- a/tests/rep-fetch/no-cycle/stable/repositories.manifest +++ b/tests/rep-fetch/no-cycle/stable/repositories.manifest @@ -1,3 +1,4 @@ : 1 location: ../extra +role: prerequisite : diff --git a/tests/rep-info.test b/tests/rep-info.test index e0c7688..66da689 100644 --- a/tests/rep-info.test +++ b/tests/rep-info.test @@ -119,6 +119,7 @@ $* --name $rep/testing >"pkg:build2.org/rep-info/testing ($rep/testing)" : 1 location: ../../foo/testing type: pkg + role: prerequisite : location: ../stable type: pkg diff --git a/tests/rep-info/testing/repositories.manifest b/tests/rep-info/testing/repositories.manifest index 3cc2531..9d763c3 100644 --- a/tests/rep-info/testing/repositories.manifest +++ b/tests/rep-info/testing/repositories.manifest @@ -1,5 +1,6 @@ : 1 location: ../../foo/testing +role: prerequisite : location: ../stable role: complement diff --git a/tests/rep-list/extra/repositories.manifest b/tests/rep-list/extra/repositories.manifest index ecaa454..6224296 100644 --- a/tests/rep-list/extra/repositories.manifest +++ b/tests/rep-list/extra/repositories.manifest @@ -1,3 +1,4 @@ : 1 location: ../stable +role: prerequisite : diff --git a/tests/rep-list/math/repositories.manifest b/tests/rep-list/math/repositories.manifest index 14d6ce0..af013a1 100644 --- a/tests/rep-list/math/repositories.manifest +++ b/tests/rep-list/math/repositories.manifest @@ -1,3 +1,4 @@ : 1 location: ../extra +role: prerequisite : diff --git a/tests/rep-list/stable/repositories.manifest b/tests/rep-list/stable/repositories.manifest index b49d922..52bb197 100644 --- a/tests/rep-list/stable/repositories.manifest +++ b/tests/rep-list/stable/repositories.manifest @@ -1,3 +1,4 @@ : 1 location: ../math +role: prerequisite : diff --git a/tests/rep-list/testing/repositories.manifest b/tests/rep-list/testing/repositories.manifest index 7bd7269..7520683 100644 --- a/tests/rep-list/testing/repositories.manifest +++ b/tests/rep-list/testing/repositories.manifest @@ -3,4 +3,5 @@ location: ../stable role: complement : location: ../extra +role: prerequisite : diff --git a/tests/rep-remove/testing/repositories.manifest b/tests/rep-remove/testing/repositories.manifest index 7bd7269..7520683 100644 --- a/tests/rep-remove/testing/repositories.manifest +++ b/tests/rep-remove/testing/repositories.manifest @@ -3,4 +3,5 @@ location: ../stable role: complement : location: ../extra +role: prerequisite : -- cgit v1.1