You are not logged in.

#401 2012-03-19 17:22:30

chenxiaolong
Member
From: /home/chenxiaolong
Registered: 2010-11-03
Posts: 784

Re: Progress on Unity under Arch Linux!

mr_comic wrote:
chenxiaolong wrote:

Actually, if you don't mind testing, it should work better than GNOME 3.2 smile Ubuntu 12.04 is already at GNOME 3.4beta2.

Awesome, I'll test it smile Any advice or package chang while doing this? Also if there's any way I could help with Unity I'll help smile

libappindicator build output

Error compiling libappindicator

pacman -S vala

big_smile (you probably have vala-git installed from lightdm-unity-greeter, which only needs it at build time)

mr_comic wrote:
mutter build output

and mutter-ubuntu [hahahahaha sad found a AUR package (muffin-git) which has the same error and it's cause I use gnome-unstable cause of the new version of cogl]

And

pacman -S mutter

big_smile The Ubuntu version doesn't have any useful patches, so I removed it from the git repo.

EDIT: muffin-git is actually a fork of mutter for the Linux Mint Cinnamon shell (same version as mutter-ubuntu too) smile

Last edited by chenxiaolong (2012-03-19 17:25:13)

Offline

#402 2012-03-19 17:25:09

mr_comic
Member
From: México
Registered: 2011-02-20
Posts: 52
Website

Re: Progress on Unity under Arch Linux!

chenxiaolong wrote:

big_smile (you probably have vala-git installed from lightdm-unity-greeter, which only needs it at build time)



big_smile The Ubuntu version doesn't have any useful patches, so I removed it from the git repo.

Perfect, I'll try installing now smile

Edit: Still the same problem with libappindicator hmm
Edit2: Somehow I had Vala 15 so I downgraded to Vala 14 and it worked

Last edited by mr_comic (2012-03-19 19:41:43)

Offline

#403 2012-03-21 15:26:29

oskar.einstein
Member
From: Poland
Registered: 2009-10-23
Posts: 30

Re: Progress on Unity under Arch Linux!

Which repo should I use? Rleyh's repo looks outdated. sad

Offline

#404 2012-03-21 17:01:09

mr_comic
Member
From: México
Registered: 2011-02-20
Posts: 52
Website

Re: Progress on Unity under Arch Linux!

Everything compiled fine but still getting the error where I can't login to any DE. Let me reproduce it and ill upload the logs.

@oskar.einstein the best option is to compile using the chenxiaolong git repo.

Offline

#405 2012-03-21 19:34:58

chenxiaolong
Member
From: /home/chenxiaolong
Registered: 2010-11-03
Posts: 784

Re: Progress on Unity under Arch Linux!

mr_comic wrote:

Everything compiled fine but still getting the error where I can't login to any DE. Let me reproduce it and ill upload the logs.

@oskar.einstein the best option is to compile using the chenxiaolong git repo.

If you're using GDM, please also tar and post the /var/log/gdm directory smile

Offline

#406 2012-03-21 20:45:37

rleyh
Member
From: germany
Registered: 2011-10-14
Posts: 28

Re: Progress on Unity under Arch Linux!

oskar.einstein wrote:

Which repo should I use? Rleyh's repo looks outdated. sad

updated as of now big_smile
there is also ubuntu-tweak available (pacman -S ubuntu-tweak python-defer).

Last edited by rleyh (2012-03-21 21:06:01)

Offline

#407 2012-03-23 00:25:59

oskar.einstein
Member
From: Poland
Registered: 2009-10-23
Posts: 30

Re: Progress on Unity under Arch Linux!

Thanks rleyh but I have:

[tesseract@Niobe Biurko]$ unity
compiz (core) - Error: Couldn't load plugin '/usr/lib/compiz/libccp.so' : libcompiz_core.so.ABI-20120216: cannot open shared object file: No such file or directory
compiz (core) - Error: Couldn't load plugin 'ccp'
unity-panel-service: nie znaleziono żadnego procesu

(unity-panel-service: cannot find such process)

when I try to run Ubuntu session sad

BTW, mutter-ubuntu, accordning to post #401 is no longer requied.

Unity 2d also doesn't work for me. There's only gray bar on the top of the screen without anything on it and icons on the desktop with gnome classic/ugly theme sad

Last edited by oskar.einstein (2012-03-23 00:32:03)

Offline

#408 2012-03-23 02:27:27

chenxiaolong
Member
From: /home/chenxiaolong
Registered: 2010-11-03
Posts: 784

Re: Progress on Unity under Arch Linux!

oskar.einstein wrote:

Thanks rleyh but I have:

[tesseract@Niobe Biurko]$ unity
compiz (core) - Error: Couldn't load plugin '/usr/lib/compiz/libccp.so' : libcompiz_core.so.ABI-20120216: cannot open shared object file: No such file or directory
compiz (core) - Error: Couldn't load plugin 'ccp'
unity-panel-service: nie znaleziono żadnego procesu

(unity-panel-service: cannot find such process)

when I try to run Ubuntu session sad

BTW, mutter-ubuntu, accordning to post #401 is no longer requied.

Unity 2d also doesn't work for me. There's only gray bar on the top of the screen without anything on it and icons on the desktop with gnome classic/ugly theme sad

You should be able to fix the compiz problem by compiling the following packages from git:

compiz-core-ubuntu
libcompizconfig-ubuntu
compizconfig-python-ubuntu
ccsm-ubuntu
compiz-plugins-main-ubuntu
compiz-plugins-extra-ubuntu
unity

This is probably the third or fourth time that Ubuntu broke the Compiz ABI in the 12.04 release cycle. Hopefully, it won't happen anymore.

As for the Unity 2D issue, I also have that problem. Unfortunately, I have a lot of school work right now and will be on vacation during spring break (March 26 to April 1), so I won't be able to fix it for a while sad

EDIT: xorg-server is back! sad But so is the autohide feature in Unity and Unity-2D big_smile And Unity-2D is now fixed (requires qt-ubuntu update) big_smile

Last edited by chenxiaolong (2012-03-23 21:57:11)

Offline

#409 2012-03-24 19:38:19

sitquietly
Member
From: On the Wolf River
Registered: 2010-07-12
Posts: 220

Re: Progress on Unity under Arch Linux!

chenxiaolong wrote:

To install Unity

To install Unity just clone my git repository and read the README file smile

git clone https://github.com/chenxiaolong/Unity-for-Arch.git

The git repository can be browsed online at: https://github.com/chenxiaolong/Unity-for-Arch

The story

So...rather than wasting internet bandwith to download a new Ubuntu ISO to test out the new Unity features, I decided to try to make it work under Arch Linux. It took a whole lot longer than I expected to get it even partially working. So, here's my story:.....


It appears that I'm on my way out of Archlinux because of the low quality of its pkgbuilds and frequent breakage but I want to compliment chenxiaolong for the quality of the pkgbuilds for Unity for Arch.  I have an unusual, or maybe unique perspective on the quality of this work, Arch in general (poor) and Unity for Arch (excellent) because for a long time I have consistently built my entire system from source code.  I end up looking at EVERY pkgbuild for my 1322 installed packages (all of kde/xmonad/unity/math-packages/latex) and I check every pkgbuild and every built package with namcap and correct dependency errors.  I had developed a set of scripts that build a database and calculate correct build order and orchestrate the build process.  My daily update command was, for example,

update-package-database --abs --aur --unity
versions --upgradable --quiet | order | build --merge --save --log

In building a system with Unity I found numerous problems compiling Arch packages but every pkgbuild from chenxiaolong worked perfectly. This is great work and I'm glad to acknowledge it!

p.s. there were some minor dependency omissions in the unity pkgbuilds but you'll catch those easily if you start running namcap on the packages.  You can just filter the namcap output, like I do in this scrap of code for "approving" a build:

# The pkgbuild is approved when namcap finds no errors, or the developer sees the errors
# and declines to change the pkgbuild.
function approve() {
    cd "${Buildfolder}/$Pkgbase" || error "$Pkgbase missing from build folder ($Buildfolder)"
    cp PKGBUILD PKGBUILD.tmp
    if [ $EDIT = 1 ]; then
        $edit PKGBUILD PKGHELP PKGCHECK
    else
        # edit unconditionally if errors
        # first form detects only missing depends
        # second form detects all errors
        if grep 'detected and not included' PKGCHECK; then
        # if grep ' E: ' PKGCHECK; then
            $edit PKGBUILD PKGHELP PKGCHECK
        fi
    fi
    if diff -Bbq PKGBUILD PKGBUILD.tmp >/dev/null; then
        rm PKGBUILD.tmp
        return 0
    else
    # the PKGBUILD was changed; fail to approve the binary package
        if [ -f PKGBUILD.orig ]; then
            rm PKGBUILD.tmp
        else
            cp PKGBUILD.tmp PKGBUILD.orig
        fi
        return 1
    fi
}
.....
        while : 
        # we stay in this loop until namcap finds no errors or developer sees error and accepts pkgbuild anyway
        do
            make_pkg || make_failed
            approve && break
            restart_pkg
        done
 .....

I'm now running Ubuntu 12.04 and find it just as easy to build a system from source as with Archlinux (although I don't have a self-bootstrapping, self-rebuildable system yet).  What was I thinking when I selected Arch?  Debian systems DO have abs/aur, it's just called "apt-get source".  So I am enjoying Unity, especially the ability to do everything without my hands leaving the keyboard and the minimalist interface (an 18 pixel status/menu bar at the top of the screen and nothing else but my work).  HUD is not there for all apps yet but it is a great design.  It will be nice to have it available as a DE for Arch.  Keep up the good work everyone.  Your work is beautiful.

Offline

#410 2012-03-24 21:52:58

chenxiaolong
Member
From: /home/chenxiaolong
Registered: 2010-11-03
Posts: 784

Re: Progress on Unity under Arch Linux!

sitquietly wrote:
chenxiaolong wrote:

To install Unity

To install Unity just clone my git repository and read the README file smile

git clone https://github.com/chenxiaolong/Unity-for-Arch.git

The git repository can be browsed online at: https://github.com/chenxiaolong/Unity-for-Arch

The story

So...rather than wasting internet bandwith to download a new Ubuntu ISO to test out the new Unity features, I decided to try to make it work under Arch Linux. It took a whole lot longer than I expected to get it even partially working. So, here's my story:.....


It appears that I'm on my way out of Archlinux because of the low quality of its pkgbuilds and frequent breakage but I want to compliment chenxiaolong for the quality of the pkgbuilds for Unity for Arch.  I have an unusual, or maybe unique perspective on the quality of this work, Arch in general (poor) and Unity for Arch (excellent) because for a long time I have consistently built my entire system from source code.  I end up looking at EVERY pkgbuild for my 1322 installed packages (all of kde/xmonad/unity/math-packages/latex) and I check every pkgbuild and every built package with namcap and correct dependency errors.  I had developed a set of scripts that build a database and calculate correct build order and orchestrate the build process.  My daily update command was, for example,

update-package-database --abs --aur --unity
versions --upgradable --quiet | order | build --merge --save --log

In building a system with Unity I found numerous problems compiling Arch packages but every pkgbuild from chenxiaolong worked perfectly. This is great work and I'm glad to acknowledge it!

p.s. there were some minor dependency omissions in the unity pkgbuilds but you'll catch those easily if you start running namcap on the packages.  You can just filter the namcap output, like I do in this scrap of code for "approving" a build:

# The pkgbuild is approved when namcap finds no errors, or the developer sees the errors
# and declines to change the pkgbuild.
function approve() {
    cd "${Buildfolder}/$Pkgbase" || error "$Pkgbase missing from build folder ($Buildfolder)"
    cp PKGBUILD PKGBUILD.tmp
    if [ $EDIT = 1 ]; then
        $edit PKGBUILD PKGHELP PKGCHECK
    else
        # edit unconditionally if errors
        # first form detects only missing depends
        # second form detects all errors
        if grep 'detected and not included' PKGCHECK; then
        # if grep ' E: ' PKGCHECK; then
            $edit PKGBUILD PKGHELP PKGCHECK
        fi
    fi
    if diff -Bbq PKGBUILD PKGBUILD.tmp >/dev/null; then
        rm PKGBUILD.tmp
        return 0
    else
    # the PKGBUILD was changed; fail to approve the binary package
        if [ -f PKGBUILD.orig ]; then
            rm PKGBUILD.tmp
        else
            cp PKGBUILD.tmp PKGBUILD.orig
        fi
        return 1
    fi
}
.....
        while : 
        # we stay in this loop until namcap finds no errors or developer sees error and accepts pkgbuild anyway
        do
            make_pkg || make_failed
            approve && break
            restart_pkg
        done
 .....

I'm now running Ubuntu 12.04 and find it just as easy to build a system from source as with Archlinux (although I don't have a self-bootstrapping, self-rebuildable system yet).  What was I thinking when I selected Arch?  Debian systems DO have abs/aur, it's just called "apt-get source".  So I am enjoying Unity, especially the ability to do everything without my hands leaving the keyboard and the minimalist interface (an 18 pixel status/menu bar at the top of the screen and nothing else but my work).  HUD is not there for all apps yet but it is a great design.  It will be nice to have it available as a DE for Arch.  Keep up the good work everyone.  Your work is beautiful.

Thank you so much for the compliments! I spend a lot of time making changes to the PKGBUILDs before I even start the first build smile

I do have to agree on the Arch Linux PKGBUILD quality issues. I like to keep my system free of unneeded dependencies and hate it when a package depends on something it doesn't need or if a build dependency is in the regular dependency array, etc. makepkg really needs an automatic dependency finder like in rpm and dpkg-buildpackage. Also, with packages the xorg-server, there are circular dependencies: to build xorg-server, I need to have xf86-input-evdev, which requires xorg-server. When I try to fix and build the packages from the ABS, a lot of the time, the md5sums don't even match. Honestly, I have no idea how the packages can even be built in the Arch repos.

The one thing I really love about dpkg and rpm based distros is the chroot build tools (pbuilder/mock). In Arch, I had to write my own and modify the source code of pacman, so that it could handle conflicts without asking me "package1 conflicts with package2. Replace package1 with package 2?" The one thing I dislike about the Debian packaging is that a lot of packages still use the old 1.0 format. I prefer the "3.0" quilt format where the patches are separated and the debian/rules file is usually just:

%:
	dh $@

rather than a whole bunch of dh-* lines.

Anyway, done with my rant. I hope you enjoy Ubuntu 12.04! I'm quadruple booting Ubuntu 12.04, Fedora 16, Debian Sid, and Arch in hopes of making the Unity experience exactly the same in each distro.

PS. Do you mind sharing your scripts? They look really useful.

PS2. I'll be sure to run namcap on all of my packages during the next round of updates.

Last edited by chenxiaolong (2012-03-24 21:54:32)

Offline

#411 2012-03-24 23:16:26

sitquietly
Member
From: On the Wolf River
Registered: 2010-07-12
Posts: 220

Re: Progress on Unity under Arch Linux!

chenxiaolong wrote:

Thank you so much for the compliments! I spend a lot of time making changes to the PKGBUILDs before I even start the first build smile

It shows. smile

chenxiaolong wrote:

I do have to agree on the Arch Linux PKGBUILD quality issues. I like to keep my system free of unneeded dependencies and hate it when a package depends on something it doesn't need or if a build dependency is in the regular dependency array, etc. makepkg really needs an automatic dependency finder like in rpm and dpkg-buildpackage. Also, with packages the xorg-server, there are circular dependencies: to build xorg-server, I need to have xf86-input-evdev, which requires xorg-server. When I try to fix and build the packages from the ABS, a lot of the time, the md5sums don't even match. Honestly, I have no idea how the packages can even be built in the Arch repos.

Arch is what it is.  I suppose it could be called a cobbled together collection of binary packages, each one built by someone from the latest upstream release.  Not infrequently I too found that the pkgbuild in abs could not possibly be the one that was actually used to build the released package. Sometimes it was simple typos or checksum errors.  Sometimes I needed to find patches from Gentoo or elsewhere to make the thing compilable.  The system as a whole is, well, not a system as a whole: libraries are updated when upstream releases them even though that breaks some packages that only work with earlier versions of that library.  At any given moment many pkgbuilds can not be built.  Sometimes I found that some library was updated and that day or soon thereafter an app that uses is updated, but the app can not be built against the library that is "current" in Arch.  I have had to assume that the app binary was actually built against an older version of the library. 

My old engineer disorder doesn't help:  I consider a system to be broken if it can't be rebuilt from source code.  (I'm retired from a career doing embedded systems development -- I made the firmware and drivers for computer boards that my company manufactured for industrial machine control.)  If it won't compile anymore you've gotten hidden problems, I don't care if it does "run".  It appeared that Arch could be "Gentoo without USE flags" but it can't be used that way.

chenxiaolong wrote:

Anyway, done with my rant. I hope you enjoy Ubuntu 12.04! I'm quadruple booting Ubuntu 12.04, Fedora 16, Debian Sid, and Arch in hopes of making the Unity experience exactly the same in each distro.

That sounds good.  You'll almost convince me to return to Archlinux, or at least keep on dual booting.  I'll think about it...

chenxiaolong wrote:

PS. Do you mind sharing your scripts? They look really useful.

There is a config file, /etc/build.conf:

#
# /etc/build.conf
#

#
# The top-level directory of the aur PKGBUILDs. 
# The aur is searched after abs, so a package
# defined in the aur can not override the abs package.
# This directory must be writeable by the user.
# Syncing the aur repo is optional.  If enabled
# AURROOT is automatically included as the last of
# the upstream repositories.
#
[ "$AURROOT" = "" ] && AURROOT="/var/aur/"
# 
# Enable the following line to disable use of aur
# AURROOT=""

#
# Directories that contain pkgbuilds from "upstream".
# Order is important.  The first PKGBUILD found will be
# used for building.  A collection that is intended to
# override others should be put earlier in the list.
# The Archlinux testing versions will be used if testing
# is enabled in /etc/abs.conf
#
source /etc/abs.conf
UPSTREAM=($ABSROOT/testing $ABSROOT/community-testing $ABSROOT/multilib-testing
    $ABSROOT/core $ABSROOT/extra $ABSROOT/community $ABSROOT/multilib)

#
# The directory that contains my linux.
# The pkgbuilds for my linux will be put in $MYLINUX/recipes
# The built packages go in $MYLINUX/packages
# The user who builds packages must have write permission on this directory
# and sudo rights to install packages.
#
MYLINUX=/home/mylinux

#
# The editor will be called to edit a pkgbuild while referring to
# related help documents.  It must open multiple documents at once.
# The editor must run in the foreground (not fork).
# PKGEDITOR will be used in xterms.  
# PKGEDITOR_CONSOLE will be used in the linux console.
#
#PKGEDITOR="gvim -f"
#PKGEDITOR="gedit"
#PKGEDITOR="geany"
PKGEDITOR="kate --new"
PKGEDITOR_CONSOLE="vim"
#PKGEDITOR_CONSOLE="emacs"

#
# The merge app will be called to merge our previous changes 
# back into a new upstream pkgbuild.  The app must run in the 
# foreground (not fork). 
# PKGMERGE will be used in xterms.
# PKGMERGE_CONSOLE will be used in the linux console.
#
# PKGMERGE="kdiff3"
PKGMERGE="meld"
PKGMERGE_CONSOLE="vimdiff"

#
# The directory for the package database must be 
# writeable by the user.
#
PKGDB=${XDG_DATA_HOME:-$HOME/.local/share}/package-database

#
# Toolchain packages require bootstrapping and will always be
# updated via the Archlinux binary before building a new version.
# Any packages can be added to this list to force that behavior.
#
TOOLCHAIN=(linux-api-headers glibc binutils libmpc isl cloog 
    ppl libtool gcc gcc-libs gcc-ada gcc-fortran gcc-go gcc-objc 
    ghc)

#
# Packages that are always out of date, such as svn or git
# versions, specified as a regular expression for egrep.
# These will not be reported as out of date. The source
# checkout for the latest build will always be saved and
# will be used as the basis for starting the next build.
# A package should be matched as a changling if the version
# of a freshly built package does not match the version
# specified in its pkgbuild.
#
CHANGLINGS='.*-(svn|git|cvs|hg|bzr)$|^ttf-google-webfonts$'

The update-package-database script:

#!/bin/bash
# update-package-database - by sitquietly
#
# A utility for Archlinux to create a database of dependencies
# for all packages available from local collections of pkgbuilds.
#
#
# Copyright (C) 2011 Garry Roseman <forestmoonsilence@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# A special kind of dependency for each package is its dependency on
# its parent package, its PKGBASE. For most packages the pkgbase is
# the same as the pkgname. The dependencies of a split package are
# accumulated into a pseudo-package named <pkgbase>-ALL so that it is 
# easy to analyze the dependencies of such a set of split packages as
# a single unit.
#
# The depends file format is
# declare -Ax DEPENDS
# DEPENDS[package1]="depends1a depends1b ..."
# DEPENDS[package2]="depends2a depends2b ..."
# ...
# The makedepends file format is
# declare -Ax MAKEDEPENDS
# MAKEDEPENDS[package1]="depends1a depends1b ..."
# MAKEDEPENDS[package2]="depends2a depends2b ..."
# ...
# The pkgbase file format is
# declare -Ax PKGBASE
# PKGBASE[package1]="pkgbase1"
# PKGBASE[package2]="pkgbase2"
# ...
# The groups file format is
# declare -Ax Groups
# Groups[package1]="group1a group1b ..."
# Groups[package2]="group2a group2b ..."
# ...
# The splits file formant is
# declare -Ax SPLITS
# SPLITS[package1]="pkgbase1 | null"
# SPLITS[package2]="pkgbase2 | null" 
#
# The version file format is
# declare -Ax VERSION
# VERSION[package1]="pkgver-pkgrel"
# VERSION[package2]="pkgver-pkgrel"
# ...
# The version file is parameterized so that sourcing
# it with a parameter adds that as a prefix to the array
# name.  So, "source $PKGDB/master/version MASTER" defines the
# MASTERVERSION array.

# Each file can simply be sourced to get the array.
# Package information from our changed or staging repositories
# can be overlaid on upstream information by simply sourcing the
# changed or staging database files on top of the upstream 
# database files.
#
# SPLITS and PKGBASE are similar but SPLITS is a boolean (same as pkgbase
# if the package is split, but null otherwise).  It would be possible
# to use only SPLITS if unsplit packages always had pkgbase=pkgname but
# there is no such guarantee in Archlinux AUR; for example calligra-git
# is currently contained in a directory named calligra-filters-git.
# A non-null value of SPLIT[pkg] indicates that pkg is a split package.
# The pkgbuild for any pkg can be found in a folder named PKGBASE[pkg]
# 
# The providers file format is
# declare -Ax PROVIDER
# PROVIDER[provides1]="provider1" 
# PROVIDER[provides2]="provider2"
# ...
# A pkgdb file can simply be sourced to get the array.
# Version information is stripped so that, for example, we record
# [java-environment]="jdk7-openjdk"
# rather than
# [java-environment=7]="jdk7-openjdk"
# or
# [java-environment=7]="jdk7-openjdk-7.b147_2.0-2"
# makepkg is the enforcer of version requirements.


source /etc/makepkg.conf
source /etc/abs.conf
source /etc/build.conf
declare -Ax SPLITS
declare -Ax DEPENDS
declare -Ax MAKEDEPENDS
declare -Ax Groups
declare -Ax PKGBASE
declare -Ax VERSION
declare -Ax FOUND
declare -Ax PROVIDER

PacmanDB=/var/lib/pacman/local

MASTER="${MYLINUX}/recipes/master"
STAGING="${MYLINUX}/recipes/staging"
TESTING="${MYLINUX}/recipes/testing"


function printhelp() {
    echo '------------------------------------------------------------------------------'
    echo 'Update the package database that is used by the build system.'
    echo ''
    echo 'Syntax:    update-package-database [options]'
    echo ''
    echo 'First synchronize the abs and aur if requested, then scan all collections defined'
    echo 'in /etc/build.conf and extract data for the package database (dependencies, versions,'
    echo 'providers, package groups, split packages, etc.).  As each repository listed in '
    echo '/etc/build.conf is entered its name is printed and, if verbose, as each folder'
    echo 'is looked at its name is printed along with the names of packages defined in it.'
    echo ''
    echo 'Options:'
    echo '    -s, --abs     Sync the abs pkgbuilds with the online repository.'
    echo '    -a, --aur     Sync the aur pkgbuilds with the online repository.'
    echo '    -U, --unity   Sync the unity pkgbuilds with the chenxiaolong repository.'
    echo '    -v, --verbose Print the name of each package processed.'
    echo '    -q, --quiet   Do not print anything to standard output.'
    echo '    -h, --help    Print this message.'
    echo ''
    echo 'The aur collection will occupy roughly 640 MB of disk space and takes a long'
    echo 'time to sync the first time.  Using the aur collection is optional; if you'
    echo 'do not want to use it just do not use the --aur option, or comment out'
    echo 'AURROOT in /etc/build.conf  You can still build aur packages without keeping'
    echo 'a local copy of the aur, but then the need command will only know the'
    echo 'dependencies and the group command will only know about groups, defined in'
    echo 'aur packages that have been installed using the "build -s" command.'
    echo ''
    echo 'The abs collection is of course not optional and should be synced as often'
    echo 'as you want to build updated packages from source.  The abs collection only'
    echo 'occupies about 60 MB of disk space.'
    echo ''
    echo '------------------------------------------------------------------------------'
    }

function dump_depends() {
    printf "declare -Ax DEPENDS\n"
    for package in ${!DEPENDS[@]}; do
    printf "DEPENDS[%s]=\"%s\"\n" $package "${DEPENDS[$package]}"
    done
}

function dump_makedepends() {
    printf "declare -Ax MAKEDEPENDS\n"
    for package in ${!MAKEDEPENDS[@]}; do
    printf "MAKEDEPENDS[%s]=\"%s\"\n" $package "${MAKEDEPENDS[$package]}"
    done
}

function dump_groups() {
    printf "declare -Ax Groups\n"
    for package in ${!Groups[@]}; do
    printf "Groups[%s]=\"%s\"\n" $package "${Groups[$package]}"
    done
}

function dump_pkgbase() {
    printf "declare -Ax PKGBASE\n"
    for package in ${!PKGBASE[@]}; do
    printf "PKGBASE[%s]=\"%s\"\n" $package ${PKGBASE[$package]}
    done
}

function dump_version() {
    echo 'eval declare -Ax ${1}VERSION'
    for package in ${!VERSION[@]}; do
    #printf "VERSION[%s]=\"%s\"\n" $package ${VERSION[$package]}
    echo "eval \${1}VERSION[$package]=\"${VERSION[$package]}\""
    done
}

# SPLITS is an array of booleans; SPLITS[pkgname]="pkgbase|NULL"
# so [ -z ${SPLITS[pkgname} ] is the test for member of split pkgbuild 
function dump_splits() {
    printf "declare -Ax SPLITS\n"
    for package in ${!SPLITS[@]}; do
    printf "SPLITS[%s]=\"%s\"\n" $package ${SPLITS[$package]}
    done
}

function oops() { # msg --
    echo "Error: $1" >&2
    exit 1
}

function versionless() { # versioned-pkgnames -- versionless-pkgnames
    i=0
    names=()
    for name; do
       names[i++]=${name%%[>=<]*} 
    done
    echo "${names[*]}"
}

function unique() { # words -- unique-words
    declare -A theword
    for word in $*; do
        theword[$word]=1
    done
    echo ${!theword[@]}
}

function add_repo() { # no-clobber changed-only -- add packages from current directory to database
    for folder in *; do
        if [ -r $folder/PKGBUILD ]; then
            [[ ! -f $folder/PKGBUILD.orig && ! -z $2 ]] && continue
            [[ "$VERBOSE" == 1 ]] && echo -n "    $folder: "
            pkgbase=$(basename $folder)
            pkgname=()
            depends=()
            makedepends=()
            groups=()
            pkgver=""; pkgrel=""; epoch=0
            if ! eval $(pkgnames $folder/PKGBUILD) 2>/dev/null; then
                echo "can't eval pkgnames for $folder -- ignoring package!" >&2
                [[ "$VERBOSE" == 1 ]] && echo "(can't evaluate name and version -- skipped)"
                continue
            fi
            if [[ "$pkgver" == "" || "$pkgrel" == "" ]]; then
                echo "bad pkgver or pkgrel string in $folder -- ignoring package!" >&2
                [[ "$VERBOSE" == 1 ]] && echo "(bad version info -- skipped)"
                continue
            fi
            _clobbered=0
            for name in ${pkgname[*]}; do
                # if name found in an earlier pkgbuild then ignore this pkgbuild if $1 is set
                if [[ "${FOUND[$name]}" == "true" && -n "$1" ]]; then
                    [[ "$VERBOSE" == 1 ]] && echo -n "(redefines $name -- skipped)"
                    _clobbered=1
                fi
                if [[ "${FOUND[$pkgbase]}" == "true" && -n "$1" ]]; then
                    [[ "$VERBOSE" == 1 ]] && echo -n "(claims pkgbase $pkgbase -- skipped)"
                    _clobbered=1
                fi
            done
            if [[ $_clobbered == 1 ]]; then
                [[ "$VERBOSE" == 1 ]] && echo
                continue
            fi
            for name in ${pkgname[*]}; do
                #--# if name found in an earlier collection then ignore this pkgbuild if $1 is set
                #--if [[ "${FOUND[$name]}" == "true" && -n "$1" ]]; then
                #--    [[ "$VERBOSE" == 1 ]] && echo -n "(redefines $name -- skipped)"
                #--    continue
                #--fi
                #--[[ "${FOUND[$name]}" == "true" ]] && oops "$name is defined for a second time at $PWD/$folder"
                FOUND[$name]="true"
                if ! eval $(pkgvariables -vpkg=$name $folder/PKGBUILD) 2>/dev/null; then
                    echo "can't eval pkgvariables for $folder -- ignoring package!" >&2
                    [[ "$VERBOSE" == 1 ]] && echo -n "(can't evaluate depends for $name -- skipped)"
                    pkgname=()
                    continue
                fi
                [[ "$VERBOSE" == 1 ]] && echo -n "$name "
                DEPENDS[$name]="$(versionless ${depends[*]})"
                MAKEDEPENDS[$name]="$(versionless ${makedepends[*]})"
                Groups[$name]="${groups[*]}"
                PKGBASE[$name]="$pkgbase"
                if (( $epoch )); then
                    VERSION[$name]="$epoch:$pkgver-$pkgrel"
                else
                    VERSION[$name]="$pkgver-$pkgrel"
                fi
            done
            if [[ ${#pkgname[*]} > 1 ]]; then
                PKGBASE[$pkgbase-ALL]=$pkgbase
                for name in ${pkgname[*]}; do
                    DEPENDS[$pkgbase-ALL]="${DEPENDS[$name]} ${DEPENDS[$pkgbase-ALL]}"
                    MAKEDEPENDS[$pkgbase-ALL]="${MAKEDEPENDS[$name]} ${MAKEDEPENDS[$pkgbase-ALL]}"
                    SPLITS[$name]=$pkgbase # SPLITS is "true", its value is pkgbase
                done
                DEPENDS[$pkgbase-ALL]=$(unique ${DEPENDS[$pkgbase-ALL]})
                MAKEDEPENDS[$pkgbase-ALL]=$(unique ${MAKEDEPENDS[$pkgbase-ALL]})
            else
                SPLITS[$pkgbase]="" # SPLITS is null/false
            fi
            [[ "$VERBOSE" == 1 ]] && echo
        fi
    done
}

function dump_providers() {
    printf "declare -Ax PROVIDER='(\n"
    for provides in ${!PROVIDER[@]}; do
    printf "[%s]=\"%s\"\n" $provides ${PROVIDER[$provides]}
    done
    printf ")'\n"
}

function set_provides() { # pkgname --; read in the provides field from file
    while read line; do
    [[ $line == %* ]] && return
        [[ $line == "" ]] && return
        PROVIDER[${line%%[>=<]*}]=$1
    done
}

function find_provides() { # desc-file --; set PROVIDER if package has a provides field
    while read line; do
        if [[ $line == "%PROVIDES%" ]]; then
         set_provides ${1%%-[0-9]*}
     fi
    done <$1
}

function sync-abs() { 
    [ -z $ABSROOT ] && oops "ABSROOT is not defined.  Check /etc/abs.conf"
    /usr/bin/abs
}
    
# pkgbuild.com is a build server for archlinux dev/tu
# it happens to have a git repo for aur but I don't know
# if it is supposed to be open to all; do NOT share this code
# and put a load on that server
function sync-aur() { 
    [ -z "$AURROOT" ] && return
    if [[ -d "$AURROOT" ]]; then
        cd "$AURROOT" || oops "Can not cd into $AURROOT"
        echo "Starting aur sync:"
        git pull
    else
        mkdir "$AURROOT" || oops "Can not create directory $AURROOT"
        cd "${AURROOT%/*}"
        echo "Starting to clone aur: (this will take more than a few minutes)"
        git clone git://pkgbuild.com/aur-mirror.git "${AURROOT##*/}"
    fi
}

function sync-unity() {
    [ -z "$UNITYROOT" ] && return
    if [[ -d "$UNITYROOT" ]]; then
        cd "$UNITYROOT" || oops "Can not cd into $UNITYROOT"
        echo -n "Sync unity for arch:  "
        git pull
        cd "$UNITYROOT-extra" || oops "Can not cd into $UNITYROOT-extra"
        echo -n "Sync unity-extra for arch:  "
        git pull
    else
        mkdir "$UNITYROOT" || oops "Can not create directory $UNITYROOT"
        mkdir "$UNITYROOT-extra" || oops "Can not create directory $UNITYROOT"
        cd "${UNITYROOT%/*}"
        echo "Starting to clone unity for arch:  "
        git clone git://github.com/chenxiaolong/Unity-for-Arch.git "${UNITYROOT##*/}"
        echo "Starting to clone unity-extra for arch:  "
        git clone git://github.com/chenxiaolong/Unity-for-Arch-Extra.git "${UNITYROOT##*/}-extra"
    fi
}
    

STAGE=0
VERBOSE=0
QUIET=0

while getopts ":ashUqv-:" OPTION ; do
    case $OPTION in
    a) sync-aur ;;
    s) sync-abs ;;
    U) sync-unity ;;
    q) QUIET=1 ;;
    v) VERBOSE=1 ;;
    h) printhelp ; exit ;;
    -)
        case $OPTARG in
        abs) sync-abs ;;
        aur) sync-aur ;;
        unity) sync-unity ;;
        stage) STAGE=1 ;;
        verbose) VERBOSE=1 ;;
        quiet) QUIET=1 ;;
        help) printhelp ; exit ;;
        *) error "$0: invalid option --$OPTARG" ;;
        esac ;;
    ?) error "$0: invalid option -$OPTARG" ;;
    esac
done
shift $(($OPTIND - 1))

mkdir -p $PKGDB/{upstream,changed,master,staging,testing} 2>/dev/null || oops "can't create the package database directories at $PKGDB"

[ "$QUIET" == 1 ] && VERBOSE=0

FOUND=()
SPLITS=()
DEPENDS=()
MAKEDEPENDS=()
Groups=()
PKGBASE=()
VERSION=()
if [ -d $STAGING ]; then
    [[ "$QUIET" == 0 ]] && echo "$STAGING"
    cd $STAGING
    add_repo "no-clobber"
fi

dump_depends >$PKGDB/staging/depends
dump_makedepends >$PKGDB/staging/makedepends
dump_pkgbase >$PKGDB/staging/pkgbase
dump_groups >$PKGDB/staging/groups
dump_splits >$PKGDB/staging/splits
dump_version >$PKGDB/staging/version

[ "$STAGE" == 1 ] && exit 0 # used by the stage command to update the staging database

FOUND=()
SPLITS=()
DEPENDS=()
MAKEDEPENDS=()
Groups=()
PKGBASE=()
VERSION=()
if [ -d $TESTING ]; then
    [[ "$QUIET" == 0 ]] && echo "$TESTING"
    cd $TESTING
    add_repo "no-clobber"
fi

dump_depends >$PKGDB/testing/depends
dump_makedepends >$PKGDB/testing/makedepends
dump_pkgbase >$PKGDB/testing/pkgbase
dump_groups >$PKGDB/testing/groups
dump_splits >$PKGDB/testing/splits
dump_version >$PKGDB/testing/version

cd $PacmanDB || oops "can't find pacman database at $PacmanDB"
for pkgfolder in *; do
    if [ -r $pkgfolder/desc ]; then
        find_provides $pkgfolder/desc
    fi
done

dump_providers >$PKGDB/providers

FOUND=()
if [ -d $MASTER ]; then
    cd $MASTER
    [[ "$QUIET" == 0 ]] && echo $MASTER
    add_repo "no-clobber"
fi
dump_depends >$PKGDB/master/depends
dump_makedepends >$PKGDB/master/makedepends
dump_pkgbase >$PKGDB/master/pkgbase
dump_groups >$PKGDB/master/groups
dump_splits >$PKGDB/master/splits
dump_version >$PKGDB/master/version


FOUND=()
SPLITS=()
DEPENDS=()
MAKEDEPENDS=()
Groups=()
PKGBASE=()
VERSION=()
if [ -n "$UNITYROOT" ]; then
    [[ "$QUIET" == 0 ]] && echo "$UNITYROOT"
    cd "$UNITYROOT" || oops "can't cd $AURROOT"
    # allow clobbering in the aur repo -- it's a mess
    add_repo "no-clobber"
    [[ "$QUIET" == 0 ]] && echo "$UNITYROOT-extra"
    cd "$UNITYROOT-extra" || oops "can't cd $AURROOT-extra"
    add_repo "no-clobber"
fi
for collection in ${UPSTREAM[*]}; do
    if [ -d $collection ]; then
        [[ "$QUIET" == 0 ]] && echo "$collection"
        cd $collection || oops "can't cd $collection"
        add_repo "no-clobber"
    fi
done
if [ -n "$AURROOT" ]; then
    [[ "$QUIET" == 0 ]] && echo "$AURROOT"
    cd "$AURROOT" || oops "can't cd $AURROOT"
    # allow clobbering in the aur repo -- it's a mess
    add_repo "no-clobber"
fi

dump_depends >$PKGDB/upstream/depends
dump_makedepends >$PKGDB/upstream/makedepends
dump_pkgbase >$PKGDB/upstream/pkgbase
dump_groups >$PKGDB/upstream/groups
dump_splits >$PKGDB/upstream/splits
dump_version >$PKGDB/upstream/version

FOUND=()
SPLITS=()
DEPENDS=()
MAKEDEPENDS=()
Groups=()
PKGBASE=()
VERSION=()
if [ -d $MASTER ]; then
    [[ "$QUIET" == 0 ]] && echo "$MASTER changed"
    cd $MASTER
    add_repo "no-clobber" "changed-only"
fi

dump_depends >$PKGDB/changed/depends
dump_makedepends >$PKGDB/changed/makedepends
dump_pkgbase >$PKGDB/changed/pkgbase
dump_groups >$PKGDB/changed/groups
dump_splits >$PKGDB/changed/splits
dump_version >$PKGDB/changed/version

exit 0

The script for calculating a correct build order:

#!/bin/bash
# order - by sitquietly
#
# A utility for Archlinux to sort a list of package names into a
# suitable order for building.
#
# Copyright (C) 2011 Garry Roseman <forestmoonsilence@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Package names are read from the command line, or standard input, 
# and written back out to standard output in the order for building. 
# Any trailing slashes on input names are removed so that a listing 
# of pkgbuild folder names is a suitable input.


#source /etc/makepkg.conf
source /etc/build.conf

declare -Ax Visited  # Visited[pkgname] is 1 if the subtree has been visited
declare -Ax Printed  # Printed[pkgname] is 1 if the dependency has been printed
declare -ax Package  # Package[] is the list of packages to build
declare -Ax Request  # Request[pkgname] is 1 if the pkgname is to be built
export Target        # The target package being processed for the makefile

# depends and makedepends arrays are loaded from the packge-database files
declare -Ax DEPENDS
declare -Ax MAKEDEPENDS


function printhelp() {
    echo '------------------------------------------------------------------------------'
    echo 'Syntax:    order [options] [pkgname]...'
    echo ''
    echo 'Print the package names in the correct order for building. (Usually used in a pipe'
    echo 'to get packages in the correct order for the build command.)'
    echo ''
    echo 'Package dependencies are assumed to be defined by the testing pkgbuild, if a '
    echo 'package is in testing, or by the pkgbuild in the master repository, if the upstream'
    echo 'package deps were changed when the package was compiled, or otherwise dependencies'
    echo 'are defined by the upstream pkgbuild. Hopefully this is "what you expect" with the'
    echo 'least surprise.  It does assume that previously made changes are going to be carried'
    echo 'forward by merging those changes, from the master or testing pkgbuild, into the'
    echo 'upstream pkgbuild.'
    echo ''
    echo 'Options:'
    echo '        --stage     use the dependencies defined in the staging repository.'
    echo '        --rebuild   dependencies are defined by the local packages (testing or master).'
    echo '                    Ignore upstream.'
    echo '    -M  --makedeps  Consider makedepends as well as depends to determine build order.'
    echo '    -h  --help      Print this message.'
    echo ''
    echo 'Examples:'
    echo '    Determine the correct order for building gtk2 glibc and firefox:'
    echo '        order gtk2 glibc firefox'
    echo '    Update the package database, calculate what packages are needed to build'
    echo '    the kde group from upstream, unify split packages, edit each upstream pkgbuild'
    echo '    and build it all in proper order:'
    echo '        update-package-database --abs'
    echo '        need --group kde | order | unify | build -es'
    echo '    Build the packages that have accumulated in the staging repository:'
    echo '        stage --list | order --stage | unify --stage | build --stage -s'
    echo '------------------------------------------------------------------------------'
    }

function error() {
    echo $1 >&2
    exit 1 
    }

function print_depend { # packagename --
    [ $1 == $Target ] && return # circular dependency; ignore it
    echo -n "$1 "
}

function print_deps() { # packagename --
    local depend
    [[ $# -eq 0 ]] && return
    [[ "${Visited[$1]}" == "true" ]] && return
    Visited[$1]="true"
    for depend in ${DEPENDS[$1]} ${MAKEDEPENDS[$1]}; do
        depend="${PROVIDER[$depend]:-$depend}"
        if [[ "${Request[$depend]}" == 1 ]]; then
            [[ "${Printed[$depend]}" != 1 ]] && print_depend "$depend"
            Printed[$depend]=1
        fi
        print_deps "$depend"
    done
}

function create_makefile() {
    i=0
    echo "# Makefile generated by order"
    echo ""
    echo "all: ${Package[*]}"
    echo ""
    while [[ $i -lt $N ]]; do
        echo -n "${Package[i]}: "
        Visited=()
        Printed=()
        Target=${Package[i]}
        print_deps "${Target}"
        printf "\n\techo ${Package[i]}\n"
        #Package[i]=""
        i=$((i+1))
    done
}


REBUILD=0
STAGE=0
USE_MAKEDEPENDS=0

while getopts ":Mh-:" OPTION ; do
    case $OPTION in
    h) printhelp ; exit ;;
    M) USE_MAKEDEPENDS=1 ;;
    -)
        case $OPTARG in
        stage) STAGE=1 ;;
        makedeps) USE_MAKEDEPENDS=1 ;;
        rebuild) REBUILD=1 ;;
        help) printhelp ; exit ;;
        *) error "$0: invalid option --$OPTARG" ;;
        esac ;;
    ?) error "$0: invalid option -$OPTARG" ;;
    esac
done
shift $(($OPTIND - 1))

if [ $REBUILD == 1 ]; then
    source "$PKGDB/master/depends"
    [ "$USE_MAKEDEPENDS" == 1 ] && source "$PKGDB/master/makedepends"
    source "$PKGDB/testing/depends"
    [ "$USE_MAKEDEPENDS" == 1 ] && source "$PKGDB/testing/makedepends"
else
    source "$PKGDB/upstream/depends"
    [ "$USE_MAKEDEPENDS" == 1 ] && source "$PKGDB/upstream/makedepends"
    source "$PKGDB/changed/depends"
    [ "$USE_MAKEDEPENDS" == 1 ] && source "$PKGDB/changed/makedepends"
    source "$PKGDB/testing/depends"
    [ "$USE_MAKEDEPENDS" == 1 ] && source "$PKGDB/testing/makedepends"
fi
if [ $STAGE == 1 ]; then
    source "$PKGDB/staging/depends"
    [ "$USE_MAKEDEPENDS" == 1 ] && source "$PKGDB/staging/makedepends"
fi
source "$PKGDB/providers"


N=0
Package=()
Depends=()

if [[ $# -eq 0 ]]; then
    while read PKG; do
        PKG=${PKG%/}
        Package[N]=$PKG
        Request[$PKG]=1
        N=$((N+1))
    done
else
    for PKG; do
        if [ $PKG == "-" ]; then
            while read PKG; do
                PKG=${PKG%/}
                Package[N]=$PKG
                Request[$PKG]=1
                N=$((N+1))
            done
        else
            PKG=${PKG%/}
            Package[N]=$PKG
            Request[$PKG]=1
            N=$((N+1))
        fi
    done
fi

if [[ $N -eq 0 ]]; then
    echo 'Warning: there is no input to order:' >&2
    echo 'Usage:  order <package names>'  >&2
    echo '        package name = "-" incorporates standard input'  >&2
    exit 1
else
#   create_makefile >.order
#   make --quiet -f .order 2>/dev/null
#   rm .order
    create_makefile | make --quiet -f - 2>/dev/null
fi

exit 0

A script to "unify" split packages so that all sub-packages will be built at once:

#!/bin/bash
# unify -- by sitquietly
#
# A utility for Archlinux to convert a list of simple package names
# into a list in which split packages are replaced by the name of 
# their containing pseudo-package.

# Copyright (C) 2011 Garry Roseman <forestmoonsilence@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


source /etc/build.conf

declare -Ax Names

function printhelp() {
    echo '------------------------------------------------------------------------------'
    echo 'Syntax:    unify [options] [pkgname]...'
    echo ''
    echo 'Replace names of split packages with the names of their inclusive base package.'
    echo 'Usually used in a pipe to process a build so that all sub-packages in a base'
    echo 'package are built together. This is especially convenient when the --merge or'
    echo '--edit option is being used to build.'
    echo ''
    echo 'Options:'
    echo '    --stage     package splitting as defined in the staging repository.'
    echo '    --rebuild   package splitting as defined in the master repository, ignore upstream.'
    echo '    -h, --help  Print this message.'
    echo ''
    echo 'Examples:'
    echo '    Rebuild gtk2 (will also rebuild gtk-update-icon-cache from the same base package):'
    echo '         unify --rebuild gtk2 | build -s'
    echo '    Update the package database, calculate what packages are needed to build'
    echo '    the kde group from upstream, unify split packages, edit each upstream pkgbuild'
    echo '    and build it all in proper order:'
    echo '         update-package-database --abs'
    echo '         need --group kde | order | unify | build -es'
    echo '------------------------------------------------------------------------------'
    }

function error() {
    echo $1 >&2
    exit 1 
    }

function unified() { # pkgname -- unified-pkgname
    if [[ ${SPLITS[$1]} == "" ]]; then
        echo $1
    else
        echo ${SPLITS[$1]}-ALL
    fi
}

function print_once() { # name --
    [[ Names[$1] -ne 1 ]] && echo $1
    Names[$1]=1
}

REBUILD=0
STAGE=0

while getopts ":h-:" OPTION ; do
    case $OPTION in
    h) printhelp ; exit ;;
    -)
        case $OPTARG in
        stage) STAGE=1 ;;
        rebuild) REBUILD=1 ;;
        help) printhelp ; exit ;;
        *) error "$0: invalid option --$OPTARG" ;;
        esac ;;
    ?) error "$0: invalid option -$OPTARG" ;;
    esac
done
shift $(($OPTIND - 1))

if [ $REBUILD == 1 ]; then
#   source $PKGDB/master/pkgbase
    source $PKGDB/master/splits
else
#   source $PKGDB/upstream/pkgbase
    source $PKGDB/upstream/splits
#   source $PKGDB/changed/pkgbase
    source $PKGDB/changed/splits
fi
if [ $STAGE == 1 ]; then
#   source $PKGDB/staging/pkgbase
    source $PKGDB/staging/splits
fi


if [ $# = 0 ]; then
    while read PKG; do
        PKG=$(unified ${PKG%/})
        print_once $PKG
    done
else
    for PKG; do
        if [ $PKG == "-" ]; then
        while read PKG; do
            PKG=$(unified ${PKG%/})
                print_once $PKG
        done
        else
        PKG=$(unified ${PKG%/})
            print_once $PKG
        fi
    done
fi

exit 0

And finally the script to actually build the packages:

#!/bin/bash
# build - by sitquietly
#
# A utility for Archlinux to build packages from source code.
#
# Copyright (C) 2011 Garry Roseman <forestmoonsilence@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# TODO: 
#   1) Allow to optionally view the packages web site during the edit phase.
#   2) Do all this from a tk gui that allows editing of lists, options;
#   view website in a pane, view forum discussions in that pane, etc.
#   3) fetch commit log from archlinux online into a ChangeLog file
#   4) when editing open equivalent Gentoo ebuild for comparison
#   5) when editing open equivalent Debian source pkg for comparison
#   6) when editing open equivalent Chakra pkgbuild for comparison
#   7) add a testing repo s.t. normal work flow is to stage related
#      packages, build (or build stage) saving to testing, possibly
#      accept testing by moving to master (command? or manual?), or
#      reject testing by "rollback" or "build --rollback" (like --rebuild
#      with clearing testing etc.).  build --testing will draw from
#      upstream and save to testing repo.  rollback should reject 
#      testing and go back to last known good set, master.
#   8) keep packages built with --testing in a separate folder, perhaps
#      $PKGDEST/testing and add command(s) to move pkgbuild and package
#      out of testing into master (promote?).  Maybe need to check that
#      installed version matches testing; if not do NOT promote it,
#      you haven't been testing it!  promote should move the tree
#      rooted at the named package(s), or alternately promote all
#      of testing.  It wouldn't make sense to promote out kdelibs, or
#      libpng, and not things that depend on it.
#   9) add a "release" command that performs sanity checks and creates
#      a release folder corresponding to master repo with cleaned up
#      pkgbuild dirs and binary packages (and distfile?).  release 
#      should complain if there are packages in testing (you are always
#      actually running testing -- a stable release occurs only when
#      testing has been accepted and promoted).
#  10) avoid common install errors by always calling certain update
#      functions after a build:
#         update-mime-database
#         update-desktop-database ?
#         gtk-update-icon-cache

# The ability to pause and resume a build can be very useful e.g. 
# You could edit the ./build.env file to add or remove packages from the job. 
# When resuming it is possible to specify new options and they will override 
# the old ones, as long as the "--resume" option comes before the others. 
# It is also possible to add more packages to the build list, they will be 
# built after those which were paused.

# Packages are built in the current directory. pkgbuilds are saved in $MASTER
# or $TESTING, otherwise they are left in place. Beware that build will NOT
# overwrite existing pkgbuilds in the working directory. That is a feature 
# allowing me to make changes while stopped and not lose those changes
# upon resuming.
#
# If a pkgbuild can't be found it is assumed to be an AUR package and the pkgbuild
# is retrieved from AUR using wget.


source /etc/makepkg.conf
source /etc/build.conf

# Force makepkg to build in the current directory and save
# built packages in $MYLINUX/packages:
unset BUILDDIR
export PKGDEST="${MYLINUX}/packages"

export Buildfolder="${PWD}"
declare -a Package
export Pkgname
export Pkgbase
export Pkgrepo
export Resuming
export edit # editor command
export merge # merge command

MASTER="${MYLINUX}/recipes/master"
STAGING="${MYLINUX}/recipes/staging"
TESTING="${MYLINUX}/recipes/testing"


function printhelp() {
    echo '------------------------------------------------------------------------------'
    echo 'A utility for Archlinux to build packages from source code.'
    echo ''
    echo 'Syntax:    build options packages'
    echo ''
    echo 'Build the packages named on the command line. A package name of "-" causes'
    echo 'package names to be read from standard input at that point in the list.'
    echo 'If no package names are given on the command line, names are read from'
    echo 'standard input. Packages are built in the order listed.'
    echo ''
    echo 'Use control-c to interrupt the build then "build --resume" when ready to continue.'
    echo ''
    echo 'Options:'
    echo '        --stage     Draw pkgbuilds from the staging repository if available there.'
    echo '        --testing   Build packages for testing. While a package is in testing it'
    echo '                    will continue to be saved there (except for rebuilds).'
    echo '        --rebuild   Copy pkgbuilds from the master repository,'
    echo '                    ignore upstream and ignore testing.'
    echo '    -m, --merge     Interactively merge in local changes (from testing or master).'
    echo '    -e, --edit      Edit each PKGBUILD before building the package.'
    echo '    -L, --log       Enable makepkg build logging.'
    echo '    -r, --resume    Resume the previously interrupted build in this directory.'
    echo '    -s, --save      Save the build dir for each package (see /etc/build.conf)'
    echo '    -S, --src       Also save the src directory.'
    echo '    -h, --help      Print this message.'
    echo ''
    echo 'Examples:'
    echo '    Rebuild all out-of-date packages except linux- (e.g. linux, linux-headers)'
    echo '         pacman -Qqu | grep -v "^linux-" | build -mes'
    echo '    Edit and recompile kdelibs, then rebuild everything that depends on kdelibs'
    echo '         build --edit --save kdelibs'
    echo '         pactree -ru kdelibs | tac | grep -v "^kdelibs$" | build'
    echo '    Update the package database, calculate what packages are needed to build'
    echo '    the kde group, unify split packages, and build it all in proper order:'
    echo '         update-package-database --abs --aur'
    echo '         need --group kde | order | unify | build'
    echo '------------------------------------------------------------------------------'
    }

function save_env() {
    for Var in STAGE REBUILD EDIT MERGE KEEPSRC SAVE EXPERIMENTAL ; do
        echo "$Var=$(($Var))"
    done 
    echo "LOG='$LOG'"
    echo "Package=(${Package[*]})"
} >"${Buildfolder}/build.env"

function error() {
    echo $1 >&2
    save_env
    exit 1 
    }

function resume() {
    if [ -f ./build.env ]; then
        source ./build.env
        N=${#Package[*]}
        Resuming="true"
    else
        error 'Can not resume: build.env is missing (are you in the right directory?)'
    fi 
}

trap "save_env; exit 1" SIGINT  # control-c
trap "STOP=1"           SIGQUIT # control-\
trap "save_env; exit 1" SIGKILL # control-u
trap "save_env; exit 1" SIGTERM # the kill command
trap "save_env; exit 1" SIGHUP

function stop_now() {
    [ ${#Package[*]} != 0 ] && save_env
    error 'stopped at user request; use "build -r" to resume'
}

function get_changling() { # if package is changling get src from master
    if echo $Pkgbase | egrep -q $CHANGLINGS; then
        [ -d "$MASTER/$Pkgbase/src" ] && cp -a "$MASTER/$Pkgbase/src" "${Buildfolder}/$Pkgbase/"
    fi
}

function get_pkgbuild() { # -- ;for Pkgbase 
    if [[ $STAGE == 1 && -d $STAGING/$Pkgbase ]]; then
       cp -r --no-clobber $STAGING/$Pkgbase "${Buildfolder}"
       get_changling
       return 0
    fi
    if [[ $REBUILD == 1 && -d $MASTER/$Pkgbase ]]; then
       cp -r --no-clobber $MASTER/$Pkgbase "${Buildfolder}"
       get_changling
       return 0
    fi
    for repo in "${UNITYROOT}" ${UPSTREAM[*]} "${AURROOT}"; do
        if [ -d $repo ]; then
            cd $repo
            for folder in */; do
                if [[ $folder == $Pkgbase/ ]]; then
                    cp -r --no-clobber ${repo}/${Pkgbase} "${Buildfolder}"
                    get_changling
                    return 0
                fi
            done
        fi
    done
    # if package has not been found in the local repositories try getting it from AUR online
    cd "${Buildfolder}"
    wget http://aur.archlinux.org/packages/${Pkgbase}/${Pkgbase}.tar.gz || return 1
    tar xfz ./${Pkgbase}.tar.gz
    rm -f ./${Pkgbase}.tar.gz
    get_changling
}

# Take list of pkgnames and print same list stripped of version numbers
function versionless() {
    i=0
    names=()
    for name; do
       names[i++]=${name%%[>=<]*} 
    done
    echo "${names[*]}"
}

function get_help() { # extract sources and create a PKGHELP file for the package
    cd "${Buildfolder}/$Pkgbase" || error "$Pkgbase missing from build folder ($Buildfolder)"
    makepkg --nobuild || error "can not extract sources for $Pkgbase"
    touch PKGHELP
    pkgname=()
    depends=()
    makedepends=()
    eval $(pkgnames PKGBUILD)
    for pkg in ${pkgname[*]}; do
        eval $(pkgvariables -vpkg=$pkg PKGBUILD)
        deps="$(versionless ${depends[*]})"
        makedeps="$(versionless ${makedepends[*]})"
        if [[ -n "${DEPENDS[$pkg]}" ]]; then
            if [ "${deps[*]}" != "${DEPENDS[$pkg]}" ]; then
                echo "WARNING: upstream depends differ from master for $pkg"
            fi
        fi
        if [[ -n "${MAKEDEPENDS[$pkg]}" ]]; then 
            if [ "${makedeps[*]}" != "${MAKEDEPENDS[$pkg]}" ]; then
                echo "WARNING: upstream makedepends differ from master for $pkg"
            fi
        fi
    done >>PKGHELP
    for dir in src/*/; do
        if [ -r $dir/README ]; then
            echo "===== $dir/README ====="
            cat $dir/README*
            echo "----------"
            echo
        fi >>PKGHELP
        if [ -r $dir/configure ]; then
            echo "===== $dir/configure --help ====="
            $dir/configure --help
            echo "----------"
            echo
        fi >>PKGHELP
        if [ -r $dir/CMakeLists.txt ]; then
            echo "===== $dir/cmake . -LH ====="
            cmake $dir -LH
            echo "----------"
            echo
        fi >>PKGHELP
    done
}

function restart_pkg() { # re-extract sources so that patches don't fail
    cd "${Buildfolder}/$Pkgbase" || error "$Pkgbase missing from build folder ($Buildfolder)"
    rm -rf src/
    makepkg --nobuild || error "can not extract sources for $Pkgbase"
}


function set_pkginfo() { # pkgname -- ;set Pkgname, Pkgbase, and Pkgrepo variables
    Pkgname=$1
    Pkgbase=${PKGBASE[$Pkgname]:-$Pkgname}
}

function make_failed() { # ;Pkgname failed to build and install
    save_env
    if [ $Pkgname == $Pkgbase ]; then
        error "Failed to build $Pkgname -- fix problems and 'build --resume'"
    else
        error "Failed to build $Pkgname from $Pkgbase -- fix problems and 'build --resume'"
    fi
}

function make_pkg() {
    cd "${Buildfolder}/$Pkgbase" || return 1
    #if [ $Pkgname == $Pkgbase ]; then
    if [ "$(ls -A src/)" ]; then
        # src directory is not empty; use it
        makepkg --force --noextract $LOG || return 1
    else
        # src directory is empty; need to "extract" sources
        # (this occurs with git packages for which no sources are obtained by makepkg --nobuild)
        makepkg --force $LOG || return 1
    fi
    #else
    #makepkg --force --install --noconfirm $LOG --pkg $Pkgname || return 1
    #fi
    (echo "Running namcap to check package $Pkgbase....."
    echo "---------"
    # I assume that PKGEXT is pkg.tar.xz (watch out for changes s.a. in openssl PKGBUILD)
    namcap *pkg.tar.xz 2>/dev/null
    echo "---------") >PKGCHECK
}

function install_pkg() {
    cd "${Buildfolder}/$Pkgbase" || return 1
    # makepkg --install --noconfirm || return 1
    # echo "y" | makepkg --install || return 1
    yes | makepkg --install || return 1
    sync
}

function keepsrc() { # succeeds or fails 
    [[ $KEEPSRC == 1 ]] && return 0
    if echo $Pkgbase | egrep -q $CHANGLINGS; then
        return 0
    else
        return 1
    fi
}

function save_pkg() { # move Pkgbase into master or testing repository
    local _Repo
    if [[ $EXPERIMENTAL == 1 || ( $REBUILD == 0 && -d $TESTING/$Pkgbase ) ]]; then
        _Repo="${TESTING}"
    else
        _Repo="${MASTER}"
    fi
    if [ ! -d $_Repo ]; then
        mkdir -p $_Repo || error "mkdir can not make repository $_Repo"
    fi
    cd "${Buildfolder}/$Pkgbase" || error "$Pkgbase missing from build folder ($Buildfolder)"
    rm -rf pkg/
    keepsrc || rm -rf src/ 
    # remove old sources
    [ -e $_Repo/$Pkgbase ] && rm -rf $_Repo/$Pkgbase
    cd "${Buildfolder}"
    # move new sources into place 
    mv $Pkgbase $_Repo || error "can not move $Pkgbase into repository $_Repo"
}

# Let developer merge changes from the local pkgbuild back into the new upstream pkgbuild.
# There are considered to be changes to merge if the previous upstream pkgbuild had been
# edited and changed (other than whitespace) during its last build or stage.  
# If a package is already in staging, or in testing, then that pkgbuild is used as the 
# reference for merging.  Otherwise the pkgbuild in master is the reference.
function merge_pkgbuild() {
    local Ref
    cd "${Buildfolder}/$Pkgbase" || error "$Pkgbase missing from build folder ($Buildfolder)"
    [ ! -f PKGBUILD ] && error" no PKGBUILD in $Pkgbase"
    if [[ -d "$STAGING/$Pkgbase" ]]; then
        Ref="$STAGING"
    else
        if [[ -d "$TESTING/$Pkgbase" ]]; then
            Ref="$TESTING"
        else
            Ref="$MASTER"
        fi
    fi
    # exclude the following line to merge unconditionally
#   [ ! -f $Ref/$Pkgbase/PKGBUILD.orig ] && return
    if [ -f "$Ref/$Pkgbase/PKGBUILD" ]; then
        cp PKGBUILD PKGBUILD.orig
        $merge "$Ref/$Pkgbase/PKGBUILD" PKGBUILD 2>/dev/null
        diff -Bbq PKGBUILD PKGBUILD.orig >/dev/null && rm PKGBUILD.orig
    fi
}

# Let developer edit upstream pkgbuild while referencing the PKGHELP file and local pkgbuild.
# If he makes changes, other than whitespace changes, save the original as PKGBUILD.orig
# The local pkgbuild is first one found in searching staging, testing, and master repositories.
function edit_pkgbuild() {
    local Ref
    local Ext
    cd "${Buildfolder}/$Pkgbase" || error "$Pkgbase missing from build folder ($Buildfolder)"
    [ ! -r PKGBUILD ] && error "can not read PKGBUILD in $Pkgbase"
    if [[ -f "$STAGING/$Pkgbase/PKGBUILD" ]]; then
        Ref="$STAGING/$Pkgbase/PKGBUILD"; Ext="stage"
    else
        if [[ -f "$TESTING/$Pkgbase/PKGBUILD" ]]; then
            Ref="$TESTING$Pkgbase/PKGBUILD"; Ext="testing"
        else
            if [[ -f "$MASTER/$Pkgbase/PKGBUILD" ]]; then
                Ref="$MASTER/$Pkgbase/PKGBUILD"; Ext="master"
            fi
        fi
    fi
    [ ! -f PKGBUILD.orig ] && cp PKGBUILD PKGBUILD.orig
    if [ -n "$Ref" ]; then
        cp "$Ref" PKGBUILD.$Ext
        $edit PKGBUILD.$Ext PKGHELP PKGBUILD 2>/dev/null
        diff -Bbq PKGBUILD PKGBUILD.orig >/dev/null && rm PKGBUILD.orig
        rm PKGBUILD.$Ext
    else
        $edit PKGHELP PKGBUILD 2>/dev/null
        diff -Bbq PKGBUILD PKGBUILD.orig >/dev/null && rm PKGBUILD.orig
    fi
}

# The pkgbuild is approved when namcap finds no errors, or the developer sees the errors
# and declines to change the pkgbuild.
function approve() { 
    cd "${Buildfolder}/$Pkgbase" || error "$Pkgbase missing from build folder ($Buildfolder)"
    cp PKGBUILD PKGBUILD.tmp
    if [ $EDIT = 1 ]; then
        $edit PKGBUILD PKGHELP PKGCHECK
    else
        # edit unconditionally if errors
        # first form detects only missing depends
        # second form detects all errors
        if grep 'detected and not included' PKGCHECK; then
        # if grep ' E: ' PKGCHECK; then
            $edit PKGBUILD PKGHELP PKGCHECK
        fi
    fi
    if diff -Bbq PKGBUILD PKGBUILD.tmp >/dev/null; then
        rm PKGBUILD.tmp
        return 0
    else
    # the PKGBUILD was changed; fail to approve the binary package
        if [ -f PKGBUILD.orig ]; then
            rm PKGBUILD.tmp 
        else
            cp PKGBUILD.tmp PKGBUILD.orig
        fi
        return 1
    fi
}


#USEABS=0
MERGE=0
EDIT=0
SAVE=0
KEEPSRC=0
STAGE=0
REBUILD=0
EXPERIMENTAL=0
LOG=""
STOP=0
Resuming="false"


while getopts ":aeLmrsSh-:" OPTION ; do
    case $OPTION in
    a) USEABS=1 ;;
    e) EDIT=1 ;;
    m) MERGE=1 ;;
    L) LOG="--log" ;;
    r) resume ;;
    S) KEEPSRC=1 ; SAVE=1 ;;
    s) SAVE=1 ;;
    h) printhelp ; exit ;;
    -)
        case $OPTARG in
        abs) USEABS=1 ;;
        edit) EDIT=1 ;;
        merge) MERGE=1 ;;
        log) LOG="--log" ;;
        resume) resume ;;
        src) KEEPSRC=1 ; SAVE=1 ;;
        save) SAVE=1 ;;
        stage) STAGE=1 ;;
        rebuild) REBUILD=1 ;;
        testing) EXPERIMENTAL=1 ;;
        help) printhelp ; exit ;;
        *) error "$0: invalid option --$OPTARG" ;;
        esac ;;
    ?) error "$0: invalid option -$OPTARG" ;;
    esac
done
shift $(($OPTIND - 1))

[ $REBUILD == 1 ] && MERGE=0  # merge makes no sense with rebuild
[ $EXPERIMENTAL == 1 ] && export PKGDEST="${PKGDEST}/testing"
mkdir -p ${PKGDEST} || error "can't make directory PKGDEST $PKGDEST"

if [ $REBUILD == 1 ]; then
    source $PKGDB/master/pkgbase
    source $PKGDB/master/depends
    source $PKGDB/master/makedepends
else
    source $PKGDB/upstream/pkgbase
    source $PKGDB/upstream/depends
    source $PKGDB/upstream/makedepends
    source $PKGDB/changed/pkgbase
    source $PKGDB/changed/depends
    source $PKGDB/changed/makedepends
    source $PKGDB/testing/pkgbase
    source $PKGDB/testing/depends
    source $PKGDB/testing/makedepends
fi
if [ $STAGE == 1 ]; then
    source $PKGDB/staging/pkgbase
    source $PKGDB/staging/depends
    source $PKGDB/staging/makedepends
fi

if [ -z $N ]; then
    N=0 # if resuming then N and Package will be initialized from build.env
    Package=()
fi

if [[ $# == 0 && $Resuming != "true" ]]; then
    while read PKG; do
        Package[N]=$PKG
        N=$((N+1))
    done
else
    for PKG; do
        if [ $PKG == "-" ]; then
            while read PKG; do
                Package[N]=$PKG
                N=$((N+1))
            done
        else
            Package[N]=$PKG
            N=$((N+1))
        fi
    done
fi

if [[ "$TERM" == "xterm" ]]; then
    edit="$PKGEDITOR"
    merge="$PKGMERGE"
    [[ -z "$edit" || -z "$merge" ]] && error "PKGEDITOR and PKGMERGE variables must be set in /etc/build.conf"
else
    edit="$PKGEDITOR_CONSOLE"
    merge="$PKGMERGE_CONSOLE"
    [[ -z "$edit" || -z "$merge" ]] && error "PKGEDITOR_CONSOLE and PKGMERGE_CONSOLE variables must be set in /etc/build.conf"
fi

if [ $N == 0 ]; then
    error "There is nothing to build"
else
    i=0
    while [ $i -lt $N ]; do
        echo "***** ${Package[i]} *****"
        set_pkginfo ${Package[i]}
        [[ "$STAGE" != 1 && -d "$STAGING/$Pkgbase" ]] && error "$Pkgbase is in staging:  Remove "$STAGING/$Pkgbase" or use 'build --stage' command."
        get_pkgbuild || error "No such package: ${Package[i]}"
        get_help
        [ $MERGE == 1 ] && merge_pkgbuild
        [ $EDIT == 1 ] && edit_pkgbuild
        while : 
        # we stay in this loop until namcap finds no errors or developer sees error and accepts pkgbuild anyway
        do
            make_pkg || make_failed
            approve && break
            restart_pkg
        done
        install_pkg || error "failed to install"
        [ $SAVE == 1 ] && save_pkg
        [[ $STAGE == 1 && -d $STAGING/$Pkgbase ]] && rm -rf $STAGING/$Pkgbase
        Package[i]=""
        [[ $STOP == 1 ]] && stop_now
        i=$((i+1))
        sleep 3
    done
fi

# Often needed but missing from post_install, post_upgrade and post_remove functions:
# update-mime-database /usr/share/mime
# update-desktop-database -q

# Quite some packages install icons in the hicolor icon theme. 
# These packages should depend on hicolor-icon-theme and should have 
# gtk-update-icon-cache -q -t -f usr/share/icons/hicolor (WITHOUT leading slash) 
# in the post_install, post_upgrade and post_remove function.
exit 0

A helper script to parse "pkgnames" from a pkgbuild:

#!/usr/bin/gawk -f
# pkgnames - by sitquietly
#
# A utility for Archlinux to parse important variables from a PKGBUILD.
#
# Copyright (C) 2011 Garry Roseman <forestmoonsilence@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Syntax:
#    pkgnames PKGBUILD
# prints the lines of the pkgbuild file that set pkgbase, pkgname,
# pkgver, and pkgrel

# Used in a shell script in the form
#    eval $(pkgnames PKGBUILD)
# to define pkgbase and the pkgname array from PKGBUILD
 
# Note that pkgname may or may not be written as an array in the PKGBUILD,
# it is either pkgname=xyzzy or pkgname=(xyzzy abcde), possibly with
# multiple lines and comments inside the array parens.  

# The form
#     true && pkgname=(...)
# is accepted as if it were simply
#     pkgname=(...)
# (This form is used in AUR pkgbuilds to define split packages.)

# Note that comment stripping is simplistic: if a ' #' occurs in a
# line that is taken to start a comment. 

# To avoid trash from some of the AUR pkgbuilds, gotversion, gotrel, and
# gotname flags are used to limit the definitions that are accepted.
# Illegal characters in the version string cause pkgver and
# pkgrel to be rejected (not printed).  pkgrel must be alphanumeric.
# This form of variable expansion is allowed: pkgver=${vendor_pkgver//-/_}

# I do print _x assignments up to the pkgver= line so that
# dynamically evaluated pkgversions such as for sudo and vim will work.
# This is a kludge for sure.  As long as developers use tricks like
# _topver=7.3
# _patchlevel=434
# pkgver=${_topver}.${_patchlevel}
# then this kludge will work ok.  If somebody fails to honor the tradition
# of using a leading underscore then this script will not give the correct
# pkgver.  The alternative of sourcing the entire pkgbuild is not acceptable.

# Note: I found some aur pkgbuilds with dos line endings, crlf, so I've
# allowed for \r at the end of lines.

# FIXME: should disallow strange stuff in pkgname array such as in
# pkgname=(${pkgname}-base
#        $(for plugin in ${plugins[@]}; do
#            echo ${plugin} | tr [A-Z] [a-z] | \
#            sed "s/^/statusnet-plugin-/"
#        done)


/^[ \t]*#/ { next }
{ sub(/^[ \t]*true[ \t]+&&[ \t]+pkgname=/,"pkgname=") }
{ sub(/[ \t]#.*$/,"") }
/^[ \t]*pkgbase=/ { print }
/^[ \t]*epoch=[0-9]*[ \t]*\r?$/ { print }
/^[ \t]*_[a-zA-Z_]*=[^("` \t]+[ \t]*\r?$/ && gotversion == 0 { print }
/^[ \t]*_[a-zA-Z_]*="[^("` ]+"[ \t]*\r?$/ && gotversion == 0 { print }
/^[ \t]*pkgver=[^\('` \t]+[ \t]*\r?$/ { print; gotversion = 1 }
/^[ \t]*pkgver='[0-9a-z]+[+._0-9a-z]*'[ \t]*\r?$/ { print; gotversion = 1 }
/^[ \t]*pkgver=\([0-9a-z]+[+._0-9a-z]*\)[ \t]*\r?$/ { print; gotversion = 1 }
/^[ \t]*pkgrel=[0-9a-z.]+[ \t]*\r?$/ && gotrel == 0 { print; gotrel = 1 }
/^[ \t]*pkgrel='[0-9a-z.]+'[ \t]*\r?$/ && gotrel == 0 { print; gotrel = 1 }
/^[ \t]*pkgrel="[0-9a-z.]+"[ \t]*\r?$/ && gotrel == 0 { print; gotrel = 1 }
/^[ \t]*pkgname=[^\(]*\r?$/ { print }
/^[ \t]*pkgname=[\(]/ && gotname == 0 { defining = 1; gotname = 1 }
defining == 1 { print }
/\)/ { defining = 0 }

A helper script to parse "pkgvariables" from a pkgbuild:

#!/usr/bin/gawk -f
# pkgvariables - by sitquietly
#
# A utility for Archlinux to parse important variables from a PKGBUILD.
#
# Copyright (C) 2011 Garry Roseman <forestmoonsilence@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Syntax:
#    pkgvariables -vpkg=<pkgname> <pkgbuild-file>
#
# prints the lines of the pkgbuild file that set depends, makedepends, and
# groups for pkgname.  If the pkgbuild defines multiple packages, split 
# packages, then more than one depends and groups assignment may be printed 
# but the last one will be for the specific package requested.

# Used in a shell script in the form
#    eval $(pkgvariables -vpkg=$pkgname PKGBUILD)
# to define the depends, makedepends, and groups arrays for pkgname

# WARNING: this script assumes a specific formatting for PKGBUILD files;
# package_xyzzy() definitions start in column 1 and the definition ends
# with a } in column 1.

# Note that comment stripping is simplistic: if a # character occurs in a
# line that is taken to start a comment. I don't check for literal # as in
# '#times' or escaped # as in \#.  

BEGIN { relevant = 1 }
/^[ \t]*#/ { next }
{ sub(/#.*$/,"") }
relevant == 1 && /^[ \t]*depends=\(/ { defining = 1 }
relevant == 1 && /^[ \t]*makedepends=\(/ { defining = 1 }
relevant == 1 && /^[ \t]*depends=[a-z]+[-0-9a-z._]*/ { print }
relevant == 1 && /^[ \t]*makedepends=[a-z]+[-0-9a-z._]*/ { print }
relevant == 1 && /^[ \t]*groups=/ { defining = 1 }
relevant == 1 && defining == 1 { print }
/\)/ { defining = 0 }
/^package_/ { relevant = 0 }
$0 ~ "^package_"pkg"\\(" { relevant = 1 }
/^\}/ { relevant = 0 }

And a helper script to scan for "pkgproviders":

#!/bin/bash
# pkgproviders - by sitquietly
#
# A utility for Archlinux to create a database of "providers"
# for all installed packages.
#
# The data is written to ~/.local/share/pkgbuild/providers
#
# Copyright (C) 2011 Garry Roseman <forestmoonsilence@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# The providers file format is
# declare -Ax PROVIDER='(
# [provides1]="provider1" 
# [provides2]="provider2"
# ...
# )'
# so that the file can simply be sourced to get the PROVIDER array.
# Version information is stripped so that, for example, we record
# [java-environment]="jdk7-openjdk"
# rather than
# [java-environment=7]="jdk7-openjdk"
# or
# [java-environment=7]="jdk7-openjdk-7.b147_2.0-2"
# makepkg is the enforcer of version requirements.

# FIXME this only allows for one provider for each virtual package.
# As a counter example consider phonon which depends on phonon-backend,
# which is provided by phonon-vlc AND by phonon-gstreamer. If a pkg
# depends on phonon-backend then it depends on BOTH of these providers. 


DATADIR=${XDG_DATA_HOME:-$HOME/.local/share}/pkgbuild
PROVIDERS=${DATADIR}/providers
PacmanDB=/var/lib/pacman/local
declare -Ax PROVIDER


mkdir -p ${DATADIR} 2>/dev/null

function dump_providers() {
    printf "declare -Ax PROVIDER='(\n"
    for provides in ${!PROVIDER[@]}; do
    printf "[%s]=\"%s\"\n" $provides ${PROVIDER[$provides]}
    done
    printf ")'\n"
}

function oops() { # msg --
    echo "Error: $1" >&2
    exit 1
}

function set_provides() { # pkgname --; read in the provides field from file
    while read line; do
    [[ $line == %* ]] && return
        [[ $line == "" ]] && return
        PROVIDER[${line%%[>=<]*}]=$1
    done
}

function find_provides() { # desc-file --; set PROVIDER if package has a provides field
    while read line; do
        if [[ $line == "%PROVIDES%" ]]; then
         set_provides ${1%%-[0-9]*}
     fi
    done <$1
}
    
    
cd $PacmanDB || oops "can't find pacman database at $PacmanDB"
for pkgfolder in *; do
    if [ -r $pkgfolder/desc ]; then
        find_provides $pkgfolder/desc
    fi
done

dump_providers >$PROVIDERS

exit 0

And the "versions" script that is crude but useful:

#!/bin/bash
# versions - by sitquietly
#
# A utility for Archlinux to print the upstream, staging, master,
# and installed versions of packages.
#
# Copyright (C) 2011 Garry Roseman <forestmoonsilence@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


source /etc/build.conf
declare -ax Package

function printhelp() {
    echo '------------------------------------------------------------------------------'
    echo 'A utility to print the upstream/staging/installed/master versions of packages.'
    echo ''
    echo 'Syntax:    versions [options] [pkgname]...'
    echo ''
    echo 'Output Options:'
    echo '    -q, --quiet       Print only package names without versions (implies -n).'
#   echo '    -c, --nocolor     Do not use color highlighting.'
    echo '    -n, --noheader    Do not print a table heading.'
#   echo '    -x, --norevisions Do not show revision suffix (or consider when filtering)'
    echo '    -h, --help        Print this message.'
    echo ''
    echo 'Filtering options (these options are mutually exclusive):'
    echo '    -u, --upgradable  package is installed but does not match upstream version'
    echo '    -e, --missing     package is installed but missing from master repo'
    echo '    -w, --mismatched  if package is installed, master is mismatched to installed'
    echo '                      if package is not installed, master is mismatched to upstream'
    echo '    -r, --removed     package is in master repo but no longer installed'
    echo '    -m, --foreign     package is in master repo but not available upstream'
    echo ''
    echo 'Definitions:'
    echo '    Where:'
    echo '        Version: U=upstream, S=staging, I=installed, M=master'
    echo '        Exists:  u=upstream, s=staging, i=installed, m=master'
    echo '    upgradable:= ui and I != U'
    echo '    missing:=    ui and !m'
    echo '    mismatched:= um and (M != U and M != I)'
    echo '    removed:=    m and !i'
    echo '    foreign:=    m and !u'
    echo ''
    echo 'Examples:'
    echo '    Print the upstream/staging/installed/master version info for gtk2'
    echo '        versions gtk2'
    echo '    Print the names of all installed packages that have newer versions upstream:'
    echo '        pacman -Qq | versions -qu'
    echo '    Report all members of the kde group that are missing from the master repo:'
    echo '        group kde | versions --missing'
    echo '    Print version info for all packages that are in staging:'
    echo '        stage --list | versions'
    echo '    Stage for upgrading all packages in the master repo that are mismatched:'
    echo '        ls /var/sources/master | versions --mismatched | stage -mes'
    echo ''
    echo '------------------------------------------------------------------------------'
    }

function error() { # message 
    echo "Error: $1" >&2
    exit 1
}

function maxlength() { # max length of pkgname
    local len
    for pkg in ${Package[*]}; do
        [[ ${#pkg} -gt $len ]] && len=${#pkg}
    done
    echo $len
}

QUIET=0
NOHEADER=0
UPGRADABLE=0
MISSING=0
MISMATCHED=0
REMOVED=0
FOREIGN=0


while getopts ":qnhumrwe-:" OPTION ; do
    case $OPTION in
    q) QUIET=1; NOHEADER=1 ;;
    n) NOHEADER=1 ;;
    u) UPGRADABLE=1 ;;
    e) MISSING=1 ;;
    w) MISMATCHED=1 ;;
    r) REMOVED=1 ;;
    m) FOREIGN=1 ;;
    h) printhelp ; exit ;;
    -)
        case $OPTARG in
        quiet) QUIET=1; NOHEADER=1 ;;
        noheader) NOHEADER=1 ;;
        upgradable) UPGRADABLE=1 ;;
        missing) MISSING=1 ;;
        mismatched) MISMATCHED=1 ;;
        removed) REMOVED=1 ;;
        foreign) FOREIGN=1 ;;
        help) printhelp ; exit ;;
        *) error "$0: invalid option --$OPTARG" ;;
        esac ;;
    ?) error "$0: invalid option -$OPTARG" ;;
    esac
done
shift $(($OPTIND - 1))

source $PKGDB/upstream/version UPSTREAM
source $PKGDB/staging/version STAGE
source $PKGDB/master/version MASTER

N=0
Package=()
filter='{ print }'
# upgradable:= ui and I != U
[[ $UPGRADABLE == 1 ]] && filter="\$1 !~ /$CHANGLINGS/ && \$2 != \"-\" && \$4 != \"-\" && \$2 != \$4 { print }"
# missing:= ui and !m
[[ $MISSING == 1 ]] && filter='$2 != "-" && $4 != "-" && $5 == "-" { print }'
# mismatched:= um and (M != U and M != I)
[[ $MISMATCHED == 1 ]] && filter='$2 != "-" && $5 != "-" && $5 != $2 && $5 != $4 { print }'
# removed:= m and !i
[[ $REMOVED == 1 ]] && filter='$5 != "-" && $4 == "-" { print }'
# foreign:= m and !u
[[ $FOREIGN == 1 ]] && filter='$5 != "-" && $2 == "-" { print }'

reporter='{ print }'
[[ $QUIET == 1 ]] && reporter='{ print $1 }'


if [[ $# == 0 ]]; then
    while read PKG; do
        Package[N]=${PKG%/}
        N=$((N+1))
    done
else
    for PKG; do
        if [ $PKG == "-" ]; then
            while read PKG; do
                Package[N]={$PKG%/}
                N=$((N+1))
            done
        else
            Package[N]=${PKG%/}
            N=$((N+1))
        fi
    done
fi

if [ $N == 0 ]; then
    error "No package names were given."
else
    L=$(maxlength)
    format="%-${L}s%20s%20s%20s%20s"
    [[ $NOHEADER == 0 ]] && printf "$format"  Package Upstream Staging Installed Master && echo ''
    for pkg in ${Package[*]}; do
        if pacman -Qq $pkg >/dev/null 2>/dev/null; then
            installed=$(pacman -Q $pkg | awk '{ print $2 }')
        else
            installed="-"
        fi
        printf "$format" "$pkg" "${UPSTREAMVERSION[$pkg]:--}" "${STAGEVERSION[$pkg]:--}" "$installed" "${MASTERVERSION[$pkg]:--}"
        echo ''
    done | awk "$filter" | awk "$reporter"
fi

exit 0

"need" lists the packages needed but missing for building another:

#!/bin/bash
# need - by sitquietly
#
# A utility for Archlinux to list all packages needed to build
# another.
#
# Copyright (C) 2011 Garry Roseman <forestmoonsilence@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Any trailing slashes on input names are removed so that a listing 
# of pkgbuild folder names is a suitable input.

# NOTE: need Y may print a long list of needed packages even if Y is
# already installed from pacman.  The packages listed will be those 
# "makedepends" needed to compile Y from source code.


source /etc/build.conf

declare -Ax Visited  # Visited[pkgname] is 1 if the subtree has been visited
declare -Ax Printed  # Printed[pkgname] is 1 if the dependency has been printed
export Target        # The target package being processed

# depends and makedepends arrays are loaded from the packge-database files
declare -Ax DEPENDS
declare -Ax MAKEDEPENDS

function printhelp() {
    echo '------------------------------------------------------------------------------'
    echo 'Syntax:    need [options] [pkgname]...'
    echo ''
    echo 'List the packages needed to build pkgname(s). (Usually used in a pipe'
    echo 'to get a complete package list for the build command.)'
    echo ''
    echo 'Package dependencies are assumed to be defined by the testing pkgbuild, if a '
    echo 'package is in testing, or by the pkgbuild in the master repository, if the upstream'
    echo 'package deps were changed when the package was compiled, or otherwise dependencies'
    echo 'are defined by the upstream pkgbuild. Hopefully this is "what you expect" with the'
    echo 'least surprise.  It does assume that previously made changes are going to be carried'
    echo 'forward by merging those changes, from the master or testing pkgbuild, into the'
    echo 'upstream pkgbuild.'
    echo ''
    echo 'Options:'
    echo '        --stage     use the dependencies defined in the staging repository.'
    echo '        --rebuild   dependencies are defined by the local packages (testing or master).'
    echo '                    Ignore upstream.'
    echo '    -h  --help      Print this message.'
    echo ''
    echo 'Examples:'
    echo '    Update the package database, calculate what packages are needed to build'
    echo '    the kde group from upstream, unify split packages, edit each upstream pkgbuild'
    echo '    and build it all in proper order:'
    echo '        update-package-database --abs'
    echo '        group kde | need | order | unify | build -es'
    echo '------------------------------------------------------------------------------'
    }

function error() {
    echo $1 >&2
    exit 1 
    }

function print_depend { # packagename --
    [ "$1" == "$Target" ] && return # circular dependency; ignore it
    echo "$1"
}

function print_deps() { # packagename --
    local depend
    [[ $# -eq 0 ]] && return
    [[ ${Visited["$1"]} == "true" ]] && return
    Visited["$1"]="true"
    [[ "${DEPENDS[$1]}" == "" && "${MAKEDEPENDS[$1]}" == "" ]] && return
    for depend in ${DEPENDS[$1]} ${MAKEDEPENDS[$1]}; do
        depend=${PROVIDER[$depend]:-$depend}
        if ! pacman -Qq $depend >/dev/null 2>/dev/null; then
            [[ ${Printed["$depend"]} != 1 ]] && print_depend $depend 
            Printed[$depend]=1
        fi
        print_deps $depend
    done
}

REBUILD=0
STAGE=0

while getopts ":h-:" OPTION ; do
    case $OPTION in
    h) printhelp ; exit ;;
    -)
        case $OPTARG in
        stage) STAGE=1 ;;
        rebuild) REBUILD=1 ;;
        help) printhelp ; exit ;;
        *) error "$0: invalid option --$OPTARG" ;;
        esac ;;
    ?) error "$0: invalid option -$OPTARG" ;;
    esac
done
shift $(($OPTIND - 1))

if [ $REBUILD == 1 ]; then
    source "$PKGDB/master/depends"
    source "$PKGDB/master/makedepends"
    source "$PKGDB/testing/depends"
    source "$PKGDB/testing/makedepends"
else
    source "$PKGDB/upstream/depends"
    source "$PKGDB/upstream/makedepends"
    source "$PKGDB/changed/depends"
    source "$PKGDB/changed/makedepends"
    source "$PKGDB/testing/depends"
    source "$PKGDB/testing/makedepends"
fi
if [ $STAGE == 1 ]; then
    source "$PKGDB/staging/depends"
    source "$PKGDB/staging/makedepends"
fi
source "$PKGDB/providers"


if [[ $# -eq 0 ]]; then
    while read PKG; do
        PKG=${PKG%/}
        print_deps $PKG
        echo $PKG
    done
else
    for PKG; do
        if [ $PKG == "-" ]; then
            while read PKG; do
                PKG=${PKG%/}
                print_deps $PKG
                echo $PKG
            done
        else
            PKG=${PKG%/}
            print_deps $PKG
            echo $PKG
        fi
    done
fi

exit 0

and "stage" stages a set of pkgbuilds so that all the merging in of local changes and editing of pkgbuild is done for the whole set before trying to build the entire stage in one go:

#!/bin/bash
# stage - by sitquietly
#
# A utility for Archlinux to stage upstream packages for later building.
#
# Copyright (C) 2011 Garry Roseman <forestmoonsilence@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# TODO: update the staging database after finishing "stage" command.
# Best if this automatic. But possibly require running "update-package-database"
# If so, make it clear in the help message.
# Make sure that PKGBUILD.orig travels along if PKGBUILD is changed; it must
# makes its way into master repo.


source /etc/makepkg.conf
source /etc/build.conf

# Force makepkg to build in the current directory and save
# built packages in $MYLINUX/packages:
unset BUILDDIR
export PKGDEST="${MYLINUX}/packages}"

export Buildfolder="${PWD}"
declare -a Package
export Pkgname
export Pkgbase
export Pkgrepo
export Resuming
export edit # editor command
export merge # merge command

MASTER="${MYLINUX}/recipes/master"
STAGING="${MYLINUX}/recipes/staging"


function printhelp() {
    echo '------------------------------------------------------------------------------'
    echo 'A utility for Archlinux to stage upstream packages for later building.'
    echo ''
    echo 'Syntax:    stage [options] [pkgname]...'
    echo ''
    echo 'Options:'
    echo '    -l, --list      List the packages that are currently staged.'
    echo '    -m, --merge     Interactively merge with pkgbuilds from master repository.'
    echo '    -e, --edit      Edit each PKGBUILD before staging the package.'
    echo '    -r, --resume    Resume the previously interrupted stage in this directory.'
    echo '    -h, --help      Print this message.'
    echo ''
    echo 'Examples:'
    echo '    Stage packages that need to be upgraded:'
    echo '         pacman -Qqu | stage -me'
    echo '    Stage the kde package group:'
    echo '         need --group kde | stage -e'
    echo '    Make sure that anything missing for building the stage is added to the stage:'
    echo '         stage --list | need --stage | stage -me'
    echo '    Build all of the staged packages:'
    echo '         stage --list | order --stage | unify --stage | build --stage -s'
    echo '------------------------------------------------------------------------------'
    }

function save_env() {
    for Var in EDIT MERGE ; do
    echo "$Var=$(($Var))"
    done 
    echo "Package=(${Package[*]})"
} >"${Buildfolder}/stage.env"

function error() {
    echo $1 >&2
    save_env
    exit 1 
    }

function resume() {
    if [ -f ./stage.env ]; then
        source ./stage.env
        N=${#Package[*]}
        Resuming="true"
    else
        error 'Can not resume: stage.env is missing (are you in the right directory?)'
    fi 
}

trap "save_env; exit 1" SIGINT  # control-c
trap "STOP=1"           SIGQUIT # control-\
trap "save_env; exit 1" SIGKILL # control-u
trap "save_env; exit 1" SIGTERM # the kill command
trap "save_env; exit 1" SIGHUP

function stop_now() {
    [ ${#Package[*]} != 0 ] && save_env
    error 'stopped at user request; use "build -r" to resume'
}

function get_pkgbuild() { # -- ;for Pkgbase 
    for repo in ${UPSTREAM[*]} ${AURROOT}; do
        if [ -d $repo ]; then
            cd $repo
            for folder in */; do
                if [[ $folder == $Pkgbase/ ]]; then
                    cp -r --no-clobber ${repo}/${Pkgbase} "${Buildfolder}"
                    return 0
                fi
            done
        fi
    done
    # if package has not been found in the local repositories try getting it from AUR online
    cd "${Buildfolder}"
    wget http://aur.archlinux.org/packages/${Pkgbase}/${Pkgbase}.tar.gz || return 1
    tar xfz ./${Pkgbase}.tar.gz
    rm -f ./${Pkgbase}.tar.gz
}

# Take list of pkgnames and print same list stripped of version numbers
function versionless() {
    i=0
    names=()
    for name; do
       names[i++]=${name%%[>=<]*} 
    done
    echo "${names[*]}"
}

function get_help() { # extract sources and create a PKGHELP file for the package
    cd "${Buildfolder}/$Pkgbase" || error "$Pkgbase missing from build folder ($Buildfolder)"
    makepkg --nobuild || error "can not extract sources for $Pkgbase"
    touch PKGHELP
    pkgname=()
    depends=()
    makedepends=()
    eval $(pkgnames PKGBUILD)
    for pkg in ${pkgname[*]}; do
    eval $(pkgvariables -vpkg=$pkg PKGBUILD)
        deps="$(versionless ${depends[*]})"
        makedeps="$(versionless ${makedepends[*]})"
    if [[ -n "${DEPENDS[$pkg]}" ]]; then
            if [ "${deps[*]}" != "${DEPENDS[$pkg]}" ]; then
        echo "WARNING: upstream depends differ from master for $pkg"
            fi
    fi
    if [[ -n "${MAKEDEPENDS[$pkg]}" ]]; then 
            if [ "${makedeps[*]}" != "${MAKEDEPENDS[$pkg]}" ]; then
        echo "WARNING: upstream makedepends differ from master for $pkg"
            fi
    fi
    done >>PKGHELP
    for dir in src/*/; do
    if [ -r $dir/README ]; then
        echo "===== $dir/README ====="
        cat $dir/README*
        echo "----------"
        echo
    fi >>PKGHELP
    if [ -r $dir/configure ]; then
        echo "===== $dir/configure --help ====="
        $dir/configure --help
        echo "----------"
        echo
    fi >>PKGHELP
    if [ -r $dir/CMakeLists.txt ]; then
        echo "===== $dir/cmake . -LH ====="
        cmake $dir -LH
        echo "----------"
        echo
    fi >>PKGHELP
    done
}

function restart_pkg() { # re-extract sources so that patches don't fail
    cd "${Buildfolder}/$Pkgbase" || error "$Pkgbase missing from build folder ($Buildfolder)"
    rm -rf src/
    makepkg --nobuild || error "can not extract sources for $Pkgbase"
}


function set_pkginfo() { # pkgname -- ;set Pkgname, Pkgbase, and Pkgrepo variables
    Pkgname=$1
    Pkgbase=${PKGBASE[$Pkgname]:-$Pkgname}
}

function check_pkgbuild() {
    cd "${Buildfolder}/$Pkgbase" || return 1
    (echo "Running namcap to check PKGBUILD for $Pkgbase....."
    echo "---------"
    namcap PKGBUILD 2>/dev/null
    echo "---------") >PKGCHECK
}

function save_pkg() { # move Pkgbase into staging repository
    if [ ! -d "$STAGING" ]; then
        mkdir -p "$STAGING" || error "mkdir can not make staging repository $STAGING"
    fi
    cd "${Buildfolder}/$Pkgbase" || error "$Pkgbase missing from build folder ($Buildfolder)"
    rm -rf pkg/ src/
    [ -e "$STAGING/$Pkgbase" ] && rm -rf "$STAGING/$Pkgbase"
    cd "${Buildfolder}"
    # move new sources into place 
    mv $Pkgbase "$STAGING" || error "can not move $Pkgbase into staging repository $STAGING"
}

# Let developer merge changes from the local pkgbuild back into the new upstream pkgbuild.
# There are considered to be changes to merge if the previous upstream pkgbuild had been
# edited and changed (other than whitespace) during its last build or stage.  
# If a package is already in staging, or in testing, then that pkgbuild is used as the 
# reference for merging.  Otherwise the pkgbuild in master is the reference.
function merge_pkgbuild() {
    local Ref
    cd "${Buildfolder}/$Pkgbase" || error "$Pkgbase missing from build folder ($Buildfolder)"
    [ ! -f PKGBUILD ] && error" no PKGBUILD in $Pkgbase"
    if [[ -d "$STAGING/$Pkgbase" ]]; then
        Ref="$STAGING"
    else
        if [[ -d "$TESTING/$Pkgbase" ]]; then
            Ref="$TESTING"
        else
            Ref="$MASTER"
        fi
    fi
    # exclude the following line to merge unconditionally
#   [ ! -f $Ref/$Pkgbase/PKGBUILD.orig ] && return
    if [ -f "$Ref/$Pkgbase/PKGBUILD" ]; then
        cp PKGBUILD PKGBUILD.orig
        $merge "$Ref/$Pkgbase/PKGBUILD" PKGBUILD 2>/dev/null
        diff -Bbq PKGBUILD PKGBUILD.orig >/dev/null && rm PKGBUILD.orig
    fi
}

# Let developer edit upstream pkgbuild while referencing the PKGHELP file and local pkgbuild.
# If he makes changes, other than whitespace changes, save the original as PKGBUILD.orig
# The local pkgbuild is first one found in searching staging, testing, and master repositories.
function edit_pkgbuild() {
    local Ref
    local Ext
    cd "${Buildfolder}/$Pkgbase" || error "$Pkgbase missing from build folder ($Buildfolder)"
    [ ! -r PKGBUILD ] && error "can not read PKGBUILD in $Pkgbase"
    if [[ -f "$STAGING/$Pkgbase/PKGBUILD" ]]; then
        Ref="$STAGING/$Pkgbase/PKGBUILD"; Ext="stage"
    else
        if [[ -f "$TESTING/$Pkgbase/PKGBUILD" ]]; then
            Ref="$TESTING$Pkgbase/PKGBUILD"; Ext="testing"
        else
            if [[ -f "$MASTER/$Pkgbase/PKGBUILD" ]]; then
                Ref="$MASTER/$Pkgbase/PKGBUILD"; Ext="master"
            fi
        fi
    fi
    [ ! -f PKGBUILD.orig ] && cp PKGBUILD PKGBUILD.orig
    if [ -n "$Ref" ]; then
        cp "$Ref" PKGBUILD.$Ext
        $edit PKGBUILD.$Ext PKGHELP PKGBUILD 2>/dev/null
        diff -Bbq PKGBUILD PKGBUILD.orig >/dev/null && rm PKGBUILD.orig
        rm PKGBUILD.$Ext
    else
        $edit PKGHELP PKGBUILD 2>/dev/null
        diff -Bbq PKGBUILD PKGBUILD.orig >/dev/null && rm PKGBUILD.orig
    fi
}

# The pkgbuild is approved when namcap finds no errors, or the developer sees the errors
# and declines to change the pkgbuild.
function approve() { 
    cd "${Buildfolder}/$Pkgbase" || error "$Pkgbase missing from build folder ($Buildfolder)"
    cp PKGBUILD PKGBUILD.tmp
    # show namcap output and allow editing pkgbuild if pkgcheck contains error messages or warnings
    if grep ' [WE]: ' PKGCHECK; then
            $edit --new PKGBUILD PKGHELP PKGCHECK 2>/dev/null
    fi
    if diff -Bbq PKGBUILD PKGBUILD.tmp >/dev/null; then
        rm PKGBUILD.tmp
        return 0
    else
    # the PKGBUILD was edited; fail to approve the binary package
        rm PKGBUILD.tmp 
        return 1
    fi
}


MERGE=0
EDIT=0
LIST=0
Resuming="false"


while getopts ":aemrsSh-:" OPTION ; do
    case $OPTION in
    e) EDIT=1 ;;
    m) MERGE=1 ;;
    r) resume ;;
    l) LIST=1 ;;
    h) printhelp ; exit ;;
    -)
        case $OPTARG in
        edit) EDIT=1 ;;
        merge) MERGE=1 ;;
        resume) resume ;;
        list) LIST=1 ;;
        help) printhelp ; exit ;;
        *) error "$0: invalid option --$OPTARG" ;;
        esac ;;
    ?) error "$0: invalid option -$OPTARG" ;;
    esac
done
shift $(($OPTIND - 1))

if [ $LIST == 1 ]; then
    cd "$STAGING"
    for pkg in *; do
        [ -d $pkg ] && echo $pkg
    done
    exit 0
fi

mkdir -p "${Buildfolder}" || error "can't create build folder $Buildfolder"

source $PKGDB/upstream/pkgbase
source $PKGDB/changed/pkgbase
source $PKGDB/upstream/version 
source $PKGDB/staging/version STAGE
source $PKGDB/master/depends
source $PKGDB/master/makedepends

if [ -z $N ]; then
    N=0 # if resuming then N and Package will be initialized from stage.env
    Package=()
fi

if [[ $# == 0 && $Resuming != "true" ]]; then
    while read PKG; do
        Package[N]=$PKG
        N=$((N+1))
    done
else
    for PKG; do
        if [ $PKG == "-" ]; then
            while read PKG; do
                Package[N]=$PKG
                N=$((N+1))
            done
        else
            Package[N]=$PKG
            N=$((N+1))
        fi
    done
fi

update-package-database --stage >/dev/null

if [[ "$TERM" == "xterm" ]]; then
    edit="$PKGEDITOR"
    merge="$PKGMERGE"
    [[ -z "$edit" || -z "$merge" ]] && error "PKGEDITOR and PKGMERGE variables must be set in /etc/build.conf"
else
    edit="$PKGEDITOR_CONSOLE"
    merge="$PKGMERGE_CONSOLE"
    [[ -z "$edit" || -z "$merge" ]] && error "PKGEDITOR_CONSOLE and PKGMERGE_CONSOLE variables must be set in /etc/build.conf"
fi

if [ $N == 0 ]; then
    error "There is nothing to build"
else
    i=0
    while [ $i -lt $N ]; do
        echo "***** ${Package[i]} *****"
        set_pkginfo ${Package[i]}
        if [[ -d "$STAGING/$Pkgbase" && -z "${STAGEVERSION[$Pkgname]}" ]]; then
        # this pkgbase is in staging as part of an unfinished stage operation
        # apparently it is part of a split package -- use the pkgbuild that
        # has already made its way into staging 
            Package[i]=""
            [ $STOP ] && stop_now
            i=$((i+1))
            continue
        fi
        if [[ -d "$STAGING/$Pkgbase" && ${VERSION[$Pkgname]} == ${STAGEVERSION[$Pkgname]} ]]; then
        # this package is in staging from earlier stage operation and is same version
            Package[i]=""
            [ $STOP ] && stop_now
            i=$((i+1))
            continue
        fi
        get_pkgbuild || error "No such package: ${Package[i]}"
        get_help
        [ $MERGE == 1 ] && merge_pkgbuild
        [ $EDIT == 1 ] && edit_pkgbuild
        while : 
    # we stay in this loop until namcap finds no errors or developer sees error and accepts pkgbuild anyway
        do
            check_pkgbuild
            approve && break
        restart_pkg
        done
        save_pkg
        Package[i]=""
        [ $STOP ] && stop_now
        i=$((i+1))
        sleep 3
    done
fi

update-package-database --stage >/dev/null
[ -f stage.env ] && rm stage.env
exit 0

There are references in there to features I didn't finish and the whole thing is a partial work in progress which was suddenly abandoned when I hit the wall of reality that a debian system would be more self-consistent base for such work.  You're welcome to use what you can.  I don't know if I'll work with these scripts more or not. 

Each of those main scripts has a help message, so
$ update-package-database --help
$ versions --help
$ need --help
$ order --help
$ unify --help
$ stage --help
$ build --help

Offline

#412 2012-03-25 15:52:05

chenxiaolong
Member
From: /home/chenxiaolong
Registered: 2010-11-03
Posts: 784

Re: Progress on Unity under Arch Linux!

sitquietly wrote:

Arch is what it is.  I suppose it could be called a cobbled together collection of binary packages, each one built by someone from the latest upstream release.  Not infrequently I too found that the pkgbuild in abs could not possibly be the one that was actually used to build the released package. Sometimes it was simple typos or checksum errors.  Sometimes I needed to find patches from Gentoo or elsewhere to make the thing compilable.  The system as a whole is, well, not a system as a whole: libraries are updated when upstream releases them even though that breaks some packages that only work with earlier versions of that library.  At any given moment many pkgbuilds can not be built.  Sometimes I found that some library was updated and that day or soon thereafter an app that uses is updated, but the app can not be built against the library that is "current" in Arch.  I have had to assume that the app binary was actually built against an older version of the library.

My old engineer disorder doesn't help:  I consider a system to be broken if it can't be rebuilt from source code.  (I'm retired from a career doing embedded systems development -- I made the firmware and drivers for computer boards that my company manufactured for industrial machine control.)  If it won't compile anymore you've gotten hidden problems, I don't care if it does "run".  It appeared that Arch could be "Gentoo without USE flags" but it can't be used that way.

That sounds good.  You'll almost convince me to return to Archlinux, or at least keep on dual booting.  I'll think about it...

Agreed. I expect source code and/or packaging files to create the same binaries/libraries as the ones in the repos. I also can't stand it when Arch upgrades a library when the applications all depend on the previous versions. For example, with libvirt: libvirt was compiled with libnl 1.1, while one of it's dependencies was compiled with libnl 3.2, causing the package to segfault. It's been a few months and it's still not fixed.

As for dual booting, Arch is not meant for embedded systems...and hard drives are pretty much unlimited in size now... big_smile

sitquietly wrote:

There are references in there to features I didn't finish and the whole thing is a partial work in progress which was suddenly abandoned when I hit the wall of reality that a debian system would be more self-consistent base for such work.  You're welcome to use what you can.  I don't know if I'll work with these scripts more or not. 

Each of those main scripts has a help message, so
$ update-package-database --help
$ versions --help
$ need --help
$ order --help
$ unify --help
$ stage --help
$ build --help

Thanks a lot for the scripts! I'll definitely have use for them smile If I make any changes to them, I'll be sure to push the changes to a repo on github.

Last edited by chenxiaolong (2012-03-25 15:52:54)

Offline

#413 2012-03-25 16:03:55

chenxiaolong
Member
From: /home/chenxiaolong
Registered: 2010-11-03
Posts: 784

Re: Progress on Unity under Arch Linux!

Update notes for yesterday's updates

(Unity-for-Arch)
- mtdev is now in the extra repo. Please install the Arch Linux version with pacman -S mtdev

- gnome-desktop made use of epochs in the extra repo. Incrementing the epoch causes the package to upgrade, no matter what the package version is (useful for downgrades). This means that gnome-desktop may not show in the upgrade checker script and will need to be updated manually.

- gtk-update-icon-cache-ubuntu was removed from the gtk2-ubuntu package because it's exactly the same as the one in the official repos. Please install the Arch Linux version with pacman -S gtk-update-icon-cache

(Unity-for-Arch-Extra)
- gtk-engine-unico is now in the community repo, so it was removed. Please install the Arch Linux version with pacman -S gtk-engine-unico

Last edited by chenxiaolong (2012-03-25 16:04:16)

Offline

#414 2012-03-25 16:34:52

mr_comic
Member
From: México
Registered: 2011-02-20
Posts: 52
Website

Re: Progress on Unity under Arch Linux!

chenxiaolong wrote:

Update notes for yesterday's updates

(Unity-for-Arch)
- mtdev is now in the extra repo. Please install the Arch Linux version with pacman -S mtdev

- gnome-desktop made use of epochs in the extra repo. Incrementing the epoch causes the package to upgrade, no matter what the package version is (useful for downgrades). This means that gnome-desktop may not show in the upgrade checker script and will need to be updated manually.

- gtk-update-icon-cache-ubuntu was removed from the gtk2-ubuntu package because it's exactly the same as the one in the official repos. Please install the Arch Linux version with pacman -S gtk-update-icon-cache

(Unity-for-Arch-Extra)
- gtk-engine-unico is now in the community repo, so it was removed. Please install the Arch Linux version with pacman -S gtk-engine-unico

Which version of gnome-desktop is the one needed? I have 3.3.92-1

Offline

#415 2012-03-25 17:29:58

chenxiaolong
Member
From: /home/chenxiaolong
Registered: 2010-11-03
Posts: 784

Re: Progress on Unity under Arch Linux!

mr_comic wrote:

Which version of gnome-desktop is the one needed? I have 3.3.92-1

If you run pacman -Syu, you'll see that pacman will upgrade gnome-desktop to version 1:3.2.1-1. You'll need to make sure that gnome-desktop version 1:3.3.92-1 is installed

Offline

#416 2012-03-25 18:09:42

mr_comic
Member
From: México
Registered: 2011-02-20
Posts: 52
Website

Re: Progress on Unity under Arch Linux!

chenxiaolong wrote:
mr_comic wrote:

Which version of gnome-desktop is the one needed? I have 3.3.92-1

If you run pacman -Syu, you'll see that pacman will upgrade gnome-desktop to version 1:3.2.1-1. You'll need to make sure that gnome-desktop version 1:3.3.92-1 is installed

Oh yeah, typo, my bad I have that version.

Offline

#417 2012-03-25 20:22:12

kuglee
Member
Registered: 2011-09-02
Posts: 61

Re: Progress on Unity under Arch Linux!

I can't compile xorg-server.
http://pastebin.com/Ht9SVM39

EDIT: I had some git packages installed smile

Last edited by kuglee (2012-03-25 21:07:09)

Offline

#418 2012-03-25 22:36:39

sitquietly
Member
From: On the Wolf River
Registered: 2010-07-12
Posts: 220

Re: Progress on Unity under Arch Linux!

chenxiaolong wrote:
sitquietly wrote:

Arch is what it is.  I suppose it could be called a cobbled together collection of binary packages, each one built by someone from the latest upstream release.....I consider a system to be broken if it can't be rebuilt from source code....

Agreed. I expect source code and/or packaging files to create the same binaries/libraries as the ones in the repos. .....

As for dual booting, Arch is not meant for embedded systems...and hard drives are pretty much unlimited in size now... big_smile

sitquietly wrote:

There are references in there to features I didn't finish and the whole thing is a partial work in progress which was suddenly abandoned when I hit the wall of reality that a debian system would be more self-consistent base for such work.  You're welcome to use what you can.  I don't know if I'll work with these scripts more or not. 

Each of those main scripts has a help message, so
$ update-package-database --help
$ versions --help
$ need --help
$ order --help
$ unify --help
$ stage --help
$ build --help

Thanks a lot for the scripts! I'll definitely have use for them smile If I make any changes to them, I'll be sure to push the changes to a repo on github.

I was updating my Arch system with your updates of last night (night for me) -- Archlinux has the priviledged position of running off my 32 GB Intel X-25E SSD, every other distro has make do with those big TB hard drives big_smile

I noticed that my "versions -qu" command fails on some of your packages, reports them as always out of date, because the version string is longer than I allowed.  I should have ensured that every field in the versions output is separated by at least one space.  If you try to use that script please correct the format spec to

  format="%-${L}s %24s %24s %24s %24s"

with a space between fields.

You could try the group script that lists members of a group:

#!/bin/bash
# group - by sitquietly
#
# A utility for Archlinux to show information about package groups.
#
# Copyright (C) 2011 Garry Roseman <forestmoonsilence@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


source /etc/build.conf
declare -ax Package
declare -Ax Groups # loaded from database

function printhelp() {
    echo '------------------------------------------------------------------------------'
    echo 'A utility to print the names of packages belonging to a group.'
    echo ''
    echo 'Syntax:    group [options] [groupname]...'
    echo ''
    echo 'Options:'
    echo '        --stage    Allow the staging repository to redefine group definitions.'
    echo '        --rebuild  Draw group definitions from the master repository, ignore upstream.'
    echo '    -l, --list     List the names of all groups.'
    echo '    -h, --help     Print this message.'
    echo ''
    echo 'Examples:'
    echo '    Show all group names known in the master repository:'
    echo '         group --list --rebuild'
    echo '    List the names of all packages in the kde group, taking account of any changes in'
    echo '    group membership that are made in the staged packages:'
    echo '         group --stage kde'
    echo '------------------------------------------------------------------------------'
    }

function error() { # message 
    echo "Error: $1" >&2
    exit 1
}

function print_groups() { # packagename --
    for group in ${Groups[$1]}; do
        echo $group
    done
}

function print_members() { # groupname --
    for pkg in ${!Groups[@]}; do
        for grp in ${Groups[$pkg]}; do
            [[ "$grp" == "$1" ]] && echo $pkg
        done
    done
}

STAGE=0
REBUILD=0
LIST=0

while getopts ":lh-:" OPTION ; do
    case $OPTION in
    l) LIST=1 ;;
    h) printhelp ; exit ;;
    -)
        case $OPTARG in
        list) LIST=1 ;;
        stage) STAGE=1 ;;
        rebuild) REBUILD=1 ;;
        help) printhelp ; exit ;;
        *) error "$0: invalid option --$OPTARG" ;;
        esac ;;
    ?) error "$0: invalid option -$OPTARG" ;;
    esac
done
shift $(($OPTIND - 1))


if [ $REBUILD == 1 ]; then
    source $PKGDB/master/groups
else
    source $PKGDB/upstream/groups
    source $PKGDB/changed/groups
fi
if [ $STAGE == 1 ]; then
    source $PKGDB/staging/groups
fi

if [[ $LIST == 1 ]]; then
    for Package in ${!Groups[@]}; do
        print_groups $Package
    done | sort -u
    exit 0
fi

for group; do
    print_members $group
done | sort

so that (hopefully) your Unity for Arch is installed by:

update-package-database --abs --unity
group unity | need | order | build --save

and updated by:

update-package-database --abs --unity
group unity | versions -qu | order | build --merge --save

or update your whole system, including aur packages, by

update-package-database --abs --aur --unity
pacman -Qq | versions -qu | order | build --merge --save

Naive users should remember that I believe that you'll soon hit a brick wall of frustration trying to build and upgrade Archlinux packages from source code: this is an exercise for a "distro builder" who is willing to resolve the build problems without complaining to the Arch devs about what are really upstream problems.  With Archlinux you are drinking from the source of the spring and the water has not been purified yet.  The overall Archlinux system is NOT integrated and by policy is not required to be recompilable (that would be Gentoo).  Please only complain to Arch devs and TUs about real packaging errors.  If a package fails to compile with today's set of libraries and tools, giving strange errors about missing symbols and such, that is not surprising and it is not their problem if they gave you a runnable binary.

Maybe someone will step up to the challenge of making a (semi)rolling distro out of Archlinux that IS integrated to contain at each step a conformable set of packages that do build and execute properly against each other from top to bottom.  That would be hard work.  Meanwhile, Arch is what it is, and it's pretty good. big_smile

Offline

#419 2012-03-26 00:44:28

mr_comic
Member
From: México
Registered: 2011-02-20
Posts: 52
Website

Re: Progress on Unity under Arch Linux!

I have to say, as a user only, that chenxiaolong is the best developer I've come up to with, he is so good at making Unity work with other distros in a easy and undestandeable way that he should be recognized by others smile Kudos.

Offline

#420 2012-03-26 17:55:41

chenxiaolong
Member
From: /home/chenxiaolong
Registered: 2010-11-03
Posts: 784

Re: Progress on Unity under Arch Linux!

sitquietly wrote:

I was updating my Arch system with your updates of last night (night for me) -- Archlinux has the priviledged position of running off my 32 GB Intel X-25E SSD, every other distro has make do with those big TB hard drives big_smile

Haha, I wish I had an SSD, but I'd probably break it very quickly by using ccache. And that's assuming I could decide on what OS to put on the SSD big_smile

sitquietly wrote:

I noticed that my "versions -qu" command fails on some of your packages, reports them as always out of date, because the version string is longer than I allowed.  I should have ensured that every field in the versions output is separated by at least one space.  If you try to use that script please correct the format spec to

  format="%-${L}s %24s %24s %24s %24s"

with a space between fields.

Thanks for the info!

sitquietly wrote:

Naive users should remember that I believe that you'll soon hit a brick wall of frustration trying to build and upgrade Archlinux packages from source code: this is an exercise for a "distro builder" who is willing to resolve the build problems without complaining to the Arch devs about what are really upstream problems.  With Archlinux you are drinking from the source of the spring and the water has not been purified yet.  The overall Archlinux system is NOT integrated and by policy is not required to be recompilable (that would be Gentoo).  Please only complain to Arch devs and TUs about real packaging errors.  If a package fails to compile with today's set of libraries and tools, giving strange errors about missing symbols and such, that is not surprising and it is not their problem if they gave you a runnable binary.

Maybe someone will step up to the challenge of making a (semi)rolling distro out of Archlinux that IS integrated to contain at each step a conformable set of packages that do build and execute properly against each other from top to bottom.  That would be hard work.  Meanwhile, Arch is what it is, and it's pretty good. big_smile

Maybe that's what caused Chakra to stop using Arch Linux as a base. Frugalware also uses pacman, but they made changes that make it more Debian-like, such as 'Fmakeinstall' (dh_auto_install) and 'Fautoreconf' (dh_autoreconf). Unfortunately, neither one installs on my UEFI laptop.

Offline

#421 2012-03-26 18:23:49

chenxiaolong
Member
From: /home/chenxiaolong
Registered: 2010-11-03
Posts: 784

Re: Progress on Unity under Arch Linux!

mr_comic wrote:

I have to say, as a user only, that chenxiaolong is the best developer I've come up to with, he is so good at making Unity work with other distros in a easy and undestandeable way that he should be recognized by others smile Kudos.

Thank you so much for the kind words smile

Offline

#422 2012-03-26 22:08:25

sitquietly
Member
From: On the Wolf River
Registered: 2010-07-12
Posts: 220

Re: Progress on Unity under Arch Linux!

chenxiaolong wrote:
sitquietly wrote:

.....Archlinux has the priviledged position of running off my 32 GB Intel X-25E SSD, every other distro has make do with those big TB hard drives big_smile

Haha, I wish I had an SSD...assuming I could decide on what OS to put on the SSD big_smile

I have to admit that Archlinux is still on my SSD because it is the fastest system I've got, (almost) completely compiled from source for my corei7 architecture with linux-lqx as kernel.  But I can't actually tell the difference when I'm running Ubuntu 12.04, it seems as fast in my daily use.

chenxiaolong wrote:
sitquietly wrote:

I noticed that my "versions -qu" command fails on some of your packages.....If you try to use that script please correct the format spec

Thanks for the info!

Uh, well, more info big_smile =>

I decided that the "versions" script would be more useful if the -u option listed missing (uninstalled) packages as upgradable.  It works better as a filter that way in some of the pipelines that I end up writing such as "group unity | need | versions -qu | order -M | build -es"

One line needs to be changed in "versions" to set the "filter" for the -u option:

# upgradable:= u and I != U
[[ $UPGRADABLE == 1 ]] && filter="\$1 !~ /$CHANGLINGS/ && \$2 != \"-\" && \$2 != \$4 { print }"

and in the "order" script everywhere you see PKG=${PKG%/} you should change it to

                PKG=${PKG%/}
                PKG="${PROVIDER[$PKG]:-$PKG}"

so that it outputs actual installed package names.  E.g. "order zeitgeist-datahub gtk2" will output "gtk2-ubuntu zeitgeist-datahub". 

chenxiaolong wrote:
sitquietly wrote:

Naive users should remember that I believe that you'll soon hit a brick wall of frustration trying to build and upgrade Archlinux packages from source code: ..... The overall Archlinux system is NOT integrated and by policy is not required to be recompilable.....Maybe someone will step up to the challenge of making a (semi)rolling distro out of Archlinux that IS integrated to contain at each step a conformable set of packages that do build and execute properly against each other from top to bottom.  That would be hard work.....

Maybe that's what caused Chakra to stop using Arch Linux as a base. Frugalware also uses pacman, but they made changes that make it more Debian-like, such as 'Fmakeinstall' (dh_auto_install) and 'Fautoreconf' (dh_autoreconf). Unfortunately, neither one installs on my UEFI laptop.

I think that Chakra is having trouble defining their policy: they want to be semi-rolling and more stable than Arch, but they want to compete with Arch's reputation for being the most up-to-date Linux on earth.  For several years I was a salesman for Apple computers and really figured out that some features sell well on the sales floor where buzzwords and the five-minute pitch form the crux of the decision.  "Arch grabs the latest upstream package as soon as it is released so it is always the most up to date" sounds great to the fanboys (like me).  It's really hard for me to accept tradeoffs, even though I was trained as an engineer, but a well-engineered product requires engineering and that takes a lot of time doesn't it big_smile

Offline

#423 2012-04-03 16:01:31

Trym
Member
Registered: 2012-04-03
Posts: 2

Re: Progress on Unity under Arch Linux!

I am on my third attempt to get Unity to work with Arch. My previous two attempts resulted in just a blue screen with a cross cursor. I have Arch in VirtualBox and I am going for a third attempt. I have snapshots for when things go wrong.

The current snapshot is a basic Arch install with X installed and nothing else.

I have git and python 3 installed, cloned the repository on the first page. I have tried running the What Can I Update.py script after making it an executable but nothing happens. I assume this is the script which installs everything listed in the readme rather than having to manually install each of them?

Offline

#424 2012-04-03 18:09:22

chenxiaolong
Member
From: /home/chenxiaolong
Registered: 2010-11-03
Posts: 784

Re: Progress on Unity under Arch Linux!

Trym wrote:

I am on my third attempt to get Unity to work with Arch. My previous two attempts resulted in just a blue screen with a cross cursor. I have Arch in VirtualBox and I am going for a third attempt. I have snapshots for when things go wrong.

The current snapshot is a basic Arch install with X installed and nothing else.

I have git and python 3 installed, cloned the repository on the first page. I have tried running the What Can I Update.py script after making it an executable but nothing happens. I assume this is the script which installs everything listed in the readme rather than having to manually install each of them?

Unfortunately, I don't have a script, like jhbuild, that can compile everything automatically sad. The What Can I Update?.py script just checks if there are updates after the initial install of all the packages.

As for the VirtualBox issue, you'll probably need to log in to another session first to install the guest additions for 3D acceleration. If it still fails, could you post the ~/.xsession-errors file from the virtual machine while it's at the blue screen?

Offline

#425 2012-04-04 02:32:42

chenxiaolong
Member
From: /home/chenxiaolong
Registered: 2010-11-03
Posts: 784

Re: Progress on Unity under Arch Linux!

sitquietly wrote:

I think that Chakra is having trouble defining their policy: they want to be semi-rolling and more stable than Arch, but they want to compete with Arch's reputation for being the most up-to-date Linux on earth.  For several years I was a salesman for Apple computers and really figured out that some features sell well on the sales floor where buzzwords and the five-minute pitch form the crux of the decision.  "Arch grabs the latest upstream package as soon as it is released so it is always the most up to date" sounds great to the fanboys (like me).  It's really hard for me to accept tradeoffs, even though I was trained as an engineer, but a well-engineered product requires engineering and that takes a lot of time doesn't it big_smile

I fully agree big_smile

Last edited by chenxiaolong (2012-04-04 02:32:53)

Offline

Board footer

Powered by FluxBB