mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-13 18:06:19 +02:00
Compare commits
33 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
563ffa7be8 | ||
![]() |
f01097f22c | ||
![]() |
ad593b8b61 | ||
![]() |
e23c94675e | ||
![]() |
96a11523e5 | ||
![]() |
bdde6e5a35 | ||
![]() |
38f85d654a | ||
![]() |
2ed8ef1185 | ||
![]() |
aa06caf31c | ||
![]() |
08a68bb4a0 | ||
![]() |
3bc5f6b5c9 | ||
![]() |
2fa8fdec47 | ||
![]() |
0af05a48ab | ||
![]() |
174ff59dba | ||
![]() |
5434d3991c | ||
![]() |
36dc5d8792 | ||
![]() |
96f22cfede | ||
![]() |
8b9733661d | ||
![]() |
dbdb237519 | ||
![]() |
2ff5c45d14 | ||
![]() |
80168e7e1c | ||
![]() |
f72297a639 | ||
![]() |
ba7cc139c4 | ||
![]() |
3491ea5d79 | ||
![]() |
d1304a3f1d | ||
![]() |
bcf8cd7eb1 | ||
![]() |
95afa2e495 | ||
![]() |
1094111559 | ||
![]() |
62860de113 | ||
![]() |
14ba11dcdf | ||
![]() |
be5505a54a | ||
![]() |
d09d34d77a | ||
![]() |
5815d639f3 |
143
Makefile
143
Makefile
@@ -1,90 +1,71 @@
|
||||
V=0.9.15
|
||||
V=0.9.19
|
||||
|
||||
BINPROGS = \
|
||||
checkpkg \
|
||||
commitpkg \
|
||||
archco \
|
||||
communityco \
|
||||
archrelease \
|
||||
archrm \
|
||||
archbuild \
|
||||
lddd \
|
||||
finddeps \
|
||||
rebuildpkgs
|
||||
|
||||
SBINPROGS = \
|
||||
mkarchroot \
|
||||
makechrootpkg
|
||||
|
||||
CONFIGFILES = \
|
||||
makepkg-i686.conf \
|
||||
makepkg-x86_64.conf \
|
||||
pacman-extra.conf \
|
||||
pacman-testing.conf \
|
||||
pacman-staging.conf \
|
||||
pacman-multilib.conf \
|
||||
pacman-multilib-testing.conf
|
||||
|
||||
COMMITPKG_LINKS = \
|
||||
extrapkg \
|
||||
corepkg \
|
||||
testingpkg \
|
||||
stagingpkg \
|
||||
communitypkg \
|
||||
community-testingpkg \
|
||||
community-stagingpkg \
|
||||
multilibpkg \
|
||||
multilib-testingpkg
|
||||
|
||||
ARCHBUILD_LINKS = \
|
||||
extra-i686-build \
|
||||
extra-x86_64-build \
|
||||
testing-i686-build \
|
||||
testing-x86_64-build \
|
||||
staging-i686-build \
|
||||
staging-x86_64-build \
|
||||
multilib-build \
|
||||
multilib-testing-build
|
||||
|
||||
all:
|
||||
|
||||
install:
|
||||
# commitpkg/checkpkg and friends
|
||||
install -d -m755 $(DESTDIR)/usr/bin
|
||||
install -m 755 checkpkg $(DESTDIR)/usr/bin
|
||||
install -m 755 commitpkg $(DESTDIR)/usr/bin
|
||||
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
|
||||
ln -sf commitpkg $(DESTDIR)/usr/bin/community-stagingpkg
|
||||
ln -sf commitpkg $(DESTDIR)/usr/bin/multilibpkg
|
||||
ln -sf commitpkg $(DESTDIR)/usr/bin/multilib-testingpkg
|
||||
# arch{co,release,rm}
|
||||
install -m 755 archco $(DESTDIR)/usr/bin
|
||||
install -m 755 communityco $(DESTDIR)/usr/bin
|
||||
install -m 755 archrelease $(DESTDIR)/usr/bin
|
||||
install -m 755 archrm $(DESTDIR)/usr/bin
|
||||
# new chroot tools, only usable by root
|
||||
install -d -m 755 $(DESTDIR)/usr/sbin
|
||||
install -m 755 mkarchroot $(DESTDIR)/usr/sbin
|
||||
install -m 755 makechrootpkg $(DESTDIR)/usr/sbin
|
||||
install -m 755 archbuild $(DESTDIR)/usr/bin
|
||||
ln -sf archbuild $(DESTDIR)/usr/bin/extra-i686-build
|
||||
ln -sf archbuild $(DESTDIR)/usr/bin/extra-x86_64-build
|
||||
ln -sf archbuild $(DESTDIR)/usr/bin/testing-i686-build
|
||||
ln -sf archbuild $(DESTDIR)/usr/bin/testing-x86_64-build
|
||||
ln -sf archbuild $(DESTDIR)/usr/bin/staging-i686-build
|
||||
ln -sf archbuild $(DESTDIR)/usr/bin/staging-x86_64-build
|
||||
ln -sf archbuild $(DESTDIR)/usr/bin/multilib-build
|
||||
ln -sf archbuild $(DESTDIR)/usr/bin/multilib-testing-build
|
||||
# Additional packaging helper scripts
|
||||
install -m 755 lddd $(DESTDIR)/usr/bin
|
||||
install -m 755 finddeps $(DESTDIR)/usr/bin
|
||||
install -m 755 rebuildpkgs $(DESTDIR)/usr/bin
|
||||
# install default config
|
||||
install -d -m755 $(DESTDIR)/usr/share/devtools
|
||||
install -m 644 makepkg-i686.conf $(DESTDIR)/usr/share/devtools
|
||||
install -m 644 makepkg-x86_64.conf $(DESTDIR)/usr/share/devtools
|
||||
install -m 644 pacman-extra.conf $(DESTDIR)/usr/share/devtools
|
||||
install -m 644 pacman-testing.conf $(DESTDIR)/usr/share/devtools
|
||||
install -m 644 pacman-staging.conf $(DESTDIR)/usr/share/devtools
|
||||
install -m 644 pacman-multilib.conf $(DESTDIR)/usr/share/devtools
|
||||
install -m 644 pacman-multilib-testing.conf $(DESTDIR)/usr/share/devtools
|
||||
install -dm0755 $(DESTDIR)/usr/bin
|
||||
install -dm0755 $(DESTDIR)/usr/sbin
|
||||
install -dm0755 $(DESTDIR)/usr/share/devtools
|
||||
install -m0755 ${BINPROGS} $(DESTDIR)/usr/bin
|
||||
install -m0755 ${SBINPROGS} $(DESTDIR)/usr/sbin
|
||||
install -m0644 ${CONFIGFILES} $(DESTDIR)/usr/share/devtools
|
||||
for l in ${COMMITPKG_LINKS}; do ln -sf commitpkg $(DESTDIR)/usr/bin/$$l; done
|
||||
for l in ${ARCHBUILD_LINKS}; do ln -sf archbuild $(DESTDIR)/usr/bin/$$l; done
|
||||
|
||||
uninstall:
|
||||
# remove all files we installed
|
||||
rm $(DESTDIR)/usr/bin/checkpkg
|
||||
rm $(DESTDIR)/usr/bin/commitpkg
|
||||
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/bin/community-stagingpkg
|
||||
rm $(DESTDIR)/usr/bin/multilibpkg
|
||||
rm $(DESTDIR)/usr/bin/multilib-testingpkg
|
||||
rm $(DESTDIR)/usr/sbin/mkarchroot
|
||||
rm $(DESTDIR)/usr/sbin/makechrootpkg
|
||||
rm $(DESTDIR)/usr/bin/extra-i686-build
|
||||
rm $(DESTDIR)/usr/bin/extra-x86_64-build
|
||||
rm $(DESTDIR)/usr/bin/testing-i686-build
|
||||
rm $(DESTDIR)/usr/bin/testing-x86_64-build
|
||||
rm $(DESTDIR)/usr/bin/staging-i686-build
|
||||
rm $(DESTDIR)/usr/bin/staging-x86_64-build
|
||||
rm $(DESTDIR)/usr/bin/multilib-build
|
||||
rm $(DESTDIR)/usr/bin/multilib-testing-build
|
||||
rm $(DESTDIR)/usr/bin/lddd
|
||||
rm $(DESTDIR)/usr/bin/finddeps
|
||||
rm $(DESTDIR)/usr/bin/archco
|
||||
rm $(DESTDIR)/usr/bin/archrelease
|
||||
rm $(DESTDIR)/usr/bin/archrm
|
||||
rm $(DESTDIR)/usr/bin/communityco
|
||||
rm $(DESTDIR)/usr/bin/rebuildpkgs
|
||||
rm $(DESTDIR)/usr/share/devtools/makepkg-i686.conf
|
||||
rm $(DESTDIR)/usr/share/devtools/makepkg-x86_64.conf
|
||||
rm $(DESTDIR)/usr/share/devtools/pacman-extra.conf
|
||||
rm $(DESTDIR)/usr/share/devtools/pacman-testing.conf
|
||||
rm $(DESTDIR)/usr/share/devtools/pacman-staging.conf
|
||||
rm $(DESTDIR)/usr/share/devtools/pacman-multilib.conf
|
||||
rm $(DESTDIR)/usr/share/devtools/pacman-multilib-testing.conf
|
||||
for f in ${BINPROGS}; do rm -f $(DESTDIR)/usr/bin/$$f; done
|
||||
for f in ${SBINPROGS}; do rm -f $(DESTDIR)/usr/sbin/$$f; done
|
||||
for f in ${CONFIGFILES}; do rm -f $(DESTDIR)/usr/share/devtools/$$f; done
|
||||
for l in ${COMMITPKG_LINKS}; do rm -f $(DESTDIR)/usr/bin/$$l; done
|
||||
for l in ${ARCHBUILD_LINKS}; do rm -f $(DESTDIR)/usr/bin/$$l; done
|
||||
|
||||
dist:
|
||||
git archive --format=tar --prefix=devtools-$(V)/ $(V) | gzip -9 > devtools-$(V).tar.gz
|
||||
|
||||
.PHONY: all install uninstall dist
|
||||
|
31
archbuild
31
archbuild
@@ -6,7 +6,7 @@ cmd="$(basename "${0%-build}")"
|
||||
if [ "${cmd%-*}" == 'multilib' ]; then
|
||||
repo="${cmd}"
|
||||
arch='x86_64'
|
||||
base_packages+=' gcc-multilib libtool-multilib'
|
||||
base_packages+=' multilib-devel'
|
||||
else
|
||||
repo=${cmd%-*}
|
||||
arch=${cmd##*-}
|
||||
@@ -29,20 +29,39 @@ while getopts 'cr:' arg; do
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$EUID" != '0' ]; then
|
||||
echo 'This script must be run as root.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ${clean_first} || [ ! -d "${chroots}/${repo}-${arch}" ]; then
|
||||
echo "Creating chroot for [${repo}] (${arch})..."
|
||||
sudo rm -rf ${chroots}/${repo}-${arch}
|
||||
sudo mkdir -p ${chroots}/${repo}-${arch}
|
||||
setarch ${arch} sudo mkarchroot \
|
||||
|
||||
for copy in ${chroots}/${repo}-${arch}/*; do
|
||||
[[ -d $copy ]] || continue
|
||||
echo "Deleting chroot copy '$(basename "${copy}")'..."
|
||||
|
||||
# Lock the copy
|
||||
exec 9>${copy}.lock
|
||||
flock 9
|
||||
|
||||
{ type -P btrfs && btrfs subvolume delete ${copy}; } &>/dev/null
|
||||
rm -rf ${copy}
|
||||
done
|
||||
exec 9>&-
|
||||
|
||||
rm -rf ${chroots}/${repo}-${arch}
|
||||
mkdir -p ${chroots}/${repo}-${arch}
|
||||
setarch ${arch} mkarchroot \
|
||||
-C /usr/share/devtools/pacman-${repo}.conf \
|
||||
-M /usr/share/devtools/makepkg-${arch}.conf \
|
||||
${chroots}/${repo}-${arch}/root \
|
||||
${base_packages}
|
||||
else
|
||||
setarch ${arch} sudo mkarchroot \
|
||||
setarch ${arch} mkarchroot \
|
||||
-u \
|
||||
${chroots}/${repo}-${arch}/root
|
||||
fi
|
||||
|
||||
echo "Building in chroot for [${repo}] (${arch})..."
|
||||
setarch ${arch} sudo makechrootpkg -c -r ${chroots}/${repo}-${arch}
|
||||
setarch ${arch} makechrootpkg -c -r ${chroots}/${repo}-${arch}
|
||||
|
@@ -13,7 +13,9 @@ if [ ! -f PKGBUILD ]; then
|
||||
abort 'archrelease: PKGBUILD not found'
|
||||
fi
|
||||
|
||||
if [ "$(basename $(readlink -f .))" != 'trunk' ]; then
|
||||
trunk=$(basename $(pwd))
|
||||
|
||||
if [ "$(basename $(dirname $(pwd)))" == "repos" ]; then
|
||||
abort 'archrelease: Not in a package trunk dir'
|
||||
fi
|
||||
|
||||
@@ -27,7 +29,7 @@ if [ -d "repos/${1}" ]; then
|
||||
svn rm --force -q "repos/${1}"
|
||||
svn commit -q -m "archrelease: remove ${1}" || abort
|
||||
fi
|
||||
svn copy -q -r HEAD trunk "repos/${1}"
|
||||
svn commit -q -m "archrelease: copy trunk to ${1}" || abort
|
||||
svn copy -q -r HEAD "${trunk}" "repos/${1}"
|
||||
svn commit -q -m "archrelease: copy ${trunk} to ${1}" || abort
|
||||
popd >/dev/null
|
||||
echo 'done'
|
||||
|
5
checkpkg
5
checkpkg
@@ -69,6 +69,8 @@ for _pkgname in ${pkgname[@]}; do
|
||||
cp `echo $pkgurl | sed 's#^file://##'` .
|
||||
elif [ -f $PKGDEST/$oldpkg ]; then
|
||||
cp $PKGDEST/$oldpkg .
|
||||
elif [ -f $STARTDIR/$oldpkg ]; then
|
||||
cp $STARTDIR/$oldpkg .
|
||||
else
|
||||
wget --quiet $pkgurl
|
||||
fi
|
||||
@@ -80,7 +82,7 @@ for _pkgname in ${pkgname[@]}; do
|
||||
sort -o filelist-$_pkgname filelist-$_pkgname
|
||||
sort -o filelist-$_pkgname-old filelist-$_pkgname-old
|
||||
|
||||
diff -u filelist-$_pkgname-old filelist-$_pkgname
|
||||
sdiff -s filelist-$_pkgname-old filelist-$_pkgname
|
||||
|
||||
if diff filelist-$_pkgname-old filelist-$_pkgname | grep '\.so' > /dev/null 2>&1; then
|
||||
mkdir -p pkg
|
||||
@@ -90,6 +92,7 @@ for _pkgname in ${pkgname[@]}; do
|
||||
echo -n "${i}: "
|
||||
objdump -p $i | grep SONAME
|
||||
done
|
||||
cd ..
|
||||
else
|
||||
echo "No soname differences for $_pkgname."
|
||||
fi
|
||||
|
38
commitpkg
38
commitpkg
@@ -17,6 +17,19 @@ getpkgfile() {
|
||||
echo ${1}
|
||||
}
|
||||
|
||||
##
|
||||
# usage : get_full_version( $epoch, $pkgver, $pkgrel )
|
||||
# return : full version spec, including epoch (if necessary), pkgver, pkgrel
|
||||
##
|
||||
get_full_version() {
|
||||
if [[ $1 -eq 0 ]]; then
|
||||
# zero epoch case, don't include it in version
|
||||
echo $2-$3
|
||||
else
|
||||
echo $1:$2-$3
|
||||
fi
|
||||
}
|
||||
|
||||
# Source makepkg.conf; fail if it is not found
|
||||
if [ -r '/etc/makepkg.conf' ]; then
|
||||
source '/etc/makepkg.conf'
|
||||
@@ -72,23 +85,23 @@ else
|
||||
fi
|
||||
|
||||
# check if all local source files are under version control
|
||||
(for s in ${source[@]}; do
|
||||
echo $s | grep -vq '://' && \
|
||||
svn status $s | grep -q '?' && \
|
||||
for s in ${source[@]}; do
|
||||
echo $s | grep -Fvq '://' && \
|
||||
svn status $s | grep -q '^\?' && \
|
||||
abort "$s is not under version control"
|
||||
done) || true
|
||||
done
|
||||
|
||||
# check if changelog and install files are under version control
|
||||
(for i in 'changelog' 'install'; do
|
||||
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
|
||||
if svn status ${file} | grep -q '^\?'; then
|
||||
abort "${file} is not under version control"
|
||||
fi
|
||||
done
|
||||
done) || true
|
||||
done
|
||||
|
||||
# see if any limit options were passed, we'll send them to rsync
|
||||
unset rsyncopts
|
||||
@@ -108,12 +121,15 @@ echo 'done'
|
||||
|
||||
for _arch in ${arch[@]}; do
|
||||
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)
|
||||
fullver=$(get_full_version ${epoch:-0} $pkgver $pkgrel)
|
||||
pkgfile=$(getpkgfile "$_pkgname-$fullver-${_arch}".pkg.tar.?z 2>/dev/null)
|
||||
pkgdestfile=$(getpkgfile "$PKGDEST/$_pkgname-$fullver-${_arch}".pkg.tar.?z 2>/dev/null)
|
||||
|
||||
if [ ! -f "$pkgfile" -a -f "$pkgdestfile" ]; then
|
||||
if [ -f "$pkgfile" ]; then
|
||||
pkgfile="./$pkgfile"
|
||||
elif [ -f "$pkgdestfile" ]; then
|
||||
pkgfile="$pkgdestfile"
|
||||
elif [ ! -f "$pkgfile" ]; then
|
||||
else
|
||||
echo "skipping ${_arch}"
|
||||
continue 2
|
||||
fi
|
||||
|
11
finddeps
11
finddeps
@@ -21,19 +21,26 @@ for d in $(find . -type d); do
|
||||
unset pkgname depends makedepends
|
||||
. PKGBUILD
|
||||
for dep in "${depends[@]}"; do
|
||||
# lose the version comaparator, if any
|
||||
# lose the version comparator, if any
|
||||
depname=${dep%%[<>=]*}
|
||||
if [ "$depname" = "$match" ]; then
|
||||
echo "$d (depends)"
|
||||
fi
|
||||
done
|
||||
for dep in "${makedepends[@]}"; do
|
||||
# lose the version comaparator, if any
|
||||
# lose the version comparator, if any
|
||||
depname=${dep%%[<>=]*}
|
||||
if [ "$depname" = "$match" ]; then
|
||||
echo "$d (makedepends)"
|
||||
fi
|
||||
done
|
||||
for dep in "${optdepends[@]/:*}"; do
|
||||
# lose the version comaparator, if any
|
||||
depname=${dep%%[<>=]*}
|
||||
if [ "$depname" = "$match" ]; then
|
||||
echo "$d (optdepends)"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
cd $tld
|
||||
done
|
||||
|
@@ -12,7 +12,6 @@ FORCE='n'
|
||||
RUN=''
|
||||
MAKEPKG_ARGS='-s --noconfirm'
|
||||
REPACK=''
|
||||
COPY='copy'
|
||||
WORKDIR=$PWD
|
||||
|
||||
update_first='0'
|
||||
@@ -24,6 +23,10 @@ chrootdir=''
|
||||
|
||||
APPNAME=$(basename "${0}")
|
||||
|
||||
default_copy=$USER
|
||||
[[ -n $SUDO_USER ]] && default_copy=$SUDO_USER
|
||||
[[ -z $default_copy || $default_copy = root ]] && default_copy=copy
|
||||
|
||||
usage() {
|
||||
echo "usage ${APPNAME} [options] -r <chrootdir> [--] [makepkg args]"
|
||||
echo ' Run this script in a PKGBUILD dir to build a package inside a'
|
||||
@@ -50,7 +53,8 @@ usage() {
|
||||
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'
|
||||
echo ' Useful for maintaining multiple copies.'
|
||||
echo " Default: $default_copy"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -62,14 +66,16 @@ while getopts 'hcudr:I:l:' arg; do
|
||||
d) add_to_db=1 ;;
|
||||
r) chrootdir="$OPTARG" ;;
|
||||
I) install_pkg="$OPTARG" ;;
|
||||
l) COPY="$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"
|
||||
# Canonicalize chrootdir, getting rid of trailing /
|
||||
chrootdir=$(readlink -e "$chrootdir")
|
||||
|
||||
[[ -z $copy ]] && copy=$default_copy
|
||||
copydir="$chrootdir/$copy"
|
||||
|
||||
# Pass all arguments after -- right to makepkg
|
||||
MAKEPKG_ARGS="$MAKEPKG_ARGS ${*:$OPTIND}"
|
||||
@@ -104,11 +110,44 @@ if [ ! -d "$chrootdir/root" ]; then
|
||||
fi
|
||||
|
||||
umask 0022
|
||||
|
||||
# Lock the chroot we want to use. We'll keep this lock until we exit.
|
||||
# Note this is the same FD number as in mkarchroot
|
||||
exec 9>"$copydir.lock"
|
||||
if ! flock -n 9; then
|
||||
echo -n "locking chroot copy '$copy'..."
|
||||
flock 9
|
||||
echo "done"
|
||||
fi
|
||||
|
||||
if [ ! -d "$copydir" -o "$clean_first" -eq "1" ]; then
|
||||
# Get a read lock on the root chroot to make
|
||||
# sure we don't clone a half-updated chroot
|
||||
exec 8>"$chrootdir/root.lock"
|
||||
|
||||
if ! flock -sn 8; then
|
||||
echo -n "locking clean chroot..."
|
||||
flock -s 8
|
||||
echo "done"
|
||||
fi
|
||||
|
||||
echo -n 'creating clean working copy...'
|
||||
use_rsync=false
|
||||
if type -P btrfs >/dev/null; then
|
||||
[ -d $copydir ] && btrfs subvolume delete "$copydir" &>/dev/null
|
||||
btrfs subvolume snapshot "$chrootdir/root" "$copydir" &>/dev/null || use_rsync=true
|
||||
else
|
||||
use_rsync=true
|
||||
fi
|
||||
|
||||
if $use_rsync; then
|
||||
mkdir -p "$copydir"
|
||||
rsync -a --delete -q -W -x "$chrootdir/root/" "$copydir"
|
||||
fi
|
||||
echo 'done'
|
||||
|
||||
# Drop the read lock again
|
||||
exec 8>&-
|
||||
fi
|
||||
|
||||
if [ -n "$install_pkg" ]; then
|
||||
@@ -160,9 +199,15 @@ if ! grep 'SRCDEST="/srcdest"' "$copydir/etc/makepkg.conf" >/dev/null 2>&1; then
|
||||
echo 'SRCDEST="/srcdest"' >> "$copydir/etc/makepkg.conf"
|
||||
fi
|
||||
[ -z "${MAKEFLAGS}" ] && eval $(grep '^MAKEFLAGS=' /etc/makepkg.conf)
|
||||
[ -n "${MAKEFLAGS}" ] && echo "MAKEFLAGS='${MAKEFLAGS}'" >> "$copydir/etc/makepkg.conf"
|
||||
if [ -n "${MAKEFLAGS}" ]; then
|
||||
sed -i '/^MAKEFLAGS=/d' "$copydir/etc/makepkg.conf"
|
||||
echo "MAKEFLAGS='${MAKEFLAGS}'" >> "$copydir/etc/makepkg.conf"
|
||||
fi
|
||||
[ -z "${PACKAGER}" ] && eval $(grep '^PACKAGER=' /etc/makepkg.conf)
|
||||
[ -n "${PACKAGER}" ] && echo "PACKAGER='${PACKAGER}'" >> "$copydir/etc/makepkg.conf"
|
||||
if [ -n "${PACKAGER}" ]; then
|
||||
sed -i '/^PACKAGER=/d' "$copydir/etc/makepkg.conf"
|
||||
echo "PACKAGER='${PACKAGER}'" >> "$copydir/etc/makepkg.conf"
|
||||
fi
|
||||
|
||||
# Set target CARCH as it might be used within the PKGBUILD to select correct sources
|
||||
eval $(grep '^CARCH=' "$copydir/etc/makepkg.conf")
|
||||
@@ -232,7 +277,7 @@ if mkarchroot -r "/chrootbuild" "$copydir"; then
|
||||
fi
|
||||
done
|
||||
|
||||
for l in "${copydir}"/build/{namcap,*-{build,package}}.log; do
|
||||
for l in "${copydir}"/build/{namcap,*-{build,package,package_*}}.log; do
|
||||
[ -f "$l" ] && mv "$l" "${WORKDIR}"
|
||||
done
|
||||
else
|
||||
|
@@ -39,15 +39,16 @@ LDFLAGS="-Wl,--hash-style=gnu -Wl,--as-needed"
|
||||
# BUILD ENVIRONMENT
|
||||
#########################################################################
|
||||
#
|
||||
# Defaults: BUILDENV=(fakeroot !distcc color !ccache)
|
||||
# Defaults: BUILDENV=(fakeroot !distcc color !ccache check)
|
||||
# A negated environment option will do the opposite of the comments below.
|
||||
#
|
||||
#-- fakeroot: Allow building packages as a non-root user
|
||||
#-- distcc: Use the Distributed C/C++/ObjC compiler
|
||||
#-- color: Colorize output messages
|
||||
#-- ccache: Use ccache to cache compilation
|
||||
#-- check: Run the check() function if present in the PKGBUILD
|
||||
#
|
||||
BUILDENV=(fakeroot !distcc color !ccache)
|
||||
BUILDENV=(fakeroot !distcc color !ccache check)
|
||||
#
|
||||
#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
|
||||
#-- specify a space-delimited list of hosts running in the DistCC cluster.
|
||||
@@ -61,7 +62,7 @@ BUILDENV=(fakeroot !distcc color !ccache)
|
||||
# Default: OPTIONS=(strip docs libtool emptydirs zipman purge)
|
||||
# A negated option will do the opposite of the comments below.
|
||||
#
|
||||
#-- strip: Strip symbols from binaries/libraries in STRIP_DIRS
|
||||
#-- strip: Strip symbols from binaries/libraries
|
||||
#-- docs: Save doc directories specified by DOC_DIRS
|
||||
#-- libtool: Leave libtool (.la) files in packages
|
||||
#-- emptydirs: Leave empty directories in packages
|
||||
@@ -82,8 +83,6 @@ STRIP_STATIC="--strip-debug"
|
||||
MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
|
||||
#-- Doc directories to remove (if !docs is specified)
|
||||
DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
|
||||
#-- Directories to be searched for the strip option (if strip is specified)
|
||||
STRIP_DIRS=(bin lib sbin usr/{bin,lib,sbin,local/{bin,lib,sbin}} opt/*/{bin,lib,sbin})
|
||||
#-- Files to be removed from all packages (if purge is specified)
|
||||
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
|
||||
|
||||
|
@@ -39,15 +39,16 @@ LDFLAGS="-Wl,--hash-style=gnu -Wl,--as-needed"
|
||||
# BUILD ENVIRONMENT
|
||||
#########################################################################
|
||||
#
|
||||
# Defaults: BUILDENV=(fakeroot !distcc color !ccache)
|
||||
# Defaults: BUILDENV=(fakeroot !distcc color !ccache check)
|
||||
# A negated environment option will do the opposite of the comments below.
|
||||
#
|
||||
#-- fakeroot: Allow building packages as a non-root user
|
||||
#-- distcc: Use the Distributed C/C++/ObjC compiler
|
||||
#-- color: Colorize output messages
|
||||
#-- ccache: Use ccache to cache compilation
|
||||
#-- check: Run the check() function if present in the PKGBUILD
|
||||
#
|
||||
BUILDENV=(fakeroot !distcc color !ccache)
|
||||
BUILDENV=(fakeroot !distcc color !ccache check)
|
||||
#
|
||||
#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
|
||||
#-- specify a space-delimited list of hosts running in the DistCC cluster.
|
||||
@@ -61,7 +62,7 @@ BUILDENV=(fakeroot !distcc color !ccache)
|
||||
# Default: OPTIONS=(strip docs libtool emptydirs zipman purge)
|
||||
# A negated option will do the opposite of the comments below.
|
||||
#
|
||||
#-- strip: Strip symbols from binaries/libraries in STRIP_DIRS
|
||||
#-- strip: Strip symbols from binaries/libraries
|
||||
#-- docs: Save doc directories specified by DOC_DIRS
|
||||
#-- libtool: Leave libtool (.la) files in packages
|
||||
#-- emptydirs: Leave empty directories in packages
|
||||
@@ -82,8 +83,6 @@ STRIP_STATIC="--strip-debug"
|
||||
MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
|
||||
#-- Doc directories to remove (if !docs is specified)
|
||||
DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
|
||||
#-- Directories to be searched for the strip option (if strip is specified)
|
||||
STRIP_DIRS=(bin lib sbin usr/{bin,lib,sbin,local/{bin,lib,sbin}} opt/*/{bin,lib,sbin})
|
||||
#-- Files to be removed from all packages (if purge is specified)
|
||||
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
|
||||
|
||||
|
27
mkarchroot
27
mkarchroot
@@ -26,7 +26,7 @@ usage() {
|
||||
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 ' -c <dir> Set pacman cache. Default: /var/cache/pacman/pkg'
|
||||
echo ' -h This message'
|
||||
exit $1
|
||||
}
|
||||
@@ -34,7 +34,7 @@ usage() {
|
||||
while getopts 'r:ufnhC:M:c:' arg; do
|
||||
case "${arg}" in
|
||||
r) RUN="$OPTARG" ;;
|
||||
u) RUN='pacman -Syu --noconfirm' ;;
|
||||
u) RUN='/bin/sh -c "pacman -Syu --noconfirm && (pacman -Qqu >/dev/null && pacman -Su --noconfirm || exit 0)"' ;;
|
||||
f) FORCE='y' ;;
|
||||
C) pac_conf="$OPTARG" ;;
|
||||
M) makepkg_conf="$OPTARG" ;;
|
||||
@@ -83,7 +83,6 @@ if echo "${host_mirror}" | grep -q 'file://'; then
|
||||
fi
|
||||
|
||||
# {{{ functions
|
||||
|
||||
chroot_mount() {
|
||||
[ -e "${working_dir}/sys" ] || mkdir "${working_dir}/sys"
|
||||
mount -t sysfs sysfs "${working_dir}/sys"
|
||||
@@ -142,6 +141,20 @@ chroot_umount () {
|
||||
umount "${working_dir}/${cache_dir}"
|
||||
[ -n "${host_mirror_path}" ] && umount "${working_dir}/${host_mirror_path}"
|
||||
}
|
||||
|
||||
chroot_lock () {
|
||||
# Only reopen the FD if it wasn't handed to us
|
||||
if [ "$(readlink -f /dev/fd/9)" != "${working_dir}.lock" ]; then
|
||||
exec 9>"${working_dir}.lock"
|
||||
fi
|
||||
|
||||
# Lock the chroot. Take note of the FD number.
|
||||
if ! flock -n 9; then
|
||||
echo -n "locking chroot..."
|
||||
flock 9
|
||||
echo "done"
|
||||
fi
|
||||
}
|
||||
# }}}
|
||||
|
||||
umask 0022
|
||||
@@ -154,10 +167,11 @@ if [ "$RUN" != "" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chroot_lock
|
||||
chroot_mount
|
||||
copy_hostconf
|
||||
|
||||
chroot "${working_dir}" ${RUN}
|
||||
eval chroot "${working_dir}" ${RUN}
|
||||
|
||||
# }}}
|
||||
else
|
||||
@@ -167,9 +181,14 @@ if [ "$RUN" != "" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if { type -P btrfs && btrfs subvolume create "${working_dir}"; } &>/dev/null; then
|
||||
chmod 0755 "${working_dir}"
|
||||
fi
|
||||
|
||||
mkdir -p "${working_dir}/var/lib/pacman/sync"
|
||||
mkdir -p "${working_dir}/etc/"
|
||||
|
||||
chroot_lock
|
||||
chroot_mount
|
||||
|
||||
pacargs="--noconfirm --root=${working_dir} --cachedir=${cache_dir}"
|
||||
|
@@ -17,7 +17,7 @@ HoldPkg = pacman glibc
|
||||
# If upgrades are available for these packages they will be asked for first
|
||||
SyncFirst = pacman
|
||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||
#XferCommand = /usr/bin/curl -C - %u > %o
|
||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||
#CleanMethod = KeepInstalled
|
||||
Architecture = auto
|
||||
|
||||
@@ -33,6 +33,7 @@ Architecture = auto
|
||||
#ShowSize
|
||||
#UseDelta
|
||||
#TotalDownload
|
||||
#CheckSpace
|
||||
|
||||
#
|
||||
# REPOSITORIES
|
||||
|
@@ -17,7 +17,7 @@ HoldPkg = pacman glibc
|
||||
# If upgrades are available for these packages they will be asked for first
|
||||
SyncFirst = pacman
|
||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||
#XferCommand = /usr/bin/curl -C - %u > %o
|
||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||
#CleanMethod = KeepInstalled
|
||||
Architecture = auto
|
||||
|
||||
@@ -33,6 +33,7 @@ Architecture = auto
|
||||
#ShowSize
|
||||
#UseDelta
|
||||
#TotalDownload
|
||||
#CheckSpace
|
||||
|
||||
#
|
||||
# REPOSITORIES
|
||||
|
@@ -17,7 +17,7 @@ HoldPkg = pacman glibc
|
||||
# If upgrades are available for these packages they will be asked for first
|
||||
SyncFirst = pacman
|
||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||
#XferCommand = /usr/bin/curl -C - %u > %o
|
||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||
#CleanMethod = KeepInstalled
|
||||
Architecture = auto
|
||||
|
||||
@@ -33,6 +33,7 @@ Architecture = auto
|
||||
#ShowSize
|
||||
#UseDelta
|
||||
#TotalDownload
|
||||
#CheckSpace
|
||||
|
||||
#
|
||||
# REPOSITORIES
|
||||
|
@@ -17,7 +17,7 @@ HoldPkg = pacman glibc
|
||||
# If upgrades are available for these packages they will be asked for first
|
||||
SyncFirst = pacman
|
||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||
#XferCommand = /usr/bin/curl -C - %u > %o
|
||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||
#CleanMethod = KeepInstalled
|
||||
Architecture = auto
|
||||
|
||||
@@ -33,6 +33,7 @@ Architecture = auto
|
||||
#ShowSize
|
||||
#UseDelta
|
||||
#TotalDownload
|
||||
#CheckSpace
|
||||
|
||||
#
|
||||
# REPOSITORIES
|
||||
|
@@ -17,7 +17,7 @@ HoldPkg = pacman glibc
|
||||
# If upgrades are available for these packages they will be asked for first
|
||||
SyncFirst = pacman
|
||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||
#XferCommand = /usr/bin/curl -C - %u > %o
|
||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||
#CleanMethod = KeepInstalled
|
||||
Architecture = auto
|
||||
|
||||
@@ -33,6 +33,7 @@ Architecture = auto
|
||||
#ShowSize
|
||||
#UseDelta
|
||||
#TotalDownload
|
||||
#CheckSpace
|
||||
|
||||
#
|
||||
# REPOSITORIES
|
||||
|
Reference in New Issue
Block a user