xbps: add patch from git to support 6th arg in pkg scripts (machine arch).
This commit is contained in:
parent
affb12291c
commit
1d84ba3c07
|
@ -0,0 +1,152 @@
|
||||||
|
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
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Template file for 'xbps'
|
# Template file for 'xbps'
|
||||||
pkgname=xbps
|
pkgname=xbps
|
||||||
version=0.33
|
version=0.33
|
||||||
revision=1
|
revision=2
|
||||||
bootstrap=yes
|
bootstrap=yes
|
||||||
short_desc="The XBPS package system utilities"
|
short_desc="The XBPS package system utilities"
|
||||||
maintainer="Juan RP <xtraeme@gmail.com>"
|
maintainer="Juan RP <xtraeme@gmail.com>"
|
||||||
|
|
Loading…
Reference in New Issue