From ab03bed726f4460276dd2c51a71dc99a39daa12d Mon Sep 17 00:00:00 2001
From: P. J. McDermott <pjm@nac.net>
Date: Thu, 16 Feb 2012 11:20:58 -0500
Subject: Fix source archive matching.

There were three things wrong:
  * '-', not '_', separates package name and version.
  * Double quotes seem to prevent pathname expansion.
  * ${OH_PKGVER} includes the package revision, if any.
---
(limited to 'lib')

diff --git a/lib/archive b/lib/archive
index 90cec3a..ed1de85 100644
--- a/lib/archive
+++ b/lib/archive
@@ -21,9 +21,9 @@
 
 oh_archive_extract_source()
 {
-	_matches="../${OH_SRCPKG}_${OH_PKGVER}.tar.*"
+	_matches=$(echo ../${OH_SRCPKG}-${OH_PKGVER%-*}.tar.*)
 
-	if [ "${_matches}" = ../${OH_SRCPKG}_${OH_PKGVER}.tar.\* ]; then
+	if [ "${_matches}" = ../${OH_SRCPKG}-${OH_PKGVER%-*}.tar.\* ]; then
 		# No archive found.
 		return 1
 	fi
@@ -37,7 +37,7 @@ oh_archive_extract_source()
 	# Note: dpkg's source format version 3 supports gzip, bzip2, LZMA, and XZ.
 	# We support gzip, bzip2, LZMA, and compress, since these are the formats
 	# supported by BusyBox tar.
-	z_ext=${_matches#"../${OH_SRCPKG}_${OH_PKGVER}.tar."}
+	z_ext=${_matches#"../${OH_SRCPKG}-${OH_PKGVER%-*}.tar."}
 	case ${_z_ext} in
 		gz)
 			_z=z
@@ -56,7 +56,7 @@ oh_archive_extract_source()
 			;;
 	esac
 
-	_files=$(tar -t${_z}f ../${OH_SRCPKG}_${OH_PKGVER}.tar.${_z_ext} | \
+	_files=$(tar -t${_z}f ../${OH_SRCPKG}-${OH_PKGVER%-*}.tar.${_z_ext} | \
 		grep -v '^./$')
 
 	if [ -z "$(echo "${_files}" | grep '/$')" ]; then
@@ -66,7 +66,7 @@ oh_archive_extract_source()
 		return 5
 	fi
 
-	tar -x${_z}f ../${OH_SRCPKG}_${OH_PKGVER}.tar.${_z_ext} || return 6
+	tar -x${_z}f ../${OH_SRCPKG}-${OH_PKGVER%-*}.tar.${_z_ext} || return 6
 
 	mv "${_files}" src || return 7
 }
--
cgit v0.9.1