Compare commits

..

64 Commits
0.8.0 ... 0.9.8

Author SHA1 Message Date
Pierre Schmitz
f1c05d870b tagging 0.9.8 2010-08-17 08:33:23 +02:00
Pierre Schmitz
2e6d542220 add [staging] repository 2010-08-17 08:12:03 +02:00
Pierre Schmitz
cfddde22be Fix typo 2010-08-16 21:30:44 +02:00
Pierre Schmitz
f7b67c25ff Provide /dev/{shm,pts} within chroot
implements FS#20246
2010-08-12 18:26:07 +02:00
Pierre Schmitz
65d654a9d7 lddd: correct mktemp usage 2010-07-13 15:10:47 +02:00
Pierre Schmitz
cfdfbd99f8 checkpkg: Improve output message 2010-07-11 13:46:40 +02:00
Pierre Schmitz
a01ed3869c checkpkg: Use temporary working directory 2010-07-11 13:45:51 +02:00
Pierre Schmitz
e656ec7052 Check if ~/.makepkg.conf exists
Fixes FS#20041
2010-07-01 16:51:43 +02:00
Pierre Schmitz
dcc7b6728d prepare 0.9.7 release 2010-06-28 10:32:47 +02:00
Pierre Schmitz
88764c0298 local can only be used within functions 2010-06-28 10:26:38 +02:00
Pierre Schmitz
f2959b8dd5 check if changelog and install files are commited to svn 2010-06-28 09:54:50 +02:00
Pierre Schmitz
0564514df4 remove useless sourcing of PKGBUILD 2010-06-28 09:50:08 +02:00
Pierre Schmitz
edb24eb1a0 Simplify detection of changelog and install files
Thise code was copied from makepkg
2010-06-28 09:48:21 +02:00
Andrea Scarpino
a2132bc899 read {SRC, PKG}DEST from user makepkg.conf
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2010-06-28 09:35:20 +02:00
Eric Bélanger
964c0d1640 Fixed changelog support to work with makepkg 3.4
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2010-06-28 08:07:41 +02:00
Pierre Schmitz
76f3e25949 keep partially transferred files 2010-06-25 21:40:45 +02:00
Pierre Schmitz
85251a1d7b removed mode lines; was not a good idea after all 2010-06-24 10:01:20 +02:00
Eric Bélanger
27df94f51b commitpkg: add newline to make output look more orderly
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2010-06-22 17:09:49 +02:00
Pierre Schmitz
12eec95ff8 set version in Makefile 2010-05-02 15:46:51 +02:00
Pierre Schmitz
d4f00819ac copy namcap.log to working dir 2010-05-02 15:42:29 +02:00
Pierre Schmitz
4a4455c086 Set target CARCH before sourcing the PKGBUILD
CARCH might be used within the PKGBUILD to select correct sources
2010-05-02 15:23:54 +02:00
Pierre Schmitz
52e140f2fe exit 1 on build failure 2010-05-02 15:16:53 +02:00
Pierre Schmitz
48dead1af7 Force correct remote file permissions 2010-03-31 23:58:59 +02:00
Pierre Schmitz
17e875f6b3 makechrootpkg: Keep source files even if build fails
implementes FS#18437
2010-03-03 21:49:22 +01:00
Pierre Schmitz
a7c5010d24 Upload any pkg.tar.* file as long as it is canonical 2010-03-03 21:41:53 +01:00
Pierre Schmitz
f72775feac PKGEXT was not defined in the context 2010-03-03 21:38:59 +01:00
Pierre Schmitz
371f57b043 Don't check if package was released already
The checks aren't reliable enough and fail if the local repo is broken due to
network failures. So for now we just allways commit.
2010-02-22 19:11:17 +01:00
Pierre Schmitz
2fe5dbf904 be more fail safe 2010-02-22 08:13:43 +01:00
Eric Bélanger
5036f1250e mkarchroot: Added default pacman cache in usage help
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2010-02-21 19:34:11 +01:00
Pierre Schmitz
f00c8f66bd escape line breaks in find command 2010-02-17 23:55:05 +01:00
Pierre Schmitz
df4310025b Use svnversion insead of svn info 2010-02-17 18:27:09 +01:00
Pierre Schmitz
53a864a5aa Use local information to determine if a commit is needed 2010-02-17 18:05:16 +01:00
Pierre Schmitz
849e6c6de5 Check if package was already released 2010-02-17 15:24:54 +01:00
Dan McGee
62e4272ca2 commitpkg: dereference symlinks on package upload
This is a regression introduced after switching to rsync in place of scp;
scp dereferenced symlinks automatically without need for a command-line
option.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2010-02-17 06:11:48 +01:00
Pierre Schmitz
dd488b3c90 add dist target to Makefile 2010-02-13 20:57:34 +01:00
Pierre Schmitz
de38f347a7 add common gitignore file 2010-02-13 20:41:46 +01:00
Pierre Schmitz
362a99b995 apply common coding style 2010-02-13 19:47:16 +01:00
Allan McRae
7a8130fec8 Further fixes to cache_dir handling
1) Typo cachedir -> cache_dir
2) Use $cache_dir when calling pacman

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2010-02-13 15:55:23 +01:00
Allan McRae
a6e1f8cfd3 Read cachedir from pacman.conf in working dir
This allows setting a different cachedir for (e.g.) i686 and x86_64
chroots.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
2010-02-13 09:57:49 +01:00
Pierre Schmitz
70d7baee68 set umask to 0022
this fixes commit 7ce9cd6965
2010-02-13 07:22:54 +01:00
Pierre Schmitz
59b7a739e8 inform the user of activities that might take a longer time 2010-02-13 04:03:10 +01:00
Pierre Schmitz
9e14e8691d Fall back to default if CacheDir is not set 2010-02-12 10:14:04 +01:00
Pierre Schmitz
c22a6014d7 supress confusing output of pushd and popd 2010-02-12 01:11:59 +01:00
Pierre Schmitz
d440e5998d copy files seperately to avoid escaping problems 2010-02-12 01:07:45 +01:00
Pierre Schmitz
611314a740 check install files, too 2010-02-11 23:48:06 +01:00
Pierre Schmitz
c39e59892d make sure pacman cache dir exists 2010-02-11 23:28:02 +01:00
Pierre Schmitz
f76261f073 don't cross filesystems. usefull if you bind a local mirror into your working copy 2010-02-11 23:27:30 +01:00
Pierre Schmitz
a37c07a8cb update comment 2010-02-11 15:27:24 +01:00
Pierre Schmitz
72a2b4789a abort if not all local source files are under version control
This looks a little hacky. The || true is needed because grep will return 1
if in fact everything is fine.

implements FS#18048
2010-02-11 15:19:13 +01:00
Pierre Schmitz
30cfcdc501 Add missing -n option to getopt list for mkarchroot
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2010-02-11 14:41:45 +01:00
Pierre Schmitz
f09baea392 Replace expensive merge with delete and copy 2010-02-11 14:25:20 +01:00
Pierre Schmitz
d68e7cb031 avoid useless output in commitpkg 2010-02-11 14:01:45 +01:00
Pierre Schmitz
106a0cddfe simplify and optimize upload process
Use rsync instead of scp to be able to continue uploads and get upload
verification for free.

We also try to commit to svn trunk first to avoid useless uploads (FS#18088).
2010-02-11 13:53:30 +01:00
Pierre Schmitz
0e43db65b2 Revert "add support for community svn"
This reverts commit 0346db0ff7.

This commit changed the expected behaviour of archco and truned it into a
more complex alias of "svn up <package>".
2010-02-11 12:50:01 +01:00
Pierre Schmitz
3e3b32641d Reduce verbosity to a sane minimum 2010-02-11 12:49:28 +01:00
Pierre Schmitz
16dd1fe6e0 Read pacman cache dir from pacman.conf or cli 2010-02-11 11:23:41 +01:00
Pierre Schmitz
f8ab1fb7a7 Create a working copy instead of using an union layer
Use rsync to create a (clean) working copy of the root dir instead of using aufs.
2010-02-11 10:26:45 +01:00
Pierre Schmitz
4ea489ad85 Move build and package logs to WORKDIR, otherwise it is lost 2010-02-11 09:14:56 +01:00
Ionut Biru
0346db0ff7 add support for community svn
Signed-off-by: Ionut Biru <ionut@archlinux.ro>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2010-01-11 13:41:04 -08:00
Nezmer
a1ede4dd4b devtools: make sure all files are owned by nobody before building
In makechrootpkg, build dirs are chowned to nobody before we move files
to "$uniondir/build". This could lead to failure If the files are
supposed to be dynamically upgraded when we run makepkg.

A common use-case is when we upgrade $pkgver in git,svn PKGBUILDS.

Signed-off-by: Nezmer <Nezmer@allurelinux.org>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2010-01-11 13:38:50 -08:00
Byron Clark
7ce9cd6965 Reset umask before touching the chroot.
This prevents problems when running with a umask that masks permissions
for others.

Signed-off-by: Byron Clark <byron@theclarkfamily.name>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2010-01-11 10:25:43 -08:00
Aaron Griffin
a7d88845a8 Remove sourcing of makepkg.conf files
This is replaced by commit marked "Use the host's SRCDEST and PKGDEST if
defined"

Noticed-by: Eric Bélanger <snowmaniscool@gmail.com>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2009-12-18 09:01:44 -08:00
Eric Bélanger
ea4b0d0a67 makechrootpkg: Replaced DB_COMPRESSION with 'gz'
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
2009-12-16 12:49:25 -08:00
Aaron Griffin
0c17e0d9fc Use the host's SRCDEST and PKGDEST if defined
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Original-by: Eric Bélanger <snowmaniscool@gmail.com>
2009-12-16 10:54:59 -08:00
13 changed files with 584 additions and 623 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*~
devtools-*.tar.gz

View File

@@ -1,3 +1,5 @@
V=0.9.8
all:
install:
@@ -8,6 +10,7 @@ install:
ln -sf commitpkg $(DESTDIR)/usr/bin/extrapkg
ln -sf commitpkg $(DESTDIR)/usr/bin/corepkg
ln -sf commitpkg $(DESTDIR)/usr/bin/testingpkg
ln -sf commitpkg $(DESTDIR)/usr/bin/stagingpkg
ln -sf commitpkg $(DESTDIR)/usr/bin/communitypkg
ln -sf commitpkg $(DESTDIR)/usr/bin/community-testingpkg
# arch{co,release,rm}
@@ -31,6 +34,7 @@ uninstall:
rm $(DESTDIR)/usr/bin/extrapkg
rm $(DESTDIR)/usr/bin/corepkg
rm $(DESTDIR)/usr/bin/testingpkg
rm $(DESTDIR)/usr/bin/stagingpkg
rm $(DESTDIR)/usr/bin/communitypkg
rm $(DESTDIR)/usr/bin/community-testingpkg
rm $(DESTDIR)/usr/sbin/mkarchroot
@@ -42,3 +46,6 @@ uninstall:
rm $(DESTDIR)/usr/bin/archrm
rm $(DESTDIR)/usr/bin/communityco
rm $(DESTDIR)/usr/bin/rebuildpkgs
dist:
git archive --format=tar --prefix=devtools-$(V)/ $(V) | gzip -9 > devtools-$(V).tar.gz

6
archco
View File

@@ -1,10 +1,10 @@
#!/bin/bash
if [ "$1" = "" ]; then
echo "Usage: archco <package name> [<package name>]"
if [ "$1" = '' ]; then
echo 'Usage: archco <package name> [<package name>]'
exit 1
fi
for i in "$@"; do
svn co svn+ssh://gerolde.archlinux.org/srv/svn-packages/$i
svn co svn+ssh://gerolde.archlinux.org/srv/svn-packages/$i
done

View File

@@ -1,55 +1,33 @@
#!/bin/bash
if [ "$1" = "" ]; then
echo "Usage: archrelease <repo>"
exit 1
abort() {
echo ${1:-'archrelease: Cancelled'}
exit 1
}
if [ "$1" = '' ]; then
abort 'Usage: archrelease <repo>'
fi
if [ ! -f PKGBUILD ]; then
echo "archrelease: PKGBUILD not found"
exit 1
abort 'archrelease: PKGBUILD not found'
fi
if [ "$(basename $(readlink -f .))" != "trunk" ]; then
echo "archrelease: Not in a package trunk dir"
exit 1
if [ "$(basename $(readlink -f .))" != 'trunk' ]; then
abort 'archrelease: Not in a package trunk dir'
fi
if [ "$(svn diff)" != "" ]; then
echo "archrelease: You have not committed your changes yet!"
echo " Please run 'upgpkg' or 'svn commit' first"
exit 1
if [ ! -z "$(svn status -q)" ]; then
abort 'archrelease: You have not committed your changes yet!'
fi
if [ ! -d ../repos/$1 ]; then
pushd ..
[ -d repos ] || mkdir repos
svn copy -r HEAD trunk repos/$1
svn commit -m "archrelease: new repo $1"
pushd repos/$1
svnmerge init
svn commit -F svnmerge-commit-message.txt
rm svnmerge-commit-message.txt
popd
popd
else
svnmerge merge ../repos/$1
pushd ..
if [ -f trunk/svnmerge-commit-message.txt ]; then
svn commit -F trunk/svnmerge-commit-message.txt
if [ $? -ne 0 ]; then
# The user is going to have to clean things up a bit
echo "*** ATTENTION: There was a problem merging the package changes ***"
echo "To fix it, edit the conflicting files in repos/$1 (the ones that are C in svn status)."
echo "Once you have resolved conflicts, execute 'svn resolved <path to file>' to tell svn the error was resolved."
echo "Then to finish the merge commit, execute 'svn commit -F trunk/svnmerge-commit-message.txt' and, if there are no problems, delete trunk/svnmerge-commit-message.txt"
exit $?
fi
rm trunk/svnmerge-commit-message.txt
else
echo "Nothing to commit"
fi
popd
echo -n 'releasing package...'
pushd .. >/dev/null
if [ -d "repos/${1}" ]; then
svn rm --force -q "repos/${1}"
svn commit -q -m "archrelease: remove ${1}" || abort
fi
echo "===> Tagged for $1"
svn copy -q -r HEAD trunk "repos/${1}"
svn commit -q -m "archrelease: copy trunk to ${1}" || abort
popd >/dev/null
echo 'done'

4
archrm
View File

@@ -1,7 +1,7 @@
#!/bin/bash
if [ "$1" = "" ]; then
echo "Usage: archrm <path to checkout>"
if [ "$1" = '' ]; then
echo 'Usage: archrm <path to checkout>'
exit 1
fi

129
checkpkg
View File

@@ -1,11 +1,11 @@
#!/bin/bash
# Source makepkg.conf; fail if it is not found
if [ -r "/etc/makepkg.conf" ]; then
source "/etc/makepkg.conf"
if [ -r '/etc/makepkg.conf' ]; then
source '/etc/makepkg.conf'
else
echo "/etc/makepkg.conf not found!"
exit 1
echo '/etc/makepkg.conf not found!'
exit 1
fi
# Source user-specific makepkg.conf overrides
@@ -18,77 +18,80 @@ strip_url() {
}
if [ ! -f PKGBUILD ]; then
echo "This must be run in the directory of a built package."
echo 'This must be run in the directory of a built package.'
exit 1
fi
source PKGBUILD
if [ "$arch" == "any" ]; then
CARCH="any"
. PKGBUILD
if [ "$arch" == 'any' ]; then
CARCH='any'
fi
TEMPDIR=$(mktemp -d /tmp/checkpkg-script.XXXX)
cd $TEMPDIR
for _pkgname in ${pkgname[@]}; do
pkgfile=${_pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}
oldstylepkgfile=${_pkgname}-${pkgver}-${pkgrel}${PKGEXT}
pkgfile=${_pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}
oldstylepkgfile=${_pkgname}-${pkgver}-${pkgrel}${PKGEXT}
if [ -f "$(pwd)/$pkgfile" ]; then
pkgfile=$(pwd)/$pkgfile
elif [ -f "$PKGDEST/$pkgfile" ]; then
pkgfile=$PKGDEST/$pkgfile
elif [ -f "$(pwd)/$oldstylepkgfile" ]; then
pkgfile=$(pwd)/$oldstylepkgfile
elif [ -f "$PKGDEST/$oldstylepkgfile" ]; then
pkgfile=$PKGDEST/$oldstylepkgfile
else
echo "File \"$pkgfile\" doesn't exist"
exit 1
fi
tmp=`pacman -Spd --noconfirm $_pkgname`
if [ $? -ne 0 ]; then
echo "Couldn't download previous package for $_pkgname."
exit 1
fi
pkgurl=`echo $tmp | rev | cut -d ' ' -f 1 | rev`
oldpkg=`strip_url $pkgurl`
if [ "$(basename $oldpkg)" = "$(basename $pkgfile)" ]; then
echo "The built package ($_pkgname) is the one in the repo right now!"
exit 1
fi
if [ ! -f $oldpkg ]; then
if echo $pkgurl | grep "^file:///" > /dev/null 2>&1; then
cp `echo $pkgurl | sed 's#^file://##'` .
elif [ -f $PKGDEST/$oldpkg ]; then
cp $PKGDEST/$oldpkg .
if [ -f "$(pwd)/$pkgfile" ]; then
pkgfile=$(pwd)/$pkgfile
elif [ -f "$PKGDEST/$pkgfile" ]; then
pkgfile=$PKGDEST/$pkgfile
elif [ -f "$(pwd)/$oldstylepkgfile" ]; then
pkgfile=$(pwd)/$oldstylepkgfile
elif [ -f "$PKGDEST/$oldstylepkgfile" ]; then
pkgfile=$PKGDEST/$oldstylepkgfile
else
wget --quiet $pkgurl
echo "File \"$pkgfile\" doesn't exist"
exit 1
fi
fi
bsdtar tf $oldpkg > filelist-$_pkgname-old
bsdtar tf "$pkgfile" > filelist-$_pkgname
tmp=`pacman -Spd --noconfirm $_pkgname`
sort -o filelist-$_pkgname filelist-$_pkgname
sort -o filelist-$_pkgname-old filelist-$_pkgname-old
if [ $? -ne 0 ]; then
echo "Couldn't download previous package for $_pkgname."
exit 1
fi
diff filelist-$_pkgname-old filelist-$_pkgname
pkgurl=`echo $tmp | rev | cut -d ' ' -f 1 | rev`
if diff filelist-$_pkgname-old filelist-$_pkgname | grep '\.so\.' > /dev/null 2>&1; then
mkdir -p pkg
cd pkg
bsdtar xf "$pkgfile" > /dev/null
for i in `diff ../filelist-$_pkgname-old ../filelist-$_pkgname | grep \> | grep \.so\. | awk '{print $2}'`; do
echo -n "${i}: "
objdump -p $i | grep SONAME
done
else
echo "No filename differences for $_pkgname."
fi
oldpkg=`strip_url $pkgurl`
if [ "$(basename $oldpkg)" = "$(basename $pkgfile)" ]; then
echo "The built package ($_pkgname) is the one in the repo right now!"
exit 1
fi
if [ ! -f $oldpkg ]; then
if echo $pkgurl | grep '^file:///' > /dev/null 2>&1; then
cp `echo $pkgurl | sed 's#^file://##'` .
elif [ -f $PKGDEST/$oldpkg ]; then
cp $PKGDEST/$oldpkg .
else
wget --quiet $pkgurl
fi
fi
bsdtar tf $oldpkg > filelist-$_pkgname-old
bsdtar tf "$pkgfile" > filelist-$_pkgname
sort -o filelist-$_pkgname filelist-$_pkgname
sort -o filelist-$_pkgname-old filelist-$_pkgname-old
diff filelist-$_pkgname-old filelist-$_pkgname
if diff filelist-$_pkgname-old filelist-$_pkgname | grep '\.so\.' > /dev/null 2>&1; then
mkdir -p pkg
cd pkg
bsdtar xf "$pkgfile" > /dev/null
for i in `diff ../filelist-$_pkgname-old ../filelist-$_pkgname | grep \> | grep \.so\. | awk '{print $2}'`; do
echo -n "${i}: "
objdump -p $i | grep SONAME
done
else
echo "No soname differences for $_pkgname."
fi
done
# vim:ft=sh:ts=4:sw=4:et:
echo "Files saved to $TEMPDIR"

181
commitpkg
View File

@@ -1,121 +1,128 @@
#!/bin/bash
abort() {
echo ${1:-"Cancelled"}
exit 1
echo ${1:-'Cancelled'}
exit 1
}
# Verify that a remote file exists and is identical to a local one
# Usage: package_verify <local path> <remote host> <remote path>
package_verify() {
local remote_checksum=$(ssh $2 openssl sha1 "'$3'" 2>/dev/null |
grep -o '[0-9a-f]\{40\}$')
local local_checksum=$(openssl sha1 "$1" | grep -o '[0-9a-f]\{40\}$')
if [ -n "$remote_checksum" -a "$remote_checksum" == "$local_checksum" ]; then
return 0
fi
return 1
getpkgfile() {
if [[ ${#} -ne 1 ]]; then
echo 'ERROR: No canonical package found!' >&2
exit 1
elif [ ! -f "${1}" ]; then
echo "ERROR: Package ${1} not found!" >&2
exit 1
fi
echo ${1}
}
# Source makepkg.conf; fail if it is not found
if [ -r "/etc/makepkg.conf" ]; then
source "/etc/makepkg.conf"
if [ -r '/etc/makepkg.conf' ]; then
source '/etc/makepkg.conf'
else
abort "/etc/makepkg.conf not found!"
abort '/etc/makepkg.conf not found!'
fi
# Source user-specific makepkg.conf overrides
if [ -r ~/.makepkg.conf ]; then
source ~/.makepkg.conf
. ~/.makepkg.conf
fi
cmd=$(basename "$0")
if [ ! -f PKGBUILD ]; then
abort "No PKGBUILD file"
abort 'No PKGBUILD file'
fi
source PKGBUILD
. PKGBUILD
pkgbase=${pkgbase:-$pkgname}
# set up repo-specific opts depending on how we were called
server="gerolde.archlinux.org"
if [ "$cmd" == "extrapkg" ]; then
repo="extra"
elif [ "$cmd" == "corepkg" ]; then
repo="core"
elif [ "$cmd" == "testingpkg" ]; then
repo="testing"
elif [ "$cmd" == "communitypkg" ]; then
repo="community"
server="aur.archlinux.org"
elif [ "$cmd" == "community-testingpkg" ]; then
repo="community-testing"
server="aur.archlinux.org"
server='gerolde.archlinux.org'
if [ "$cmd" == 'extrapkg' ]; then
repo='extra'
elif [ "$cmd" == 'corepkg' ]; then
repo='core'
elif [ "$cmd" == 'testingpkg' ]; then
repo='testing'
elif [ "$cmd" == 'stagingpkg' ]; then
repo='staging'
elif [ "$cmd" == 'communitypkg' ]; then
repo='community'
server='aur.archlinux.org'
elif [ "$cmd" == 'community-testingpkg' ]; then
repo='community-testing'
server='aur.archlinux.org'
else
if [ $# -eq 0 ]; then
abort "usage: commitpkg <reponame> [-l limit] [commit message]"
fi
repo="$1"
shift
if [ $# -eq 0 ]; then
abort 'usage: commitpkg <reponame> [-l limit] [commit message]'
fi
repo="$1"
shift
fi
# see if any limit options were passed, we'll send them to SCP
unset scpopts
if [ "$1" = "-l" ]; then
scpopts="-l $2"
shift 2
# check if all local source files are under version control
(for s in ${source[@]}; do
echo $s | grep -vq '://' && \
svn status $s | grep -q '?' && \
abort "$s is not under version control"
done) || true
# check if changelog and install files are under version control
(for i in 'changelog' 'install'; do
filelist=$(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
for file in $filelist; do
# evaluate any bash variables used
eval file=${file}
if svn status ${file} | grep -q '?'; then
abort "${file} is not under version control"
fi
done
done) || true
# see if any limit options were passed, we'll send them to rsync
unset rsyncopts
if [ "$1" = '-l' ]; then
rsyncopts="--bwlimit=$2"
shift 2
fi
echo -n 'committing changes to trunk...'
if [ -n "$1" ]; then
svn commit -q -m "upgpkg: $pkgbase $pkgver-$pkgrel
$1" || abort
else
svn commit -q || abort
fi
echo 'done'
for _arch in ${arch[@]}; do
echo "===> Uploading to staging/$repo for arch=${_arch}"
for _pkgname in ${pkgname[@]}; do
pkgfile=$_pkgname-$pkgver-$pkgrel-${_arch}$PKGEXT
for _pkgname in ${pkgname[@]}; do
pkgfile=$(getpkgfile "$_pkgname-$pkgver-$pkgrel-${_arch}".pkg.tar.* 2>/dev/null)
pkgdestfile=$(getpkgfile "$PKGDEST/$_pkgname-$pkgver-$pkgrel-${_arch}".pkg.tar.* 2>/dev/null)
if [ ! -f $pkgfile -a -f "$PKGDEST/$pkgfile" ]; then
pkgfile="$PKGDEST/$pkgfile"
elif [ ! -f $pkgfile ]; then
echo "File $pkgfile doesn't exist"
# skip to next architecture
continue 2
fi
if [ ! -f "$pkgfile" -a -f "$pkgdestfile" ]; then
pkgfile="$pkgdestfile"
elif [ ! -f "$pkgfile" ]; then
echo "skipping ${_arch}"
continue 2
fi
# combine what we know into a variable
uploadto=staging/$repo/$(basename "$pkgfile")
# don't re-upload the same package (useful for -any sub packages)
if ! package_verify "$pkgfile" $server "$uploadto"; then
scp $scpopts "$pkgfile" $server:"$uploadto" || abort
fi
if ! package_verify "$pkgfile" $server "$uploadto"; then
abort "File got corrupted during upload, cancelled."
else
echo "File integrity okay."
fi
echo "===> Uploaded $pkgfile"
done
if [ -n "$1" ]; then
svn commit -m "upgpkg: $pkgbase $pkgver-$pkgrel
$1" >/dev/null || abort
echo "===> Commited with message:
upgpkg: $pkgbase $pkgver-$pkgrel
$1"
else
svn commit || abort
echo "===> Commited"
fi
archrelease $repo-${_arch} || abort
echo -n 'uploading '
rsync -p --chmod 'ug=rw,o=r' -c -h -L --progress $rsyncopts --partial "${pkgfile}" -e ssh $server:staging/$repo || abort
done
archrelease $repo-${_arch} || abort
done
if [ "${arch[*]}" == "any" ]; then
if [ -d ../repos/$repo-i686 -a -d ../repos/$repo-x86_64 ]; then
pushd ../repos/
svn rm $repo-i686
svn rm $repo-x86_64
svn commit -m "removed $repo-i686 and $repo-x86_64 for $pkgname"
popd
fi
if [ "${arch[*]}" == 'any' ]; then
if [ -d ../repos/$repo-i686 -a -d ../repos/$repo-x86_64 ]; then
pushd ../repos/ >/dev/null
echo "removing $repo-i686 and $repo-x86_64..."
svn rm $repo-i686
svn rm $repo-x86_64
svn commit -q -m "removed $repo-i686 and $repo-x86_64 for $pkgname"
echo 'done'
popd >/dev/null
fi
fi
# vim:ft=sh:ts=4:sw=4:et:

View File

@@ -1,10 +1,10 @@
#!/bin/bash
if [ "$1" = "" ]; then
echo "Usage: communityco <package name> [<package name>]"
if [ "$1" = '' ]; then
echo 'Usage: communityco <package name> [<package name>]'
exit 1
fi
for i in "$@"; do
svn co svn+ssh://aur.archlinux.org/srv/svn-packages/$i
svn co svn+ssh://aur.archlinux.org/srv/svn-packages/$i
done

View File

@@ -3,39 +3,37 @@
# finddeps - find packages that depend on a given depname
#
if [ "$1" = "" ]; then
echo "usage: finddeps <depname>"
echo ""
echo "Find packages that depend on a given depname."
echo "Run this script from the top-level directory of your ABS tree."
echo ""
exit 0
if [ "$1" = '' ]; then
echo 'usage: finddeps <depname>'
echo ''
echo 'Find packages that depend on a given depname.'
echo 'Run this script from the top-level directory of your ABS tree.'
echo ''
exit 0
fi
match=$1
tld=$(pwd)
for d in $(find . -type d); do
cd $d
if [ -f PKGBUILD ]; then
unset pkgname depends makedepends
. PKGBUILD
for dep in "${depends[@]}"; do
# lose the version comaparator, if any
depname=${dep%%[<>=]*}
if [ "$depname" = "$match" ]; then
echo "$d (depends)"
fi
done
for dep in "${makedepends[@]}"; do
# lose the version comaparator, if any
depname=${dep%%[<>=]*}
if [ "$depname" = "$match" ]; then
echo "$d (makedepends)"
fi
done
fi
cd $tld
cd $d
if [ -f PKGBUILD ]; then
unset pkgname depends makedepends
. PKGBUILD
for dep in "${depends[@]}"; do
# lose the version comaparator, if any
depname=${dep%%[<>=]*}
if [ "$depname" = "$match" ]; then
echo "$d (depends)"
fi
done
for dep in "${makedepends[@]}"; do
# lose the version comaparator, if any
depname=${dep%%[<>=]*}
if [ "$depname" = "$match" ]; then
echo "$d (makedepends)"
fi
done
fi
cd $tld
done
# vim:ft=sh:ts=4:sw=4:et:

49
lddd
View File

@@ -6,42 +6,41 @@
ifs=$IFS
IFS=':'
libdirs="/lib:/usr/lib:/opt/qt/lib:/opt/kde/lib:/usr/lib/libfakeroot:/opt/NX/lib"
libdirs='/lib:/usr/lib:/opt/qt/lib:/opt/kde/lib:/usr/lib/libfakeroot:/opt/NX/lib'
extras=
TEMPDIR=$(mktemp /tmp/lddd-script.XXXX)
rm $TEMPDIR
mkdir -p $TEMPDIR
TEMPDIR=$(mktemp -d /tmp/lddd-script.XXXX)
echo " Go out and drink some tea, this will take a while :) ..."
echo 'Go out and drink some tea, this will take a while :) ...'
# Check ELF binaries in the PATH and specified dir trees.
for tree in $PATH $libdirs $extras
do
echo DIR $tree
for tree in $PATH $libdirs $extras; do
echo DIR $tree
# Get list of files in tree.
files=$(find $tree -type f ! -name '*.a' ! -name '*.la' ! -name '*.py*' ! -name '*.txt' ! -name '*.h' ! -name '*.ttf' ! -name '*.rb' ! -name '*.ko' ! -name '*.pc' ! -name '*.enc' ! -name '*.cf' ! -name '*.def' ! -name '*.rules' ! -name '*.cmi' ! -name '*.mli' ! -name '*.ml' ! -name '*.cma' ! -name '*.cmx' ! -name '*.cmxa' ! -name '*.pod' ! -name '*.pm' ! -name '*.pl' ! -name '*.al' ! -name '*.tcl' ! -name '*.bs' ! -name '*.o' ! -name '*.png' ! -name '*.gif' ! -name '*.cmo' ! -name '*.cgi' ! -name '*.defs' ! -name '*.conf' ! -name '*_LOCALE' ! -name 'Compose' ! -name '*_OBJS' ! -name '*.msg' ! -name '*.mcopclass' ! -name '*.mcoptype')
IFS=$ifs
for i in $files
do
if [ `file $i | grep -c 'ELF'` -ne 0 ]; then
# Is an ELF binary.
if [ `ldd $i 2>/dev/null | grep -c 'not found'` -ne 0 ]; then
# Missing lib.
echo "$i:" >> $TEMPDIR/raw.txt
ldd $i 2>/dev/null | grep 'not found' >> $TEMPDIR/raw.txt
fi
fi
done
# Get list of files in tree.
files=$(find $tree -type f ! -name '*.a' ! -name '*.la' ! -name '*.py*' ! -name '*.txt' ! -name '*.h' ! -name '*.ttf' ! \
-name '*.rb' ! -name '*.ko' ! -name '*.pc' ! -name '*.enc' ! -name '*.cf' ! -name '*.def' ! -name '*.rules' ! -name \
'*.cmi' ! -name '*.mli' ! -name '*.ml' ! -name '*.cma' ! -name '*.cmx' ! -name '*.cmxa' ! -name '*.pod' ! -name '*.pm' \
! -name '*.pl' ! -name '*.al' ! -name '*.tcl' ! -name '*.bs' ! -name '*.o' ! -name '*.png' ! -name '*.gif' ! -name '*.cmo' \
! -name '*.cgi' ! -name '*.defs' ! -name '*.conf' ! -name '*_LOCALE' ! -name 'Compose' ! -name '*_OBJS' ! -name '*.msg' ! \
-name '*.mcopclass' ! -name '*.mcoptype')
IFS=$ifs
for i in $files; do
if [ `file $i | grep -c 'ELF'` -ne 0 ]; then
# Is an ELF binary.
if [ `ldd $i 2>/dev/null | grep -c 'not found'` -ne 0 ]; then
# Missing lib.
echo "$i:" >> $TEMPDIR/raw.txt
ldd $i 2>/dev/null | grep 'not found' >> $TEMPDIR/raw.txt
fi
fi
done
done
grep '^/' $TEMPDIR/raw.txt | sed -e 's/://g' >> $TEMPDIR/affected-files.txt
# invoke pacman
for i in $(cat $TEMPDIR/affected-files.txt); do
pacman -Qo $i | awk '{print $4,$5}' >> $TEMPDIR/pacman.txt
pacman -Qo $i | awk '{print $4,$5}' >> $TEMPDIR/pacman.txt
done
# clean list
sort -u $TEMPDIR/pacman.txt >> $TEMPDIR/possible-rebuilds.txt
echo "Files saved to $TEMPDIR"
# vim:ft=sh:ts=4:sw=4:et:

View File

@@ -8,203 +8,185 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
FORCE="n"
RUN=""
MAKEPKG_ARGS="-sr"
REPACK=""
LAYER="rw"
FORCE='n'
RUN=''
MAKEPKG_ARGS='-sr'
REPACK=''
COPY='copy'
WORKDIR=$PWD
update_first="0"
clean_first="0"
install_pkg=""
update_first='0'
clean_first='0'
install_pkg=''
add_to_db=0
chrootdir=""
chrootdir=''
APPNAME=$(basename "${0}")
usage ()
{
echo "usage ${APPNAME} [options] -r <chrootdir> [--] [makepkg args]"
echo " Run this script in a PKGBUILD dir to build a package inside a"
echo " clean chroot. All unrecognized arguments passed to this script"
echo " will be passed to makepkg."
echo ""
echo " The chroot dir consists of the following directories:"
echo " <chrootdir>/{root, rw, union} but only 'root' is required"
echo " by default. The rest will be created as needed"
echo ""
echo "The chroot 'root' directory must be created via the following"
echo "command:"
echo " mkarchroot <chrootdir>/root base base-devel sudo"
echo ""
echo "Default makepkg args: $MAKEPKG_ARGS"
echo ""
echo "Flags:"
echo "-h This help"
echo "-c Clean the chroot before building"
echo "-u Update the rw layer of the chroot before building"
echo " This is useful for rebuilds without dirtying the pristine"
echo " chroot"
echo "-d Add the package to a local db at /repo after building"
echo "-r <dir> The chroot shell to use"
echo "-I <pkg> Install a package into the rw layer of the chroot"
echo "-l <layer> The directory to use as the rw layer of the union"
echo " Useful for maintain multiple layers. Default: rw"
exit 1
usage() {
echo "usage ${APPNAME} [options] -r <chrootdir> [--] [makepkg args]"
echo ' Run this script in a PKGBUILD dir to build a package inside a'
echo ' clean chroot. All unrecognized arguments passed to this script'
echo ' will be passed to makepkg.'
echo ''
echo ' The chroot dir consists of the following directories:'
echo ' <chrootdir>/{root, copy} but only "root" is required'
echo ' by default. The working copy will be created as needed'
echo ''
echo 'The chroot "root" directory must be created via the following'
echo 'command:'
echo ' mkarchroot <chrootdir>/root base base-devel sudo'
echo ''
echo "Default makepkg args: $MAKEPKG_ARGS"
echo ''
echo 'Flags:'
echo '-h This help'
echo '-c Clean the chroot before building'
echo '-u Update the working copy of the chroot before building'
echo ' This is useful for rebuilds without dirtying the pristine'
echo ' chroot'
echo '-d Add the package to a local db at /repo after building'
echo '-r <dir> The chroot dir to use'
echo '-I <pkg> Install a package into the working copy of the chroot'
echo '-l <copy> The directory to use as the working copy of the chroot'
echo ' Useful for maintain multiple copies Default: copy'
exit 1
}
while getopts 'hcudr:I:l:' arg; do
case "${arg}" in
h) usage ;;
c) clean_first=1 ;;
u) update_first=1 ;;
d) add_to_db=1 ;;
r) chrootdir="$OPTARG" ;;
I) install_pkg="$OPTARG" ;;
l) LAYER="$OPTARG" ;;
*) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;;
esac
case "${arg}" in
h) usage ;;
c) clean_first=1 ;;
u) update_first=1 ;;
d) add_to_db=1 ;;
r) chrootdir="$OPTARG" ;;
I) install_pkg="$OPTARG" ;;
l) COPY="$OPTARG" ;;
*) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;;
esac
done
#Get rid of trailing / in chrootdir
[ "$chrootdir" != "/" ] && chrootdir=$(echo $chrootdir | sed 's#/$##')
copydir="$chrootdir/$COPY"
# Pass all arguments after -- right to makepkg
MAKEPKG_ARGS="$MAKEPKG_ARGS ${*:$OPTIND}"
# See if -R was passed to makepkg
for arg in ${*:$OPTIND}; do
if [ "$arg" = "-R" ]; then
REPACK=1
break;
fi
if [ "$arg" = '-R' ]; then
REPACK=1
break;
fi
done
if [ "$EUID" != "0" ]; then
echo "This script must be run as root."
exit 1
if [ "$EUID" != '0' ]; then
echo 'This script must be run as root.'
exit 1
fi
if [ ! -f PKGBUILD ]; then
echo "This must be run in a directory containing a PKGBUILD."
exit 1
echo 'This must be run in a directory containing a PKGBUILD.'
exit 1
fi
source PKGBUILD
if [ ! -d "$chrootdir" ]; then
echo "No chroot dir defined, or invalid path '$chrootdir'"
exit 1
echo "No chroot dir defined, or invalid path '$chrootdir'"
exit 1
fi
if [ ! -d "$chrootdir/root" ]; then
echo "Missing chroot dir root directory."
echo "Try using: mkarchroot $chrootdir/root base base-devel sudo"
usage
echo 'Missing chroot dir root directory.'
echo "Try using: mkarchroot $chrootdir/root base base-devel sudo"
usage
fi
[ -d "$chrootdir/$LAYER" -a "$clean_first" -eq "1" ] && rm -rf "$chrootdir/$LAYER/"
[ -d "$chrootdir/$LAYER" ] || mkdir "$chrootdir/$LAYER"
[ -d "$chrootdir/union" ] || mkdir "$chrootdir/union"
cleanup ()
{
echo "cleaning up unioned mounts"
umount "$chrootdir/union"
}
uniondir="$chrootdir/union"
echo "building union chroot"
grep -Fq aufs /proc/filesystems
if [ $? -ne 0 ]; then
modprobe -q aufs
if [ $? -ne 0 ]; then
echo "ERROR: No aufs available. Abandon ship!" && exit 1
fi
umask 0022
if [ ! -d "$copydir" -o "$clean_first" -eq "1" ]; then
echo -n 'creating clean working copy...'
mkdir -p "$copydir"
rsync -a --delete -q -W -x "$chrootdir/root/" "$copydir"
echo 'done'
fi
mount -t aufs none -o "dirs=$chrootdir/$LAYER=rw:$chrootdir/root=ro" "$uniondir"
trap 'cleanup' 0 1 2 15
if [ -n "$install_pkg" ]; then
pkgname="$(basename "$install_pkg")"
echo "installing '$pkgname' in chroot"
cp "$install_pkg" "$uniondir/$pkgname"
mkarchroot -r "pacman -U /$pkgname" "$uniondir"
ret=$?
rm "$uniondir/$pkgname"
#exit early, we've done all we need to
exit $ret
pkgname="$(basename "$install_pkg")"
cp "$install_pkg" "$copydir/$pkgname"
mkarchroot -r "pacman -U /$pkgname" "$copydir"
ret=$?
rm "$copydir/$pkgname"
#exit early, we've done all we need to
exit $ret
fi
if [ $update_first -eq 1 ]; then
echo "updating chroot"
mkarchroot -r "pacman -Syu --noconfirm" "$uniondir"
mkarchroot -r 'pacman -Syu --noconfirm' "$copydir"
fi
echo "moving build files to chroot"
[ -d "$uniondir/build" ] || mkdir "$uniondir/build"
[ -d "$copydir/build" ] || mkdir "$copydir/build"
if [ "$REPACK" != "1" ]; then
#Remove anything in there UNLESS -R (repack) was passed to makepkg
rm -rf "$uniondir/build/"*
#Remove anything in there UNLESS -R (repack) was passed to makepkg
rm -rf "$copydir/build/"*
fi
[ -d "$uniondir/pkgdest" ] || mkdir "$uniondir/pkgdest"
if ! grep "PKGDEST=/pkgdest" "$uniondir/etc/makepkg.conf" >/dev/null 2>&1; then
echo "Setting PKGDEST in makepkg.conf"
echo "PKGDEST=/pkgdest" >> "$uniondir/etc/makepkg.conf"
# Get SRC/PKGDEST from makepkg.conf
if [ -f ~/.makepkg.conf ]; then
SRCDEST=$(grep '^SRCDEST=' ~/.makepkg.conf | cut -d= -f2)
PKGDEST=$(grep '^PKGDEST=' ~/.makepkg.conf | cut -d= -f2)
fi
[ -z ${SRCDEST} ] && SRCDEST=$(grep '^SRCDEST=' /etc/makepkg.conf | cut -d= -f2)
[ -z ${PKGDEST} ] && PKGDEST=$(grep '^PKGDEST=' /etc/makepkg.conf | cut -d= -f2)
[ -d "$copydir/pkgdest" ] || mkdir "$copydir/pkgdest"
if ! grep 'PKGDEST=/pkgdest' "$copydir/etc/makepkg.conf" >/dev/null 2>&1; then
echo 'PKGDEST=/pkgdest' >> "$copydir/etc/makepkg.conf"
fi
[ -d "$uniondir/srcdest" ] || mkdir "$uniondir/srcdest"
if ! grep "SRCDEST=/srcdest" "$uniondir/etc/makepkg.conf" >/dev/null 2>&1; then
echo "Setting SRCDEST in makepkg.conf"
echo "SRCDEST=/srcdest" >> "$uniondir/etc/makepkg.conf"
[ -d "$copydir/srcdest" ] || mkdir "$copydir/srcdest"
if ! grep 'SRCDEST=/srcdest' "$copydir/etc/makepkg.conf" >/dev/null 2>&1; then
echo 'SRCDEST=/srcdest' >> "$copydir/etc/makepkg.conf"
fi
chown -R nobody "$uniondir/build"
chown -R nobody "$uniondir/srcdest"
chown -R nobody "$uniondir/pkgdest"
# Set target CARCH as it might be used within the PKGBUILD to select correct sources
CARCH=$(eval $(grep '^CARCH=' "$copydir/etc/makepkg.conf"))
# Copy PKGBUILD and sources
source PKGBUILD
cp PKGBUILD "$uniondir/build/"
cp PKGBUILD "$copydir/build/"
for f in ${source[@]}; do
basef=$(echo $f | sed 's|::.*||' | sed 's|^.*://.*/||g')
if [ -f "$basef" ]; then
cp "$basef" "$uniondir/srcdest/"
elif [ -f "$SRCDEST/$basef" ]; then
cp "$SRCDEST/$basef" "$uniondir/srcdest/"
fi
basef=$(echo $f | sed 's|::.*||' | sed 's|^.*://.*/||g')
if [ -f "$basef" ]; then
cp "$basef" "$copydir/srcdest/"
elif [ -f "$SRCDEST/$basef" ]; then
cp "$SRCDEST/$basef" "$copydir/srcdest/"
fi
done
install_files=$(grep "install=" PKGBUILD)
for pkg in ${pkgname[@]}; do
install_files+=' '
install_files+=$(echo $install_files |sed "s/\$pkgname/$pkg/"|sed "s/\${pkgname}/$pkg/")
install_files=$(eval echo $install_files |tr '[:blank:]' '\n'|sort |uniq)
for i in 'changelog' 'install'; do
filelist=$(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
for file in $filelist; do
# evaluate any bash variables used
eval file=${file}
if [[ -f "$file" ]]; then
cp "$file" "$copydir/build/"
fi
done
done
for f in $install_files;do
install="${f#"install="}"
if [ "$install" != "" -a -f "$install" ]; then
cp "$install" "$uniondir/build/"
fi
done
chown -R nobody "$copydir/build"
chown -R nobody "$copydir/srcdest"
chown -R nobody "$copydir/pkgdest"
if [ -f "ChangeLog" ]; then
cp ChangeLog "$uniondir/build/"
fi
if ! grep "^nobody" "$uniondir/etc/sudoers" >/dev/null 2>&1; then
echo "allowing 'nobody' sudo rights in the chroot"
touch "$uniondir/etc/sudoers"
echo "nobody ALL=(ALL) NOPASSWD: ALL" >> "$uniondir/etc/sudoers"
chmod 440 "$uniondir/etc/sudoers"
if ! grep "^nobody" "$copydir/etc/sudoers" >/dev/null 2>&1; then
touch "$copydir/etc/sudoers"
echo 'nobody ALL=(ALL) NOPASSWD: ALL' >> "$copydir/etc/sudoers"
chmod 440 "$copydir/etc/sudoers"
fi
#This is a little gross, but this way the script is recreated every time in the
#rw portion of the union
#working copy
(cat <<EOF
#!/bin/bash
export LANG=$LOCALE
@@ -212,60 +194,51 @@ cd /build
export HOME=/build
sudo -u nobody makepkg $MAKEPKG_ARGS || touch BUILD_FAILED
[ -f BUILD_FAILED ] && exit 1
which namcap &>/dev/null && namcap /build/PKGBUILD /pkgdest/*${PKGEXT} > /pkgdest/namcap.log
which namcap &>/dev/null && namcap /build/PKGBUILD /pkgdest/*.pkg.tar.* > /build/namcap.log
exit 0
EOF
) > "$uniondir/chrootbuild"
chmod +x "$uniondir/chrootbuild"
) > "$copydir/chrootbuild"
chmod +x "$copydir/chrootbuild"
if mkarchroot -r "/chrootbuild" "$uniondir"; then
if mkarchroot -r "/chrootbuild" "$copydir"; then
for pkgfile in "${copydir}"/pkgdest/*.pkg.tar.*; do
[ -e "$pkgfile" ] || continue
if [ "$add_to_db" -eq "1" ]; then
mkdir -p "${copydir}/repo"
pushd "${copydir}/repo" >/dev/null
cp "$pkgfile" .
repo-add repo.db.tar.gz "$(basename "$pkgfile")"
popd >/dev/null
fi
# Source global makepkg.conf for SRCDEST and PKGDEST vars
[ -f /etc/makepkg.conf ] && source /etc/makepkg.conf
[ -f ~/.makepkg.conf ] && source ~/.makepkg.conf
if [ -d "$PKGDEST" ]; then
mv "$pkgfile" "${PKGDEST}"
else
mv "$pkgfile" "${WORKDIR}"
fi
done
for pkgfile in "${chrootdir}"/union/pkgdest/*${PKGEXT}; do
[ -e "$pkgfile" ] || continue
_pkgname=$(basename "$pkgfile")
if [ "$add_to_db" -eq "1" ]; then
[ -d "${chrootdir}/union/repo" ] || mkdir -p "${chrootdir}/union/repo"
pushd "${chrootdir}/union/repo" >/dev/null
cp "$pkgfile" .
repo-add repo.db.tar.${DB_COMPRESSION} "$_pkgname"
popd >/dev/null
fi
if [ -d "$PKGDEST" ]; then
echo "Moving completed ${_pkgname%${PKGEXT}} package file to ${PKGDEST}"
mv "$pkgfile" "${PKGDEST}"
else
echo "Moving completed ${_pkgname%${PKGEXT}} package file to ${WORKDIR}"
mv "$pkgfile" "${WORKDIR}"
fi
done
for f in "${chrootdir}"/union/srcdest/*; do
[ -e "$f" ] || continue
if [ -d "$SRCDEST" ]; then
echo "Moving downloaded source file $(basename $f) to ${SRCDEST}"
mv "$f" "${SRCDEST}"
else
echo "Moving downloaded source file $(basename $f) to ${WORKDIR}"
mv "$f" "${WORKDIR}"
fi
done
for l in "${copydir}"/build/{namcap,*-{build,package}}.log; do
[ -f "$l" ] && mv "$l" "${WORKDIR}"
done
else
#just in case. We returned 1, make sure we fail
touch "${chrootdir}/union/build/BUILD_FAILED"
#just in case. We returned 1, make sure we fail
touch "${copydir}/build/BUILD_FAILED"
fi
if [ -e "${chrootdir}/union/build/BUILD_FAILED" ]; then
echo "Build failed, check $chrootdir/$LAYER/build"
rm "${chrootdir}/union/build/BUILD_FAILED"
for f in "${copydir}"/srcdest/*; do
[ -e "$f" ] || continue
if [ -d "$SRCDEST" ]; then
mv "$f" "${SRCDEST}"
else
mv "$f" "${WORKDIR}"
fi
done
if [ -e "${copydir}/build/BUILD_FAILED" ]; then
echo "Build failed, check $copydir/build"
rm "${copydir}/build/BUILD_FAILED"
exit 1
else
rm -rf "${chrootdir}"/union/build/*
echo "Build complete"
fi
# vim:ft=sh:ts=4:sw=4:et:
rm -rf "${copydir}"/build/*
fi

View File

@@ -8,182 +8,176 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
FORCE="n"
RUN=""
NOCOPY="n"
FORCE='n'
RUN=''
NOCOPY='n'
working_dir=""
working_dir=''
APPNAME=$(basename "${0}")
# usage: usage <exitvalue>
usage ()
{
echo "usage ${APPNAME} [options] working-dir [package-list | app]"
echo " options:"
echo " -r <app> Run 'app' within the context of the chroot"
echo " -u Update the chroot via pacman"
echo " -f Force overwrite of files in the working-dir"
echo " -C <file> location of a pacman config file"
echo " -M <file> location of a makepkg config file"
echo " -n do not copy config files into the chroot"
echo " -h This message"
exit $1
usage() {
echo "usage ${APPNAME} [options] working-dir [package-list | app]"
echo ' options:'
echo ' -r <app> Run "app" within the context of the chroot'
echo ' -u Update the chroot via pacman'
echo ' -f Force overwrite of files in the working-dir'
echo ' -C <file> Location of a pacman config file'
echo ' -M <file> Location of a makepkg config file'
echo ' -n Do not copy config files into the chroot'
echo " -c <dir> Set pacman cache. Default: /var/cache/pacman/pkg"
echo ' -h This message'
exit $1
}
while getopts 'r:ufhC:M:' arg; do
case "${arg}" in
r) RUN="$OPTARG" ;;
u) RUN="pacman -Syu" ;;
f) FORCE="y" ;;
C) pac_conf="$OPTARG" ;;
M) makepkg_conf="$OPTARG" ;;
n) NOCOPY="y" ;;
h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;;
esac
while getopts 'r:ufnhC:M:c:' arg; do
case "${arg}" in
r) RUN="$OPTARG" ;;
u) RUN='pacman -Syu' ;;
f) FORCE='y' ;;
C) pac_conf="$OPTARG" ;;
M) makepkg_conf="$OPTARG" ;;
n) NOCOPY='y' ;;
c) cache_dir="$OPTARG" ;;
h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;;
esac
done
if [ "$EUID" != "0" ]; then
echo "error: this script must be run as root."
exit 1
if [ "$EUID" != '0' ]; then
echo 'error: this script must be run as root.'
exit 1
fi
shift $(($OPTIND - 1))
if [ "$RUN" = "" -a $# -lt 2 ]; then
echo "you must specify a directory and one or more packages"
usage 1
if [ "$RUN" = '' -a $# -lt 2 ]; then
echo 'you must specify a directory and one or more packages'
usage 1
elif [ $# -lt 1 ]; then
echo "you must specify a directory"
usage 1
echo 'you must specify a directory'
usage 1
fi
working_dir="$(readlink -f ${1})"
shift 1
[ "${working_dir}" = "" ] && echo "error: please specify a working directory" && usage 1
[ "${working_dir}" = '' ] && echo 'error: please specify a working directory' && usage 1
if [ -z "$cache_dir" ]; then
cache_conf=${working_dir}/etc/pacman.conf
[ ! -f $cache_conf ] && cache_conf=${pac_conf:-/etc/pacman.conf}
cache_dir=$((grep -m 1 '^CacheDir' $cache_conf || echo 'CacheDir = /var/cache/pacman/pkg') | sed 's/CacheDir\s*=\s*//')
unset cache_conf
fi
# {{{ functions
chroot_mount ()
{
echo "mounting sysfs : /sys"
[ -e "${working_dir}/sys" ] || mkdir "${working_dir}/sys"
mount -t sysfs sysfs "${working_dir}/sys"
chroot_mount() {
[ -e "${working_dir}/sys" ] || mkdir "${working_dir}/sys"
mount -t sysfs sysfs "${working_dir}/sys"
echo "mounting procfs : /proc"
[ -e "${working_dir}/proc" ] || mkdir "${working_dir}/proc"
mount -t proc proc "${working_dir}/proc"
[ -e "${working_dir}/proc" ] || mkdir "${working_dir}/proc"
mount -t proc proc "${working_dir}/proc"
echo "binding device nodes : /dev"
[ -e "${working_dir}/dev" ] || mkdir "${working_dir}/dev"
mount -o bind /dev "${working_dir}/dev"
[ -e "${working_dir}/dev" ] || mkdir "${working_dir}/dev"
mount -o bind /dev "${working_dir}/dev"
echo "binding pacman cache : /var/cache/pacman"
[ -e "${working_dir}/var/cache/pacman" ] || mkdir -p "${working_dir}/var/cache/pacman"
mount -o bind /var/cache/pacman "${working_dir}/var/cache/pacman"
[ -e "${working_dir}/dev/shm" ] || mkdir "${working_dir}/dev/shm"
mount -t tmpfs shm "${working_dir}/dev/shm"
trap 'chroot_umount' 0 1 2 15
[ -e "${working_dir}/dev/pts" ] || mkdir "${working_dir}/dev/pts"
mount -t devpts devpts "${working_dir}/dev/pts"
[ -e "${cache_dir}" ] || mkdir -p "${cache_dir}"
[ -e "${working_dir}/${cache_dir}" ] || mkdir -p "${working_dir}/${cache_dir}"
mount -o bind "${cache_dir}" "${working_dir}/${cache_dir}"
trap 'chroot_umount' 0 1 2 15
}
copy_hostconf ()
{
echo "copying mtab : /etc/mtab"
cp /etc/mtab "${working_dir}/etc/mtab"
echo "copying resolv.conf : /etc/resolv.conf"
cp /etc/resolv.conf "${working_dir}/etc/resolv.conf"
copy_hostconf () {
cp /etc/mtab "${working_dir}/etc/mtab"
cp /etc/resolv.conf "${working_dir}/etc/resolv.conf"
}
chroot_umount ()
{
echo "cleaning up mounts"
umount "${working_dir}/proc"
umount "${working_dir}/sys"
umount "${working_dir}/dev"
umount "${working_dir}/var/cache/pacman"
chroot_umount () {
umount "${working_dir}/proc"
umount "${working_dir}/sys"
umount "${working_dir}/dev/pts"
umount "${working_dir}/dev/shm"
umount "${working_dir}/dev"
umount "${working_dir}/${cache_dir}"
}
# }}}
umask 0022
if [ "$RUN" != "" ]; then
# run chroot {{{
#Sanity check
if [ ! -f "${working_dir}/.arch-chroot" ]; then
echo "error: '${working_dir}' does not appear to be a Arch chroot"
echo " please build the image using mkarchroot"
exit 1
fi
# run chroot {{{
#Sanity check
if [ ! -f "${working_dir}/.arch-chroot" ]; then
echo "error: '${working_dir}' does not appear to be a Arch chroot"
echo ' please build the image using mkarchroot'
exit 1
fi
chroot_mount
copy_hostconf
chroot_mount
copy_hostconf
echo "starting chroot ($RUN)"
chroot "${working_dir}" ${RUN}
chroot "${working_dir}" ${RUN}
# }}}
else
# {{{ build chroot
if [ -e "${working_dir}" -a "${FORCE}" = "n" ]; then
echo "error: working dir '${working_dir}' already exists - try using -f"
exit 1
fi
# }}}
else
# {{{ build chroot
if [ -e "${working_dir}" -a "${FORCE}" = "n" ]; then
echo "error: working dir '${working_dir}' already exists - try using -f"
exit 1
fi
mkdir -p "${working_dir}/var/lib/pacman/"
mkdir -p "${working_dir}/etc/"
mkdir -p "${working_dir}/var/lib/pacman/"
mkdir -p "${working_dir}/etc/"
chroot_mount
chroot_mount
pacargs="--noconfirm -v " #--noprogressbar -v
pacargs="$pacargs --root=${working_dir}"
# pacman takes these as relative to the given root
pacargs="$pacargs --cachedir=/var/cache/pacman/pkg"
if [ "$pac_conf" != "" ]; then
pacargs="$pacargs --config=${pac_conf}"
fi
pacargs='--noconfirm -v ' #--noprogressbar -v
pacargs="$pacargs --root=${working_dir}"
# pacman takes these as relative to the given root
pacargs="$pacargs --cachedir=${cache_dir}"
if [ "$pac_conf" != "" ]; then
pacargs="$pacargs --config=${pac_conf}"
fi
if [ $# -eq 0 ]; then
echo "no packages to install"
else
echo "installing packages:"
for i in $@; do echo -e "\t$i"; done
if [ $# -ne 0 ]; then
op='-Sy'
if [ "$FORCE" = "y" ]; then
op="${op}f"
fi
if ! pacman ${op} ${pacargs} $@; then
echo 'error: failed to install all packages'
exit 1
fi
fi
op="-Sy"
if [ "$FORCE" = "y" ]; then
op="${op}f"
fi
if ! pacman ${op} ${pacargs} $@; then
echo "error: failed to install all packages"
exit 1
fi
fi
if [ -d "${working_dir}/lib/modules" ]; then
ldconfig -r "${working_dir}"
fi
if [ -d "${working_dir}/lib/modules" ]; then
echo "running ldconfig"
ldconfig -r "${working_dir}"
fi
if [ "$pac_conf" != "" -a "$NOCOPY" = "n" ]; then
cp ${pac_conf} ${working_dir}/etc/pacman.conf
fi
if [ "$pac_conf" != "" -a "$NOCOPY" = "n" ]; then
echo "installing custom pacman.conf"
cp ${pac_conf} ${working_dir}/etc/pacman.conf
fi
if [ "$makepkg_conf" != "" -a "$NOCOPY" = "n" ]; then
cp ${makepkg_conf} ${working_dir}/etc/makepkg.conf
fi
if [ "$makepkg_conf" != "" -a "$NOCOPY" = "n" ]; then
echo "installing custom makepkg.conf"
cp ${makepkg_conf} ${working_dir}/etc/makepkg.conf
fi
if [ -e "${working_dir}/etc/locale.gen" ]; then
cp /etc/locale.gen "${working_dir}/etc/locale.gen"
chroot "${working_dir}" locale-gen
fi
if [ -e "${working_dir}/etc/locale.gen" ]; then
echo "generating default locales from host system"
cp /etc/locale.gen "${working_dir}/etc/locale.gen"
chroot "${working_dir}" locale-gen
fi
if [ ! -e "${working_dir}/.arch-chroot" ]; then
date +%s > "${working_dir}/.arch-chroot"
fi
# }}}
if [ ! -e "${working_dir}/.arch-chroot" ]; then
date +%s > "${working_dir}/.arch-chroot"
fi
# }}}
fi
# vim:ft=sh:ts=4:sw=4:et:

View File

@@ -10,48 +10,48 @@
# TODO make this work for community too
if [ $# -le 1 ]; then
echo "usage: $(basename $0) <chrootdir> <packages to rebuild>"
echo " example: $(basename $0) ~/chroot readline bash foo bar baz"
exit 1
echo "usage: $(basename $0) <chrootdir> <packages to rebuild>"
echo " example: $(basename $0) ~/chroot readline bash foo bar baz"
exit 1
fi
# Source makepkg.conf; fail if it is not found
if [ -r "/etc/makepkg.conf" ]; then
source "/etc/makepkg.conf"
if [ -r '/etc/makepkg.conf' ]; then
source '/etc/makepkg.conf'
else
echo "/etc/makepkg.conf not found!"
exit 1
echo '/etc/makepkg.conf not found!'
exit 1
fi
die () {
echo $@ >&2
exit 1
echo $@ >&2
exit 1
}
bump_pkgrel () {
# Get the current pkgrel from SVN and update the working copy with it
# This prevents us from incrementing out of control :)
pbuild=".svn/text-base/PKGBUILD.svn-base"
oldrel=$(grep "pkgrel=" $pbuild | cut -d= -f2)
bump_pkgrel() {
# Get the current pkgrel from SVN and update the working copy with it
# This prevents us from incrementing out of control :)
pbuild='.svn/text-base/PKGBUILD.svn-base'
oldrel=$(grep 'pkgrel=' $pbuild | cut -d= -f2)
#remove decimals
rel=$(echo $oldrel | cut -d. -f1)
newrel=$(($rel + 1))
#remove decimals
rel=$(echo $oldrel | cut -d. -f1)
sed -i "s/pkgrel=$oldrel/pkgrel=$newrel/" PKGBUILD
newrel=$(($rel + 1))
sed -i "s/pkgrel=$oldrel/pkgrel=$newrel/" PKGBUILD
}
pkg_from_pkgbuild () {
# we want the sourcing to be done in a subshell so we don't pollute our current namespace
export CARCH PKGEXT
(. PKGBUILD; echo "$pkgname-$pkgver-$pkgrel-$CARCH$PKGEXT")
pkg_from_pkgbuild() {
# we want the sourcing to be done in a subshell so we don't pollute our current namespace
export CARCH PKGEXT
(source PKGBUILD; echo "$pkgname-$pkgver-$pkgrel-$CARCH$PKGEXT")
}
chrootdir="$1"; shift
pkgs="$@"
SVNPATH="svn+ssh://gerolde.archlinux.org/srv/svn-packages"
SVNPATH='svn+ssh://gerolde.archlinux.org/srv/svn-packages'
echo ":: Work will be done in $(pwd)/rebuilds"
@@ -63,39 +63,39 @@ cd "$REBUILD_ROOT"
FAILED=""
for pkg in $pkgs; do
cd "$REBUILD_ROOT/svn-packages"
cd "$REBUILD_ROOT/svn-packages"
echo ":: Building '$pkg'"
/usr/bin/svn update "$pkg"
if [ ! -d "$pkg/trunk" ]; then
FAILED="$FAILED $pkg"
echo ":: $pkg does not exist in SVN"
continue
fi
cd "$pkg/trunk/"
echo ":: Building '$pkg'"
/usr/bin/svn update "$pkg"
if [ ! -d "$pkg/trunk" ]; then
FAILED="$FAILED $pkg"
echo ":: $pkg does not exist in SVN"
continue
fi
cd "$pkg/trunk/"
bump_pkgrel
bump_pkgrel
if ! sudo makechrootpkg -u -d -r "$chrootdir" -- --noconfirm; then
FAILED="$FAILED $pkg"
echo ":: $pkg Failed!"
else
pkgfile=$(pkg_from_pkgbuild)
if [ -e "$pkgfile" ]; then
echo ":: $pkg Complete"
else
FAILED="$FAILED $pkg"
echo ":: $pkg Failed, no package built!"
fi
fi
if ! sudo makechrootpkg -u -d -r "$chrootdir" -- --noconfirm; then
FAILED="$FAILED $pkg"
echo ":: $pkg Failed!"
else
pkgfile=$(pkg_from_pkgbuild)
if [ -e "$pkgfile" ]; then
echo ":: $pkg Complete"
else
FAILED="$FAILED $pkg"
echo ":: $pkg Failed, no package built!"
fi
fi
done
cd "$REBUILD_ROOT"
if [ "$FAILED" != "" ]; then
echo "Packages failed:"
for pkg in $FAILED; do
echo -e "\t$pkg"
done
echo 'Packages failed:'
for pkg in $FAILED; do
echo -e "\t$pkg"
done
fi
echo "SVN pkgbumps in svn-packages/ - commit when ready"
echo 'SVN pkgbumps in svn-packages/ - commit when ready'