Openembedded Devel Discussions
 help / color / mirror / Atom feed
From: Tom Rini <tom_rini@mentor.com>
To: openembedded-devel@lists.openembedded.org
Subject: [RFC] Don't pipe ar/tar/gzip in stage-manager-ipkg
Date: Mon, 21 Jun 2010 14:32:05 -0700	[thread overview]
Message-ID: <4C1FDA55.6050705@mentor.com> (raw)

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



             reply	other threads:[~2010-06-21 21:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-21 21:32 Tom Rini [this message]
2010-06-22 14:44 ` [RFC] Don't pipe ar/tar/gzip in stage-manager-ipkg Khem Raj
2010-08-27  4:01   ` Chris Larson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C1FDA55.6050705@mentor.com \
    --to=tom_rini@mentor.com \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox