xbps: update to 0.34.

This commit is contained in:
Juan RP 2014-03-26 09:35:43 +01:00
parent 19d17f0d50
commit 8a465b7821
7 changed files with 2 additions and 396 deletions

View File

@ -1,152 +0,0 @@
From ef3b6278a67f1e30fc50b5272e24ddf0ec660a30 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Wed, 12 Mar 2014 10:16:37 +0100
Subject: [PATCH] Added support to pass native machine architecture to pkg
scripts (6th arg).
---
NEWS | 3 ++
lib/package_script.c | 2 +-
tests/xbps/libxbps/common/Kyuafile | 1 +
tests/xbps/libxbps/shell/Makefile | 2 +-
tests/xbps/libxbps/shell/scripts_test.sh | 90 ++++++++++++++++++++++++++++++++
5 files changed, 96 insertions(+), 2 deletions(-)
create mode 100644 tests/xbps/libxbps/shell/scripts_test.sh
diff --git a/lib/package_script.c b/lib/package_script.c
index 0031bab..3a9b316 100644
--- lib/package_script.c
+++ lib/package_script.c
@@ -98,7 +98,7 @@ xbps_pkg_exec_buffer(struct xbps_handle *xhp,
rv = xbps_file_exec(xhp, fpath, action, pkgname, version,
update ? "yes" : "no",
- xhp->conffile, NULL);
+ xhp->conffile, xhp->native_arch, NULL);
free(pkgname);
out:
diff --git a/tests/xbps/libxbps/common/Kyuafile b/tests/xbps/libxbps/common/Kyuafile
index 7361066..838557e 100644
--- tests/xbps/libxbps/common/Kyuafile
+++ tests/xbps/libxbps/common/Kyuafile
@@ -17,6 +17,7 @@ atf_test_program{name="remove_test"}
atf_test_program{name="replace_test"}
atf_test_program{name="installmode_test"}
atf_test_program{name="obsoletefiles_test"}
+atf_test_program{name="scripts_test"}
include('find_pkg_orphans/Kyuafile')
include('pkgdb/Kyuafile')
diff --git a/tests/xbps/libxbps/shell/Makefile b/tests/xbps/libxbps/shell/Makefile
index e0ef1ea..5ddb15f 100644
--- tests/xbps/libxbps/shell/Makefile
+++ tests/xbps/libxbps/shell/Makefile
@@ -3,7 +3,7 @@ TOPDIR = ../../../..
TESTSHELL = conf_files_test issue6_test issue18_test issue20_test remove_test
TESTSHELL+= replace_test installmode_test obsoletefiles_test
-TESTSHELL+= issue31_test
+TESTSHELL+= issue31_test scripts_test
include ../Makefile.inc
include $(TOPDIR)/mk/test.mk
diff --git a/tests/xbps/libxbps/shell/scripts_test.sh b/tests/xbps/libxbps/shell/scripts_test.sh
new file mode 100644
index 0000000..f6c9d53
--- /dev/null
+++ tests/xbps/libxbps/shell/scripts_test.sh
@@ -0,0 +1,90 @@
+#!/usr/bin/env atf-sh
+#
+# Tests to verify that INSTALL/REMOVE scripts in pkgs work as expected.
+
+create_script() {
+ cat > "$1" <<_EOF
+#!/bin/sh
+ACTION="\$1"
+PKGNAME="\$2"
+VERSION="\$3"
+UPDATE="\$4"
+CONF_FILE="\$5"
+ARCH="\$6"
+
+echo "\$@" >&2
+_EOF
+ chmod +x "$1"
+}
+
+atf_test_case script_nargs
+
+script_nargs_head() {
+ atf_set "descr" "Tests for package scripts: number of arguments"
+}
+
+script_nargs_body() {
+ mkdir some_repo root
+ mkdir -p pkg_A/usr/bin
+ echo "A-1.0_1" > pkg_A/usr/bin/foo
+ create_script pkg_A/INSTALL
+
+ cd some_repo
+ xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A
+ atf_check_equal $? 0
+ xbps-rindex -a *.xbps
+ atf_check_equal $? 0
+ cd ..
+ xbps-install -C empty.conf -r root --repository=$PWD/some_repo -y A
+ atf_check_equal $? 0
+
+ rval=0
+ xbps-reconfigure -C empty.conf -r root -f A 2>out
+ out="$(cat out)"
+ expected="post A 1.0_1 no empty.conf $(uname -m)"
+ if [ "$out" != "$expected" ]; then
+ echo "out: '$out'"
+ echo "expected: '$expected'"
+ rval=1
+ fi
+ atf_check_equal $rval 0
+}
+
+atf_test_case script_arch
+
+script_arch_head() {
+ atf_set "descr" "Tests for package scripts: XBPS_ARCH overrides \$ARCH"
+}
+
+script_arch_body() {
+ mkdir some_repo root
+ mkdir -p pkg_A/usr/bin
+ echo "A-1.0_1" > pkg_A/usr/bin/foo
+ create_script pkg_A/INSTALL
+
+ cd some_repo
+ xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A
+ atf_check_equal $? 0
+ xbps-rindex -a *.xbps
+ atf_check_equal $? 0
+ cd ..
+ xbps-install -C empty.conf -r root --repository=$PWD/some_repo -y A
+ atf_check_equal $? 0
+
+ # Check that XBPS_ARCH overrides $ARCH.
+ rval=0
+ XBPS_ARCH=foo xbps-reconfigure -C empty.conf -r root -f A 2>out
+ out="$(cat out)"
+ expected="post A 1.0_1 no empty.conf foo"
+ if [ "$out" != "$expected" ]; then
+ echo "out: '$out'"
+ echo "expected: '$expected'"
+ rval=1
+ fi
+ atf_check_equal $rval 0
+}
+
+atf_init_test_cases() {
+ atf_add_test_case script_nargs
+ atf_add_test_case script_arch
+}
--
1.9.0

View File

@ -1,40 +0,0 @@
From 62888d310396476b54b46689da48477501490033 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Thu, 13 Mar 2014 20:35:26 +0100
Subject: [PATCH 1/4] xbps_transaction_commit: add some debugging in error
paths.
---
lib/transaction_commit.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/transaction_commit.c b/lib/transaction_commit.c
index dee8876..ef6b0ce 100644
--- lib/transaction_commit.c
+++ lib/transaction_commit.c
@@ -256,7 +256,7 @@ xbps_transaction_commit(struct xbps_handle *xhp)
rv = xbps_remove_pkg(xhp, pkgver, update);
if (rv != 0) {
xbps_dbg_printf(xhp, "[trans] failed to "
- "remove %s\n", pkgver);
+ "remove %s: %s\n", pkgver, strerror(rv));
goto out;
}
continue;
@@ -266,9 +266,11 @@ xbps_transaction_commit(struct xbps_handle *xhp)
* Reconfigure pending package.
*/
rv = xbps_configure_pkg(xhp, pkgver, false, false);
- if (rv != 0)
+ if (rv != 0) {
+ xbps_dbg_printf(xhp, "[trans] failed to "
+ "configure %s: %s\n", pkgver, strerror(rv));
goto out;
-
+ }
continue;
} else if (strcmp(tract, "update") == 0) {
--
1.9.0

View File

@ -1,61 +0,0 @@
From 67b5ba0dc33b5fce23202cb4c2ec6a786734c269 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Thu, 13 Mar 2014 20:49:54 +0100
Subject: [PATCH 2/4] xbps_transaction_commit: add some more debugging.
---
lib/transaction_commit.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/lib/transaction_commit.c b/lib/transaction_commit.c
index ef6b0ce..4d67676 100644
--- lib/transaction_commit.c
+++ lib/transaction_commit.c
@@ -229,14 +229,20 @@ xbps_transaction_commit(struct xbps_handle *xhp)
* Download binary packages (if they come from a remote repository).
*/
xbps_set_cb_state(xhp, XBPS_STATE_TRANS_DOWNLOAD, 0, NULL, NULL);
- if ((rv = download_binpkgs(xhp, iter)) != 0)
+ if ((rv = download_binpkgs(xhp, iter)) != 0) {
+ xbps_dbg_printf(xhp, "[trans] failed to download binpkgs: "
+ "%s\n", strerror(rv));
goto out;
+ }
/*
* Check binary package integrity.
*/
xbps_set_cb_state(xhp, XBPS_STATE_TRANS_VERIFY, 0, NULL, NULL);
- if ((rv = check_binpkgs(xhp, iter)) != 0)
+ if ((rv = check_binpkgs(xhp, iter)) != 0) {
+ xbps_dbg_printf(xhp, "[trans] failed to check binpkgs: "
+ "%s\n", strerror(rv));
goto out;
+ }
/*
* Install, update, configure or remove packages as specified
* in the transaction dictionary.
@@ -297,13 +303,19 @@ xbps_transaction_commit(struct xbps_handle *xhp)
/*
* Unpack binary package.
*/
- if ((rv = xbps_unpack_binary_pkg(xhp, obj)) != 0)
+ if ((rv = xbps_unpack_binary_pkg(xhp, obj)) != 0) {
+ xbps_dbg_printf(xhp, "[trans] failed to unpack "
+ "%s: %s\n", pkgver, strerror(rv));
goto out;
+ }
/*
* Register package.
*/
- if ((rv = xbps_register_pkg(xhp, obj)) != 0)
+ if ((rv = xbps_register_pkg(xhp, obj)) != 0) {
+ xbps_dbg_printf(xhp, "[trans] failed to register "
+ "%s: %s\n", pkgver, strerror(rv));
goto out;
+ }
}
/* if there are no packages to install or update we are done */
if (!xbps_dictionary_get(xhp->transd, "total-update-pkgs") &&
--
1.9.0

View File

@ -1,32 +0,0 @@
From 56786ed31545f04f14174694d1ea2ca96539c55d Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Thu, 13 Mar 2014 21:07:44 +0100
Subject: [PATCH 3/4] xbps_remove_pkg: misc debugging tweaks.
---
lib/package_remove.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/package_remove.c b/lib/package_remove.c
index 27d1078..1dcf750 100644
--- lib/package_remove.c
+++ lib/package_remove.c
@@ -231,13 +231,12 @@ xbps_remove_pkg(struct xbps_handle *xhp, const char *pkgver, bool update)
pkgname = xbps_pkg_name(pkgver);
assert(pkgname);
- xbps_dbg_printf(xhp, "attempting to remove %s state %d\n", pkgver, state);
-
if ((rv = xbps_pkg_state_installed(xhp, pkgname, &state)) != 0) {
- xbps_dbg_printf(xhp, "cannot find %s in pkgdb: %s\n",
+ xbps_dbg_printf(xhp, "[remove] cannot find %s in pkgdb: %s\n",
pkgver, strerror(rv));
goto out;
}
+ xbps_dbg_printf(xhp, "attempting to remove %s state %d\n", pkgver, state);
if (!update)
xbps_set_cb_state(xhp, XBPS_STATE_REMOVE, 0, pkgver, NULL);
--
1.9.0

View File

@ -1,76 +0,0 @@
From cbbdc4c8bc41e3ec9efffd6db58eea03753bb9e4 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Thu, 13 Mar 2014 21:28:31 +0100
Subject: [PATCH 4/4] xbps_configure_pkg: try to use pkgname if possible to
configure a pkg.
In pwwka's case for some reason the transaction was trying to configure
'man-pages-3.62_1' while in pkgdb there was only 'man-pages-3.55_1'.
By using the pkgname the pkg stored in pkgdb will be configured, without
caring what version it is.
---
lib/package_configure.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/lib/package_configure.c b/lib/package_configure.c
index 9eba42c..8608e79 100644
--- lib/package_configure.c
+++ lib/package_configure.c
@@ -87,13 +87,25 @@ xbps_configure_pkg(struct xbps_handle *xhp,
assert(pkgver != NULL);
- pkgd = xbps_pkgdb_get_pkg(xhp, pkgver);
- if (pkgd == NULL)
+ if ((pkgname = xbps_pkg_name(pkgver)) == NULL) {
+ xbps_dbg_printf(xhp, "[configure] cannot guess "
+ "pkgname for %s\n", pkgver);
+ /* assume pkgver == pkgname */
+ pkgname = strdup(pkgver);
+ assert(pkgname);
+ }
+ pkgd = xbps_pkgdb_get_pkg(xhp, pkgname);
+ if (pkgd == NULL) {
+ free(pkgname);
+ xbps_dbg_printf(xhp, "[configure] cannot find %s (%s) "
+ "in pkgdb\n", pkgname, pkgver);
return ENOENT;
+ }
rv = xbps_pkg_state_dictionary(pkgd, &state);
xbps_dbg_printf(xhp, "%s: state %d rv %d\n", pkgver, state, rv);
if (rv != 0) {
+ free(pkgname);
xbps_dbg_printf(xhp, "%s: [configure] failed to get "
"pkg state: %s\n", pkgver, strerror(rv));
return EINVAL;
@@ -101,19 +113,18 @@ xbps_configure_pkg(struct xbps_handle *xhp,
if (check_state) {
if (state == XBPS_PKG_STATE_INSTALLED) {
- if ((xhp->flags & XBPS_FLAG_FORCE_CONFIGURE) == 0)
+ if ((xhp->flags & XBPS_FLAG_FORCE_CONFIGURE) == 0) {
+ free(pkgname);
return 0;
- } else if (state != XBPS_PKG_STATE_UNPACKED)
+ }
+ } else if (state != XBPS_PKG_STATE_UNPACKED) {
+ free(pkgname);
return EINVAL;
+ }
}
xbps_set_cb_state(xhp, XBPS_STATE_CONFIGURE, 0, pkgver, NULL);
- /* internalize pkg dictionary from metadir */
- pkgname = xbps_pkg_name(pkgver);
- if (pkgname == NULL) /* assume pkgname */
- pkgname = strdup(pkgver);
-
plist = xbps_xasprintf("%s/.%s.plist", xhp->metadir, pkgname);
free(pkgname);
--
1.9.0

View File

@ -1,33 +0,0 @@
From d0a9bbb912630fee4fe7d29b6ec0655142f42fad Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Tue, 18 Mar 2014 14:08:40 +0100
Subject: [PATCH] Fix #34 (make libfetch always add "Accept: */*" in the HTTP
header).
---
NEWS | 6 ++++++
lib/fetch/http.c | 8 ++++++++
2 files changed, 14 insertions(+)
--- lib/fetch/http.c
+++ lib/fetch/http.c
@@ -939,8 +939,16 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
http_cmd(conn, "User-Agent: %s\r\n", p);
else
http_cmd(conn, "User-Agent: %s\r\n", _LIBFETCH_VER);
+
+ /*
+ * Some servers returns 406 (Not Acceptable) if the Accept field is not
+ * provided by the user agent, such example is http://alioth.debian.org.
+ */
+ http_cmd(conn, "Accept: */*\r\n");
+
if (url->offset > 0)
http_cmd(conn, "Range: bytes=%lld-\r\n", (long long)url->offset);
+
http_cmd(conn, "\r\n");
/*
--
1.9.0

View File

@ -1,7 +1,7 @@
# Template file for 'xbps'
pkgname=xbps
version=0.33
revision=4
version=0.34
revision=1
bootstrap=yes
short_desc="The XBPS package system utilities"
maintainer="Juan RP <xtraeme@gmail.com>"