[oe] [RFC] Don't pipe ar/tar/gzip in stage-manager-ipkg

Tom Rini tom_rini at mentor.com
Mon Jun 21 21:32:05 UTC 2010


As we've gone over before, gunzip/tar can have a broken pipe, and this 
is allowed.  In python code, we have things setup to ignore the problem. 
  stage-manager-ipkg is written in shell however and we can hit the 
problem there too.  There's two ways around this, one of which is to 
stop checking for problems with the extraction (and hide stderr) or we 
extract the archive, gunzip and then tar.  I've done the latter for this 
RFC.  Does anyone have a strong preference for the other way?

Signed-off-by: Tom Rini <tom_rini at mentor.com>

diff --git a/recipes/stage-manager/files/stage-manager-ipkg 
b/recipes/stage-manager/files/stage-manager-ipkg
index 2559fdb..e5ad6f6 100755
--- a/recipes/stage-manager/files/stage-manager-ipkg
+++ b/recipes/stage-manager/files/stage-manager-ipkg
@@ -732,11 +732,11 @@ ipkg_install_file_dest() {

  	local pkg=`ipkg_file_part $filename | sed 's/\([a-z0-9.+-]\+\)_.*/\1/'`
  	local ext=`echo $filename | sed 's/.*\.//'`
-	local pkg_extract_stdout
+	local pkg_extract
  	#if [ "$ext" = "ipk" ]; then
  	#	pkg_extract_stdout="tar -xzOf"
  	#elif [ "$ext" = "deb" ]; then
-		pkg_extract_stdout="ar p"
+		pkg_extract="ar x"
  	#else
  	#	echo "ipkg_install_file: ERROR: File $filename has unknown 
extension $ext (not .ipk or .deb)"
  	#	return 1
@@ -768,7 +768,7 @@ ipkg_install_file_dest() {
  	mkdir -p $IPKG_TMP/$pkg/data
  	mkdir -p $info_dir

-	if ! $pkg_extract_stdout $filename control.tar.gz | (cd 
$IPKG_TMP/$pkg/control; tar -xzf - ) ; then
+	if ! (cd $IPKG_TMP/$pkg/control ; $pkg_extract $filename 
control.tar.gz ; gunzip control.tar.gz ; tar xf control.tar ) ; then
  		echo "ipkg_install_file: ERROR unpacking control.tar.gz from $filename"
  		return 1
  	fi
@@ -798,10 +798,11 @@ Status: install ok pending" | 
ipkg_status_update_sd $sd $pkg
  	set -o noglob
  	rm -r $IPKG_TMP/$pkg/control

-	if ! $pkg_extract_stdout $filename ./data.tar.gz | (cd 
$IPKG_TMP/$pkg/data; tar -xzf - ) ; then
+	if ! (cd $IPKG_TMP/$pkg/data ; $pkg_extract $filename ./data.tar.gz ; 
gunzip data.tar.gz ; tar xf data.tar ) ; then
  		echo "ipkg_install_file: ERROR unpacking data.tar.gz from $filename"
  		return 1
  	fi
+	rm $IPKG_TMP/$pkg/data/data.tar
  	echo "Done."

  	echo -n "Configuring $pkg..."
@@ -869,7 +870,10 @@ diff -u $dest/$conffile $IPKG_TMP/$pkg/data/$conffile"
  	(cd $IPKG_TMP/$pkg/data/; tar cf - . | (cd $owd; cd $dest; tar xf -))	
  	rm -rf $IPKG_TMP/$pkg/data
  	rmdir $IPKG_TMP/$pkg
-	$pkg_extract_stdout $filename ./data.tar.gz | tar tzf - | sed -e 
's/^\.//' > $info_dir/$pkg.list
+	$pkg_extract $filename ./data.tar.gz
+	gunzip data.tar
+	tar tf data.tar | sed -e 's/^\.//' > $info_dir/$pkg.list
+	rm data.tar

  	if [ -x "$info_dir/$pkg.postinst" ]; then
  		$info_dir/$pkg.postinst configure
diff --git a/recipes/stage-manager/stagemanager-native_0.0.1.bb 
b/recipes/stage-manager/stagemanager-native_0.0.1.bb
index 733cc83..9eeac4b 100644
--- a/recipes/stage-manager/stagemanager-native_0.0.1.bb
+++ b/recipes/stage-manager/stagemanager-native_0.0.1.bb
@@ -1,5 +1,5 @@
  DESCRIPTION = "Helper script for packaged-staging.bbclass"
-PR = "r12"
+PR = "r13"

  SRC_URI = "file://stage-manager \
             file://stage-manager-ipkg \

-- 
Tom Rini
Mentor Graphics Corporation




More information about the Openembedded-devel mailing list