mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-13 18:06:19 +02:00
Compare commits
36 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
905198295d | ||
![]() |
03611dc63e | ||
![]() |
7aac293d76 | ||
![]() |
6db31cc16a | ||
![]() |
4ee45fe6d4 | ||
![]() |
0b2ae245f1 | ||
![]() |
fdd079f3d5 | ||
![]() |
9f7ba3d407 | ||
![]() |
40ea1b3ca5 | ||
![]() |
fd1be1b27a | ||
![]() |
8ce6e29add | ||
![]() |
1e043445d2 | ||
![]() |
3029c8e4bc | ||
![]() |
b8dd44083a | ||
![]() |
4b3a6c7803 | ||
![]() |
59e348fc3c | ||
![]() |
27441f201c | ||
![]() |
c4f72f781b | ||
![]() |
9974309cee | ||
![]() |
e3cf64ad2f | ||
![]() |
7524bec6d9 | ||
![]() |
70309118ab | ||
![]() |
164f5b758d | ||
![]() |
1ae58aed5b | ||
![]() |
0d16a91350 | ||
![]() |
e77242c539 | ||
![]() |
9c85d116f0 | ||
![]() |
914ebe3a74 | ||
![]() |
7267664ed8 | ||
![]() |
e0f7c21a68 | ||
![]() |
8dbb02de4f | ||
![]() |
b12d5eaf85 | ||
![]() |
0fa2536957 | ||
![]() |
be3c71fa81 | ||
![]() |
fb30cabe61 | ||
![]() |
29e62278a7 |
3
Makefile
3
Makefile
@@ -1,4 +1,4 @@
|
|||||||
V=20130525
|
V=20140510
|
||||||
|
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
|
|
||||||
@@ -77,6 +77,7 @@ edit = sed -e "s|@pkgdatadir[@]|$(DESTDIR)$(PREFIX)/share/devtools|g"
|
|||||||
@m4 -P $@.in | $(edit) >$@
|
@m4 -P $@.in | $(edit) >$@
|
||||||
@chmod a-w "$@"
|
@chmod a-w "$@"
|
||||||
@chmod +x "$@"
|
@chmod +x "$@"
|
||||||
|
@bash -O extglob -n "$@"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(BINPROGS) bash_completion zsh_completion
|
rm -f $(BINPROGS) bash_completion zsh_completion
|
||||||
|
@@ -37,18 +37,18 @@ while getopts 'hC:M:c:' arg; do
|
|||||||
done
|
done
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
(( $EUID != 0 )) && die 'This script must be run as root.'
|
|
||||||
(( $# < 1 )) && die 'You must specify a directory.'
|
(( $# < 1 )) && die 'You must specify a directory.'
|
||||||
|
check_root "$0" "$@"
|
||||||
|
|
||||||
working_dir="$(readlink -f $1)"
|
working_dir=$(readlink -f "$1")
|
||||||
shift 1
|
shift 1
|
||||||
|
|
||||||
[[ -z $working_dir ]] && die 'Please specify a working directory.'
|
[[ -z $working_dir ]] && die 'Please specify a working directory.'
|
||||||
|
|
||||||
if [[ -z $cache_dir ]]; then
|
if [[ -z $cache_dir ]]; then
|
||||||
cache_dirs=($(pacman -v $cache_conf 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g'))
|
cache_dirs=($(pacman -v 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g'))
|
||||||
else
|
else
|
||||||
cache_dirs=(${cache_dir})
|
cache_dirs=("$cache_dir")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
host_mirror=$(pacman -Sddp extra/devtools 2>/dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')
|
host_mirror=$(pacman -Sddp extra/devtools 2>/dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')
|
||||||
@@ -56,31 +56,27 @@ host_mirror=$(pacman -Sddp extra/devtools 2>/dev/null | sed -r 's#(.*/)extra/os/
|
|||||||
|
|
||||||
# {{{ functions
|
# {{{ functions
|
||||||
build_mount_args() {
|
build_mount_args() {
|
||||||
local p
|
|
||||||
declare -g mount_args=()
|
declare -g mount_args=()
|
||||||
|
|
||||||
if [[ -n $host_mirror_path ]]; then
|
if [[ -n $host_mirror_path ]]; then
|
||||||
printf -v p '%q' "$host_mirror_path"
|
mount_args+=(--bind-ro="$host_mirror_path")
|
||||||
mount_args+=(--bind-ro="$p")
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf -v p '%q' "${cache_dirs[0]}"
|
mount_args+=(--bind="${cache_dirs[0]}")
|
||||||
mount_args+=(--bind="$p")
|
|
||||||
|
|
||||||
for cache_dir in ${cache_dirs[@]:1}; do
|
for cache_dir in ${cache_dirs[@]:1}; do
|
||||||
printf -v p '%q' "$cache_dir"
|
mount_args+=(--bind-ro="$cache_dir")
|
||||||
mount_args+=(--bind-ro="$p")
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_hostconf () {
|
copy_hostconf () {
|
||||||
cp -a /etc/pacman.d/gnupg "$working_dir/etc/pacman.d"
|
cp -a /etc/pacman.d/gnupg "$working_dir/etc/pacman.d"
|
||||||
echo "Server = $host_mirror" > $working_dir/etc/pacman.d/mirrorlist
|
echo "Server = $host_mirror" >"$working_dir/etc/pacman.d/mirrorlist"
|
||||||
|
|
||||||
[[ -n $pac_conf ]] && cp $pac_conf $working_dir/etc/pacman.conf
|
[[ -n $pac_conf ]] && cp $pac_conf "$working_dir/etc/pacman.conf"
|
||||||
[[ -n $makepkg_conf ]] && cp $makepkg_conf $working_dir/etc/makepkg.conf
|
[[ -n $makepkg_conf ]] && cp $makepkg_conf "$working_dir/etc/makepkg.conf"
|
||||||
|
|
||||||
sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${cache_dirs[@]})|g" -i $working_dir/etc/pacman.conf
|
sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${cache_dirs[@]})|g" -i "$working_dir/etc/pacman.conf"
|
||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
@@ -88,9 +84,9 @@ umask 0022
|
|||||||
|
|
||||||
# Sanity check
|
# Sanity check
|
||||||
if [[ ! -f "$working_dir/.arch-chroot" ]]; then
|
if [[ ! -f "$working_dir/.arch-chroot" ]]; then
|
||||||
die "'$working_dir' does not appear to be a Arch chroot."
|
die "'%s' does not appear to be a Arch chroot." "$working_dir"
|
||||||
elif [[ $(cat "$working_dir/.arch-chroot") != $CHROOT_VERSION ]]; then
|
elif [[ $(cat "$working_dir/.arch-chroot") != $CHROOT_VERSION ]]; then
|
||||||
die "chroot '$working_dir' is not at version $CHROOT_VERSION. Please rebuild."
|
die "chroot '%s' is not at version %s. Please rebuild." "$working_dir" "$CHROOT_VERSION"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
build_mount_args
|
build_mount_args
|
||||||
@@ -98,8 +94,11 @@ copy_hostconf
|
|||||||
|
|
||||||
eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf")
|
eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf")
|
||||||
|
|
||||||
|
machine_name="${working_dir//[![:alnum:]_-]/-}"
|
||||||
|
machine_name="${machine_name#-}"
|
||||||
|
|
||||||
exec ${CARCH:+setarch "$CARCH"} systemd-nspawn 2>/dev/null \
|
exec ${CARCH:+setarch "$CARCH"} systemd-nspawn 2>/dev/null \
|
||||||
-D "$working_dir" \
|
-D "$working_dir" \
|
||||||
--machine "${working_dir//\//-}" \
|
--machine "$machine_name" \
|
||||||
"${mount_args[@]}" \
|
"${mount_args[@]}" \
|
||||||
"$@"
|
"$@"
|
||||||
|
@@ -40,9 +40,7 @@ done
|
|||||||
# Pass all arguments after -- right to makepkg
|
# Pass all arguments after -- right to makepkg
|
||||||
makechrootpkg_args+=("${@:$OPTIND}")
|
makechrootpkg_args+=("${@:$OPTIND}")
|
||||||
|
|
||||||
if (( EUID )); then
|
check_root "$0" "$@"
|
||||||
die 'This script must be run as root.'
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
|
if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
|
||||||
msg "Creating chroot for [${repo}] (${arch})..."
|
msg "Creating chroot for [${repo}] (${arch})..."
|
||||||
|
@@ -15,7 +15,7 @@ case $scriptname in
|
|||||||
communityco)
|
communityco)
|
||||||
SVNURL="svn+ssh://svn-community@nymeria.archlinux.org/srv/repos/svn-community/svn";;
|
SVNURL="svn+ssh://svn-community@nymeria.archlinux.org/srv/repos/svn-community/svn";;
|
||||||
*)
|
*)
|
||||||
die "Couldn't find svn url for $scriptname"
|
die "Couldn't find svn url for %s" "$scriptname"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@@ -8,8 +8,8 @@ FORCE=
|
|||||||
while getopts ':f' flag; do
|
while getopts ':f' flag; do
|
||||||
case $flag in
|
case $flag in
|
||||||
f) FORCE=1 ;;
|
f) FORCE=1 ;;
|
||||||
:) die "Option requires an argument -- '$OPTARG'" ;;
|
:) die "Option requires an argument -- '%s'" "$OPTARG" ;;
|
||||||
\?) die "Invalid option -- '$OPTARG'" ;;
|
\?) die "Invalid option -- '%s'" "$OPTARG" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $(( OPTIND - 1 ))
|
shift $(( OPTIND - 1 ))
|
||||||
@@ -23,7 +23,7 @@ fi
|
|||||||
if [[ -z $FORCE ]]; then
|
if [[ -z $FORCE ]]; then
|
||||||
for tag in "$@"; do
|
for tag in "$@"; do
|
||||||
if ! in_array "$tag" "${_tags[@]}"; then
|
if ! in_array "$tag" "${_tags[@]}"; then
|
||||||
die 'archrelease: Invalid tag: "'$tag'" (use -f to force release)'
|
die "archrelease: Invalid tag: '%s' (use -f to force release)" "$tag"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
50
checkpkg.in
50
checkpkg.in
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
shopt -s extglob
|
||||||
|
|
||||||
m4_include(lib/common.sh)
|
m4_include(lib/common.sh)
|
||||||
|
|
||||||
# Source makepkg.conf; fail if it is not found
|
# Source makepkg.conf; fail if it is not found
|
||||||
@@ -18,63 +20,55 @@ if [[ ! -f PKGBUILD ]]; then
|
|||||||
die 'This must be run in the directory of a built package.'
|
die 'This must be run in the directory of a built package.'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. PKGBUILD
|
. ./PKGBUILD
|
||||||
if [[ $arch == 'any' ]]; then
|
if [[ $arch == 'any' ]]; then
|
||||||
CARCH='any'
|
CARCH='any'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
STARTDIR=$(pwd)
|
STARTDIR=$(pwd)
|
||||||
TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
|
TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
|
||||||
cd "$TEMPDIR"
|
|
||||||
|
|
||||||
for _pkgname in "${pkgname[@]}"; do
|
for _pkgname in "${pkgname[@]}"; do
|
||||||
pkgfile=${_pkgname}-$(get_full_version $_pkgname)-${CARCH}${PKGEXT}
|
target_pkgver=$(get_full_version "$_pkgname")
|
||||||
|
if ! pkgfile=$(find_cached_package "$_pkgname" "$target_pkgver" "$CARCH"); then
|
||||||
if [[ -f "$STARTDIR/$pkgfile" ]]; then
|
die 'tarball not found for package: %s' "${_pkgname}-$target_pkgver"
|
||||||
ln -s "$STARTDIR/$pkgfile" "$pkgfile"
|
|
||||||
elif [[ -f "$PKGDEST/$pkgfile" ]]; then
|
|
||||||
ln -s "$PKGDEST/$pkgfile" "$pkgfile"
|
|
||||||
else
|
|
||||||
die "File \"$pkgfile\" doesn't exist"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ln -s "$pkgfile" "$TEMPDIR"
|
||||||
|
|
||||||
pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$_pkgname")
|
pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$_pkgname")
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
die "Couldn't download previous package for $_pkgname."
|
die "Couldn't download previous package for %s." "$_pkgname"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
oldpkg=${pkgurl##*://*/}
|
oldpkg=${pkgurl##*://*/}
|
||||||
|
|
||||||
if [[ ${oldpkg##*/} = ${pkgfile##*/} ]]; then
|
if [[ ${oldpkg##*/} = ${pkgfile##*/} ]]; then
|
||||||
die "The built package ($_pkgname) is the one in the repo right now!"
|
die "The built package (%s) is the one in the repo right now!" "$_pkgname"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -f $oldpkg ]]; then
|
|
||||||
if [[ $pkgurl = file://* ]]; then
|
if [[ $pkgurl = file://* ]]; then
|
||||||
ln -s "${pkgurl#file://}" "${pkgurl##file://*/}"
|
ln -s "${pkgurl#file://}" "$TEMPDIR/$oldpkg"
|
||||||
elif [[ -f "$PKGDEST/$oldpkg" ]]; then
|
elif [[ -f "$PKGDEST/$oldpkg" ]]; then
|
||||||
ln -s "$PKGDEST/$oldpkg" "$oldpkg"
|
ln -s "$PKGDEST/$oldpkg" "$TEMPDIR/$oldpkg"
|
||||||
elif [[ -f "$STARTDIR/$oldpkg" ]]; then
|
elif [[ -f "$STARTDIR/$oldpkg" ]]; then
|
||||||
ln -s "$STARTDIR/$oldpkg" "$oldpkg"
|
ln -s "$STARTDIR/$oldpkg" "$TEMPDIR/$oldpkg"
|
||||||
else
|
else
|
||||||
curl -fsLC - --retry 3 --retry-delay 3 -o "$oldpkg" "$pkgurl"
|
curl -fsLC - --retry 3 --retry-delay 3 -o "$TEMPDIR/$oldpkg" "$pkgurl"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bsdtar tf "$oldpkg" | sort > "filelist-$_pkgname-old"
|
bsdtar tf "$TEMPDIR/$oldpkg" | sort > "$TEMPDIR/filelist-$_pkgname-old"
|
||||||
bsdtar tf "$pkgfile" | sort > "filelist-$_pkgname"
|
bsdtar tf "$pkgfile" | sort > "$TEMPDIR/filelist-$_pkgname"
|
||||||
|
|
||||||
sdiff -s "filelist-$_pkgname-old" "filelist-$_pkgname"
|
sdiff -s "$TEMPDIR/filelist-$_pkgname-old" "$TEMPDIR/filelist-$_pkgname"
|
||||||
|
|
||||||
if diff "filelist-$_pkgname-old" "filelist-$_pkgname" | grep '\.so' > /dev/null 2>&1; then
|
if diff "$TEMPDIR/filelist-$_pkgname"{-old,} | grep '\.so' &>/dev/null; then
|
||||||
mkdir -p pkg
|
mkdir -p "$TEMPDIR/pkg"
|
||||||
cd pkg
|
bsdtar -x -C "$TEMPDIR" -f "$pkgfile" #> /dev/null
|
||||||
bsdtar xf ../"$pkgfile" > /dev/null
|
comm -13 <(sort "$TEMPDIR/filelist-$_pkgname-old") <(sort "$TEMPDIR/filelist-$_pkgname") | grep .so$ | while read i; do
|
||||||
diff "../filelist-$_pkgname-old" "../filelist-$_pkgname" | awk '/>.*\.so/{$1 = ""; print $0}' | while read i; do
|
echo "${i}: " "$(objdump -p "$TEMPDIR/$i" | grep SONAME)"
|
||||||
echo "${i}: " "$(objdump -p "$i" | grep SONAME)"
|
|
||||||
done
|
done
|
||||||
cd ..
|
|
||||||
else
|
else
|
||||||
msg "No soname differences for $_pkgname."
|
msg "No soname differences for $_pkgname."
|
||||||
fi
|
fi
|
||||||
|
54
commitpkg.in
54
commitpkg.in
@@ -2,22 +2,6 @@
|
|||||||
|
|
||||||
m4_include(lib/common.sh)
|
m4_include(lib/common.sh)
|
||||||
|
|
||||||
getpkgfile() {
|
|
||||||
case $# in
|
|
||||||
0)
|
|
||||||
error 'No canonical package found!'
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
[!1])
|
|
||||||
error 'Failed to canonicalize package name -- multiple packages found:'
|
|
||||||
msg2 '%s' "$@"
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Source makepkg.conf; fail if it is not found
|
# Source makepkg.conf; fail if it is not found
|
||||||
if [[ -r '/etc/makepkg.conf' ]]; then
|
if [[ -r '/etc/makepkg.conf' ]]; then
|
||||||
source '/etc/makepkg.conf'
|
source '/etc/makepkg.conf'
|
||||||
@@ -36,7 +20,7 @@ if [[ ! -f PKGBUILD ]]; then
|
|||||||
die 'No PKGBUILD file'
|
die 'No PKGBUILD file'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. PKGBUILD
|
. ./PKGBUILD
|
||||||
pkgbase=${pkgbase:-$pkgname}
|
pkgbase=${pkgbase:-$pkgname}
|
||||||
|
|
||||||
case "$cmd" in
|
case "$cmd" in
|
||||||
@@ -55,24 +39,28 @@ case "$cmd" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# check if all local source files are under version control
|
# find files which should be under source control
|
||||||
|
needsversioning=()
|
||||||
for s in "${source[@]}"; do
|
for s in "${source[@]}"; do
|
||||||
if [[ $s != *://* ]] && ! svn status -v "$s@" | grep -q '^[ AMRX~]'; then
|
[[ $s != *://* ]] && needsversioning+=("$s")
|
||||||
die "$s is not under version control"
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# check if changelog and install files are under version control
|
|
||||||
for i in 'changelog' 'install'; do
|
for i in 'changelog' 'install'; do
|
||||||
while read -r file; do
|
while read -r file; do
|
||||||
# evaluate any bash variables used
|
# evaluate any bash variables used
|
||||||
eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\"
|
eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\"
|
||||||
if ! svn status -v "${file}" | grep -q '^[ AMRX~]'; then
|
needsversioning+=("$file")
|
||||||
die "${file} is not under version control"
|
|
||||||
fi
|
|
||||||
done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
|
done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# assert that they really are controlled by SVN
|
||||||
|
if (( ${#needsversioning[*]} )); then
|
||||||
|
# svn status's output is only two columns when the status is unknown
|
||||||
|
while read -r status filename; do
|
||||||
|
[[ $status = '?' ]] && unversioned+=("$filename")
|
||||||
|
done < <(svn status -v "${needsversioning[@]}")
|
||||||
|
(( ${#unversioned[*]} )) && die "%s is not under version control" "${unversioned[@]}"
|
||||||
|
fi
|
||||||
|
|
||||||
rsyncopts=(-e ssh -p --chmod=ug=rw,o=r -c -h -L --progress --partial -y)
|
rsyncopts=(-e ssh -p --chmod=ug=rw,o=r -c -h -L --progress --partial -y)
|
||||||
archreleaseopts=()
|
archreleaseopts=()
|
||||||
while getopts ':l:a:s:f' flag; do
|
while getopts ':l:a:s:f' flag; do
|
||||||
@@ -81,8 +69,8 @@ while getopts ':l:a:s:f' flag; do
|
|||||||
s) server=$OPTARG ;;
|
s) server=$OPTARG ;;
|
||||||
l) rsyncopts+=("--bwlimit=$OPTARG") ;;
|
l) rsyncopts+=("--bwlimit=$OPTARG") ;;
|
||||||
a) commit_arch=$OPTARG ;;
|
a) commit_arch=$OPTARG ;;
|
||||||
:) die "Option requires an argument -- '$OPTARG'" ;;
|
:) die "Option requires an argument -- '%s'" "$OPTARG" ;;
|
||||||
\?) die "Invalid option -- '$OPTARG'" ;;
|
\?) die "Invalid option -- '%s'" "$OPTARG" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $(( OPTIND - 1 ))
|
shift $(( OPTIND - 1 ))
|
||||||
@@ -95,9 +83,8 @@ for _arch in ${arch[@]}; do
|
|||||||
for _pkgname in ${pkgname[@]}; do
|
for _pkgname in ${pkgname[@]}; do
|
||||||
fullver=$(get_full_version $_pkgname)
|
fullver=$(get_full_version $_pkgname)
|
||||||
|
|
||||||
if pkgfile=$(shopt -s nullglob;
|
if pkgfile=$(find_cached_package "$_pkgname" "$_arch" "$fullver"); then
|
||||||
getpkgfile "${PKGDEST+$PKGDEST/}$_pkgname-$fullver-${_arch}".pkg.tar.?z); then
|
if grep -q "packager = Unknown Packager" <(bsdtar -xOqf "$pkgfile" .PKGINFO); then
|
||||||
if grep -q "packager = Unknown Packager" <(bsdtar -xOqf $pkgfile .PKGINFO); then
|
|
||||||
die "PACKAGER was not set when building package"
|
die "PACKAGER was not set when building package"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -147,8 +134,7 @@ for _arch in ${arch[@]}; do
|
|||||||
for _pkgname in ${pkgname[@]}; do
|
for _pkgname in ${pkgname[@]}; do
|
||||||
fullver=$(get_full_version $_pkgname)
|
fullver=$(get_full_version $_pkgname)
|
||||||
|
|
||||||
if ! pkgfile=$(shopt -s nullglob;
|
if ! pkgfile=$(find_cached_package "$_pkgname" "$fullver" "${_arch}"); then
|
||||||
getpkgfile "${PKGDEST+$PKGDEST/}$_pkgname-$fullver-${_arch}".pkg.tar.?z); then
|
|
||||||
warning "Skipping $_pkgname-$fullver-$_arch: failed to locate package file"
|
warning "Skipping $_pkgname-$fullver-$_arch: failed to locate package file"
|
||||||
skip_arches+=($_arch)
|
skip_arches+=($_arch)
|
||||||
continue 2
|
continue 2
|
||||||
@@ -164,7 +150,7 @@ for _arch in ${arch[@]}; do
|
|||||||
gpg --detach-sign --use-agent ${SIGNWITHKEY} "${pkgfile}" || die
|
gpg --detach-sign --use-agent ${SIGNWITHKEY} "${pkgfile}" || die
|
||||||
fi
|
fi
|
||||||
if ! gpg --verify "$sigfile" >/dev/null 2>&1; then
|
if ! gpg --verify "$sigfile" >/dev/null 2>&1; then
|
||||||
die "Signature ${pkgfile}.sig is incorrect!"
|
die "Signature %s.sig is incorrect!" "$pkgfile"
|
||||||
fi
|
fi
|
||||||
uploads+=("$sigfile")
|
uploads+=("$sigfile")
|
||||||
done
|
done
|
||||||
|
@@ -25,7 +25,7 @@ case $scriptname in
|
|||||||
target_repo='extra'
|
target_repo='extra'
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
die "Couldn't find configuration for $scriptname"
|
die "Couldn't find configuration for %s" "$scriptname"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ script_mode=${0##*/find-lib}
|
|||||||
|
|
||||||
case $script_mode in
|
case $script_mode in
|
||||||
deps|provides) true;;
|
deps|provides) true;;
|
||||||
*) die "Unknown mode $script_mode" ;;
|
*) die "Unknown mode %s" "$script_mode" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ -z $1 ]]; then
|
if [[ -z $1 ]]; then
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
# Avoid any encoding problems
|
# Avoid any encoding problems
|
||||||
export LANG=C
|
export LANG=C
|
||||||
|
|
||||||
|
shopt -s extglob
|
||||||
|
|
||||||
# check if messages are to be printed using color
|
# check if messages are to be printed using color
|
||||||
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
|
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
|
||||||
if [[ -t 2 ]]; then
|
if [[ -t 2 ]]; then
|
||||||
@@ -63,12 +65,12 @@ setup_workdir() {
|
|||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
[[ -n $WORKDIR ]] && rm -rf "$WORKDIR"
|
[[ -n $WORKDIR ]] && rm -rf "$WORKDIR"
|
||||||
[[ $1 ]] && exit $1
|
exit ${1:-0}
|
||||||
}
|
}
|
||||||
|
|
||||||
abort() {
|
abort() {
|
||||||
msg 'Aborting...'
|
error 'Aborting...'
|
||||||
cleanup 0
|
cleanup 255
|
||||||
}
|
}
|
||||||
|
|
||||||
trap_abort() {
|
trap_abort() {
|
||||||
@@ -82,8 +84,8 @@ trap_exit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
die() {
|
die() {
|
||||||
error "$*"
|
(( $# )) && error "$@"
|
||||||
cleanup 1
|
cleanup 255
|
||||||
}
|
}
|
||||||
|
|
||||||
trap 'trap_abort' INT QUIT TERM HUP
|
trap 'trap_abort' INT QUIT TERM HUP
|
||||||
@@ -112,7 +114,7 @@ get_full_version() {
|
|||||||
pkgbase=${pkgbase:-${pkgname[0]}}
|
pkgbase=${pkgbase:-${pkgname[0]}}
|
||||||
epoch=${epoch:-0}
|
epoch=${epoch:-0}
|
||||||
if [[ -z $1 ]]; then
|
if [[ -z $1 ]]; then
|
||||||
if [[ $epoch ]] && (( ! $epoch )); then
|
if (( ! epoch )); then
|
||||||
echo $pkgver-$pkgrel
|
echo $pkgver-$pkgrel
|
||||||
else
|
else
|
||||||
echo $epoch:$pkgver-$pkgrel
|
echo $epoch:$pkgver-$pkgrel
|
||||||
@@ -154,3 +156,88 @@ slock() {
|
|||||||
stat_done
|
stat_done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# usage: pkgver_equal( $pkgver1, $pkgver2 )
|
||||||
|
##
|
||||||
|
pkgver_equal() {
|
||||||
|
local left right
|
||||||
|
|
||||||
|
if [[ $1 = *-* && $2 = *-* ]]; then
|
||||||
|
# if both versions have a pkgrel, then they must be an exact match
|
||||||
|
[[ $1 = "$2" ]]
|
||||||
|
else
|
||||||
|
# otherwise, trim any pkgrel and compare the bare version.
|
||||||
|
[[ ${1%%-*} = "${2%%-*}" ]]
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# usage: find_cached_package( $pkgname, $pkgver, $arch )
|
||||||
|
#
|
||||||
|
# $pkgver can be supplied with or without a pkgrel appended.
|
||||||
|
# If not supplied, any pkgrel will be matched.
|
||||||
|
##
|
||||||
|
find_cached_package() {
|
||||||
|
local searchdirs=("$PWD" "$PKGDEST") results=()
|
||||||
|
local targetname=$1 targetver=$2 targetarch=$3
|
||||||
|
local dir pkg pkgbasename pkgparts name ver rel arch size r results
|
||||||
|
|
||||||
|
for dir in "${searchdirs[@]}"; do
|
||||||
|
[[ -d $dir ]] || continue
|
||||||
|
|
||||||
|
for pkg in "$dir"/*.pkg.tar?(.?z); do
|
||||||
|
[[ -f $pkg ]] || continue
|
||||||
|
|
||||||
|
# avoid adding duplicates of the same inode
|
||||||
|
for r in "${results[@]}"; do
|
||||||
|
[[ $r -ef $pkg ]] && continue 2
|
||||||
|
done
|
||||||
|
|
||||||
|
# split apart package filename into parts
|
||||||
|
pkgbasename=${pkg##*/}
|
||||||
|
pkgbasename=${pkgbasename%.pkg.tar?(.?z)}
|
||||||
|
|
||||||
|
arch=${pkgbasename##*-}
|
||||||
|
pkgbasename=${pkgbasename%-"$arch"}
|
||||||
|
|
||||||
|
rel=${pkgbasename##*-}
|
||||||
|
pkgbasename=${pkgbasename%-"$rel"}
|
||||||
|
|
||||||
|
ver=${pkgbasename##*-}
|
||||||
|
name=${pkgbasename%-"$ver"}
|
||||||
|
|
||||||
|
if [[ $targetname = "$name" && $targetarch = "$arch" ]] &&
|
||||||
|
pkgver_equal "$targetver" "$ver-$rel"; then
|
||||||
|
results+=("$pkg")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
case ${#results[*]} in
|
||||||
|
0)
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
1)
|
||||||
|
printf '%s\n' "$results"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
error 'Multiple packages found:'
|
||||||
|
printf '\t%s\n' "${results[@]}" >&2
|
||||||
|
return 1
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# usage : check_root ("$0" "$@")
|
||||||
|
##
|
||||||
|
check_root() {
|
||||||
|
(( EUID == 0 )) && return
|
||||||
|
if type -P sudo >/dev/null; then
|
||||||
|
exec sudo -- "$@"
|
||||||
|
else
|
||||||
|
exec su root -c "$(printf '%q' "$@")"
|
||||||
|
fi
|
||||||
|
die 'This script must be run as root.'
|
||||||
|
}
|
||||||
|
@@ -24,6 +24,9 @@ passeddir=
|
|||||||
declare -a install_pkgs
|
declare -a install_pkgs
|
||||||
declare -i ret=0
|
declare -i ret=0
|
||||||
|
|
||||||
|
bindmounts_ro=()
|
||||||
|
bindmounts_rw=()
|
||||||
|
|
||||||
copy=$USER
|
copy=$USER
|
||||||
[[ -n $SUDO_USER ]] && copy=$SUDO_USER
|
[[ -n $SUDO_USER ]] && copy=$SUDO_USER
|
||||||
[[ -z "$copy" || $copy = root ]] && copy=copy
|
[[ -z "$copy" || $copy = root ]] && copy=copy
|
||||||
@@ -32,8 +35,8 @@ src_owner=${SUDO_USER:-$USER}
|
|||||||
usage() {
|
usage() {
|
||||||
echo "Usage: ${0##*/} [options] -r <chrootdir> [--] [makepkg args]"
|
echo "Usage: ${0##*/} [options] -r <chrootdir> [--] [makepkg args]"
|
||||||
echo ' Run this script in a PKGBUILD dir to build a package inside a'
|
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 ' clean chroot. Arguments passed to this script after the'
|
||||||
echo ' will be passed to makepkg.'
|
echo ' end-of-options marker (--) will be passed to makepkg.'
|
||||||
echo ''
|
echo ''
|
||||||
echo ' The chroot dir consists of the following directories:'
|
echo ' The chroot dir consists of the following directories:'
|
||||||
echo ' <chrootdir>/{root, copy} but only "root" is required'
|
echo ' <chrootdir>/{root, copy} but only "root" is required'
|
||||||
@@ -48,6 +51,8 @@ usage() {
|
|||||||
echo 'Flags:'
|
echo 'Flags:'
|
||||||
echo '-h This help'
|
echo '-h This help'
|
||||||
echo '-c Clean the chroot before building'
|
echo '-c Clean the chroot before building'
|
||||||
|
echo '-d <dir> Bind directory into build chroot as read-write'
|
||||||
|
echo '-D <dir> Bind directory into build chroot as read-only'
|
||||||
echo '-u Update the working copy of 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 ' This is useful for rebuilds without dirtying the pristine'
|
||||||
echo ' chroot'
|
echo ' chroot'
|
||||||
@@ -61,28 +66,29 @@ usage() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts 'hcur:I:l:nT' arg; do
|
while getopts 'hcur:I:l:nTD:d:' arg; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
h) usage ;;
|
h) usage ;;
|
||||||
c) clean_first=true ;;
|
c) clean_first=true ;;
|
||||||
|
D) bindmounts_ro+=(--bind-ro="$OPTARG") ;;
|
||||||
|
d) bindmounts_rw+=(--bind="$OPTARG") ;;
|
||||||
u) update_first=true ;;
|
u) update_first=true ;;
|
||||||
r) passeddir="$OPTARG" ;;
|
r) passeddir="$OPTARG" ;;
|
||||||
I) install_pkgs+=("$OPTARG") ;;
|
I) install_pkgs+=("$OPTARG") ;;
|
||||||
l) copy="$OPTARG" ;;
|
l) copy="$OPTARG" ;;
|
||||||
n) run_namcap=true; makepkg_args="$makepkg_args -i" ;;
|
n) run_namcap=true; makepkg_args="$makepkg_args -i" ;;
|
||||||
T) temp_chroot=true; copy+="-$$" ;;
|
T) temp_chroot=true; copy+="-$$" ;;
|
||||||
*) makepkg_args="$makepkg_args -$arg $OPTARG" ;;
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
(( EUID != 0 )) && die 'This script must be run as root.'
|
check_root "$0" "$@"
|
||||||
|
|
||||||
[[ ! -f PKGBUILD && -z "${install_pkgs[*]}" ]] && die 'This must be run in a directory containing a PKGBUILD.'
|
[[ ! -f PKGBUILD && -z "${install_pkgs[*]}" ]] && die 'This must be run in a directory containing a PKGBUILD.'
|
||||||
|
|
||||||
# Canonicalize chrootdir, getting rid of trailing /
|
# Canonicalize chrootdir, getting rid of trailing /
|
||||||
chrootdir=$(readlink -e "$passeddir")
|
chrootdir=$(readlink -e "$passeddir")
|
||||||
[[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '$passeddir'"
|
[[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '%s'" "$passeddir"
|
||||||
[[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkarchroot $chrootdir/root base-devel"
|
[[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkarchroot %s/root base-devel" "$chrootdir"
|
||||||
|
|
||||||
# Detect chrootdir filesystem type
|
# Detect chrootdir filesystem type
|
||||||
chroottype=$(stat -f -c %T "$chrootdir")
|
chroottype=$(stat -f -c %T "$chrootdir")
|
||||||
@@ -97,11 +103,13 @@ fi
|
|||||||
makepkg_args="$makepkg_args ${*:$OPTIND}"
|
makepkg_args="$makepkg_args ${*:$OPTIND}"
|
||||||
|
|
||||||
# See if -R was passed to makepkg
|
# See if -R was passed to makepkg
|
||||||
for arg in ${*:$OPTIND}; do
|
for arg in "${@:OPTIND}"; do
|
||||||
if [[ $arg = -R ]]; then
|
case ${arg%%=*} in
|
||||||
|
-*R*|--repackage)
|
||||||
repack=true
|
repack=true
|
||||||
break
|
break 2
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -n $SUDO_USER ]]; then
|
if [[ -n $SUDO_USER ]]; then
|
||||||
@@ -116,7 +124,7 @@ load_vars() {
|
|||||||
|
|
||||||
[[ -f $makepkg_conf ]] || return 1
|
[[ -f $makepkg_conf ]] || return 1
|
||||||
|
|
||||||
for var in {SRC,PKG,LOG}DEST MAKEFLAGS PACKAGER; do
|
for var in {SRC,SRCPKG,PKG,LOG}DEST MAKEFLAGS PACKAGER; do
|
||||||
[[ -z ${!var} ]] && eval $(grep "^${var}=" "$makepkg_conf")
|
[[ -z ${!var} ]] && eval $(grep "^${var}=" "$makepkg_conf")
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -133,13 +141,13 @@ create_chroot() {
|
|||||||
slock 8 "$chrootdir/root.lock" "Locking clean chroot"
|
slock 8 "$chrootdir/root.lock" "Locking clean chroot"
|
||||||
|
|
||||||
stat_busy "Creating clean working copy [$copy]"
|
stat_busy "Creating clean working copy [$copy]"
|
||||||
if [[ "$chroottype" == btrfs ]]; then
|
if [[ "$chroottype" == btrfs ]] && ! mountpoint -q "$copydir"; then
|
||||||
if [[ -d $copydir ]]; then
|
if [[ -d $copydir ]]; then
|
||||||
btrfs subvolume delete "$copydir" >/dev/null ||
|
btrfs subvolume delete "$copydir" >/dev/null ||
|
||||||
die "Unable to delete subvolume $copydir"
|
die "Unable to delete subvolume %s" "$copydir"
|
||||||
fi
|
fi
|
||||||
btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
|
btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
|
||||||
die "Unable to create subvolume $copydir"
|
die "Unable to create subvolume %s" "$copydir"
|
||||||
else
|
else
|
||||||
mkdir -p "$copydir"
|
mkdir -p "$copydir"
|
||||||
rsync -a --delete -q -W -x "$chrootdir/root/" "$copydir"
|
rsync -a --delete -q -W -x "$chrootdir/root/" "$copydir"
|
||||||
@@ -149,17 +157,20 @@ create_chroot() {
|
|||||||
# Drop the read lock again
|
# Drop the read lock again
|
||||||
exec 8>&-
|
exec 8>&-
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Update mtime
|
||||||
|
touch "$copydir"
|
||||||
}
|
}
|
||||||
|
|
||||||
clean_temporary() {
|
clean_temporary() {
|
||||||
stat_busy "Removing temporary copy [$copy]"
|
stat_busy "Removing temporary copy [$copy]"
|
||||||
if [[ "$chroottype" == btrfs ]]; then
|
if [[ "$chroottype" == btrfs ]]; then
|
||||||
btrfs subvolume delete "$copydir" >/dev/null ||
|
btrfs subvolume delete "$copydir" >/dev/null ||
|
||||||
die "Unable to delete subvolume $copydir"
|
die "Unable to delete subvolume %s" "$copydir"
|
||||||
else
|
else
|
||||||
# avoid change of filesystem in case of an umount failure
|
# avoid change of filesystem in case of an umount failure
|
||||||
rm --recursive --force --one-file-system "$copydir" ||
|
rm --recursive --force --one-file-system "$copydir" ||
|
||||||
die "Unable to delete $copydir"
|
die "Unable to delete %s" "$copydir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# remove lock file
|
# remove lock file
|
||||||
@@ -174,7 +185,9 @@ install_packages() {
|
|||||||
pkgname="${install_pkg##*/}"
|
pkgname="${install_pkg##*/}"
|
||||||
cp "$install_pkg" "$copydir/$pkgname"
|
cp "$install_pkg" "$copydir/$pkgname"
|
||||||
|
|
||||||
arch-nspawn "$copydir" pacman -U /$pkgname --noconfirm
|
arch-nspawn "$copydir" \
|
||||||
|
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
||||||
|
pacman -U /$pkgname --noconfirm
|
||||||
(( ret += !! $? ))
|
(( ret += !! $? ))
|
||||||
|
|
||||||
rm "$copydir/$pkgname"
|
rm "$copydir/$pkgname"
|
||||||
@@ -203,6 +216,11 @@ prepare_chroot() {
|
|||||||
echo 'PKGDEST="/pkgdest"' >> "$copydir/etc/makepkg.conf"
|
echo 'PKGDEST="/pkgdest"' >> "$copydir/etc/makepkg.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$copydir/srcpkgdest"
|
||||||
|
if ! grep -q 'SRCPKGDEST="/srcpkgdest"' "$copydir/etc/makepkg.conf"; then
|
||||||
|
echo 'SRCPKGDEST="/srcpkgdest"' >> "$copydir/etc/makepkg.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p "$copydir/logdest"
|
mkdir -p "$copydir/logdest"
|
||||||
if ! grep -q 'LOGDEST="/logdest"' "$copydir/etc/makepkg.conf"; then
|
if ! grep -q 'LOGDEST="/logdest"' "$copydir/etc/makepkg.conf"; then
|
||||||
echo 'LOGDEST="/logdest"' >> "$copydir/etc/makepkg.conf"
|
echo 'LOGDEST="/logdest"' >> "$copydir/etc/makepkg.conf"
|
||||||
@@ -216,7 +234,7 @@ prepare_chroot() {
|
|||||||
echo 'SRCDEST="/srcdest"' >> "$copydir/etc/makepkg.conf"
|
echo 'SRCDEST="/srcdest"' >> "$copydir/etc/makepkg.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chown -R nobody "$copydir"/{build,pkgdest,logdest,srcdest,startdir}
|
chown -R nobody "$copydir"/{build,pkgdest,srcpkgdest,logdest,srcdest,startdir}
|
||||||
|
|
||||||
if [[ -n $MAKEFLAGS ]]; then
|
if [[ -n $MAKEFLAGS ]]; then
|
||||||
sed -i '/^MAKEFLAGS=/d' "$copydir/etc/makepkg.conf"
|
sed -i '/^MAKEFLAGS=/d' "$copydir/etc/makepkg.conf"
|
||||||
@@ -276,14 +294,16 @@ _chrootbuild() {
|
|||||||
ln -sft /srcdest /srcdest_host/*
|
ln -sft /srcdest /srcdest_host/*
|
||||||
ln -sft /startdir /startdir_host/*
|
ln -sft /startdir /startdir_host/*
|
||||||
|
|
||||||
# XXX: Keep svn sources writable
|
# XXX: Keep bzr and svn sources writable
|
||||||
# Since makepkg 4.1.1 they get checked out via cp -a, copying the symlink
|
# Since makepkg 4.1.1 they get checked out via cp -a, copying the symlink
|
||||||
for dir in /srcdest /startdir; do
|
for dir in /srcdest /startdir; do
|
||||||
cd $dir
|
for vcs in bzr svn; do
|
||||||
for svndir in */.svn; do
|
cd "$dir"
|
||||||
rm ${svndir%/.svn}
|
for vcsdir in */.$vcs; do
|
||||||
cp -a ${dir}_host/${svndir%/.svn} .
|
rm "${vcsdir%/.$vcs}"
|
||||||
chown -R nobody ${svndir%/.svn}
|
cp -a "${dir}_host/${vcsdir%/.$vcs}" .
|
||||||
|
chown -R nobody "${vcsdir%/.$vcs}"
|
||||||
|
done
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -320,9 +340,15 @@ move_products() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
for l in "$copydir"/logdest/*; do
|
for l in "$copydir"/logdest/*; do
|
||||||
|
[[ $l == */logpipe.* ]] && continue
|
||||||
chown "$src_owner" "$l"
|
chown "$src_owner" "$l"
|
||||||
mv "$l" "$LOGDEST"
|
mv "$l" "$LOGDEST"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
for s in "$copydir"/srcpkgdest/*; do
|
||||||
|
chown "$src_owner" "$s"
|
||||||
|
mv "$s" "$SRCPKGDEST"
|
||||||
|
done
|
||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
@@ -334,11 +360,14 @@ load_vars /etc/makepkg.conf
|
|||||||
# Use PKGBUILD directory if these don't exist
|
# Use PKGBUILD directory if these don't exist
|
||||||
[[ -d $PKGDEST ]] || PKGDEST=$PWD
|
[[ -d $PKGDEST ]] || PKGDEST=$PWD
|
||||||
[[ -d $SRCDEST ]] || SRCDEST=$PWD
|
[[ -d $SRCDEST ]] || SRCDEST=$PWD
|
||||||
|
[[ -d $SRCPKGDEST ]] || SRCPKGDEST=$PWD
|
||||||
[[ -d $LOGDEST ]] || LOGDEST=$PWD
|
[[ -d $LOGDEST ]] || LOGDEST=$PWD
|
||||||
|
|
||||||
create_chroot
|
create_chroot
|
||||||
|
|
||||||
$update_first && arch-nspawn "$copydir" pacman -Syu --noconfirm
|
$update_first && arch-nspawn "$copydir" \
|
||||||
|
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
||||||
|
pacman -Syu --noconfirm
|
||||||
|
|
||||||
[[ -n ${install_pkgs[*]} ]] && install_packages
|
[[ -n ${install_pkgs[*]} ]] && install_packages
|
||||||
|
|
||||||
@@ -349,6 +378,7 @@ download_sources
|
|||||||
if arch-nspawn "$copydir" \
|
if arch-nspawn "$copydir" \
|
||||||
--bind-ro="$PWD:/startdir_host" \
|
--bind-ro="$PWD:/startdir_host" \
|
||||||
--bind-ro="$SRCDEST:/srcdest_host" \
|
--bind-ro="$SRCDEST:/srcdest_host" \
|
||||||
|
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
||||||
/chrootbuild
|
/chrootbuild
|
||||||
then
|
then
|
||||||
move_products
|
move_products
|
||||||
@@ -362,7 +392,7 @@ if (( ret != 0 )); then
|
|||||||
if $temp_chroot; then
|
if $temp_chroot; then
|
||||||
die "Build failed"
|
die "Build failed"
|
||||||
else
|
else
|
||||||
die "Build failed, check $copydir/build"
|
die "Build failed, check %s/build" "$copydir"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
true
|
true
|
||||||
|
@@ -30,8 +30,8 @@ CHOST="i686-pc-linux-gnu"
|
|||||||
# -march (or -mcpu) builds exclusively for an architecture
|
# -march (or -mcpu) builds exclusively for an architecture
|
||||||
# -mtune optimizes for an architecture, but builds for whole processor family
|
# -mtune optimizes for an architecture, but builds for whole processor family
|
||||||
CPPFLAGS="-D_FORTIFY_SOURCE=2"
|
CPPFLAGS="-D_FORTIFY_SOURCE=2"
|
||||||
CFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
|
CFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4"
|
||||||
CXXFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
|
CXXFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4"
|
||||||
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
|
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
|
||||||
#-- Make Flags: change this for DistCC/SMP systems
|
#-- Make Flags: change this for DistCC/SMP systems
|
||||||
#MAKEFLAGS="-j2"
|
#MAKEFLAGS="-j2"
|
||||||
@@ -67,7 +67,7 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
|||||||
# These are default values for the options=() settings
|
# These are default values for the options=() settings
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# Default: OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !upx !debug)
|
# Default: OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !upx !debug)
|
||||||
# A negated option will do the opposite of the comments below.
|
# A negated option will do the opposite of the comments below.
|
||||||
#
|
#
|
||||||
#-- strip: Strip symbols from binaries/libraries
|
#-- strip: Strip symbols from binaries/libraries
|
||||||
@@ -80,7 +80,7 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
|||||||
#-- upx: Compress binary executable files using UPX
|
#-- upx: Compress binary executable files using UPX
|
||||||
#-- debug: Add debugging flags as specified in DEBUG_* variables
|
#-- debug: Add debugging flags as specified in DEBUG_* variables
|
||||||
#
|
#
|
||||||
OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !upx !debug)
|
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !upx !debug)
|
||||||
|
|
||||||
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
||||||
INTEGRITY_CHECK=(md5)
|
INTEGRITY_CHECK=(md5)
|
||||||
@@ -109,6 +109,8 @@ PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
|
|||||||
#SRCDEST=/home/sources
|
#SRCDEST=/home/sources
|
||||||
#-- Source packages: specify a fixed directory where all src packages will be placed
|
#-- Source packages: specify a fixed directory where all src packages will be placed
|
||||||
#SRCPKGDEST=/home/srcpackages
|
#SRCPKGDEST=/home/srcpackages
|
||||||
|
#-- Log files: specify a fixed directory where all log files will be placed
|
||||||
|
#LOGDEST=/home/makepkglogs
|
||||||
#-- Packager: name/email of the person or organization building packages
|
#-- Packager: name/email of the person or organization building packages
|
||||||
#PACKAGER="John Doe <john@doe.com>"
|
#PACKAGER="John Doe <john@doe.com>"
|
||||||
#-- Specify a key to use for package signing
|
#-- Specify a key to use for package signing
|
||||||
|
@@ -30,8 +30,8 @@ CHOST="x86_64-unknown-linux-gnu"
|
|||||||
# -march (or -mcpu) builds exclusively for an architecture
|
# -march (or -mcpu) builds exclusively for an architecture
|
||||||
# -mtune optimizes for an architecture, but builds for whole processor family
|
# -mtune optimizes for an architecture, but builds for whole processor family
|
||||||
CPPFLAGS="-D_FORTIFY_SOURCE=2"
|
CPPFLAGS="-D_FORTIFY_SOURCE=2"
|
||||||
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
|
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4"
|
||||||
CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
|
CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4"
|
||||||
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
|
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
|
||||||
#-- Make Flags: change this for DistCC/SMP systems
|
#-- Make Flags: change this for DistCC/SMP systems
|
||||||
#MAKEFLAGS="-j2"
|
#MAKEFLAGS="-j2"
|
||||||
@@ -67,7 +67,7 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
|||||||
# These are default values for the options=() settings
|
# These are default values for the options=() settings
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# Default: OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !upx !debug)
|
# Default: OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !upx !debug)
|
||||||
# A negated option will do the opposite of the comments below.
|
# A negated option will do the opposite of the comments below.
|
||||||
#
|
#
|
||||||
#-- strip: Strip symbols from binaries/libraries
|
#-- strip: Strip symbols from binaries/libraries
|
||||||
@@ -80,7 +80,7 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
|||||||
#-- upx: Compress binary executable files using UPX
|
#-- upx: Compress binary executable files using UPX
|
||||||
#-- debug: Add debugging flags as specified in DEBUG_* variables
|
#-- debug: Add debugging flags as specified in DEBUG_* variables
|
||||||
#
|
#
|
||||||
OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !upx !debug)
|
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !upx !debug)
|
||||||
|
|
||||||
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
||||||
INTEGRITY_CHECK=(md5)
|
INTEGRITY_CHECK=(md5)
|
||||||
@@ -109,6 +109,8 @@ PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
|
|||||||
#SRCDEST=/home/sources
|
#SRCDEST=/home/sources
|
||||||
#-- Source packages: specify a fixed directory where all src packages will be placed
|
#-- Source packages: specify a fixed directory where all src packages will be placed
|
||||||
#SRCPKGDEST=/home/srcpackages
|
#SRCPKGDEST=/home/srcpackages
|
||||||
|
#-- Log files: specify a fixed directory where all log files will be placed
|
||||||
|
#LOGDEST=/home/makepkglogs
|
||||||
#-- Packager: name/email of the person or organization building packages
|
#-- Packager: name/email of the person or organization building packages
|
||||||
#PACKAGER="John Doe <john@doe.com>"
|
#PACKAGER="John Doe <john@doe.com>"
|
||||||
#-- Specify a key to use for package signing
|
#-- Specify a key to use for package signing
|
||||||
|
@@ -35,9 +35,10 @@ while getopts 'hC:M:c:' arg; do
|
|||||||
done
|
done
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
(( $EUID != 0 )) && die 'This script must be run as root.'
|
|
||||||
(( $# < 2 )) && die 'You must specify a directory and one or more packages.'
|
(( $# < 2 )) && die 'You must specify a directory and one or more packages.'
|
||||||
|
|
||||||
|
check_root "$0" "$@"
|
||||||
|
|
||||||
working_dir="$(readlink -f $1)"
|
working_dir="$(readlink -f $1)"
|
||||||
shift 1
|
shift 1
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ fi
|
|||||||
|
|
||||||
umask 0022
|
umask 0022
|
||||||
|
|
||||||
[[ -e $working_dir ]] && die "Working directory '$working_dir' already exists"
|
[[ -e $working_dir ]] && die "Working directory '%s' already exists" "$working_dir"
|
||||||
|
|
||||||
mkdir -p "$working_dir"
|
mkdir -p "$working_dir"
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ lock 9 "${working_dir}.lock" "Locking chroot"
|
|||||||
if [[ $(stat -f -c %T "$working_dir") == btrfs ]]; then
|
if [[ $(stat -f -c %T "$working_dir") == btrfs ]]; then
|
||||||
rmdir "$working_dir"
|
rmdir "$working_dir"
|
||||||
if ! btrfs subvolume create "$working_dir"; then
|
if ! btrfs subvolume create "$working_dir"; then
|
||||||
die "Couldn't create subvolume for '$working_dir'"
|
die "Couldn't create subvolume for '%s'" "$working_dir"
|
||||||
fi
|
fi
|
||||||
chmod 0755 "$working_dir"
|
chmod 0755 "$working_dir"
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user