Fix #69 (No way to set globally a custom architecture)

The "architecture" configuration keyword is now available to override
the native machine architecture returned by (uname(2)).

The XBPS_ARCH environment variable still has preference.
This commit is contained in:
Juan RP
2014-11-19 11:36:09 +01:00
parent b2bc7af66e
commit 428a747fad
8 changed files with 72 additions and 3 deletions

View File

@@ -8,3 +8,5 @@ include('xbps-create/Kyuafile')
include('xbps-install/Kyuafile')
include('xbps-query/Kyuafile')
include('xbps-rindex/Kyuafile')
include('xbps-uhelper/Kyuafile')

View File

@@ -1,5 +1,5 @@
-include ../../config.mk
SUBDIRS = common libxbps xbps-checkvers xbps-create xbps-install xbps-query xbps-rindex
SUBDIRS = common libxbps xbps-checkvers xbps-create xbps-install xbps-query xbps-rindex xbps-uhelper
include ../../mk/subdir.mk

View File

@@ -0,0 +1,4 @@
syntax("kyuafile", 1)
test_suite("xbps-uhelper")
atf_test_program{name="arch_test"}

View File

@@ -0,0 +1,8 @@
TOPDIR = ../../..
-include $(TOPDIR)/config.mk
TESTSHELL = arch_test
TESTSSUBDIR = xbps/xbps-uhelper
EXTRA_FILES = Kyuafile
include $(TOPDIR)/mk/test.mk

View File

@@ -0,0 +1,39 @@
#! /usr/bin/env atf-sh
# Test that xbps-uhelper arch works as expected.
atf_test_case native
native_head() {
atf_set "descr" "xbps-uhelper arch: native test"
}
native_body() {
atf_check_equal $(xbps-uhelper arch) $(uname -m)
}
atf_test_case env
env_head() {
atf_set "descr" "xbps-uhelper arch: envvar override test"
}
env_body() {
export XBPS_ARCH=foo
atf_check_equal $(xbps-uhelper arch) foo
}
atf_test_case conf
conf_head() {
atf_set "descr" "xbps-uhelper arch: configuration override test"
}
conf_body() {
mkdir -p xbps.d
echo "architecture=x86_64-musl" > xbps.d/arch.conf
atf_check_equal $(xbps-uhelper -C $PWD/xbps.d arch) x86_64-musl
}
atf_init_test_cases() {
atf_add_test_case native
atf_add_test_case env
atf_add_test_case conf
}