summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-06-15 12:04:07 -0600
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-06-15 12:04:07 -0600
commitfc25e189650a7ad6fb341487ac7fbb91aa6becfa (patch)
tree60768b7724be37b55672e76142e1ac54763737f0
parent47108a24dee698bcd43d83be24e204ccd27776a3 (diff)
parent8c4553f68cb1c01b24f4883db0032f646b2e77dd (diff)
Merge branch 'devtools'
-rw-r--r--.gitignore1
-rw-r--r--Makefile13
-rw-r--r--arch-nspawn.in8
-rw-r--r--archbuild.in4
-rw-r--r--crossrepomove.in7
-rw-r--r--makechrootpkg.in79
6 files changed, 71 insertions, 41 deletions
diff --git a/.gitignore b/.gitignore
index e5e29ed..1e92b82 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@ rebuildpkgs
zsh_completion
find-libdeps
crossrepomove
+arch-nspawn
diff --git a/Makefile b/Makefile
index d73682a..674d656 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-V=20130408
+V=20130525
PREFIX = /usr/local
@@ -13,9 +13,7 @@ BINPROGS = \
finddeps \
rebuildpkgs \
find-libdeps \
- crossrepomove
-
-SBINPROGS = \
+ crossrepomove\
arch-nspawn \
mkarchroot \
makechrootpkg
@@ -69,7 +67,7 @@ BASHCOMPLETION_LINKS = \
archco \
communityco
-all: $(BINPROGS) $(SBINPROGS) bash_completion zsh_completion
+all: $(BINPROGS) bash_completion zsh_completion
edit = sed -e "s|@pkgdatadir[@]|$(DESTDIR)$(PREFIX)/share/devtools|g"
@@ -81,14 +79,12 @@ edit = sed -e "s|@pkgdatadir[@]|$(DESTDIR)$(PREFIX)/share/devtools|g"
@chmod +x "$@"
clean:
- rm -f $(BINPROGS) $(SBINPROGS) bash_completion zsh_completion
+ rm -f $(BINPROGS) bash_completion zsh_completion
install:
install -dm0755 $(DESTDIR)$(PREFIX)/bin
- install -dm0755 $(DESTDIR)$(PREFIX)/sbin
install -dm0755 $(DESTDIR)$(PREFIX)/share/devtools
install -m0755 ${BINPROGS} $(DESTDIR)$(PREFIX)/bin
- install -m0755 ${SBINPROGS} $(DESTDIR)$(PREFIX)/sbin
install -m0644 ${CONFIGFILES} $(DESTDIR)$(PREFIX)/share/devtools
for l in ${COMMITPKG_LINKS}; do ln -sf commitpkg $(DESTDIR)$(PREFIX)/bin/$$l; done
for l in ${ARCHBUILD_LINKS}; do ln -sf archbuild $(DESTDIR)$(PREFIX)/bin/$$l; done
@@ -101,7 +97,6 @@ install:
uninstall:
for f in ${BINPROGS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done
- for f in ${SBINPROGS}; do rm -f $(DESTDIR)$(PREFIX)/sbin/$$f; done
for f in ${CONFIGFILES}; do rm -f $(DESTDIR)$(PREFIX)/share/devtools/$$f; done
for l in ${COMMITPKG_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
for l in ${ARCHBUILD_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
diff --git a/arch-nspawn.in b/arch-nspawn.in
index fdff31e..8ef39ed 100644
--- a/arch-nspawn.in
+++ b/arch-nspawn.in
@@ -96,4 +96,10 @@ fi
build_mount_args
copy_hostconf
-exec systemd-nspawn -D "$working_dir" --machine "${working_dir//\//-}" "${mount_args[@]}" "$@"
+eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf")
+
+exec ${CARCH:+setarch "$CARCH"} systemd-nspawn 2>/dev/null \
+ -D "$working_dir" \
+ --machine "${working_dir//\//-}" \
+ "${mount_args[@]}" \
+ "$@"
diff --git a/archbuild.in b/archbuild.in
index 8e272a1..06b9d4b 100644
--- a/archbuild.in
+++ b/archbuild.in
@@ -69,7 +69,7 @@ if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
"${base_packages[@]}" || abort
else
lock 9 "${chroots}/${repo}-${arch}/root.lock" "Locking clean chroot"
- setarch ${arch} arch-nspawn \
+ arch-nspawn \
-C "@pkgdatadir@/pacman-${repo}.conf" \
-M "@pkgdatadir@/makepkg-${arch}.conf" \
"${chroots}/${repo}-${arch}/root" \
@@ -77,4 +77,4 @@ else
fi
msg "Building in chroot for [${repo}] (${arch})..."
-exec setarch "${arch}" makechrootpkg "${makechrootpkg_args[@]}" -r "${chroots}/${repo}-${arch}"
+exec makechrootpkg -r "${chroots}/${repo}-${arch}" "${makechrootpkg_args[@]}"
diff --git a/crossrepomove.in b/crossrepomove.in
index b1204af..1d4ae6c 100644
--- a/crossrepomove.in
+++ b/crossrepomove.in
@@ -30,7 +30,6 @@ case $scriptname in
esac
server='nymeria.archlinux.org'
-mirror="http://${server}"
source_svn="svn+ssh://svn-${source_name}@${server}/srv/repos/svn-${source_name}/svn"
target_svn="svn+ssh://svn-${target_name}@${server}/srv/repos/svn-${target_name}/svn"
source_dbscripts="/srv/repos/svn-${source_name}/dbscripts"
@@ -55,10 +54,8 @@ for _arch in ${arch[@]}; do
fi
for _pkgname in ${pkgname[@]}; do
fullver=$(get_full_version $_pkgname)
- # FIXME: this only works with .xz packages
- ssh "${server}" "cd staging/${target_repo}
- curl -O ${mirror}/${source_repo}/os/${repo_arch}/$_pkgname-$fullver-${_arch}.pkg.tar.xz
- curl -O ${mirror}/${source_repo}/os/${repo_arch}/$_pkgname-$fullver-${_arch}.pkg.tar.xz.sig" || die
+ pkgpath="/srv/ftp/$source_repo/os/$repo_arch/$_pkgname-$fullver-${_arch}.pkg.tar.*"
+ ssh "$server" "cp $pkgpath staging/$target_repo" || die
done
done
diff --git a/makechrootpkg.in b/makechrootpkg.in
index 947efad..83aa5d3 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -208,7 +208,8 @@ prepare_chroot() {
echo 'LOGDEST="/logdest"' >> "$copydir/etc/makepkg.conf"
fi
- # These two get bind-mounted
+ # These two get bind-mounted read-only
+ # XXX: makepkg dislikes having these dirs read-only, so separate them
mkdir -p "$copydir/startdir" "$copydir/startdir_host"
mkdir -p "$copydir/srcdest" "$copydir/srcdest_host"
if ! grep -q 'SRCDEST="/srcdest"' "$copydir/etc/makepkg.conf"; then
@@ -237,29 +238,8 @@ EOF
# This is a little gross, but this way the script is recreated every time in the
# working copy
- cat >"$copydir/chrootbuild" <<EOF
-#!/bin/bash
-. /etc/profile
-export HOME=/build
-shopt -s nullglob
-
-# Workaround makepkg disliking read-only dirs
-ln -sft /srcdest /srcdest_host/*
-ln -sft /startdir /startdir_host/*
-
-cd /startdir
-sudo -u nobody makepkg $makepkg_args || exit 1
-
-if $run_namcap; then
- pacman -S --needed --noconfirm namcap
- for pkgfile in /startdir/PKGBUILD /pkgdest/*; do
- echo "Checking \${pkgfile##*/}"
- sudo -u nobody namcap "\$pkgfile" 2>&1 | tee "/logdest/\${pkgfile##*/}-namcap.log"
- done
-fi
-
-exit 0
-EOF
+ printf $'#!/bin/bash\n%s\n_chrootbuild %q %q' "$(declare -f _chrootbuild)" \
+ "$makepkg_args" "$run_namcap" >"$copydir/chrootbuild"
chmod +x "$copydir/chrootbuild"
}
@@ -282,6 +262,57 @@ download_sources() {
rm -rf $builddir
}
+_chrootbuild() {
+ # This function isn't run in makechrootpkg,
+ # so no global variables
+ local makepkg_args="$1"
+ local run_namcap="$2"
+
+ . /etc/profile
+ export HOME=/build
+ shopt -s nullglob
+
+ # XXX: Workaround makepkg disliking read-only dirs
+ ln -sft /srcdest /srcdest_host/*
+ ln -sft /startdir /startdir_host/*
+
+ # XXX: Keep svn sources writable
+ # Since makepkg 4.1.1 they get checked out via cp -a, copying the symlink
+ for dir in /srcdest /startdir; do
+ cd $dir
+ for svndir in */.svn; do
+ rm ${svndir%/.svn}
+ cp -a ${dir}_host/${svndir%/.svn} .
+ chown -R nobody ${svndir%/.svn}
+ done
+ done
+
+ cd /startdir
+
+ # XXX: Keep PKGBUILD writable for pkgver()
+ rm PKGBUILD*
+ cp /startdir_host/PKGBUILD* .
+ chown nobody PKGBUILD*
+
+ # Safety check
+ if [[ ! -w PKGBUILD ]]; then
+ echo "Can't write to PKGBUILD!"
+ exit 1
+ fi
+
+ sudo -u nobody makepkg $makepkg_args || exit 1
+
+ if $run_namcap; then
+ pacman -S --needed --noconfirm namcap
+ for pkgfile in /startdir/PKGBUILD /pkgdest/*; do
+ echo "Checking ${pkgfile##*/}"
+ sudo -u nobody namcap "$pkgfile" 2>&1 | tee "/logdest/${pkgfile##*/}-namcap.log"
+ done
+ fi
+
+ exit 0
+}
+
move_products() {
for pkgfile in "$copydir"/pkgdest/*; do
chown "$src_owner" "$pkgfile"