diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2023-03-06 08:48:59 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2023-03-06 08:48:59 +0200 |
commit | d7014bd5a0bc3c09d175140641d1d8ad95e27559 (patch) | |
tree | 195db0cda3ac8d0e3067223472b6f7a3a5017854 | |
parent | c84c3bda276e6b07ab784521de2634376286e76d (diff) |
Change <out-dir> argument to --output-root|-o option
-rw-r--r-- | bpkg/pkg-bindist.cli | 36 | ||||
-rw-r--r-- | bpkg/pkg-bindist.cxx | 21 | ||||
-rw-r--r-- | bpkg/system-package-manager-debian.cxx | 17 | ||||
-rw-r--r-- | bpkg/system-package-manager-debian.hxx | 1 | ||||
-rw-r--r-- | bpkg/system-package-manager-fedora.cxx | 4 | ||||
-rw-r--r-- | bpkg/system-package-manager-fedora.hxx | 1 | ||||
-rw-r--r-- | bpkg/system-package-manager.hxx | 1 |
7 files changed, 43 insertions, 38 deletions
diff --git a/bpkg/pkg-bindist.cli b/bpkg/pkg-bindist.cli index 527cc8b..7c686bf 100644 --- a/bpkg/pkg-bindist.cli +++ b/bpkg/pkg-bindist.cli @@ -10,11 +10,11 @@ include <bpkg/configuration.cli>; namespace bpkg { { - "<options> <vars> <out-dir> <pkg>", + "<options> <dir> <vars> <pkg>", "\h|SYNOPSIS| - \c{\b{bpkg pkg-bindist}|\b{bindist} [<options>] [<vars>] <out-dir> <pkg> [<pkg>...]} + \c{\b{bpkg pkg-bindist}|\b{bindist} [\b{--output-root}|\b{-o} <dir>] [<options>] [<vars>] <pkg>...} \h|DESCRIPTION| @@ -22,8 +22,10 @@ namespace bpkg the specified package. If additional packages are specified, then they are bundled in the same distribution package. All the specified packages must have been previously configured with \l{bpkg-pkg-build(1)} or - \l{bpkg-pkg-configure(1)}. The intermediate files and the resulting - binary package are created in the <out-dir> directory. + \l{bpkg-pkg-configure(1)}. For some system package managers a directory + for intermediate files and subdirectories as well as the resulting binary + package may have to be specified explicitly with the + \c{\b{--output-root}|\b{-o}} option. Underneath, this command roughly performs the following steps: First it installs the specified packages similar to the \l{bpkg-pkg-install(1)} @@ -60,7 +62,7 @@ namespace bpkg "Prepare all the package metadata files (\cb{control}, \cb{rules}, etc) but do not invoke \cb{bpkg-buildpackage} to generate the binary package, printing its command line instead unless requested to be - quiet. Implies \cb{--keep-out}." + quiet. Implies \cb{--keep-output}." } string --debian-buildflags = "assign" @@ -173,17 +175,27 @@ namespace bpkg makes sense together with \cb{--recursive}." } - bool --wipe-out + dir_path --output-root|-o { - "Wipe the output directory (\ci{out-dir}) clean before using it to - generate the binary package." + "<dir>", + "Directory for intermediate files and subdirectories as well as the + resulting binary package. Note that this option may be required for + some system package managers and may not be specified for others." } - bool --keep-out + bool --wipe-output { - "Keep intermediate files in the output directory (\ci{out-dir}) that - were used to generate the binary package. This is primarily useful - for troubleshooting." + "Wipe the output root directory (either specified with \ci{--output-root} + or system package manager-specific) clean before using it to generate + the binary package." + } + + bool --keep-output + { + "Keep intermediate files in the output root directory (either specified + with \ci{--output-root} or system package manager-specific) that were + used to generate the binary package. This is primarily useful for + troubleshooting." } }; diff --git a/bpkg/pkg-bindist.cxx b/bpkg/pkg-bindist.cxx index d68f60b..d4f7f1c 100644 --- a/bpkg/pkg-bindist.cxx +++ b/bpkg/pkg-bindist.cxx @@ -209,10 +209,8 @@ namespace bpkg dr << info << "run 'bpkg help pkg-bindist' for more information"; } - // Sort arguments into the output directory, package names, and - // configuration variables. + // Sort arguments into package names and configuration variables. // - dir_path out; vector<package_name> pns; strings vars; { @@ -234,17 +232,6 @@ namespace bpkg if (a.find ('=') != string::npos) vars.push_back (move (trim (a))); - else if (out.empty ()) - { - try - { - out = dir_path (move (a)); - } - catch (const invalid_path& e) - { - fail << "invalid output directory '" << e.path << "'"; - } - } else { try @@ -258,8 +245,8 @@ namespace bpkg } } - if (out.empty () || pns.empty ()) - fail << "output directory or package name argument expected" << + if (pns.empty ()) + fail << "package name argument expected" << info << "run 'bpkg help pkg-bindist' for more information"; } @@ -385,7 +372,7 @@ namespace bpkg // option to specify/override it (along with languages). Note that there // will probably be no way to override type for dependencies. // - paths r (spm->generate (pkgs, deps, vars, pm, type, langs, out, rec)); + paths r (spm->generate (pkgs, deps, vars, pm, type, langs, rec)); if (r.empty ()) return 0; // Assume prepare-only mode or similar. diff --git a/bpkg/system-package-manager-debian.cxx b/bpkg/system-package-manager-debian.cxx index a3f2721..f012d6c 100644 --- a/bpkg/system-package-manager-debian.cxx +++ b/bpkg/system-package-manager-debian.cxx @@ -1856,13 +1856,20 @@ namespace bpkg const package_manifest& pm, const string& pt, const small_vector<language, 1>& langs, - const dir_path& out, optional<recursive_mode> recur) { tracer trace ("system_package_manager_debian::generate"); assert (!langs.empty ()); // Should be effective. + // We require explicit output root. + // + if (!ops_->output_root_specified ()) + fail << "output root directory must be specified explicitly with " + << "--output-root|-o"; + + const dir_path& out (ops_->output_root ()); // Cannot be empty. + const shared_ptr<selected_package>& sp (pkgs.front ().selected); const package_name& pn (sp->name); const version& pv (sp->version); @@ -2082,9 +2089,9 @@ namespace bpkg { if (!empty (out)) { - if (!ops_->wipe_out ()) - fail << "directory " << out << " is not empty" << - info << "use --wipe-out to clean it up but be careful"; + if (!ops_->wipe_output ()) + fail << "output root directory " << out << " is not empty" << + info << "use --wipe-output to clean it up but be careful"; rm_r (out, false); } @@ -3179,7 +3186,7 @@ namespace bpkg // Cleanup intermediate files unless requested not to. // - if (!ops_->keep_out ()) + if (!ops_->keep_output ()) { rm_r (src); } diff --git a/bpkg/system-package-manager-debian.hxx b/bpkg/system-package-manager-debian.hxx index b82cfd2..bba3f04 100644 --- a/bpkg/system-package-manager-debian.hxx +++ b/bpkg/system-package-manager-debian.hxx @@ -140,7 +140,6 @@ namespace bpkg const package_manifest&, const string&, const small_vector<language, 1>&, - const dir_path&, optional<recursive_mode>) override; public: diff --git a/bpkg/system-package-manager-fedora.cxx b/bpkg/system-package-manager-fedora.cxx index 45b4fdd..02c2f59 100644 --- a/bpkg/system-package-manager-fedora.cxx +++ b/bpkg/system-package-manager-fedora.cxx @@ -1801,9 +1801,11 @@ namespace bpkg const package_manifest&, const string&, const small_vector<language, 1>&, - const dir_path&, optional<recursive_mode>) { + // @@ TODO: make sure --output-root is not specified or matched the + // rpm standard directory. + paths r; return r; } diff --git a/bpkg/system-package-manager-fedora.hxx b/bpkg/system-package-manager-fedora.hxx index 792c3f3..982881a 100644 --- a/bpkg/system-package-manager-fedora.hxx +++ b/bpkg/system-package-manager-fedora.hxx @@ -203,7 +203,6 @@ namespace bpkg const package_manifest&, const string&, const small_vector<language, 1>&, - const dir_path&, optional<recursive_mode>) override; public: diff --git a/bpkg/system-package-manager.hxx b/bpkg/system-package-manager.hxx index 65f4b2d..c661919 100644 --- a/bpkg/system-package-manager.hxx +++ b/bpkg/system-package-manager.hxx @@ -199,7 +199,6 @@ namespace bpkg const package_manifest&, const string& type, const small_vector<language, 1>&, - const dir_path& out, optional<recursive_mode>) = 0; public: |