aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-07-31 09:15:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-07-31 09:15:45 +0200
commit7c5d099c8d1142ffd2c05863169a624c2711eb1c (patch)
tree70dbe4dc6dda2891107fa49d04ffb4b7edea3833
parent8fb57cc32b6db9121989d856d3465e81f4cdfdd0 (diff)
Extract project from manifest in bdep-publish
-rw-r--r--bdep/new.cxx2
-rw-r--r--bdep/project.cxx16
-rw-r--r--bdep/project.hxx5
-rw-r--r--bdep/publish.cxx10
4 files changed, 18 insertions, 15 deletions
diff --git a/bdep/new.cxx b/bdep/new.cxx
index 2287431..ca8367b 100644
--- a/bdep/new.cxx
+++ b/bdep/new.cxx
@@ -1118,7 +1118,7 @@ namespace bdep
package_locations pkgs;
if (t != type::empty) // prj == pkg
- pkgs.push_back (package_location {move (pkgn), dir_path ()});
+ pkgs.push_back (package_location {move (pkgn), nullopt, dir_path ()});
configurations cfgs {
cmd_init_config (
diff --git a/bdep/project.cxx b/bdep/project.cxx
index 795e365..cd4f029 100644
--- a/bdep/project.cxx
+++ b/bdep/project.cxx
@@ -226,11 +226,13 @@ namespace bdep
dir_path d (path_cast<dir_path> (move (*m.location)));
d.normalize (false /* actualize */, true /* cur_empty */);
- pls.push_back (package_location {package_name (), move (d)});
+ pls.push_back (package_location {package_name (), nullopt, move (d)});
}
}
else if (exists (prj / manifest_file))
- pls.push_back (package_location {package_name (), dir_path ()});
+ {
+ pls.push_back (package_location {package_name (), nullopt, dir_path ()});
+ }
else if (!allow_empty)
fail << "no packages in project " << prj;
@@ -248,6 +250,7 @@ namespace bdep
path f (prj / pl.path / manifest_file);
auto m (parse_manifest<bpkg::package_manifest> (f, "package"));
pl.name = move (m.name);
+ pl.project = move (m.project);
}
}
@@ -296,10 +299,10 @@ namespace bdep
return *p.package == pl.path;
}) == r.packages.end ())
{
- // Name is to be extracted later.
+ // Name/project is to be extracted later.
//
r.packages.push_back (
- package_location {package_name (), move (*p.package)});
+ package_location {package_name (), nullopt, move (*p.package)});
}
}
}
@@ -312,9 +315,10 @@ namespace bdep
if (!ignore_packages && p.package)
{
- // Name is to be extracted later.
+ // Name/project is to be extracted later.
//
- r.packages.push_back (package_location {package_name (), *p.package});
+ r.packages.push_back (
+ package_location {package_name (), nullopt, *p.package});
}
}
diff --git a/bdep/project.hxx b/bdep/project.hxx
index cb0b2d4..4047dc5 100644
--- a/bdep/project.hxx
+++ b/bdep/project.hxx
@@ -188,8 +188,9 @@ namespace bdep
//
struct package_location
{
- package_name name;
- dir_path path;
+ package_name name;
+ optional<package_name> project; // Same semantics as in package_manifest.
+ dir_path path;
};
using package_locations = vector<package_location>;
diff --git a/bdep/publish.cxx b/bdep/publish.cxx
index eb4979d..bea883e 100644
--- a/bdep/publish.cxx
+++ b/bdep/publish.cxx
@@ -702,7 +702,7 @@ namespace bdep
{
package_name name;
standard_version version;
- string project;
+ package_name project;
string section; // alpha|beta|stable (or --section)
path archive;
@@ -713,6 +713,7 @@ namespace bdep
for (package_location& pl: pkg_locs)
{
package_name n (move (pl.name));
+ package_name p (pl.project ? move (*pl.project) : n);
standard_version v (package_version (o, cfg, n));
@@ -723,8 +724,6 @@ namespace bdep
if (v.snapshot ())
fail << "package " << n << " version " << v << " is a snapshot";
- string p (prj.leaf ().string ()); // @@ TODO/TMP
-
// Per semver we treat zero major versions as alpha.
//
string s (o.section_specified () ? o.section () :
@@ -755,9 +754,8 @@ namespace bdep
if (i != 0)
dr << '\n';
- // While currently the control repository is the same for all
- // packages, this could change in the future (e.g., multi-project
- // publishing).
+ // Currently the control repository is the same for all packages, but
+ // this could change in the future (e.g., multi-project publishing).
//
dr << " package: " << p.name << '\n'
<< " version: " << p.version << '\n'