aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bpkg/pkg-configure.cxx12
-rw-r--r--tests/pkg-build.test8
-rw-r--r--tests/pkg-configure.test36
-rw-r--r--tests/pkg-drop.test2
-rw-r--r--tests/pkg-unpack.test26
5 files changed, 53 insertions, 31 deletions
diff --git a/bpkg/pkg-configure.cxx b/bpkg/pkg-configure.cxx
index 86aadcb..c839d42 100644
--- a/bpkg/pkg-configure.cxx
+++ b/bpkg/pkg-configure.cxx
@@ -126,7 +126,17 @@ namespace bpkg
dir_path src_root (p->src_root->absolute ()
? *p->src_root
: c / *p->src_root);
- dir_path out_root (c / dir_path (p->name + "-" + p->version.string ()));
+
+ const repository_location& rl (p->repository);
+
+ // For external packages call the output directory <pkg>, rather than
+ // <pkg>-<ver>.
+ //
+ dir_path out_root (
+ (!rl.empty () && rl.directory_based ()) || // pkg-unpack <name>/<version>
+ ( rl.empty () && !p->archive) // pkg-unpack --existing <dir>
+ ? c / dir_path (p->name)
+ : c / dir_path (p->name + "-" + p->version.string ()));
l4 ([&]{trace << "src_root: " << src_root << ", "
<< "out_root: " << out_root;});
diff --git a/tests/pkg-build.test b/tests/pkg-build.test
index 6c5ceed..f4e77cd 100644
--- a/tests/pkg-build.test
+++ b/tests/pkg-build.test
@@ -1076,14 +1076,14 @@ rep_fetch += -d cfg --auth all --trust-yes 2>!
configured libfoo/1.1.0
unpacked libbar/1.1.0
configured libbar/1.1.0
- %info: .+dir\{libbar-1.1.0.\} is up to date%
+ %info: .+dir\{libbar.\} is up to date%
updated libbar/1.1.0
EOE
$* ./libbaz/ 2>>~%EOE%;
unpacked libbaz/1.1.0
configured libbaz/1.1.0
- %info: .+dir\{libbaz-1.1.0.\} is up to date%
+ %info: .+dir\{libbaz.\} is up to date%
updated libbaz/1.1.0
EOE
@@ -1461,7 +1461,7 @@ rep_fetch += -d cfg --auth all --trust-yes 2>!
fetching dir:$d
using libfoo/1.1.0 \(external\)
configured libfoo/1.1.0
- %info: .+dir\\{libfoo-1.1.0.\\} is up to date%
+ %info: .+dir\\{libfoo.\\} is up to date%
updated libfoo/1.1.0
EOE
@@ -1487,7 +1487,7 @@ rep_fetch += -d cfg --auth all --trust-yes 2>!
$* libfoo 2>>~%EOE%;
using libfoo/1.1.0 (external)
configured libfoo/1.1.0
- %info: .+dir\{libfoo-1.1.0.\} is up to date%
+ %info: .+dir\{libfoo.\} is up to date%
updated libfoo/1.1.0
EOE
diff --git a/tests/pkg-configure.test b/tests/pkg-configure.test
index 5a9e6f8..3b4834e 100644
--- a/tests/pkg-configure.test
+++ b/tests/pkg-configure.test
@@ -186,16 +186,16 @@ $* libhello libhello 2>>EOE != 0
$clone_cfg && $pkg_unpack -e $src/libhello-1.0.0;
$* libhello 2>'configured libhello/1.0.0';
- touch cfg/libhello-1.0.0/stray &!cfg/libhello-1.0.0/stray;
+ touch cfg/libhello/stray &!cfg/libhello/stray;
$pkg_disfigure libhello 2>>/EOE != 0;
- warning: directory cfg/libhello-1.0.0/ is not empty, not removing
- error: package output directory cfg/libhello-1.0.0/ still exists
+ warning: directory cfg/libhello/ is not empty, not removing
+ error: package output directory cfg/libhello/ still exists
info: package libhello is now broken; use 'pkg-purge' to remove
EOE
$pkg_status libhello/1.0.0 >'broken';
- rm -r cfg/libhello-1.0.0;
+ rm -r cfg/libhello;
$pkg_purge -f libhello 2>'purged libhello/1.0.0';
$pkg_status libhello/1.0.0 1>'unknown'
@@ -211,17 +211,17 @@ if ($cxx.target.class != 'windows')
$clone_root_cfg && $pkg_unpack -e $src/libhello-1.0.0;
$* libhello 2>'configured libhello/1.0.0';
- chmod 555 cfg/libhello-1.0.0;
+ chmod 555 cfg/libhello;
$pkg_disfigure libhello 2>>/~%EOE% != 0;
- %error: unable to remove directory cfg/libhello-1.0.0/.+%
+ %error: unable to remove directory cfg/libhello/.+%
info: package libhello is now broken; use 'pkg-purge' to remove
EOE
$pkg_status libhello >'broken 1.0.0';
- chmod 755 cfg/libhello-1.0.0;
- rm -r cfg/libhello-1.0.0;
+ chmod 755 cfg/libhello;
+ rm -r cfg/libhello;
$pkg_purge -f libhello 2>'purged libhello/1.0.0';
$pkg_status libhello >'unknown'
}
@@ -233,12 +233,11 @@ if ($cxx.target.class != 'windows')
:
{
$clone_root_cfg && $pkg_unpack -e $src/libhello-1.0.0;
- c = &!cfg/libhello-1.0.0/ &!cfg/libhello-1.0.0/build/;
- mkdir -p cfg/libhello-1.0.0/build $c;
- chmod 555 cfg/libhello-1.0.0/build;
+ mkdir -p cfg/libhello/build &!cfg/libhello/ &!cfg/libhello/build/;
+ chmod 555 cfg/libhello/build;
$* libhello 2>>/~%EOE% != 0;
- %error: unable to create directory cfg/libhello-1.0.0/build/.+%
+ %error: unable to create directory cfg/libhello/build/.+%
EOE
$pkg_status libhello >'unpacked 1.0.0'
@@ -251,20 +250,19 @@ if ($cxx.target.class != 'windows')
:
{
$clone_root_cfg && $pkg_unpack -e $src/libhello-1.0.0;
- c = &!cfg/libhello-1.0.0/ &!cfg/libhello-1.0.0/build/;
- mkdir -p cfg/libhello-1.0.0/build $c;
- chmod 555 cfg/libhello-1.0.0 cfg/libhello-1.0.0/build;
+ mkdir -p cfg/libhello/build &!cfg/libhello/ &!cfg/libhello/build/;
+ chmod 555 cfg/libhello cfg/libhello/build;
$* libhello 2>>/~%EOE% != 0;
- %error: unable to create directory cfg/libhello-1.0.0/build/.+%
- %error: unable to remove directory cfg/libhello-1.0.0/build/.+%
+ %error: unable to create directory cfg/libhello/build/.+%
+ %error: unable to remove directory cfg/libhello/build/.+%
info: package libhello is now broken; use 'pkg-purge' to remove
EOE
$pkg_status libhello >'broken 1.0.0';
- chmod 755 cfg/libhello-1.0.0 cfg/libhello-1.0.0/build;
- rm -r cfg/libhello-1.0.0;
+ chmod 755 cfg/libhello cfg/libhello/build;
+ rm -r cfg/libhello;
$pkg_purge -f libhello 2>'purged libhello/1.0.0';
$pkg_status libhello >'unknown'
}
diff --git a/tests/pkg-drop.test b/tests/pkg-drop.test
index 0bc52b2..2fb616e 100644
--- a/tests/pkg-drop.test
+++ b/tests/pkg-drop.test
@@ -198,7 +198,7 @@ $* libfoo/1.0.0 2>>~%EOE% != 0
: dependencies
:
- : Note that we don't move this test to the prerequisites-and-dependents
+ : Note that we do not move this test to the prerequisites-and-dependents
: group as the configuration repository set would be different.
:
$clone_cfg;
diff --git a/tests/pkg-unpack.test b/tests/pkg-unpack.test
index af07fc5..0795f6b 100644
--- a/tests/pkg-unpack.test
+++ b/tests/pkg-unpack.test
@@ -38,11 +38,13 @@
cp -r $src/t1 $out/t1 && $rep_create $out/t1 &$out/t1/packages.manifest
end
-pkg_fetch += -d cfg 2>!
-pkg_purge += -d cfg
-pkg_status += -d cfg
-rep_add += -d cfg 2>!
-rep_fetch += -d cfg --auth all 2>!
+pkg_fetch += -d cfg 2>!
+pkg_purge += -d cfg
+pkg_status += -d cfg
+rep_add += -d cfg 2>!
+rep_fetch += -d cfg --auth all 2>!
+pkg_configure += -d cfg
+pkg_disfigure += -d cfg
: replace-with-existing
:
@@ -101,6 +103,10 @@ $* 2>>EOE != 0
$* -e $src/libfoo-1.1.0 2>'using libfoo/1.1.0 (external)';
$pkg_status libfoo/1.1.0 1>'unpacked; available';
+ $pkg_configure libfoo 2>'configured libfoo/1.1.0';
+ test -d cfg/libfoo;
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.1.0';
+
$pkg_purge libfoo 2>'purged libfoo/1.1.0'
}
@@ -168,6 +174,10 @@ $* 2>>EOE != 0
$* libfoo 2>'unpacked libfoo/1.0.0';
$pkg_status libfoo/1.0.0 1>'unpacked; available';
+ $pkg_configure libfoo 2>'configured libfoo/1.0.0';
+ test -d cfg/libfoo-1.0.0;
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.0.0';
+
$pkg_purge libfoo 2>'purged libfoo/1.0.0'
}
@@ -251,6 +261,10 @@ $* 2>>EOE != 0
using libfoo/1.1.0 (external)
EOE
- $pkg_status libfoo 1>'unpacked 1.1.0; available sys:?'
+ $pkg_status libfoo 1>'unpacked 1.1.0; available sys:?';
+
+ $pkg_configure libfoo 2>'configured libfoo/1.1.0';
+ test -d cfg/libfoo;
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.1.0'
}
}