aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bpkg/pkg-fetch-options.cli12
-rw-r--r--bpkg/pkg-fetch.cxx2
-rw-r--r--bpkg/pkg-unpack-options.cli10
-rw-r--r--bpkg/pkg-unpack.cxx6
4 files changed, 21 insertions, 9 deletions
diff --git a/bpkg/pkg-fetch-options.cli b/bpkg/pkg-fetch-options.cli
index 057bc43..0ad0531 100644
--- a/bpkg/pkg-fetch-options.cli
+++ b/bpkg/pkg-fetch-options.cli
@@ -19,9 +19,10 @@ name and version from one of the configuration's repositories. If the
\cb{-e|--existing} option is used, then instead of the name and version
arguments, \cb{pkg-fetch} expects a local path to the existing package
archive. In this case, \cb{bpkg} will use the archive in place, without
-copying it to the configuration or package cache directories. It will
-also not attempt to remove the archive if the package is purged with
-the \cb{pkg-purge} command."
+copying it to the configuration or package cache directories. Also,
+unless the \cb{-p|--purge} option is specified, \cb{bpkg} will not
+attempt to remove the archive when the package is purged with the
+\cb{pkg-purge} command."
*/
namespace bpkg
@@ -40,5 +41,10 @@ namespace bpkg
"Treat the argument as an existing package archive path rather than
package name/version to fetch."
};
+
+ bool --purge|-p
+ {
+ "Remove the existing package archive when the package is purged."
+ };
};
}
diff --git a/bpkg/pkg-fetch.cxx b/bpkg/pkg-fetch.cxx
index 7558862..9d4efaa 100644
--- a/bpkg/pkg-fetch.cxx
+++ b/bpkg/pkg-fetch.cxx
@@ -45,7 +45,7 @@ namespace bpkg
if (!exists (a))
fail << "archive file '" << a << "' does not exist";
- purge = false;
+ purge = o.purge ();
}
else
{
diff --git a/bpkg/pkg-unpack-options.cli b/bpkg/pkg-unpack-options.cli
index 0fa77a3..7ffcc62 100644
--- a/bpkg/pkg-unpack-options.cli
+++ b/bpkg/pkg-unpack-options.cli
@@ -19,8 +19,9 @@ fetched (\cb{pkg-fetch}) package. If the \cb{-e|--existing} option
is used, then instead of the package name, \cb{pkg-unpack} expects
a local path to the existing package source directory. In this case,
\cb{bpkg} will use the directory in place, without copying it to the
-configuration or package cache directories. It will also not attempt
-to remove this directory if the package is purged with the \cb{pkg-purge}
+configuration or package cache directories. Also, unless the
+\cb{-p|--purge} option is specified, \cb{bpkg} will not attempt to
+remove this directory when the package is purged with the \cb{pkg-purge}
command."
*/
@@ -40,5 +41,10 @@ namespace bpkg
"Treat the argument as an existing package directory path rather than
package name to unpack."
};
+
+ bool --purge|-p
+ {
+ "Remove the existing package directory when the package is purged."
+ };
};
}
diff --git a/bpkg/pkg-unpack.cxx b/bpkg/pkg-unpack.cxx
index 8b08674..3192c27 100644
--- a/bpkg/pkg-unpack.cxx
+++ b/bpkg/pkg-unpack.cxx
@@ -24,7 +24,7 @@ using namespace butl;
namespace bpkg
{
static shared_ptr<package>
- pkg_unpack (database& db, const dir_path& c, const dir_path& d)
+ pkg_unpack (database& db, const dir_path& c, const dir_path& d, bool purge)
{
tracer trace ("pkg_unpack(dir)");
@@ -66,7 +66,7 @@ namespace bpkg
optional<path> (), // No archive
false, // Don't purge archive.
move (ad),
- false}); // Don't purge source.
+ purge});
db.persist (p);
t.commit ();
@@ -186,7 +186,7 @@ namespace bpkg
fail << "package directory argument expected" <<
info << "run 'bpkg help pkg-unpack' for more information";
- p = pkg_unpack (db, c, dir_path (args.next ()));
+ p = pkg_unpack (db, c, dir_path (args.next ()), o.purge ());
}
else
{