Skip to contentSkip to conversation

Don't pipe ar/tar/gzip in stage-manager-ipkg

RFC In review Tom Rini 3 participants 3 messages Jun 21, 2010 – Aug 27, 2010

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

RFC 1/1 Don't pipe ar/tar/gzip in stage-manager-ipkg

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?

recipes/stage-manager/files/stage-manager-ipkg +2 -2
index 2559fdb..e5ad6f6 100755
@@ -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

recipes/stage-manager/stagemanager-native_0.0.1.bb +1 -1
index 733cc83..9eeac4b 100644
@@ -1,5 +1,5 @@
 DESCRIPTION = "Helper script for packaged-staging.bbclass"
-PR = "r12"
+PR = "r13"
 
 SRC_URI = "file://stage-manager \
            file://stage-manager-ipkg \
Signature · 2 lines
Tom Rini
Mentor Graphics Corporation
#1 lore raw
Quoted 9 lines · Tom Rini

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?

sounds good to me.

Quoted 83 lines
recipes/stage-manager/files/stage-manager-ipkg +2 -2
index 2559fdb..e5ad6f6 100755
@@ -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)"

recipes/stage-manager/files/stage-manager-ipkg +0 -1
 	#	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

recipes/stage-manager/files/stage-manager-ipkg +1 -0
+	if ! (cd $IPKG_TMP/$pkg/control ; $pkg_extract $filename

control.tar.gz ; gunzip control.tar.gz ; tar xf control.tar ) ; then

recipes/stage-manager/files/stage-manager-ipkg +0 -0
 		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

recipes/stage-manager/files/stage-manager-ipkg +0 -1
 	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

recipes/stage-manager/files/stage-manager-ipkg +1 -0
+	if ! (cd $IPKG_TMP/$pkg/data ; $pkg_extract $filename

./data.tar.gz ; gunzip data.tar.gz ; tar xf data.tar ) ; then

recipes/stage-manager/files/stage-manager-ipkg +1 -1
 		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

recipes/stage-manager/files/stage-manager-ipkg +4 -0
+	$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
recipes/stage-manager/stagemanager-native_0.0.1.bb +1 -1
index 733cc83..9eeac4b 100644
@@ -1,5 +1,5 @@
 DESCRIPTION = "Helper script for packaged-staging.bbclass"
-PR = "r12"
+PR = "r13"
 
 SRC_URI = "file://stage-manager \
            file://stage-manager-ipkg \
Signature · 8 lines
-- 
Tom Rini
Mentor Graphics Corporation

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
#2 lore raw

How about:
trap "" PIPE

As an alternative to handle this? Sorry for the delayed comment, this has been sitting in my inbox waiting for me to look at it :)

Quoted 108 lines · Khem Raj
Quoted 9 lines · Tom Rini

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?

sounds good to me.

recipes/stage-manager/files/stage-manager-ipkg ipkg_install_file_dest() { · line 733

Quoted 10 lines
recipes/stage-manager/files/stage-manager-ipkg +0 -0
index 2559fdb..e5ad6f6 100755
@@ -732,11 +732,11 @@ ipkg_install_file_dest() {
 
      local pkg=`ipkg_file_part $filename | sed

's/\([a-z0-9.+-]\+\)_.*/\1/'`

Quoted 17 lines
recipes/stage-manager/files/stage-manager-ipkg +2 -2
      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

recipes/stage-manager/files/stage-manager-ipkg +0 -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
Quoted 4 lines

$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"

Quoted 7 lines

return 1
fi

recipes/stage-manager/files/stage-manager-ipkg +0 -0
@@ -798,10 +798,11 @@ Status: install ok pending" |

ipkg_status_update_sd $sd $pkg
set -o noglob
rm -r $IPKG_TMP/$pkg/control

Quoted 5 lines

- 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"

recipes/stage-manager/files/stage-manager-ipkg diff -u $dest/$conffile

Quoted 7 lines

return 1
fi

recipes/stage-manager/files/stage-manager-ipkg +1 -0
+     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"

recipes/stage-manager/files/stage-manager-ipkg diff -u $dest/$conffile · line 870

Quoted 1 line
recipes/stage-manager/files/stage-manager-ipkg +0 -0
      (cd $IPKG_TMP/$pkg/data/; tar cf - . | (cd $owd; cd $dest; tar xf

-))

Quoted 28 lines
recipes/stage-manager/files/stage-manager-ipkg +0 -1
      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

recipes/stage-manager/files/stage-manager-ipkg +4 -0
+     $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
recipes/stage-manager/stagemanager-native_0.0.1.bb +1 -2
index 733cc83..9eeac4b 100644
@@ -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

Quoted 4 lines

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics