aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bpkg/auth.cxx5
-rw-r--r--bpkg/rep-add.cxx2
-rw-r--r--bpkg/repository-signing.cli13
-rw-r--r--tests/rep-add.test10
-rw-r--r--tests/rep-auth.test80
-rw-r--r--tests/rep-fetch.test48
-rw-r--r--tests/rep-info.test18
7 files changed, 92 insertions, 84 deletions
diff --git a/bpkg/auth.cxx b/bpkg/auth.cxx
index da4d0b5..82e17ec 100644
--- a/bpkg/auth.cxx
+++ b/bpkg/auth.cxx
@@ -699,7 +699,10 @@ namespace bpkg
};
pair<string, string> c (split (cert.name));
- pair<string, string> r (split (rl.canonical_name ()));
+
+ // Strip 'bpkg:' prefix.
+ //
+ pair<string, string> r (split (rl.canonical_name ().substr (5)));
// Match the repository canonical name leading part.
//
diff --git a/bpkg/rep-add.cxx b/bpkg/rep-add.cxx
index d18536f..7adb843 100644
--- a/bpkg/rep-add.cxx
+++ b/bpkg/rep-add.cxx
@@ -56,9 +56,7 @@ namespace bpkg
shared_ptr<repository> root (db.load<repository> (""));
if (!root->complements.insert (lazy_shared_ptr<repository> (db, r)).second)
- {
fail << rn << " is already a repository of this configuration";
- }
db.update (root);
t.commit ();
diff --git a/bpkg/repository-signing.cli b/bpkg/repository-signing.cli
index d4d32a6..f6ee7fa 100644
--- a/bpkg/repository-signing.cli
+++ b/bpkg/repository-signing.cli
@@ -92,12 +92,13 @@ it. Also use a working email address in case users need to contact you about
issues with your certificate. Note that the \cb{name:} prefix in the \cb{CN}
value is not a typo.
-The \cb{name} field is a canonical repository name prefix. Any repository with
-a canonical name that starts with this prefix can be authenticated by this
-certificate (see the repository manifest documentation for more information on
-canonical names). For example, name \cb{example.com} will match any
-repository hosted on \cb{{,www.,pkg.,bpkg.\}example.com}. While name
-\cb{example.com/math} will match \cb{{...\}example.com/pkg/1/math} but not
+The \cb{name} field is a canonical repository name prefix with the \cb{bpkg:}
+type part stripped. Any repository with a canonical name that starts with this
+prefix can be authenticated by this certificate (see the repository manifest
+documentation for more information on canonical names). For example, name
+\cb{example.com} will match any repository hosted on
+\cb{{,www.,pkg.,bpkg.\}example.com}. While name \cb{example.com/math} will
+match \cb{{...\}example.com/pkg/1/math} but not
\cb{{...\}example.com/pkg/1/misc}.
A certificate name can also contain a subdomain wildcard. A wildcard name in
diff --git a/tests/rep-add.test b/tests/rep-add.test
index 28a7a20..4e203cc 100644
--- a/tests/rep-add.test
+++ b/tests/rep-add.test
@@ -66,21 +66,21 @@
:
$clone_cfg;
$* 'git://example.org/repo#master' 2>>EOE
- added repository example.org/repo
+ added repository git:example.org/repo
EOE
: http-git
:
$clone_cfg;
$* 'http://example.org/repo.git#master' 2>>EOE
- added repository example.org/repo
+ added repository git:example.org/repo
EOE
: http-bpkg
:
$clone_cfg;
$* 'http://example.org/1/repo' 2>>EOE
- added repository example.org/repo
+ added repository bpkg:example.org/repo
EOE
: file-git
@@ -135,10 +135,10 @@
$clone_cfg;
$* 'http://pkg.example.org/1/testing' 2>>~%EOE%;
- %added repository example.org/testing%
+ %added repository bpkg:example.org/testing%
EOE
$* 'https://www.example.org/1/testing' 2>>~%EOE% != 0
- %error: example.org/testing is already a repository of this configuration%
+ %error: bpkg:example.org/testing is already a repository of this configuration%
EOE
}
diff --git a/tests/rep-auth.test b/tests/rep-auth.test
index c67bd75..5fa3568 100644
--- a/tests/rep-auth.test
+++ b/tests/rep-auth.test
@@ -173,8 +173,8 @@ sc = " " # Space character to append to here-document line when required.
$clone_cfg;
$rep_fetch 2>>"EOE" != 0;
- fetching build2.org/rep-auth/signed
- warning: authenticity of the certificate for repository build2.org/rep-auth/signed cannot be established
+ fetching bpkg:build2.org/rep-auth/signed
+ warning: authenticity of the certificate for repository bpkg:build2.org/rep-auth/signed cannot be established
certificate is for build2.org, "Code Synthesis" <info@build2.org>
certificate SHA256 fingerprint:
$cert_fp
@@ -191,7 +191,7 @@ sc = " " # Space character to append to here-document line when required.
$clone_cfg;
$rep_fetch --trust $cert_fp 2>>EOE;
- fetching build2.org/rep-auth/signed
+ fetching bpkg:build2.org/rep-auth/signed
1 package(s) in 1 repository(s)
EOE
@@ -204,7 +204,7 @@ sc = " " # Space character to append to here-document line when required.
$clone_cfg;
$rep_fetch --trust-no --trust $cert_fp 2>>EOE;
- fetching build2.org/rep-auth/signed
+ fetching bpkg:build2.org/rep-auth/signed
1 package(s) in 1 repository(s)
EOE
@@ -217,7 +217,7 @@ sc = " " # Space character to append to here-document line when required.
$clone_cfg;
$rep_fetch --trust-yes 2>>EOE;
- fetching build2.org/rep-auth/signed
+ fetching bpkg:build2.org/rep-auth/signed
1 package(s) in 1 repository(s)
EOE
@@ -230,8 +230,8 @@ sc = " " # Space character to append to here-document line when required.
$clone_cfg;
$rep_fetch --trust-no 2>>EOE != 0;
- fetching build2.org/rep-auth/signed
- error: authenticity of the certificate for repository build2.org/rep-auth/signed cannot be established
+ fetching bpkg:build2.org/rep-auth/signed
+ error: authenticity of the certificate for repository bpkg:build2.org/rep-auth/signed cannot be established
EOE
$not_fetched
@@ -243,7 +243,7 @@ sc = " " # Space character to append to here-document line when required.
$clone_cfg;
$rep_fetch --trust-yes --trust-no 2>>EOE != 0;
- fetching build2.org/rep-auth/signed
+ fetching bpkg:build2.org/rep-auth/signed
error: --trust-yes and --trust-no are mutually exclusive
EOE
@@ -256,19 +256,19 @@ sc = " " # Space character to append to here-document line when required.
$clone_cfg;
$rep_fetch --trust-yes 2>>EOE;
- fetching build2.org/rep-auth/signed
+ fetching bpkg:build2.org/rep-auth/signed
1 package(s) in 1 repository(s)
EOE
$rep_fetch 2>>EOE;
- fetching build2.org/rep-auth/signed
+ fetching bpkg:build2.org/rep-auth/signed
1 package(s) in 1 repository(s)
EOE
$fetched;
$rep_fetch --trust-no 2>>EOE;
- fetching build2.org/rep-auth/signed
+ fetching bpkg:build2.org/rep-auth/signed
1 package(s) in 1 repository(s)
EOE
@@ -284,7 +284,7 @@ sc = " " # Space character to append to here-document line when required.
: no-auth
:
$rep_info 2>>"EOE" != 0
- warning: authenticity of the certificate for repository build2.org/rep-auth/signed cannot be established
+ warning: authenticity of the certificate for repository bpkg:build2.org/rep-auth/signed cannot be established
certificate is for build2.org, "Code Synthesis" <info@build2.org>
certificate SHA256 fingerprint:
$cert_fp
@@ -303,7 +303,7 @@ sc = " " # Space character to append to here-document line when required.
: trust-no
:
$rep_info --trust-no 2>>EOE != 0
- error: authenticity of the certificate for repository build2.org/rep-auth/signed cannot be established
+ error: authenticity of the certificate for repository bpkg:build2.org/rep-auth/signed cannot be established
EOE
: already-trusted
@@ -347,11 +347,11 @@ sc = " " # Space character to append to here-document line when required.
:
{
r = $canonicalize([dir_path] $~/pkg/1/b.a.build2.org/);
- mkdir -p $r;
+ mkdir -p $r;
cp -r $rep/self-match $r;
$rep_info $r/self-match 2>>EOE != 0
- error: certificate name mismatch for repository b.a.build2.org/self-match
+ error: certificate name mismatch for repository bpkg:b.a.build2.org/self-match
info: certificate name is *build2.org
EOE
}
@@ -397,7 +397,7 @@ sc = " " # Space character to append to here-document line when required.
: exact
:
$rep_info $rep/subdomain-match 2>>EOE != 0
- error: certificate name mismatch for repository build2.org/rep-auth/subdomain-match
+ error: certificate name mismatch for repository bpkg:build2.org/rep-auth/subdomain-match
info: certificate name is *.build2.org
EOE
@@ -419,11 +419,11 @@ sc = " " # Space character to append to here-document line when required.
:
{
r = $canonicalize([dir_path] $~/pkg/1/b.a.build2.org/);
- mkdir -p $r;
+ mkdir -p $r;
cp -r $rep/subdomain-match $r;
$rep_info $r/subdomain-match 2>>EOE != 0
- error: certificate name mismatch for repository b.a.build2.org/subdomain-match
+ error: certificate name mismatch for repository bpkg:b.a.build2.org/subdomain-match
info: certificate name is *.build2.org
EOE
}
@@ -447,8 +447,8 @@ sc = " " # Space character to append to here-document line when required.
$clone_cfg;
$rep_fetch 2>>~%EOE% != 0;
- fetching build2.org/rep-auth/unsigned1
- warning: repository build2.org/rep-auth/unsigned1 is unsigned
+ fetching bpkg:build2.org/rep-auth/unsigned1
+ warning: repository bpkg:build2.org/rep-auth/unsigned1 is unsigned
%continue without authenticating repositories at .+\? \[y/n\] %
error: unable to read y/n answer from STDOUT
EOE
@@ -462,7 +462,7 @@ sc = " " # Space character to append to here-document line when required.
$clone_cfg;
$rep_fetch --trust-yes 2>>EOE;
- fetching build2.org/rep-auth/unsigned1
+ fetching bpkg:build2.org/rep-auth/unsigned1
1 package(s) in 1 repository(s)
EOE
@@ -475,8 +475,8 @@ sc = " " # Space character to append to here-document line when required.
$clone_cfg;
$rep_fetch --trust-no 2>>EOE != 0;
- fetching build2.org/rep-auth/unsigned1
- error: repository build2.org/rep-auth/unsigned1 is unsigned
+ fetching bpkg:build2.org/rep-auth/unsigned1
+ error: repository bpkg:build2.org/rep-auth/unsigned1 is unsigned
EOE
$not_fetched
@@ -488,19 +488,19 @@ sc = " " # Space character to append to here-document line when required.
$clone_cfg;
$rep_fetch --trust-yes 2>>EOE;
- fetching build2.org/rep-auth/unsigned1
+ fetching bpkg:build2.org/rep-auth/unsigned1
1 package(s) in 1 repository(s)
EOE
$rep_fetch 2>>EOE;
- fetching build2.org/rep-auth/unsigned1
+ fetching bpkg:build2.org/rep-auth/unsigned1
1 package(s) in 1 repository(s)
EOE
$fetched;
$rep_fetch --trust-no 2>>EOE;
- fetching build2.org/rep-auth/unsigned1
+ fetching bpkg:build2.org/rep-auth/unsigned1
1 package(s) in 1 repository(s)
EOE
@@ -509,8 +509,8 @@ sc = " " # Space character to append to here-document line when required.
$rep_add $rep/unsigned2;
$rep_fetch 2>>EOE;
- fetching build2.org/rep-auth/unsigned1
- fetching build2.org/rep-auth/unsigned2
+ fetching bpkg:build2.org/rep-auth/unsigned1
+ fetching bpkg:build2.org/rep-auth/unsigned2
1 package(s) in 2 repository(s)
EOE
@@ -526,19 +526,21 @@ sc = " " # Space character to append to here-document line when required.
: no-auth
:
$rep_info 2>>~%EOE% != 0
- warning: repository build2.org/rep-auth/unsigned1 is unsigned
+ warning: repository bpkg:build2.org/rep-auth/unsigned1 is unsigned
%continue without authenticating repositories at .+\? \[y/n\] %
error: unable to read y/n answer from STDOUT
EOE
: trust-yes
:
- $rep_info --trust-yes >"build2.org/rep-auth/unsigned1 ($rep/unsigned1)"
+ $rep_info --trust-yes >>"EOO"
+ bpkg:build2.org/rep-auth/unsigned1 ($rep/unsigned1)
+ EOO
: trust-no
:
$rep_info --trust-no 2>>EOE != 0
- error: repository build2.org/rep-auth/unsigned1 is unsigned
+ error: repository bpkg:build2.org/rep-auth/unsigned1 is unsigned
EOE
: already-trusted
@@ -547,8 +549,12 @@ sc = " " # Space character to append to here-document line when required.
$clone_root_cfg;
rep_info += -d cfg;
- $rep_info --trust-yes >"build2.org/rep-auth/unsigned1 ($rep/unsigned1)";
- $rep_info >"build2.org/rep-auth/unsigned1 ($rep/unsigned1)"
+ $rep_info --trust-yes >>"EOO";
+ bpkg:build2.org/rep-auth/unsigned1 ($rep/unsigned1)
+ EOO
+ $rep_info >>"EOO"
+ bpkg:build2.org/rep-auth/unsigned1 ($rep/unsigned1)
+ EOO
}
}
}
@@ -561,20 +567,20 @@ sc = " " # Space character to append to here-document line when required.
: name-mismatch
:
$rep_info $rep/name-mismatch 2>>EOE != 0
- error: certificate name mismatch for repository build2.org/rep-auth/name-mismatch
+ error: certificate name mismatch for repository bpkg:build2.org/rep-auth/name-mismatch
info: certificate name is build2.org/mismatched/name
EOE
: expired
:
$rep_info $rep/expired 2>>EOE != 0
- error: certificate for repository build2.org/rep-auth/expired has expired
+ error: certificate for repository bpkg:build2.org/rep-auth/expired has expired
EOE
: sha256sum-mismatch
:
$rep_info $rep/sha256sum-mismatch 2>>EOE != 0
- error: packages manifest file checksum mismatch for build2.org/rep-auth/sha256sum-mismatch
+ error: packages manifest file checksum mismatch for bpkg:build2.org/rep-auth/sha256sum-mismatch
info: try again
EOE
@@ -582,7 +588,7 @@ sc = " " # Space character to append to here-document line when required.
:
$rep_info $rep/signature-mismatch 2>>~%EOE% != 0
%.*
- %error: unable to authenticate repository build2.org/rep-auth/signature-mismatch: .*%
+ %error: unable to authenticate repository bpkg:build2.org/rep-auth/signature-mismatch: .*%
EOE
: create-rep
diff --git a/tests/rep-fetch.test b/tests/rep-fetch.test
index a733ee5..c9f026d 100644
--- a/tests/rep-fetch.test
+++ b/tests/rep-fetch.test
@@ -73,12 +73,12 @@ $* 2>>/EOE != 0
$clone_cfg && $rep_add $rep/hello;
$* --trust $cert_fp 2>>EOE &cfg/.bpkg/certs/***;
- fetching build2.org/rep-fetch/hello
+ fetching bpkg:build2.org/rep-fetch/hello
1 package(s) in 1 repository(s)
EOE
$* 2>>EOE
- fetching build2.org/rep-fetch/hello
+ fetching bpkg:build2.org/rep-fetch/hello
1 package(s) in 1 repository(s)
EOE
}
@@ -89,20 +89,20 @@ $* 2>>/EOE != 0
$clone_cfg && $rep_add $rep/bar/unstable;
$* --trust-yes 2>>EOE;
- fetching build2.org/rep-fetch/bar/unstable
- fetching build2.org/rep-fetch/foo/testing (prerequisite of build2.org/rep-fetch/bar/unstable)
- fetching build2.org/rep-fetch/foo/stable (complements build2.org/rep-fetch/foo/testing)
- fetching build2.org/rep-fetch/bar/testing (complements build2.org/rep-fetch/bar/unstable)
- fetching build2.org/rep-fetch/bar/stable (complements build2.org/rep-fetch/bar/testing)
+ fetching bpkg:build2.org/rep-fetch/bar/unstable
+ fetching bpkg:build2.org/rep-fetch/foo/testing (prerequisite of bpkg:build2.org/rep-fetch/bar/unstable)
+ fetching bpkg:build2.org/rep-fetch/foo/stable (complements bpkg:build2.org/rep-fetch/foo/testing)
+ fetching bpkg:build2.org/rep-fetch/bar/testing (complements bpkg:build2.org/rep-fetch/bar/unstable)
+ fetching bpkg:build2.org/rep-fetch/bar/stable (complements bpkg:build2.org/rep-fetch/bar/testing)
5 package(s) in 5 repository(s)
EOE
$* 2>>EOE
- fetching build2.org/rep-fetch/bar/unstable
- fetching build2.org/rep-fetch/foo/testing (prerequisite of build2.org/rep-fetch/bar/unstable)
- fetching build2.org/rep-fetch/foo/stable (complements build2.org/rep-fetch/foo/testing)
- fetching build2.org/rep-fetch/bar/testing (complements build2.org/rep-fetch/bar/unstable)
- fetching build2.org/rep-fetch/bar/stable (complements build2.org/rep-fetch/bar/testing)
+ fetching bpkg:build2.org/rep-fetch/bar/unstable
+ fetching bpkg:build2.org/rep-fetch/foo/testing (prerequisite of bpkg:build2.org/rep-fetch/bar/unstable)
+ fetching bpkg:build2.org/rep-fetch/foo/stable (complements bpkg:build2.org/rep-fetch/foo/testing)
+ fetching bpkg:build2.org/rep-fetch/bar/testing (complements bpkg:build2.org/rep-fetch/bar/unstable)
+ fetching bpkg:build2.org/rep-fetch/bar/stable (complements bpkg:build2.org/rep-fetch/bar/testing)
5 package(s) in 5 repository(s)
EOE
}
@@ -113,22 +113,22 @@ $* 2>>/EOE != 0
$clone_cfg && $rep_add $rep/hello && $rep_add $rep/bar/unstable;
$* --trust-yes 2>>EOE &cfg/.bpkg/certs/***;
- fetching build2.org/rep-fetch/bar/unstable
- fetching build2.org/rep-fetch/foo/testing (prerequisite of build2.org/rep-fetch/bar/unstable)
- fetching build2.org/rep-fetch/foo/stable (complements build2.org/rep-fetch/foo/testing)
- fetching build2.org/rep-fetch/bar/testing (complements build2.org/rep-fetch/bar/unstable)
- fetching build2.org/rep-fetch/bar/stable (complements build2.org/rep-fetch/bar/testing)
- fetching build2.org/rep-fetch/hello
+ fetching bpkg:build2.org/rep-fetch/bar/unstable
+ fetching bpkg:build2.org/rep-fetch/foo/testing (prerequisite of bpkg:build2.org/rep-fetch/bar/unstable)
+ fetching bpkg:build2.org/rep-fetch/foo/stable (complements bpkg:build2.org/rep-fetch/foo/testing)
+ fetching bpkg:build2.org/rep-fetch/bar/testing (complements bpkg:build2.org/rep-fetch/bar/unstable)
+ fetching bpkg:build2.org/rep-fetch/bar/stable (complements bpkg:build2.org/rep-fetch/bar/testing)
+ fetching bpkg:build2.org/rep-fetch/hello
6 package(s) in 6 repository(s)
EOE
$* 2>>EOE
- fetching build2.org/rep-fetch/bar/unstable
- fetching build2.org/rep-fetch/foo/testing (prerequisite of build2.org/rep-fetch/bar/unstable)
- fetching build2.org/rep-fetch/foo/stable (complements build2.org/rep-fetch/foo/testing)
- fetching build2.org/rep-fetch/bar/testing (complements build2.org/rep-fetch/bar/unstable)
- fetching build2.org/rep-fetch/bar/stable (complements build2.org/rep-fetch/bar/testing)
- fetching build2.org/rep-fetch/hello
+ fetching bpkg:build2.org/rep-fetch/bar/unstable
+ fetching bpkg:build2.org/rep-fetch/foo/testing (prerequisite of bpkg:build2.org/rep-fetch/bar/unstable)
+ fetching bpkg:build2.org/rep-fetch/foo/stable (complements bpkg:build2.org/rep-fetch/foo/testing)
+ fetching bpkg:build2.org/rep-fetch/bar/testing (complements bpkg:build2.org/rep-fetch/bar/unstable)
+ fetching bpkg:build2.org/rep-fetch/bar/stable (complements bpkg:build2.org/rep-fetch/bar/testing)
+ fetching bpkg:build2.org/rep-fetch/hello
6 package(s) in 6 repository(s)
EOE
}
diff --git a/tests/rep-info.test b/tests/rep-info.test
index 3bb0d3c..f9791b0 100644
--- a/tests/rep-info.test
+++ b/tests/rep-info.test
@@ -43,9 +43,9 @@ EOE
: unsigned
:
$* $rep/testing >>"EOO"
- build2.org/rep-info/testing ($rep/testing)
- prerequisite build2.org/foo/testing ($rep_root/foo/testing)
- complement build2.org/rep-info/stable ($rep/stable)
+ bpkg:build2.org/rep-info/testing ($rep/testing)
+ prerequisite bpkg:build2.org/foo/testing ($rep_root/foo/testing)
+ complement bpkg:build2.org/rep-info/stable ($rep/stable)
foo/1
EOO
@@ -53,11 +53,11 @@ EOE
: signed
:
$* $rep/signed >>"EOO"
- build2.org/rep-info/signed ($rep/signed)
+ bpkg:build2.org/rep-info/signed ($rep/signed)
CN=build2.org/O=Code Synthesis/info@build2.org
$cert_fp
- prerequisite build2.org/foo/testing ($rep_root/foo/testing)
- complement build2.org/rep-info/stable ($rep/stable)
+ prerequisite bpkg:build2.org/foo/testing ($rep_root/foo/testing)
+ complement bpkg:build2.org/rep-info/stable ($rep/stable)
foo/1
EOO
@@ -65,7 +65,7 @@ EOE
: name
:
-$* --name $rep/testing >"build2.org/rep-info/testing ($rep/testing)"
+$* --name $rep/testing >"bpkg:build2.org/rep-info/testing ($rep/testing)"
: packages
:
@@ -100,8 +100,8 @@ $* --name $rep/testing >"build2.org/rep-info/testing ($rep/testing)"
: list
:
$* --repositories $rep/testing >>"EOO"
- prerequisite build2.org/foo/testing ($rep_root/foo/testing)
- complement build2.org/rep-info/stable ($rep/stable)
+ prerequisite bpkg:build2.org/foo/testing ($rep_root/foo/testing)
+ complement bpkg:build2.org/rep-info/stable ($rep/stable)
EOO
: manifest