aboutsummaryrefslogtreecommitdiff
path: root/bpkg
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-09-18 07:58:04 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-09-18 07:58:04 +0200
commitf146720a3800fa2a9025a7326e0f0a2ce9048364 (patch)
treeef463d23a347032fe1c30e617223edd80bdf6278 /bpkg
parent9accdefc33940d713828195313ca1a0eb0de030f (diff)
Implement pkg-clean command
Diffstat (limited to 'bpkg')
-rw-r--r--bpkg/bpkg-options.cli7
-rw-r--r--bpkg/bpkg.cxx2
-rw-r--r--bpkg/buildfile2
-rw-r--r--bpkg/pkg-clean21
-rw-r--r--bpkg/pkg-clean-options.cli27
-rwxr-xr-xbpkg/test.sh31
6 files changed, 90 insertions, 0 deletions
diff --git a/bpkg/bpkg-options.cli b/bpkg/bpkg-options.cli
index 9e2e6b2..cac46ba 100644
--- a/bpkg/bpkg-options.cli
+++ b/bpkg/bpkg-options.cli
@@ -77,6 +77,13 @@ namespace bpkg
""
};
+ bool pkg-clean
+ {
+ "<pkg>",
+ "Clean package.",
+ ""
+ };
+
bool cfg-create
{
"[<conf>]",
diff --git a/bpkg/bpkg.cxx b/bpkg/bpkg.cxx
index 0df2613..ffe41a6 100644
--- a/bpkg/bpkg.cxx
+++ b/bpkg/bpkg.cxx
@@ -23,6 +23,7 @@
#include <bpkg/pkg-configure>
#include <bpkg/pkg-disfigure>
#include <bpkg/pkg-update>
+#include <bpkg/pkg-clean>
#include <bpkg/cfg-create>
#include <bpkg/rep-create>
@@ -181,6 +182,7 @@ try
PKG_COMMAND (configure);
PKG_COMMAND (disfigure);
PKG_COMMAND (update);
+ PKG_COMMAND (clean);
// cfg-* commands
//
diff --git a/bpkg/buildfile b/bpkg/buildfile
index 2e840ca..8d7a0f9 100644
--- a/bpkg/buildfile
+++ b/bpkg/buildfile
@@ -23,6 +23,7 @@ exe{bpkg}: cxx{package package-odb database diagnostics utility} \
cxx{pkg-configure} cli.cxx{pkg-configure-options} \
cxx{pkg-disfigure} cli.cxx{pkg-disfigure-options} \
cli.cxx{pkg-update-options} \
+ cli.cxx{pkg-clean-options} \
cxx{cfg-create} cli.cxx{cfg-create-options} \
cxx{rep-create} cli.cxx{rep-create-options} \
$libs
@@ -55,6 +56,7 @@ cli.cxx{pkg-purge-options}: cli{pkg-purge-options}
cli.cxx{pkg-configure-options}: cli{pkg-configure-options}
cli.cxx{pkg-disfigure-options}: cli{pkg-disfigure-options}
cli.cxx{pkg-update-options}: cli{pkg-update-options}
+cli.cxx{pkg-clean-options}: cli{pkg-clean-options}
cli.cxx{pkg-verify-options}: cli{pkg-verify-options}
cli.cxx{pkg-verify-options}: cli.options += --exclude-base
diff --git a/bpkg/pkg-clean b/bpkg/pkg-clean
new file mode 100644
index 0000000..baed20a
--- /dev/null
+++ b/bpkg/pkg-clean
@@ -0,0 +1,21 @@
+// file : bpkg/pkg-clean -*- C++ -*-
+// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#ifndef BPKG_PKG_CLEAN
+#define BPKG_PKG_CLEAN
+
+#include <bpkg/types>
+#include <bpkg/pkg-command>
+#include <bpkg/pkg-clean-options>
+
+namespace bpkg
+{
+ inline void
+ pkg_clean (const pkg_clean_options& o, cli::scanner& args)
+ {
+ pkg_command ("clean", o, args);
+ }
+}
+
+#endif // BPKG_PKG_CLEAN
diff --git a/bpkg/pkg-clean-options.cli b/bpkg/pkg-clean-options.cli
new file mode 100644
index 0000000..c9d9bca
--- /dev/null
+++ b/bpkg/pkg-clean-options.cli
@@ -0,0 +1,27 @@
+// file : bpkg/pkg-clean-options.cli
+// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+include <bpkg/pkg-common-options.cli>;
+
+/*
+"\section=1"
+"\name=bpkg-pkg-clean"
+
+"\h{SYNOPSIS}
+
+bpkg pkg-clean <pkg>"
+
+"\h{DESCRIPTION}
+
+The \cb{pkg-clean} command cleans the previously configured
+(\cb{pkg-configure}) package. Underneath, this command doesn't
+do much more than run (\cb{b clean})."
+*/
+
+namespace bpkg
+{
+ class pkg_clean_options: pkg_common_options
+ {
+ };
+}
diff --git a/bpkg/test.sh b/bpkg/test.sh
index b7282b6..3ab76df 100755
--- a/bpkg/test.sh
+++ b/bpkg/test.sh
@@ -291,3 +291,34 @@ test pkg-update $pkg
test pkg-update $pkg
test pkg-disfigure $pkg
test pkg-purge $pkg
+
+##
+## pkg-clean
+##
+
+fail pkg-clean # package name expected
+fail pkg-clean $pkg # no such package
+test pkg-fetch -e $pkga
+fail pkg-clean $pkg # wrong package state
+test pkg-purge $pkg
+
+# src == out
+#
+test pkg-fetch -e $pkga
+test pkg-unpack $pkg
+test pkg-configure $pkg
+test pkg-update $pkg
+test pkg-clean $pkg
+test pkg-clean $pkg
+test pkg-disfigure $pkg
+test pkg-purge $pkg
+
+# src != out
+#
+test pkg-unpack -e $pkgd
+test pkg-configure $pkg
+test pkg-update $pkg
+test pkg-clean $pkg
+test pkg-clean $pkg
+test pkg-disfigure $pkg
+test pkg-purge $pkg