[xen-tools-discuss] patch: new rinse option to use rpm2tar instead of rpm2cpio

Axel Beckert abe at deuxchevaux.org
Thu Jun 7 22:56:57 CEST 2012


Hi Tapp,

[Full quote because of Thomas Lange added as Cc]

On Fri, Mar 09, 2012 at 01:59:27PM -0800, Tapp Darden wrote:
> While trying to use Johan's new scripts to make a centos 6 VM
> (thanks Johan's!) i ran into trouble while extracting the rpm's.

Worked fine for me, too. :-/

> I'm not sure if it was my copy of rpm2cpio or cpio or the .rpm's i
> downloaded from my mirror or soemthing else. But it would take the
> the rpm's and output garbadge. I would get files and directories
> starting with '?' charactor.

Sounds indeed severly broken.

> anyway. I added an option to rinse to use rpm2tar instead. Same goal
> is reached, but we go through tar instead. I'm not sure if this is
> the correct spot to post a patch to rinse. (is it?)

No more. While previously xen-tools and rinse were both developed by
the same person (Steve Kemp) they're now developed by different
people.

Thomas Lange of FAI fame (Cc'ed) has adopted rinse, so he's like the
better contact for all things rinse.

> but i figured xen-tools would need to make a change to take
> advantage of this new option...

If Thomas adds the patch to rinse, I'm happy to add the according
patch to xen-tools.

> and/or maybe somebody has a better idea than this. basically. if
> --tar is turned on it will use rpm2tar instead.
> 
> rinse
> @@ -45,6 +45,7 @@ rinse - RPM Installation Entity.
>     --list-distributions  Show installable distributions.
>     --print-uris          Only show the RPMs which should be downloaded.
>                           default files in /usr/lib/rinse/$distro
> +   --tar         Use rpm2tar instead of rpm2cpio for rpm expansion.
>     --verbose             Enable verbose output.
> 
>  =cut
> @@ -210,7 +211,7 @@ $CONFIG{ 'cache' }     = 1;
>  $CONFIG{ 'cache-dir' } = "/var/cache/rinse/";
>  $CONFIG{ 'config' }    = "/etc/rinse/rinse.conf";
>  $CONFIG{ 'pkgs-dir' }  = "/etc/rinse";
> -
> +$CONFIG{ 'tar' }       = 0;
> 
>  #
>  #  Find the size of our terminal
> @@ -418,6 +419,7 @@ sub parseCommandLineArguments
>          "before-post-install=s", \$CONFIG{ 'before-post-install' },
>          "after-post-install=s",  \$CONFIG{ 'after-post-install' },
>          "add-pkg-list=s",        \$CONFIG{ 'add-pkg-list' },
> +        "tar",             \$CONFIG{ 'tar' },
> 
>          # Help options
>          "help",    \$HELP,
> @@ -1093,9 +1095,12 @@ sub unpackPackages
>      my @rpms = glob( $dir . "/*.rpm" );
>      @rpms = sort {lc($a) cmp lc($b)} @rpms;
> 
> +    # Command to do the  extraction
> +    my $cmd = "";
>      # Command to execute after extraction
>      my $postcmd = "";
> 
> +
>      #
>      #  For each RPM file: convert to .tgz
>      #
> @@ -1125,9 +1130,15 @@ sub unpackPackages
>          #
>          #  Run the unpacking command.
>          #
> -        my $cmd =
> -          "rpm2cpio $file | (cd $CONFIG{'directory'} ; cpio --extract --make-directories --no-absolute-filenames --preserve-modification-time) 2>/dev/null >/dev/null";
> -        if ( $file =~ /(fedora|centos|redhat|mandriva)-release-/ )
> +    if ($CONFIG{'tar'})
> +        {
> +         $cmd = 
> +        "/usr/bin/rpm2tar -O $file | tar -xvpf - -C $CONFIG{'directory'}  2>/dev/null >/dev/null";
> +        } else {
> +        $cmd =
> +            "rpm2cpio $file | (cd $CONFIG{'directory'} ; cpio --extract --make-directories --no-absolute-filenames --preserve-modification-time) 2>/dev/null >/dev/null";
> +    }
> +    if ( $file =~ /(fedora|centos|redhat|mandriva)-release-/ )
>          {
>              my $rpmname = basename($file);
>              $postcmd =     

		Kind regards, Axel
-- 
/~\  Plain Text Ribbon Campaign                   | Axel Beckert
\ /  Say No to HTML in E-Mail and News            | abe at deuxchevaux.org  (Mail)
 X   See http://www.asciiribbon.org/              | abe at noone.org (Mail+Jabber)
/ \  I love long mails: http://email.is-not-s.ms/ | http://noone.org/abe/ (Web)


More information about the xen-tools-discuss mailing list