From a93c2bf2c44bba4c88ed7f9d974a76fcf03e6150 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 29 Mar 2023 13:25:24 +0200 Subject: Tweak structured result format in pkg-bindist --- bpkg/system-package-manager-debian.cxx | 41 ++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'bpkg/system-package-manager-debian.cxx') diff --git a/bpkg/system-package-manager-debian.cxx b/bpkg/system-package-manager-debian.cxx index 19f6391..b029901 100644 --- a/bpkg/system-package-manager-debian.cxx +++ b/bpkg/system-package-manager-debian.cxx @@ -3543,39 +3543,52 @@ namespace bpkg // Collect and return the binary package paths. // binary_files r; - - r.system_name = gen_main ? st.main : st.dev; r.system_version = st.system_version; - auto add = [&out, &r] (const string& n, const char* t, bool opt = false) + auto add = [&out, &r] (const string& f, + const char* t, + const string& n, + bool opt = false) { - path p (out / n); + path p (out / f); if (exists (p)) - r.push_back (binary_file {move (p), t}); + r.push_back (binary_file {t, move (p), n}); else if (!opt) - fail << "expected output file " << p << " does not exist"; + fail << "expected output file " << f << " does not exist"; }; // The resulting .deb file names have the __.deb // form. If the package is architecture-independent, then is the // special `all` value. // - const string& ver (st.system_version); + const string& v (st.system_version); + const string& a (arch); + + if (gen_main) + add (st.main + '_' + v + '_' + a + ".deb", "main.deb", st.main); + + if (!binless) + add (st.main + "-dbgsym_" + v + '_' + a + ".deb", + "dbgsym.deb", + st.main + "-dbgsym", + true); + + if (!st.dev.empty ()) + add (st.dev + '_' + v + '_' + a + ".deb", "dev.deb", st.dev); - if (gen_main) add (st.main + '_' + ver + '_' + arch + ".deb", "main.deb"); - if (!binless) add (st.main + "-dbgsym_" + ver + '_' + arch + ".deb", "dbgsym.deb", true); + if (!st.doc.empty ()) + add (st.doc + '_' + v + "_all.deb", "doc.deb", st.doc); - if (!st.dev.empty ()) add (st.dev + '_' + ver + '_' + arch + ".deb", "dev.deb"); - if (!st.doc.empty ()) add (st.doc + '_' + ver + "_all.deb", "doc.deb"); - if (!st.common.empty ()) add (st.common + '_' + ver + "_all.deb", "common.deb"); + if (!st.common.empty ()) + add (st.common + '_' + v + "_all.deb", "common.deb", st.common); // Besides the binary packages (.deb) we also get the .buildinfo and // .changes files, which could be useful. Note that their names are based // on the source package name. // - add (pn.string () + '_' + ver + '_' + arch + ".buildinfo", "buildinfo"); - add (pn.string () + '_' + ver + '_' + arch + ".changes", "changes"); + add (pn.string () + '_' + v + '_' + a + ".buildinfo", "buildinfo", ""); + add (pn.string () + '_' + v + '_' + a + ".changes", "changes", ""); return r; } -- cgit v1.1