summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-01-29 23:09:44 (EST)
committer P. J. McDermott <pjm@nac.net>2012-01-29 23:09:44 (EST)
commit0c5692f2fc47b4b6216e2807fd4315c28b9425a4 (patch)
tree965e18adbaac2a50db127fef5e091743e9036367
parent0ee239776cdfefadb611885d8e88a1cc9174301f (diff)
Sometimes I hate shell script...
Piping input into a read command won't work, because read will be run in a subshell and therefore be unable to modify variables of the parent shell. Also, for some reason double quotes cause the substring processing in this parameter expansion to fail: export OH_PKGVER="${version%'-'*}"
-rw-r--r--lib/architecture4
-rw-r--r--src/opkbuild9
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/architecture b/lib/architecture
index 47102ba..4af24ef 100644
--- a/lib/architecture
+++ b/lib/architecture
@@ -32,7 +32,9 @@ oh_is_buildable()
# XXX: Handle platforms.
# Tokenize the 4-tuple binary architecture.
- echo "${_pkgarch}" | IFS=- read _pkgcpu _pkgvendor _pkgkernel _pkglibs
+ IFS=- read _pkgcpu _pkgvendor _pkgkernel _pkglibs <<EOF
+${_pkgarch}
+EOF
# Test each element of the tuple.
[ "${_pkgcpu}" != any -a "${_pkgcpu}" != "${OH_ARCH_CPU}" ] &&
diff --git a/src/opkbuild b/src/opkbuild
index 5167563..6cae035 100644
--- a/src/opkbuild
+++ b/src/opkbuild
@@ -128,12 +128,13 @@ version=$(oh_get_field Version)
# Set environment variables for the build configuration.
export OH_PLATFORM="${platform}"
export OH_ARCH="${arch}"
-echo "${OH_ARCH}" | \
- IFS=- read OH_ARCH_CPU OH_ARCH_VENDOR OH_ARCH_KERNEL OH_ARCH_LIBS
+IFS=- read OH_ARCH_CPU OH_ARCH_VENDOR OH_ARCH_KERNEL OH_ARCH_LIBS <<EOF
+${OH_ARCH}
+EOF
export OH_ARCH_CPU OH_ARCH_VENDOR OH_ARCH_KERNEL OH_ARCH_LIBS
export OH_SRCPKG="${srcpkg}"
-export OH_PKGVER="${version%'-'*}"
-export OH_PKGREV="${version#*'-'}"
+export OH_PKGVER=${version%'-'*}
+export OH_PKGREV=${version#*'-'}
# Check build dependencies.
oh-checkbuilddeps || error "${srcpkg}-src"