diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-08-03 07:42:57 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-08-03 07:42:57 +0200 |
commit | ca6ac5f217f3217a2e2b5d07bf8448e0e6887447 (patch) | |
tree | b82cd5f94c2e994e1f0b9724424be980e202edc6 | |
parent | 6f6266c8ca840bbecb85e8cc394037572b5e29d3 (diff) |
Separate package names in lists with commas instead of just spaces
Now that a package name can include a configuration, using just spaces is
insufficient.
-rw-r--r-- | bpkg/pkg-build.cxx | 17 | ||||
-rw-r--r-- | tests/pkg-build.testscript | 22 |
2 files changed, 20 insertions, 19 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx index 8e50d05..08e1868 100644 --- a/bpkg/pkg-build.cxx +++ b/bpkg/pkg-build.cxx @@ -1827,7 +1827,7 @@ namespace bpkg if (!p.user_selection ()) { for (const config_package& cp: p.required_by) - rb += ' ' + cp.string (); + rb += (rb.empty () ? " " : ", ") + cp.string (); } if (!rb.empty ()) @@ -2788,18 +2788,19 @@ namespace bpkg { dr << info << package_string (nm, u.first) << " doesn't satisfy"; - size_t n (0); const sp_set& ps (u.second); - for (const config_selected_package& p: ps) + + size_t i (0), n (ps.size ()); + for (auto p (ps.begin ()); i != n; ++p) { - dr << ' ' << *p.package << p.db; + dr << (i == 0 ? " " : ", ") << *p->package << p->db; - if (++n == 5 && ps.size () != 6) // Printing 'and 1 more' looks stupid. + if (++i == 5 && n != 6) // Printing 'and 1 more' looks stupid. break; } - if (n != ps.size ()) - dr << " and " << ps.size () - n << " more"; + if (i != n) + dr << " and " << n - i << " more"; if (++nv == 3 && unsatisfiable.size () != 4) break; @@ -5753,7 +5754,7 @@ namespace bpkg if (!p.user_selection ()) { for (const config_package& cp: p.required_by) - rb += ' ' + cp.string (); + rb += (rb.empty () ? " " : ", ") + cp.string (); // If not user-selected, then there should be another (implicit) // reason for the action. diff --git a/tests/pkg-build.testscript b/tests/pkg-build.testscript index b8c17d2..7938e60 100644 --- a/tests/pkg-build.testscript +++ b/tests/pkg-build.testscript @@ -782,7 +782,7 @@ test.options += --no-progress : $clone_cfg; $* libbaz >>EOO - new libfoo/1.1.0 (required by libbar libbaz) + new libfoo/1.1.0 (required by libbar, libbaz) new libbar/1.1.0 (required by libbaz) new libbaz/1.1.0 EOO @@ -844,7 +844,7 @@ test.options += --no-progress $pkg_fetch -e $src/libfix-0.0.1.tar.gz && $pkg_unpack libfix; $* libbaz >>EOO; - upgrade libfoo/1.1.0 (required by libbar libbaz) + upgrade libfoo/1.1.0 (required by libbar, libbaz) new libbar/1.1.0 (required by libbaz) new libbaz/1.1.0 EOO @@ -860,7 +860,7 @@ test.options += --no-progress $pkg_fetch -e $src/libfoo-1.2.0.tar.gz && $pkg_unpack libfoo; $* libbaz >>EOO; - downgrade libfoo/1.1.0 (required by libbar libbaz) + downgrade libfoo/1.1.0 (required by libbar, libbaz) new libbar/1.1.0 (required by libbaz) new libbaz/1.1.0 EOO @@ -967,7 +967,7 @@ test.options += --no-progress $* libbar >>EOO upgrade libfoo/1.1.0 (required by libbar) upgrade libbar/1.1.0 - reconfigure libbaz (dependent of libbar libfoo) + reconfigure libbaz (dependent of libbar, libfoo) EOO : foo @@ -976,7 +976,7 @@ test.options += --no-progress $* libfoo >>EOO upgrade libfoo/1.1.0 reconfigure libbar (dependent of libfoo) - reconfigure libbaz (dependent of libbar libfoo) + reconfigure libbaz (dependent of libbar, libfoo) EOO : foo-bar @@ -985,7 +985,7 @@ test.options += --no-progress $* libfoo libbar/1.0.0 >>EOO upgrade libfoo/1.1.0 reconfigure/update libbar/1.0.0 - reconfigure libbaz (dependent of libbar libfoo) + reconfigure libbaz (dependent of libbar, libfoo) EOO : bar-foo @@ -994,7 +994,7 @@ test.options += --no-progress $* libbar/1.0.0 libfoo >>EOO upgrade libfoo/1.1.0 reconfigure/update libbar/1.0.0 - reconfigure libbaz (dependent of libbar libfoo) + reconfigure libbaz (dependent of libbar, libfoo) EOO : baz-foo @@ -4639,7 +4639,7 @@ else $rep_add $rep/t7a && $rep_fetch; $* libbar <'y' 2>>~%EOE%; - new libbaz/1.0.0 (required by foo libbar) + new libbaz/1.0.0 (required by foo, libbar) new foo/1.0.0 (required by libbar) new libbar/1.0.0 continue? [Y/n] fetched libbaz/1.0.0 @@ -4665,7 +4665,7 @@ else $rep_add $rep/t7b && $rep_fetch; $* libbar <'y' 2>>~%EOE%; - upgrade libbaz/1.1.0 (required by foo libbar) + upgrade libbaz/1.1.0 (required by foo, libbar) upgrade foo/1.1.0 (required by libbar) upgrade libbar/1.1.0 continue? [Y/n] disfigured libbar/1.0.0 @@ -5748,7 +5748,7 @@ else y EOI % new libbaz/1.0.0 \[cfg3.\] \(required by foo \[cfg3.\]\)% - % new foo/1.0.0 \[cfg3.\] \(required by libbiz libbuild2-foo \[cfg2.\]\)% + % new foo/1.0.0 \[cfg3.\] \(required by libbiz, libbuild2-foo \[cfg2.\]\)% % new libbuild2-bar/1.0.0 \[cfg2.\] \(required by libbuild2-foo \[cfg2.\]\)% % new libbaz/1.0.0 \[cfg2.\] \(required by libbuild2-foo \[cfg2.\]\)% % new libbuild2-foo/1.0.0 \[cfg2.\] \(required by libbiz\)% @@ -5818,7 +5818,7 @@ else y EOI % new libbaz/1.0.0 \[cfg3.\] \(required by foo \[cfg3.\]\)% - % new foo/1.0.0 \[cfg3.\] \(required by libbiz libbuild2-foo \[cfg2.\]\)% + % new foo/1.0.0 \[cfg3.\] \(required by libbiz, libbuild2-foo \[cfg2.\]\)% % new libbuild2-bar/1.0.0 \[cfg2.\] \(required by libbuild2-foo \[cfg2.\]\)% % new libbaz/1.0.0 \[cfg2.\]% % new libbuild2-foo/1.0.0 \[cfg2.\]% |