aboutsummaryrefslogtreecommitdiff
path: root/libbpkg
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-04-24 22:10:57 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-04-24 22:10:57 +0300
commit99dc5d7463236ee9c094736dfbcb56641e782335 (patch)
tree5734d5611b24e30346331a33a1d8cf247bcd673d /libbpkg
parentbba520774fd6185f62a6bf52c61b98104a826f5f (diff)
Add fragment manifest value
Diffstat (limited to 'libbpkg')
-rw-r--r--libbpkg/manifest.cxx42
-rw-r--r--libbpkg/manifest.hxx6
2 files changed, 48 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