From f146720a3800fa2a9025a7326e0f0a2ce9048364 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 18 Sep 2015 07:58:04 +0200 Subject: Implement pkg-clean command --- bpkg/bpkg-options.cli | 7 +++++++ bpkg/bpkg.cxx | 2 ++ bpkg/buildfile | 2 ++ bpkg/pkg-clean | 21 +++++++++++++++++++++ bpkg/pkg-clean-options.cli | 27 +++++++++++++++++++++++++++ bpkg/test.sh | 31 +++++++++++++++++++++++++++++++ 6 files changed, 90 insertions(+) create mode 100644 bpkg/pkg-clean create mode 100644 bpkg/pkg-clean-options.cli (limited to 'bpkg') 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 + { + "", + "Clean package.", + "" + }; + bool cfg-create { "[]", 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 #include #include +#include #include #include @@ -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 +#include +#include + +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 ; + +/* +"\section=1" +"\name=bpkg-pkg-clean" + +"\h{SYNOPSIS} + +bpkg pkg-clean " + +"\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 -- cgit v1.1