aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbpkg/manifest.cxx42
-rw-r--r--libbpkg/manifest.hxx6
-rw-r--r--tests/manifest/testscript46
3 files changed, 94 insertions, 0 deletions
diff --git a/libbpkg/manifest.cxx b/libbpkg/manifest.cxx
index 2374b77..ab3acf1 100644
--- a/libbpkg/manifest.cxx
+++ b/libbpkg/manifest.cxx
@@ -1196,6 +1196,19 @@ namespace bpkg
m.sha256sum = move (v);
}
+ else if (n == "fragment")
+ {
+ if (!il)
+ bad_name ("package repository fragment not allowed");
+
+ if (m.fragment)
+ bad_name ("package repository fragment redefinition");
+
+ if (v.empty ())
+ bad_value ("empty package repository fragment");
+
+ m.fragment = move (v);
+ }
else if (!iu)
bad_name ("unknown name '" + n + "' in package manifest");
}
@@ -1354,6 +1367,9 @@ namespace bpkg
if (sha256sum)
s.next ("sha256sum", *sha256sum);
+ if (fragment)
+ s.next ("fragment", *fragment);
+
s.next ("", ""); // End of manifest.
}
@@ -1412,6 +1428,16 @@ namespace bpkg
bad_value ("invalid package location");
}
}
+ else if (n == "fragment")
+ {
+ if (r.fragment)
+ bad_name ("package repository fragment redefinition");
+
+ if (v.empty ())
+ bad_value ("empty package repository fragment");
+
+ r.fragment = move (v);
+ }
else if (!iu)
bad_name ("unknown name '" + n + "' in package manifest");
}
@@ -1452,6 +1478,9 @@ namespace bpkg
s.next ("location", m.location->posix_representation ());
+ if (m.fragment)
+ s.next ("fragment", *m.fragment);
+
s.next ("", ""); // End of manifest.
}
@@ -2564,6 +2593,16 @@ namespace bpkg
r.certificate = move (v);
}
+ else if (n == "fragment")
+ {
+ if (r.fragment)
+ bad_name ("fragment redefinition");
+
+ if (v.empty ())
+ bad_value ("empty fragment");
+
+ r.fragment = move (v);
+ }
else if (!iu)
bad_name ("unknown name '" + n + "' in repository manifest");
}
@@ -2717,6 +2756,9 @@ namespace bpkg
s.next ("certificate", *certificate);
}
+ if (fragment)
+ s.next ("fragment", *fragment);
+
s.next ("", ""); // End of manifest.
}
diff --git a/libbpkg/manifest.hxx b/libbpkg/manifest.hxx
index f3223b6..3716670 100644
--- a/libbpkg/manifest.hxx
+++ b/libbpkg/manifest.hxx
@@ -405,6 +405,7 @@ namespace bpkg
//
butl::optional<butl::path> location;
butl::optional<std::string> sha256sum;
+ butl::optional<std::string> fragment;
public:
package_manifest () = default; // VC export.
@@ -893,6 +894,11 @@ namespace bpkg
butl::optional<std::string> description;
butl::optional<std::string> certificate;
+ // The repository fragment id this repository belongs to (may only be
+ // present for multi-fragment repositories).
+ //
+ butl::optional<std::string> fragment;
+
// Return the effective role of the repository. If the role is not
// explicitly specified (see the role member above), then calculate
// the role based on the location. Specifically, if the location is
diff --git a/tests/manifest/testscript b/tests/manifest/testscript
index 59f4db0..d3fe1a7 100644
--- a/tests/manifest/testscript
+++ b/tests/manifest/testscript
@@ -107,6 +107,21 @@
location: mhello/
EOI
}
+
+ : git
+ :
+ {
+ : fragment
+ :
+ $* -gp <<EOF >>EOF
+ : 1
+ location: hello/
+ fragment: ca602c2d46b0dca7a9ebc856871767b0ba6b74f3
+ :
+ location: mhello/
+ fragment: ca602c2d46b0dca7a9ebc856871767b0ba6b74f3
+ EOF
+ }
}
: repositories
@@ -232,6 +247,37 @@
stuff.
EOF
+ : fragment
+ :
+ $* -gr <<EOF >>EOF
+ : 1
+ location: http://example.org/math.git#master
+ type: git
+ role: prerequisite
+ fragment: ca602c2d46b0dca7a9ebc856871767b0ba6b74f3
+ :
+ location: ../stable.git#stable
+ type: git
+ role: complement
+ fragment: ca602c2d46b0dca7a9ebc856871767b0ba6b74f3
+ :
+ location: http://example.org/math.git#master
+ type: git
+ role: prerequisite
+ fragment: abc1232d46b0dca7a9ebc856871767b0ba6b74f3
+ :
+ location: ../stable.git#stable
+ type: git
+ role: complement
+ fragment: abc1232d46b0dca7a9ebc856871767b0ba6b74f3
+ :
+ url: http://cppget.org
+ email: repoman@cppget.org; General mailing list.
+ summary: General C++ package repository
+ description: This is the awesome C++ package repository full of exciting\
+ stuff.
+ EOF
+
: prerequisite-type
:
$* -gr <<EOI >>EOO