All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] Don't pipe ar/tar/gzip in stage-manager-ipkg
@ 2010-06-21 21:32 Tom Rini
  2010-06-22 14:44 ` Khem Raj
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Rini @ 2010-06-21 21:32 UTC (permalink / raw)
  To: openembedded-devel

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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC] Don't pipe ar/tar/gzip in stage-manager-ipkg
  2010-06-21 21:32 [RFC] Don't pipe ar/tar/gzip in stage-manager-ipkg Tom Rini
@ 2010-06-22 14:44 ` Khem Raj
  2010-08-27  4:01   ` Chris Larson
  0 siblings, 1 reply; 3+ messages in thread
From: Khem Raj @ 2010-06-22 14:44 UTC (permalink / raw)
  To: openembedded-devel

On (21/06/10 14:32), Tom Rini wrote:
> 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.


> 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
> 
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] Don't pipe ar/tar/gzip in stage-manager-ipkg
  2010-06-22 14:44 ` Khem Raj
@ 2010-08-27  4:01   ` Chris Larson
  0 siblings, 0 replies; 3+ messages in thread
From: Chris Larson @ 2010-08-27  4:01 UTC (permalink / raw)
  To: openembedded-devel

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 :)

On Tue, Jun 22, 2010 at 7:44 AM, Khem Raj <raj.khem@gmail.com> wrote:

> On (21/06/10 14:32), Tom Rini wrote:
> > 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.
>
>
> > 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
> >
> > _______________________________________________
> > Openembedded-devel mailing list
> > Openembedded-devel@lists.openembedded.org
> > http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
>



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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-27  4:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-21 21:32 [RFC] Don't pipe ar/tar/gzip in stage-manager-ipkg Tom Rini
2010-06-22 14:44 ` Khem Raj
2010-08-27  4:01   ` Chris Larson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.