From 07e8330936b2059092b4cdf74c39487d4afec40c Mon Sep 17 00:00:00 2001 From: Juan RP Date: Wed, 3 Jun 2015 11:15:11 +0200 Subject: [PATCH] xbps-install(1): added -U --unpack-only to only unpack pkgs, skips configuration. --- NEWS | 3 +++ bin/xbps-install/main.c | 7 ++++++- bin/xbps-install/xbps-install.1 | 6 +++++- include/xbps.h.in | 9 ++++++++- lib/transaction_commit.c | 8 ++++++-- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 5f86b98b..b6c1d597 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ xbps-0.45 (???): + * xbps-install(1): added -U --unpack-only option, to only unpack packages + in the transaction, skips the configuration phase. + * configure: added `--enable-fulldebug` option to enable extra/expensive debug output. diff --git a/bin/xbps-install/main.c b/bin/xbps-install/main.c index f543241a..3bedf677 100644 --- a/bin/xbps-install/main.c +++ b/bin/xbps-install/main.c @@ -52,6 +52,7 @@ usage(bool fail) " overwritten.\n" " -h --help Print help usage\n" " -i --ignore-conf-repos Ignore repositories defined in xbps.d\n" + " -U --unpack-only Unpack packages in transaction, do not configure them\n" " -M --memory-sync Remote repository data is fetched and stored\n" " in memory, ignoring on-disk repodata archives.\n" " -n --dry-run Dry-run mode\n" @@ -93,7 +94,7 @@ repo_import_key_cb(struct xbps_repo *repo, void *arg _unused, bool *done _unused int main(int argc, char **argv) { - const char *shortopts = "AC:c:dfhiMnR:r:SuVvy"; + const char *shortopts = "AC:c:dfhiMnR:r:SuUVvy"; const struct option longopts[] = { { "automatic", no_argument, NULL, 'A' }, { "config", required_argument, NULL, 'C' }, @@ -107,6 +108,7 @@ main(int argc, char **argv) { "repository", required_argument, NULL, 'R' }, { "rootdir", required_argument, NULL, 'r' }, { "sync", no_argument, NULL, 'S' }, + { "unpack-only", no_argument, NULL, 'U' }, { "update", no_argument, NULL, 'u' }, { "verbose", no_argument, NULL, 'v' }, { "version", no_argument, NULL, 'V' }, @@ -167,6 +169,9 @@ main(int argc, char **argv) case 'S': syncf = true; break; + case 'U': + flags |= XBPS_FLAG_UNPACK_ONLY; + break; case 'u': update = true; break; diff --git a/bin/xbps-install/xbps-install.1 b/bin/xbps-install/xbps-install.1 index 12a6ce8d..68d1ea15 100644 --- a/bin/xbps-install/xbps-install.1 +++ b/bin/xbps-install/xbps-install.1 @@ -1,4 +1,4 @@ -.Dd May 16, 2015 +.Dd June 3, 2015 .Dt XBPS-INSTALL 1 .Sh NAME .Nm xbps-install @@ -104,6 +104,10 @@ This option can be specified multiple times. Specifies a full path for the target root directory. .It Fl S, Fl -sync Synchronize remote repository index files. +.It Fl U, Fl -unpack-only +If set, packages to be installed or upgraded in the transaction won't be configured, +just unpacked. That means that those packages should be reconfigured via +.Xr xbps-reconfigure 1 . .It Fl u, Fl -update Performs a full system upgrade: all installed packages will be updated to the greatest versions that were found in repositories. diff --git a/include/xbps.h.in b/include/xbps.h.in index d95a64bf..aa4e7fd6 100644 --- a/include/xbps.h.in +++ b/include/xbps.h.in @@ -48,7 +48,7 @@ * * This header documents the full API for the XBPS Library. */ -#define XBPS_API_VERSION "20150528" +#define XBPS_API_VERSION "20150603" #ifndef XBPS_VERSION #define XBPS_VERSION "UNSET" @@ -200,6 +200,13 @@ */ #define XBPS_FLAG_FORCE_REMOVE_REVDEPS 0x00000800 +/** + * @def XBPS_FLAG_UNPACK_ONLY + * Do not configure packages in the transaction, just unpack them. + * Must be set through the xbps_handle::flags member. + */ +#define XBPS_FLAG_UNPACK_ONLY 0x00001000 + /** * @def XBPS_FETCH_CACHECONN * Default (global) limit of cached connections used in libfetch. diff --git a/lib/transaction_commit.c b/lib/transaction_commit.c index 511bb0d5..3de305de 100644 --- a/lib/transaction_commit.c +++ b/lib/transaction_commit.c @@ -348,9 +348,13 @@ xbps_transaction_commit(struct xbps_handle *xhp) !xbps_dictionary_get(xhp->transd, "total-install-pkgs")) goto out; - /* if installing packages for target_arch, don't configure anything */ - if (xhp->target_arch && strcmp(xhp->native_arch, xhp->target_arch)) + if (xhp->target_arch && strcmp(xhp->native_arch, xhp->target_arch)) { + /* if installing packages for target_arch, don't configure anything */ goto out; + /* do not configure packages if only unpacking is desired */ + } else if (xhp->flags & XBPS_FLAG_UNPACK_ONLY) { + goto out; + } xbps_object_iterator_reset(iter); /* Force a pkgdb write for all unpacked pkgs in transaction */