[aur-general] [arch-dev-public] Status of arch=any ?

Abhishek Dasgupta abhidg at gmail.com
Wed May 13 00:52:10 EDT 2009


2009/5/13 Aaron Griffin <aaronmgriffin at gmail.com>:
> On Tue, May 12, 2009 at 4:57 AM, Firmicus <Firmicus at gmx.net> wrote:
>> Aaron Griffin:
>>> Regarding the new convert2any script you added - I'd prefer to fix the
>>> existing script rather than add a new one - or at least preserve some
>>> of the logic (such as sourcing of makepkg.conf)
>>
>> All right, perhaps Abhishek can do that? ;)
>
> Yeah, I'm gonna try to merge your changes into the existing script.
> It's not a show-stopper though
>

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.

I would've attached a git patch but for some weird reason no application
in the terminal can access the net! Firefox works fine though.

-- 
Abhishek
-------------- next part --------------
--- convert-to-any	2009-05-11 20:16:15.000000000 +0530
+++ convert-to-any	2009-05-13 10:13:30.000000000 +0530
@@ -5,24 +5,15 @@
 
 # -- Abhishek Dasgupta <abhidg at gmail.com>
 
-. "$(dirname $0)/db-functions"
 [ "$UID" = "" ] && UID=$(uid)
+OUTDIR="$(pwd)"
+WORKDIR="/tmp/convert-to-any.$UID"
 
 if [ $# -ne 1 ]; then
-    echo "Syntax: $(basename $0) <reponame/pkgname>"
+    echo "Syntax: $(basename $0) <package-file>"
     exit 1
 fi
 
-repo=$(echo $1 | sed "s#\(.*\)/.*#\1#g")
-pkg=$(echo $1 | sed "s#.*/\(.*\)#\1#g")
-
-if [ -f "$(dirname $0)/config" ]; then
-    . "$(dirname $0)/config"
-else
-    TMPDIR=/srv/tmp
-    FTP_BASE=/srv/ftp
-fi
-
 if [ -f /etc/makepkg.conf ]; then
     . /etc/makepkg.conf
 else
@@ -31,14 +22,8 @@
     PKGEXT=".pkg.tar.gz"
 fi
 
-repo_lock $repo any
-WORKDIR="$TMPDIR/convert-to-any.$pkg.$UID"
-ftppath="$FTP_BASE/$repo/os"
-
 cleanup() {
     trap '' 0 2
-    # unlock
-    repo_unlock $repo any
     rm -rf "$WORKDIR"
     [ "$1" ] && exit $1
 }
@@ -56,53 +41,34 @@
 # Enter the temporary build directory
 # and convert the i686 package into an
 # architecture-independent package.
-mkdir -p "$WORKDIR/build"
-pushd "$WORKDIR/build" >/dev/null
 
-oldpkgname=$ftppath/i686/$pkg*
-if [ -f "$oldpkgname" ]; then
-    cp "$oldpkgname" .
-else
-    die "E: Package $oldpkgname not found in $ftppath/i686"
+oldpkgname=$1
+
+if [ -z $oldpkgname ]; then
+    echo "convert-to-any: which package to convert?"
+	exit 1
 fi
 
-for architecture in i686 x86_64; do
-    if [ -f "$ftppath/$architecture/$repo.db.tar.$DB_COMPRESSION" ]; then
-        cp $ftppath/$architecture/$repo.db.tar.$DB_COMPRESSION \
-        $repo-$architecture.db.tar.$DB_COMPRESSION
-    else
-        touch $repo-$architecture.db.tar.$DB_COMPRESSION
-    fi
-done
+newpkgname=$(echo $oldpkgname | sed "s/-\(i686\|x86_64\)$PKGEXT/-any$PKGEXT/")
 
-if [ ! -d "$ftppath/any" ]; then mkdir -p "$ftppath/any"; fi
+mkdir -p "$WORKDIR/build"
+if ! cp $oldpkgname "$WORKDIR/build/$(basename $oldpkgname)"; then
+    echo "convert-to-any: failed to copy package to $WORKDIR"
+    exit 1
+fi
+pushd "$WORKDIR/build" >/dev/null
 
 # Conversion of i686 package into "any" package.
-echo -n "Extracting $pkg..."
 mkdir -p package
-tar zxf $pkg*i686$PKGEXT -C package
-echo " done."
+if ! tar zxf $oldpkgname -C package; then
+	echo "convert-to-any: error in extracting $oldpkgname"
+    exit 1
+fi
 
-sed -i "s/arch = i686/arch = any/g" package/.PKGINFO
-newpkgname=$(ls $pkg*i686$PKGEXT | sed "s/i686/any/g")
+sed -i "s/arch = \(i686\|x86_64\)/arch = any/g" package/.PKGINFO
 pushd package >/dev/null
-tar czf "$newpkgname" * .PKGINFO
+tar czf "$OUTDIR/$newpkgname" * .PKGINFO
 popd >/dev/null
-mv "package/$newpkgname" .
-echo "Created $newpkgname."
-
-# New package is ready, move it into place and update db.
-mv "$newpkgname" "$ftppath/any/"
-for architecture in i686 x86_64; do
-    #       rm -f $ftppath/$architecture/$pkg*$PKGEXT
-    ln -s "$ftppath/any/$newpkgname" "$ftppath/$architecture/$newpkgname"
-    repo-remove -q $repo-$architecture.db.tar.$DB_COMPRESSION $pkg
-    repo-add -q $repo-$architecture.db.tar.$DB_COMPRESSION $newpkgname
-    mv $repo-$architecture.db.tar.$DB_COMPRESSION "$ftppath/os/$architecture"
-    echo "Updated $repo-$architecture for $pkg."
-done
 
-echo -n "Cleaning up..."
 popd >/dev/null
 cleanup
-echo " done."


More information about the aur-general mailing list