On Wed, May 13, 2009 at 1:44 PM, Firmicus <[email protected]> wrote: > Abhishek Dasgupta a écrit : >> 2009/5/13 Abhishek Dasgupta <[email protected]>: >> >>> I've attached a diff for convert-to-any which does away with all the >>> committing stuff and just makes an i686/x86_64 package into an >>> architecture independent package putting the file in the same directory. >>> I tested the code here and it's working. >>> >>> >> >> updated patch using die() and some other corrections like >> using quotes when accessing variables, etc. >> >> Currently, I'm copying the i686/x86_64 package to $WORKDIR/build >> and extracting it there. This causes some additional disk i/o which can >> be done away with if I directly extract from the package. However >> this does ensure that the original package is unharmed. >> > > IMHO extracting the package is not really necessary. It is simpler and > faster to > 1. decompress the package (with gunzip, or eventually some other > (de)compression tool, depending of ) > 2. extract the .PKGINFO from the tar and then delete it with "tar --delete" > 3. modify the extracted .PKGINFO with sed to change the arch field > 4. re-add .PKGINFO to the tar with "tar --append" > and finally > 5. gzip the tar > > This has the additional advantage of making sure the properties of the > files (ownership and mode) are not mangled. I have tested this procedure > with a large number of arch-independent packages that I converted from > i686 to x86_64, and I have never encountered a problem. In any case, I > leave it to our benevolent dictator Aaron to decide which solution is to > be preferred ;)
One quick thing to note - because pacman reads .PKGINFO files to get metadata, it's nice to have them at the beginning of the tar. tar --append is going to slap them on the end. This could make a significant difference on larger packages > PS: change the description header as follows: > > diff --git a/convert-to-any b/convert-to-any > index 1c48eb3..72dad04 100644 > --- a/convert-to-any > +++ b/convert-to-any > @@ -1,8 +1,8 @@ > #!/bin/bash > -# Converts an existing package into an > -# architecture-independent package and updates > -# the repositories accordingly. > - > +# > +# Converts an existing architecture-independent package > +# for i686 or x86_64 into a package with "arch = any" > +# > # -- Abhishek Dasgupta <[email protected]> > > [ "$UID" = "" ] && UID=$(uid) Merged and pushed both patches
