aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bpkg/pkg-bindist.cli16
-rw-r--r--bpkg/pkg-bindist.cxx4
-rw-r--r--bpkg/system-package-manager-archive.cxx2
-rw-r--r--bpkg/system-package-manager-debian.cxx41
-rw-r--r--bpkg/system-package-manager-fedora.cxx3
-rw-r--r--bpkg/system-package-manager.hxx8
6 files changed, 44 insertions, 30 deletions
diff --git a/bpkg/pkg-bindist.cli b/bpkg/pkg-bindist.cli
index 71497f5..4160a12 100644
--- a/bpkg/pkg-bindist.cli
+++ b/bpkg/pkg-bindist.cli
@@ -754,15 +754,15 @@ namespace bpkg
struct file
{
- string path;
string type;
+ string path;
+ optional<string> system_name;
};
struct package
{
string name;
string version;
- optional<string> system_name;
optional<string> system_version;
vector<file> files;
};
@@ -795,16 +795,17 @@ namespace bpkg
\"package\": {
\"name\": \"libfoo\",
\"version\": \"2.5.0-b.23\",
- \"system_name\": \"libfoo\",
\"system_version\": \"2.5.0~b.23-0~debian11\",
\"files\": [
{
+ \"type\": \"main.deb\",
\"path\": \"/tmp/libfoo_2.5.0~b.23-0~debian11_amd64.deb\",
- \"type\": \"main.deb\"
+ \"system_name\": \"libfoo\"
},
{
+ \"type\": \"dev.deb\",
\"path\": \"/tmp/libfoo-dev_2.5.0~b.23-0~debian11_amd64.deb\",
- \"type\": \"dev.deb\"
+ \"system_name\": \"libfoo-dev\"
},
...
]
@@ -828,8 +829,11 @@ namespace bpkg
Production} for background. For the \cb{archive} distribution this is the
archive type (\cb{--archive-type}), for example, \cb{tar.xz} or \cb{zip}.
- The \cb{system_name} and \cb{system_version} members in \cb{package} are
+ The \cb{package::system_version} and \cb{file::system_name} members are
absent if not applicable to the distribution (for example, \cb{archive}).
+ The \cb{file::system_name} member is also absent if the file is not a
+ binary package (for example, \cb{.changes} and \cb{.buildid} files in the
+ \cb{debian} distribution).
"
// NOTE: remember to add the corresponding `--class-doc ...=exclude-base`
diff --git a/bpkg/pkg-bindist.cxx b/bpkg/pkg-bindist.cxx
index 5038d12..939356e 100644
--- a/bpkg/pkg-bindist.cxx
+++ b/bpkg/pkg-bindist.cxx
@@ -597,15 +597,15 @@ namespace bpkg
{
member ("name", p.name.string ());
member ("version", ver);
- member ("system_name", bfs.system_name);
member ("system_version", bfs.system_version);
s.member_begin_array ("files");
for (const binary_file& bf: bfs)
{
s.begin_object (); // file
{
- member ("path", bf.path.string ());
member ("type", bf.type);
+ member ("path", bf.path.string ());
+ member ("system_name", bf.system_name);
}
s.end_object (); // file
};
diff --git a/bpkg/system-package-manager-archive.cxx b/bpkg/system-package-manager-archive.cxx
index 8496bb3..e0f0ad2 100644
--- a/bpkg/system-package-manager-archive.cxx
+++ b/bpkg/system-package-manager-archive.cxx
@@ -761,7 +761,7 @@ namespace bpkg
// Using archive type as file type seems appropriate.
//
path f (archive (out, base, t));
- r.push_back (binary_file {move (f), move (t)});
+ r.push_back (binary_file {move (t), move (f), "" /* system_name */});
}
}
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 <name>_<version>_<arch>.deb
// form. If the package is architecture-independent, then <arch> 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;
}
diff --git a/bpkg/system-package-manager-fedora.cxx b/bpkg/system-package-manager-fedora.cxx
index dcd953d..e22412c 100644
--- a/bpkg/system-package-manager-fedora.cxx
+++ b/bpkg/system-package-manager-fedora.cxx
@@ -4296,7 +4296,6 @@ namespace bpkg
// Here we will use `rpm --eval` to resolve the RPM sub-package paths.
//
binary_files r;
- r.system_name = gen_main ? st.main : st.devel;
r.system_version = st.system_version;
{
string expressions;
@@ -4319,7 +4318,7 @@ namespace bpkg
add_macro ("NAME", name);
add_macro ("ARCH", arch);
expressions += rpmfile + '\n';
- r.push_back (binary_file {path (), type}); // Reserve.
+ r.push_back (binary_file {type, path (), name}); // Reserve.
return r.size () - 1;
};
diff --git a/bpkg/system-package-manager.hxx b/bpkg/system-package-manager.hxx
index 372730d..7f5af7d 100644
--- a/bpkg/system-package-manager.hxx
+++ b/bpkg/system-package-manager.hxx
@@ -201,16 +201,14 @@ namespace bpkg
struct binary_file
{
- bpkg::path path;
string type;
+ bpkg::path path;
+ string system_name; // Empty if not applicable.
};
struct binary_files: public vector<binary_file>
{
- // Empty if not applicable.
- //
- string system_name;
- string system_version;
+ string system_version; // Empty if not applicable.
};
virtual binary_files