diff options
author | Andreas Grapentin <andreas@grapentin.org> | 2018-03-31 10:34:13 +0200 |
---|---|---|
committer | Andreas Grapentin <andreas@grapentin.org> | 2018-03-31 10:40:18 +0200 |
commit | 7d0a8632714b131001c58e36dbb23e488b8a5251 (patch) | |
tree | 9ac15e05f675916130221fb1642975a122751269 | |
parent | c1fced40c2f37f844eb810216eb0a1da1a436aa8 (diff) |
rework arrived in stage4
96 files changed, 916 insertions, 3013 deletions
@@ -61,12 +61,12 @@ fi # shellcheck source=src/stage3/stage3.sh . "$TOPSRCDIR"/stage3/stage3.sh # shellcheck source=src/stage4/stage4.sh -#. "$TOPSRCDIR"/stage4/stage4.sh +. "$TOPSRCDIR"/stage4/stage4.sh # run stages stage1 || die -e "$ERROR_BUILDFAIL" "Stage 1 failed. Exiting..." stage2 || die -e "$ERROR_BUILDFAIL" "Stage 2 failed. Exiting..." stage3 || die -e "$ERROR_BUILDFAIL" "Stage 3 failed. Exiting..." -#stage4 +stage4 || die -e "$ERROR_BUILDFAIL" "Stage 4 failed. Exiting..." msg -n "all done." diff --git a/src/shared/common.sh b/src/shared/common.sh index 0a11251..81deaaf 100644 --- a/src/shared/common.sh +++ b/src/shared/common.sh @@ -30,6 +30,8 @@ . "$TOPSRCDIR"/shared/upstream.sh # shellcheck source=src/shared/deptree.sh . "$TOPSRCDIR"/shared/deptree.sh +# shellcheck source=src/shared/package.sh +. "$TOPSRCDIR"/shared/package.sh retry() { local OPTIND o n=5 s=60 @@ -49,6 +51,10 @@ retry() { "$@" || return } +runas() { + sudo -u "$1" --preserve-env=PKGDEST,LOGDEST,SRCDEST "${@:2}" +} + prepare_makepkgdir() { rm -rf "$1" mkdir -p "$1" @@ -57,13 +63,6 @@ prepare_makepkgdir() { pushd "$1" >/dev/null || return 1 } -find_lastlog() { - local log - # shellcheck disable=SC2010 - log=$(ls -t "$1" | grep -P "^$2(-[^-]*){3}-(pkgver|prepare|build|package)" | head -n1) - [ -n "$log" ] && echo "$log" -} - binfmt_enable() { echo 1 > /proc/sys/fs/binfmt_misc/status } @@ -71,22 +70,3 @@ binfmt_enable() { binfmt_disable() { echo 0 > /proc/sys/fs/binfmt_misc/status } - -#failed_build() { -# # FIXME -# _log=$(find "$_logdest" -type f -iname "$1-*" -printf "%T@ %p\n" \ -# | sort -n | tail -n1 | cut -d' ' -f2-) -# set +o pipefail -# _phase="" -# [ -z "$_log" ] || _phase=$(cat $_log | grep '==>.*occurred in' \ -# | awk '{print $7}' | sed 's/().*//') -# set -o pipefail -# if [ -n "${_phase:-}" ]; then -# notify -c error "$_pkgname: error in $_phase()" -h string:document:"$_log" -# else -# notify -c error "$_pkgname: error in makepkg" -# fi -# [ "x$KEEP_GOING" == "xyes" ] || die "error building $_pkgname" -# _build_failed=yes -#} - diff --git a/src/shared/deptree.sh b/src/shared/deptree.sh index ffc0af8..c01b2ca 100644 --- a/src/shared/deptree.sh +++ b/src/shared/deptree.sh @@ -32,21 +32,18 @@ build_deptree() { check_exe ed pacman sed || return # create empty deptree - truncate -s0 "$DEPTREE".FULL + truncate -s0 "$DEPTREE".FULL || return # add the packages listed in the given groups local g p r for g in "$@"; do for p in $(pacman -Sg "$g" | awk '{print $2}'); do r=$(make_realpkg "$p") || return "$ERROR_MISSING" - - if ! grep -q "^$r :" "$DEPTREE".FULL; then - echo "$r : [ ] # $g" >> "$DEPTREE".FULL - else - sed -i "s/^$r : \\[.*/&, $g/" "$DEPTREE".FULL - fi + deptree_add_entry "$r" "$g" done done + + return 0 } prepare_deptree() { @@ -67,7 +64,11 @@ deptree_remove() { sed -i "/^$1 :/d; s/ / /g; s/ $1 / /g; s/ */ /g" "$DEPTREE" } -deptree_check_depends() { +deptree_is_satisfyable() { + grep -q "^$1 : \\[ *\\]" "$DEPTREE" +} + +deptree_check_depend() { local OPTIND o needed=yes while getopts "n" o; do case "$o" in @@ -80,24 +81,28 @@ deptree_check_depends() { local pkg="$1" shift - local dep r res=0 - # shellcheck disable=SC2068 - for dep in $@; do - r=$(make_realpkg "$dep") || { res="$ERROR_MISSING"; continue; } - - local have_pkg=yes - check_pkgfile "$PKGDEST" "$r" || have_pkg=no - - if ! grep -q "^$r :" "$DEPTREE".FULL; then - echo "$r : [ ] # $pkg" >> "$DEPTREE".FULL - echo "$r : [ ] # $pkg" >> "$DEPTREE" - else - sed -i "/#.* $pkg\\(\\$\\|[ ,]\\)/! s/^$r : \\[.*/&, $pkg/" "$DEPTREE"{,.FULL} - fi - if [ "x$needed" == "xyes" ] && [ "x$have_pkg" == "xno" ]; then - sed -i "s/^$pkg : \\[/& $r/" "$DEPTREE"{,.FULL} - fi + local r + r=$(make_realpkg "$1") || return + deptree_add_entry "$r" "$pkg" + + local have_pkg=no + local path + for path in "${DEPPATH[@]}"; do + check_pkgfile "$path" "$r" && have_pkg=yes done - return "$res" + if [ "x$needed" == "xyes" ] && [ "x$have_pkg" == "xno" ]; then + sed -i "s/^$pkg : \\[/& $r/" "$DEPTREE"{,.FULL} + fi +} + +deptree_add_entry() { + local r="${2:-<cmd>}" + + if ! grep -q "^$1 :" "$DEPTREE".FULL; then + echo "$1 : [ ] # $r" >> "$DEPTREE".FULL + [ -f "$DEPTREE" ] && echo "$1 : [ ] # $r" >> "$DEPTREE" + else + sed -i "/#.* $r\\(\$\\|[ ,]\\)/! s/^$1 : \\[.*/&, $r/" "$DEPTREE"* + fi } diff --git a/src/shared/package.sh b/src/shared/package.sh new file mode 100644 index 0000000..f252bf6 --- /dev/null +++ b/src/shared/package.sh @@ -0,0 +1,147 @@ +#!/bin/bash + ############################################################################## + # parabola-riscv64-bootstrap # + # # + # Copyright (C) 2018 Andreas Grapentin # + # # + # This program is free software: you can redistribute it and/or modify # + # it under the terms of the GNU General Public License as published by # + # the Free Software Foundation, either version 3 of the License, or # + # (at your option) any later version. # + # # + # This program is distributed in the hope that it will be useful, # + # but WITHOUT ANY WARRANTY; without even the implied warranty of # + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # + # GNU General Public License for more details. # + # # + # You should have received a copy of the GNU General Public License # + # along with this program. If not, see <http://www.gnu.org/licenses/>. # + ############################################################################## + +package_build() { + local pkgname="$3" + + deptree_is_satisfyable "$pkgname" || return 0 + + msg "makepkg: $pkgname" + msg " remaining packages: $(wc -l < "$DEPTREE")" + + prepare_makepkgdir "$MAKEPKGDIR/$pkgname" || return + + local res=0 + "$1" "$pkgname" 2>&1 | tee .MAKEPKGLOG + res="${PIPESTATUS[0]}" + + popd >/dev/null || return + + if [ "$res" -ne 0 ]; then + notify -c error "$pkgname" -h string:document:"$MAKEPKGDIR/$pkgname/.MAKEPKGLOG" + if [ "x$KEEP_GOING" == "xyes" ]; then + sed -i "s/^$pkgname : \\[/& FIXME/" "$DEPTREE" + else + return "$res" + fi + fi + + deptree_is_satisfyable "$pkgname" || return 0 + + "$2" "$pkgname" || return + + deptree_remove "$pkgname" + + local full curr + full=$(wc -l < "$DEPTREE".FULL) + curr=$((full - $(wc -l < "$DEPTREE"))) + notify -c success -u low "*$curr/$full* $pkgname" +} + +packages_build_all() { + while [ -s "$DEPTREE" ]; do + local pkgname pkgarch + pkgname=$(deptree_next) \ + || { error "could not resolve dependencies"; return "$ERROR_MISSING"; } + + package_build "$1" "$2" "$pkgname" || return + done +} + +package_reuse_upstream() { + local dep + for dep in $(pkgdeps "$1"); do + deptree_check_depend "$1" "$dep" || return + done + deptree_is_satisfyable "$1" || return 0 + + check_pkgfile "$PKGPOOL" "$1" && return + + local pkgarch + pkgarch=$(pkgarch "$1") + + case "$pkgarch" in + any) + pacman -Sddw --noconfirm --cachedir "$PKGDEST" "$1" || return + ;; + *) + pacman -Sddw --noconfirm --cachedir . "$1" || return + local pkgdir="$MAKEPKGDIR/$1/pkg/$1" + local pkgfiles pkgfile + pkgfiles=( "$1"-*.pkg.tar.xz ); pkgfile="${pkgfiles[0]}" + mkdir -p "$pkgdir" + bsdtar -C "$pkgdir" -xf "$pkgfile" || return + sed -i "s/arch = .*/arch = $CARCH/" "$pkgdir"/.PKGINFO + pushd "$pkgdir" >/dev/null || return + env LANG=C bsdtar -cf - .MTREE .PKGINFO .BUILDINFO ./* | xz -c -z - > \ + "$PKGDEST/${pkgfile%-*}-$CARCH.pkg.tar.xz" || return + popd >/dev/null || return + ;; + esac +} + +package_enable_arch() { + sed -i "/arch=(.*\\bany\\b.*)/!s/arch=([^)]*/& $1/" PKGBUILD + + # force regeneration of .SRCINFO + rm -f .SRCINFO +} + +package_patch() { + local OPTIND o p='' r=no + while getopts "p:r" o; do + case "$o" in + p) p="-$OPTARG" ;; + r) r=yes ;; + *) die -e "$ERROR_INVOCATION" "Usage: ${FUNCNAME[0]} [-p prefix] [-r] pkgname" ;; + esac + done + shift $((OPTIND-1)) + + local pkgbase + pkgbase=$(srcinfo_pkgbase) || return + + local patch="$SRCDIR/patches/$pkgbase$p".patch + + if [ "x$r" == "xyes" ] && [ ! -e "$patch" ]; then + error -n "$pkgname: missing $pkgbase$p.patch" + return "$ERROR_MISSING" + fi + + cp PKGBUILD{,.orig} + [ ! -e "$patch" ] || patch -Np1 -i "$patch" || return + cp PKGBUILD{,.in} + + # force regeneration of .SRCINFO + rm -f .SRCINFO +} + +package_import_keys() { + local keys k + keys="$(srcinfo_validpgpkeys)" + for k in $keys; do + check_gpgkey "$k" && continue + if ! retry -n 5 -s 60 sudo -u "$SUDO_USER" gpg --recv-keys "$k"; then + error -n "failed to import key '$k'" + return "$ERROR_KEYFAIL" + fi + done +} + diff --git a/src/shared/pacman.sh b/src/shared/pacman.sh index fde78e7..3ea06e4 100644 --- a/src/shared/pacman.sh +++ b/src/shared/pacman.sh @@ -18,18 +18,6 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## -import_keys() { - local keys k - keys="$(srcinfo_validpgpkeys)" - for k in $keys; do - check_gpgkey "$k" && continue - if ! retry -n 5 -s 60 sudo -u "$SUDO_USER" gpg --recv-keys "$k"; then - error -n "failed to import key '$k'" - return "$ERROR_KEYFAIL" - fi - done -} - pkgdeps() { pacman -Si "$1" | grep '^Depends' | cut -d':' -f2 | sed 's/None//' } @@ -51,6 +39,20 @@ pkgver() { echo "$pkgver" } +pkgdesc() { + local pkgdesc + pkgdesc=$(pacman -Si "$1" | grep '^Descr' | cut -d':' -f2 | sed 's/^ *//') || return + [ -n "$pkgdesc" ] || return + echo "$pkgdesc" +} + +pkgurl() { + local pkgurl + pkgurl=$(pacman -Si "$1" | grep '^URL' | cut -d':' -f2 | sed 's/^ *//') || return + [ -n "$pkgurl" ] || return + echo "$pkgurl" +} + make_realpkg() { local dep realpkg diff --git a/src/shared/upstream.sh b/src/shared/upstream.sh index d310be7..ff4552d 100644 --- a/src/shared/upstream.sh +++ b/src/shared/upstream.sh @@ -19,17 +19,11 @@ ############################################################################## package_get_upstream_repo() { - local repo url response target= - for repo in core extra community; do - url=https://www.archlinux.org/packages/$repo/x86_64/$1/ - response=$(retry -n 5 -s 60 curl -sL "$url") || die "failed to retrieve url $url" - grep -iq "Arch Linux - $1" <<< "$response" || continue - - target=$repo - break - done - [ -z "$target" ] || target=libre - echo $target + local repo repoinfo + repoinfo=$(asp list-repos "$1") || repoinfo="" + repo=$(grep -P '^(core|extra|community)' <<< "$repoinfo" | head -n1) + [ -z "$repo" ] && repo=libre + echo "$repo" } package_fetch_upstream_pkgfiles() { @@ -66,28 +60,3 @@ package_fetch_upstream_pkgfiles() { return "$ERROR_MISSING" fi } - -#package_fetch_upstream_pkgfiles() { -# FIXME -# # acquire the pkgbuild and auxiliary files -# local url=https://www.parabola.nu/packages/libre/x86_64/$1/ -# _fetch_pkgfiles_from $url && echo "libre" > .REPO && return -# -# local repo -# for repo in core extra community; do -# url=https://www.archlinux.org/packages/$repo/x86_64/$1/ -# _fetch_pkgfiles_from $url && echo "$repo" > .REPO && return -# done -# die "$1: failed to fetch pkgfiles" -#} -# -#_fetch_pkgfiles_from() { -# curl -sL $url | grep -iq 'not found' && return 1 -# local src=$(curl -sL $url | grep -i 'source files' | cut -d'"' -f2 | sed 's#/tree/#/plain/#') -# for link in $(curl -sL $src | grep '^ <li><a href' | cut -d"'" -f2 \ -# | sed "s#^#$(echo $src | awk -F/ '{print $3}')#"); do -# wget -q $link -O $(basename ${link%\?*}); -# done -# [ -f PKGBUILD ] || return 1 -#} - diff --git a/src/stage1/stage1.sh b/src/stage1/stage1.sh index 0715724..2bf3bc5 100755 --- a/src/stage1/stage1.sh +++ b/src/stage1/stage1.sh @@ -47,18 +47,39 @@ check_cross_toolchain() { [ "x$have_glibc" == "xyes" ] || return 1 } +stage1_makepkg() { + # produce pkgfiles + for f in "$SRCDIR"/toolchain-pkgbuilds/$pkg/*.in; do + sed "s#@CHOST@#$CHOST#g; \ + s#@CARCH@#$CARCH#g; \ + s#@LINUX_ARCH@#$LINUX_ARCH#g; \ + s#@GCC_MARCH@#${GCC_MARCH:-}#g; \ + s#@GCC_MABI@#${GCC_MABI:-}#g; \ + s#@MULTILIB@#${MULTILIB:-disable}#g; \ + s#@GCC_32_MARCH@#${GCC_32_MARCH:-}#g; \ + s#@GCC_32_MABI@#${GCC_32_MABI:-}#g; \ + s#@CARCH32@#${CARCH32:-}#g; \ + s#@CHOST32@#${CHOST32:-}#g" \ + "$f" > ./"$(basename "${f%.in}")" + done + + import_keys || return + + runas "$SUDO_USER" makepkg -LC --config "$BUILDDIR"/makepkg.conf || return +} + stage1() { msg -n "Entering Stage 1" export BUILDDIR="$TOPBUILDDIR"/stage1 export SRCDIR="$TOPSRCDIR"/stage1 + export MAKEPKGDIR="$BUILDDIR" export PKGDEST="$BUILDDIR"/packages export LOGDEST="$BUILDDIR"/makepkglogs - export MAKEPKGDIR="$BUILDDIR" check_cross_toolchain && return - check_exe gpg makepkg pacman sed sudo || return + check_exe gpg makepkg pacman sed || return # create required directories mkdir -p "$LOGDEST" "$PKGDEST" "$SRCDEST" @@ -67,9 +88,6 @@ stage1() { # create a sane makepkg.conf cat "$SRCDIR"/makepkg.conf.in > "$BUILDDIR"/makepkg.conf cat >> "$BUILDDIR"/makepkg.conf << EOF -LOGDEST="$LOGDEST" -PKGDEST="$PKGDEST" -SRCDEST="$SRCDEST" MAKEFLAGS="-j$(($(nproc) + 1))" EOF @@ -80,35 +98,17 @@ EOF if ! check_pkgfile "$PKGDEST" "$CHOST-$pkg"; then prepare_makepkgdir "$MAKEPKGDIR/$CHOST-$pkg" || return - # produce pkgfiles - for f in "$SRCDIR"/toolchain-pkgbuilds/$pkg/*.in; do cp "$f" "$(basename "${f%.in}")"; done - sed -i "s#@CHOST@#$CHOST#g; \ - s#@CARCH@#$CARCH#g; \ - s#@LINUX_ARCH@#$LINUX_ARCH#g; \ - s#@GCC_MARCH@#${GCC_MARCH:-}#g; \ - s#@GCC_MABI@#${GCC_MABI:-}#g; \ - s#@MULTILIB@#${MULTILIB:-disable}#g; \ - s#@GCC_32_MARCH@#${GCC_32_MARCH:-}#g; \ - s#@GCC_32_MABI@#${GCC_32_MABI:-}#g; \ - s#@CARCH32@#${CARCH32:-}#g; \ - s#@CHOST32@#${CHOST32:-}#g" \ - PKGBUILD - - import_keys || return - - if ! sudo -u "$SUDO_USER" makepkg -LC --config "$BUILDDIR"/makepkg.conf; then - local log phase - log=$(find_lastlog "$LOGDEST" "$CHOST-$pkg") - if [ -z "$log" ]; then - error -n "$CHOST-$pkg: error in makepkg" - else - phase=$(sed 's/.*\(pkgver\|prepare\|build\|package\).*/\1/' <<< "$log") - error -n -d "$log" "$CHOST-$pkg: error in $phase" - fi - return "$ERROR_BUILDFAIL" - fi + local res=0 + stage1_makepkg "$pkg" 2>&1 | tee .MAKEPKGLOG + res="${PIPESTATUS[0]}" popd >/dev/null || return + + if [ "$res" -ne 0 ]; then + notify -c error "$CHOST-$pkg" -h string:document:"$(readlink -f .MAKEPKGLOG)" + return "$res" + fi + notify -c success -u low "$CHOST-$pkg" fi diff --git a/src/stage2/chroot.sh b/src/stage2/chroot.sh index 9a1384f..f815331 100644 --- a/src/stage2/chroot.sh +++ b/src/stage2/chroot.sh @@ -18,7 +18,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## -check_chroot() { +check_stage2_chroot() { echo -n "checking for functional $CARCH skeleton chroot ... " local pacman_works=yes @@ -28,7 +28,7 @@ check_chroot() { [ "x$pacman_works" == "xyes" ] || return "$ERROR_MISSING" } -build_chroot() { +build_stage2_chroot() { # create directories rm -rf "$CHROOTDIR" mkdir -pv "$CHROOTDIR"/etc/pacman.d/{gnupg,hooks} \ @@ -55,24 +55,24 @@ EOF cp -ar "$SYSROOT"/usr "$CHROOTDIR"/ # final sanity check - check_chroot || return + check_stage2_chroot || return } -umount_chrootdir() { +umount_stage2_chrootdir() { umount "$SYSROOT"/usr trap - INT TERM EXIT } -mount_chrootdir() { - if mount | grep -q "$SYSROOT/usr"; then umount_chrootdir; fi +mount_stage2_chrootdir() { + if mount | grep -q "$SYSROOT/usr"; then umount_stage2_chrootdir; fi mount -o bind "$CHROOTDIR"/usr "$SYSROOT"/usr - trap 'umount_chrootdir' INT TERM EXIT + trap 'umount_stage2_chrootdir' INT TERM EXIT } -prepare_chroot() { - check_chroot || build_chroot || return +prepare_stage2_chroot() { + check_stage2_chroot || build_stage2_chroot || return - mount_chrootdir + mount_stage2_chrootdir } diff --git a/src/stage2/makepkg.sh b/src/stage2/makepkg.sh index fd3a4f7..31e9633 100644 --- a/src/stage2/makepkg.sh +++ b/src/stage2/makepkg.sh @@ -18,17 +18,17 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## -check_makepkg() { +check_stage2_makepkg() { echo -n "checking for makepkg-$CARCH.sh ... " - local have_makepkg=yes - [ -f "$BUILDDIR"/makepkg-"$CARCH".sh ] || have_makepkg=no - echo $have_makepkg + local have_stage2_makepkg=yes + [ -f "$BUILDDIR"/makepkg-"$CARCH".sh ] || have_stage2_makepkg=no + echo $have_stage2_makepkg - [ "x$have_makepkg" == "xyes" ] || return "$ERROR_MISSING" + [ "x$have_stage2_makepkg" == "xyes" ] || return "$ERROR_MISSING" } -build_makepkg() { +build_stage2_makepkg() { check_exe bsdtar pacman || return prepare_makepkgdir "$MAKEPKGDIR/makepkg-$CARCH" || return @@ -47,8 +47,8 @@ build_makepkg() { popd >/dev/null || return } -prepare_makepkg() { - check_makepkg || build_makepkg || return +prepare_stage2_makepkg() { + check_stage2_makepkg || build_stage2_makepkg || return # create a sane makepkg.conf cat "$SRCDIR"/makepkg.conf.in > "$BUILDDIR"/makepkg-"$CARCH".conf @@ -57,9 +57,6 @@ CARCH="$CARCH" CHOST="$CHOST" CFLAGS="-march=$GCC_MARCH -mabi=$GCC_MABI -O2 -pipe -fstack-protector-strong -fno-plt" CXXFLAGS="-march=$GCC_MARCH -mabi=$GCC_MABI -O2 -pipe -fstack-protector-strong -fno-plt" -LOGDEST="$LOGDEST" -PKGDEST="$PKGDEST" -SRCDEST="$SRCDEST" MAKEFLAGS="-j$(($(nproc) + 1))" EOF diff --git a/src/stage2/patches/glib2.patch b/src/stage2/patches/glib2.patch index d10b45b..81ae1ac 100644 --- a/src/stage2/patches/glib2.patch +++ b/src/stage2/patches/glib2.patch @@ -1,6 +1,6 @@ --- a/PKGBUILD 2018-02-21 21:54:28.027494092 +0100 +++ b/PKGBUILD 2018-02-21 22:13:00.992257732 +0100 -@@ -2,7 +2,7 @@ +@@ -2,14 +2,14 @@ # Maintainer: Jan de Groot <jgc@archlinux.org> pkgbase=glib2 @@ -9,6 +9,14 @@ pkgver=2.56.0+7+g66948ae23 pkgrel=1 pkgdesc="Low level core library" + url="https://wiki.gnome.org/Projects/GLib" + license=(LGPL2.1) + arch=(x86_64) +-depends=(pcre libffi libutil-linux zlib) ++depends=(pcre libffi libutil-linux zlib libelf) + makedepends=(gettext gtk-doc shared-mime-info python libelf git util-linux dbus) + checkdepends=(desktop-file-utils) + optdepends=('python: for gdbus-codegen and gtester-report' @@ -43,13 +43,18 @@ build() { check_option debug n && debug=yes diff --git a/src/stage2/patches/systemd.patch b/src/stage2/patches/systemd.patch index 09c622d..b1803fe 100644 --- a/src/stage2/patches/systemd.patch +++ b/src/stage2/patches/systemd.patch @@ -5,7 +5,7 @@ makedepends_i686=('gnu-efi-libs') makedepends_x86_64=('gnu-efi-libs') -options=('strip') -+depends=('libutil-linux' 'pcre2') ++depends=('libutil-linux' 'pcre2' 'libidn' 'libseccomp' 'kmod') validpgpkeys=('63CDA1E5D3FC22B998D20DD6327F26951A015CC4' # Lennart Poettering <lennart@poettering.net> '5C251B5FC54EB2F80F407AAAC54CA336CFEB557E') # Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> source=('git+https://github.com/systemd/systemd-stable' diff --git a/src/stage2/stage2.sh b/src/stage2/stage2.sh index ecd0340..4231b85 100755 --- a/src/stage2/stage2.sh +++ b/src/stage2/stage2.sh @@ -23,67 +23,13 @@ # shellcheck source=src/stage2/chroot.sh . "$TOPSRCDIR"/stage2/chroot.sh -build_pkg_any() { - local dep - for dep in $(pkgdeps "$pkgname"); do - deptree_check_depends "$pkgname" "$dep" || return - done - [ "x$(deptree_next)" != "x$pkgname" ] && return - - check_pkgfile "$PKGDEST" "$pkgname" && return - - pacman -Sddw --noconfirm --cachedir "$PKGDEST" "$pkgname" || return -} - -build_pkg_ca-certificates-mozilla() { - # repackage ca-certificates-mozilla to avoid building nss - local dep - for dep in $(pkgdeps "$pkgname"); do - deptree_check_depends "$pkgname" "$dep" || return - done - [ "x$(deptree_next)" != "x$pkgname" ] && return - - check_pkgfile "$PKGDEST" "$pkgname" && return - - local pkgver pkgdir="$MAKEPKGDIR"/$pkgname/pkg/$pkgname - pkgver=$(pkgver "$pkgname") || return - pacman -Sddw --noconfirm --cachedir . "$pkgname" || return - mkdir tmp && bsdtar -C tmp -xf "$pkgname"-*.pkg.tar.xz || return - mkdir -p "$pkgdir"/usr/share/ - cp -rv tmp/usr/share/ca-certificates/ "$pkgdir"/usr/share/ - cat > "$pkgdir"/.PKGINFO << EOF -pkgname = $pkgname -pkgver = $pkgver -pkgdesc = Mozilla's set of trusted CA certificates -url = https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS -builddate = $(date '+%s') -size = 0 -arch = $pkgarch -EOF - cd "$pkgdir" || return - env LANG=C bsdtar -czf .MTREE \ - --format=mtree \ - --options='!all,use-set,type,uid,gid,mode,time,size,md5,sha256,link' \ - .PKGINFO ./* || return - env LANG=C bsdtar -cf - .MTREE .PKGINFO ./* | xz -c -z - > \ - "$PKGDEST/$pkgname-$pkgver-$pkgarch.pkg.tar.xz" || return -} - -build_stage2_pkg() { - package_fetch_upstream_pkgfiles "$pkgname" || return - import_keys || return - - local pkgbase - pkgbase=$(srcinfo_pkgbase) || return - - # patch for cross-compiling - cp PKGBUILD{,.old} - patch -Np1 -i "$SRCDIR"/patches/"$pkgbase".patch || return - cp PKGBUILD{,.in} +stage2_makepkg() { + package_fetch_upstream_pkgfiles "$1" || return + package_import_keys "$1" || return + package_patch -r "$1" || return # substitute common variables - sed -i \ - "s#@CARCH@#$CARCH#g; \ + sed "s#@CARCH@#$CARCH#g; \ s#@CHOST@#$CHOST#g; \ s#@GCC_MARCH@#$GCC_MARCH#g; \ s#@GCC_MABI@#$GCC_MABI#g; \ @@ -91,35 +37,31 @@ build_stage2_pkg() { s#@CHOST32@#${CHOST32:-}#g; \ s#@GCC32_MARCH@#${GCC32_MARCH:-}#g; \ s#@GCC32_MABI@#${GCC32_MABI:-}#g; \ - s#@BUILDHOST@#$BUILDHOST#g; \ + s#@BUILDHOST@#$(gcc -dumpmachine)#g; \ s#@SYSROOT@#$SYSROOT#g; \ s#@LINUX_ARCH@#$LINUX_ARCH#g; \ s#@MULTILIB@#${MULTILIB:-disable}#g;" \ - PKGBUILD - - # enable the target CARCH in arch array - sed -i "s/arch=([^)]*/& $CARCH/" PKGBUILD + PKGBUILD.in > PKGBUILD - # force regeneration of .SRCINFO - rm .SRCINFO + package_enable_arch "$CARCH" # check built dependencies local dep for dep in $(srcinfo_builddeps -nm); do - deptree_check_depends "$pkgname" "$dep" || return + deptree_check_depend "$1" "$dep" || return done - for dep in $(srcinfo_rundeps "$pkgname"); do - deptree_check_depends "$pkgname" "$dep" || return + for dep in $(srcinfo_rundeps "$1"); do + deptree_check_depend "$1" "$dep" || return done # postpone build if necessary - [ "x$(deptree_next)" != "x$pkgname" ] && return + deptree_is_satisfyable "$1" || return 0 # don't rebuild if already exists - check_pkgfile "$PKGDEST" "$pkgname" && return + check_pkgfile "$PKGDEST" "$1" && return # build the package - sudo -u "$SUDO_USER" \ + runas "$SUDO_USER" \ "$BUILDDIR"/makepkg-"$CARCH".sh -fLC --config "$BUILDDIR"/makepkg-"$CARCH".conf \ --nocheck --nodeps --nobuild --noconfirm || return @@ -128,35 +70,41 @@ build_stage2_pkg() { find src -iname config.sub -print -exec curl "$url;f=config.sub;hb=HEAD" -o {} \; || return fi - sudo -u "$SUDO_USER" \ + runas "$SUDO_USER" \ "$BUILDDIR"/makepkg-"$CARCH".sh -efL --config "$BUILDDIR"/makepkg-"$CARCH".conf \ --nocheck --nodeps --noprepare --noconfirm || return } -build_pkg() { - local pkgname="$1" - pkgarch=$(pkgarch "$pkgname") || return +stage2_package_build() { + local pkgarch + pkgarch=$(pkgarch "$1") || return - if [ "x$pkgarch" == "xany" ]; then - build_pkg_any "$1" || return - elif [ "x$pkgname" == "xca-certificates-mozilla" ]; then - build_pkg_ca-certificates-mozilla "$1" || return + if [ "x$pkgarch" == "xany" ] || [ "x$1" == "xca-certificates-mozilla" ]; then + package_reuse_upstream "$1" || return else - build_stage2_pkg "$1" || return + stage2_makepkg "$1" || return fi # postpone on unmet dependencies - [ "x$(deptree_next)" != "x$pkgname" ] && return + deptree_is_satisfyable "$1" || return 0 - # update pacman cache + # update repo rm -rf "$CHROOTDIR"/var/cache/pacman/pkg/* rm -rf "$PKGDEST"/cross.{db,files}* repo-add -q -R "$PKGDEST"/{cross.db.tar.gz,*.pkg.tar.xz} } +stage2_package_install() { + # install in chroot + yes | pacman --noscriptlet --force --config "$CHROOTDIR"/etc/pacman.conf \ + -r "$CHROOTDIR" -Syydd "$1" || return +} + stage2() { msg -n "Entering Stage 2" + local groups=(base-devel) + local sysroot sysroot="$("$CHOST"-gcc --print-sysroot)" @@ -166,56 +114,30 @@ stage2() { export MAKEPKGDIR="$BUILDDIR"/$CARCH-makepkg export DEPTREE="$BUILDDIR"/DEPTREE export SYSROOT="$sysroot" - export BUILDHOST="x86_64-pc-linux-gnu" export PKGDEST="$BUILDDIR"/packages/$CARCH + export PKGPOOL="$PKGDEST" export LOGDEST="$BUILDDIR"/makepkglogs + export DEPPATH=("$PKGDEST") - mkdir -p "$PKGDEST" "$LOGDEST" - chown "$SUDO_USER" "$PKGDEST" "$LOGDEST" + mkdir -p "$PKGDEST" "$PKGPOOL" "$LOGDEST" + chown "$SUDO_USER" "$PKGDEST" "$PKGPOOL" "$LOGDEST" binfmt_disable - prepare_makepkg || die -e "$ERROR_BUILDFAIL" "failed to prepare $CARCH makepkg" - prepare_chroot || die -e "$ERROR_BUILDFAIL" "failed to prepare $CARCH chroot" - prepare_deptree base-devel || die -e "$ERROR_BUILDFAIL" "failed to prepare DEPTREE" + prepare_stage2_makepkg || die -e "$ERROR_BUILDFAIL" "failed to prepare $CARCH makepkg" + prepare_stage2_chroot || die -e "$ERROR_BUILDFAIL" "failed to prepare $CARCH chroot" + prepare_deptree "${groups[@]}" || die -e "$ERROR_BUILDFAIL" "failed to prepare DEPTREE" echo "remaining pkges: $(wc -l < "$DEPTREE") / $(wc -l < "$DEPTREE".FULL)" - [ -s "$DEPTREE" ] || return 0 - - # pull in various tools required to run the scripts or build the packages - check_exe -r arch-meson asp awk bsdtar git gperf help2man pacman sed svn tar tclsh - - while [ -s "$DEPTREE" ]; do - local pkgname pkgarch - pkgname=$(deptree_next) \ - || die -e "$ERROR_MISSING" "could not resolve dependencies" - - msg "makepkg: $pkgname" - msg " remaining packages: $(wc -l < "$DEPTREE")" - - prepare_makepkgdir "$MAKEPKGDIR/$pkgname" || return - build_pkg "$pkgname" 2>&1 | tee .MAKEPKGLOG - if [ "${PIPESTATUS[0]}" -ne 0 ]; then - notify -c error "$pkgname" -h string:document:.MAKEPKGLOG - [ "x$KEEP_GOING" == "xyes" ] || return - sed -i "s/^$pkgname : \\[/& FIXME/" "$DEPTREE" - fi + if [ -s "$DEPTREE" ]; then + # pull in various tools required to run the scripts or build the packages + check_exe -r arch-meson asp awk bsdtar git gperf help2man pacman sed svn tar tclsh - popd >/dev/null || return - - [ "x$(deptree_next)" != "x$pkgname" ] && continue - - # install in chroot - yes | pacman --noscriptlet --force --config "$CHROOTDIR"/etc/pacman.conf \ - -r "$CHROOTDIR" -Syydd "$pkgname" || die -e "$ERROR_BUILDFAIL" "failed to install pkg" - - deptree_remove "$pkgname" - - full=$(wc -l < "$DEPTREE".FULL) - curr=$((full - $(wc -l < "$DEPTREE"))) - notify -c success -u low "*$curr/$full* $pkgname" - done + # build packages from deptree + packages_build_all stage2_package_build stage2_package_install || return + fi - umount_chrootdir + # cleanup + umount_stage2_chrootdir } diff --git a/src/stage3/chroot.sh b/src/stage3/chroot.sh new file mode 100644 index 0000000..3d64546 --- /dev/null +++ b/src/stage3/chroot.sh @@ -0,0 +1,72 @@ +#!/bin/bash + ############################################################################## + # parabola-riscv64-bootstrap # + # # + # Copyright (C) 2018 Andreas Grapentin # + # # + # This program is free software: you can redistribute it and/or modify # + # it under the terms of the GNU General Public License as published by # + # the Free Software Foundation, either version 3 of the License, or # + # (at your option) any later version. # + # # + # This program is distributed in the hope that it will be useful, # + # but WITHOUT ANY WARRANTY; without even the implied warranty of # + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # + # GNU General Public License for more details. # + # # + # You should have received a copy of the GNU General Public License # + # along with this program. If not, see <http://www.gnu.org/licenses/>. # + ############################################################################## + +check_stage3_chroot() { + echo -n "checking for $CARCH chroot ... " + + local have_chroot=yes + [ -e "$1" ] || have_chroot=no + echo $have_chroot + + [ "x$have_chroot" == "xyes" ] || return "$ERROR_MISSING" +} + +build_stage3_chroot() { + rm -rf /var/cache/pacman/pkg-"$CARCH"/* + librechroot -n "$CHOST-stage3" \ + -C "$BUILDDIR"/config/pacman-bootstrap.conf \ + -M "$BUILDDIR"/config/makepkg.conf \ + make || return +} + +umount_stage3_chrootdir() { + local chrootdir + chrootdir="$(librechroot -n "$CHOST-stage3" 2>&1 | grep "copydir.*:" | awk '{print $3}')" + + umount "$chrootdir"/repos/native/"$CARCH" + umount "$chrootdir"/repos/cross/"$CARCH" + + trap - INT TERM EXIT +} + +mount_stage3_chrootdir() { + mkdir -p "$1"/repos/{native,cross}/"$CARCH" + for repo in native cross; do + if mount | grep -q "$1/repos/$repo/$CARCH"; then umount "$1/repos/$repo/$CARCH"; fi + done + mount -o bind "$PKGDEST" "$1"/repos/native/"$CARCH" + mount -o bind "${PKGDEST//stage3/stage2}" "$1"/repos/cross/"$CARCH" + + trap 'umount_stage3_chrootdir' INT TERM EXIT +} + +prepare_stage3_chroot() { + local chrootdir + chrootdir="$(librechroot -n "$CHOST-stage3" 2>&1 | grep "copydir.*:" | awk '{print $3}')" + + check_stage3_chroot "$chrootdir" || build_stage3_chroot "$chrootdir" || return + + mount_stage3_chrootdir "$chrootdir" + + librechroot -n "$CHOST-stage3" \ + -C "$BUILDDIR"/config/pacman.conf \ + -M "$BUILDDIR"/config/makepkg.conf \ + update || return +} diff --git a/src/stage3/makepkg.sh b/src/stage3/makepkg.sh new file mode 100644 index 0000000..99d5971 --- /dev/null +++ b/src/stage3/makepkg.sh @@ -0,0 +1,69 @@ +#!/bin/bash + ############################################################################## + # parabola-riscv64-bootstrap # + # # + # Copyright (C) 2018 Andreas Grapentin # + # # + # This program is free software: you can redistribute it and/or modify # + # it under the terms of the GNU General Public License as published by # + # the Free Software Foundation, either version 3 of the License, or # + # (at your option) any later version. # + # # + # This program is distributed in the hope that it will be useful, # + # but WITHOUT ANY WARRANTY; without even the implied warranty of # + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # + # GNU General Public License for more details. # + # # + # You should have received a copy of the GNU General Public License # + # along with this program. If not, see <http://www.gnu.org/licenses/>. # + ############################################################################## + +prepare_stage3_makepkg() { + mkdir -p "$BUILDDIR"/config + + cat > "$BUILDDIR"/config/pacman-bootstrap.conf << EOF +[options] +Architecture = $CARCH +[native] +Server = file://$TOPBUILDDIR/stage3/packages/\$arch +[cross] +Server = file://$TOPBUILDDIR/stage2/packages/\$arch +EOF + + cat > "$BUILDDIR"/config/pacman.conf << EOF +[options] +Architecture = $CARCH +[native] +Server = file:///repos/native/\$arch +[cross] +Server = file:///repos/cross/\$arch +EOF + + cat "$SRCDIR"/makepkg.conf.in > "$BUILDDIR"/config/makepkg.conf + cat >> "$BUILDDIR"/config/makepkg.conf << EOF +CARCH="$CARCH" +CHOST="$CHOST" +CFLAGS="-march=$GCC_MARCH -mabi=$GCC_MABI -O2 -pipe -fstack-protector-strong -fno-plt" +CXXFLAGS="-march=$GCC_MARCH -mabi=$GCC_MABI -O2 -pipe -fstack-protector-strong -fno-plt" +MAKEFLAGS="-j$(($(nproc) + 1))" +EOF + + check_repo "$PKGDEST" native || make_repo "$PKGDEST" native + + # patch libremakepkg to update config.sub/config.guess + cat "$(which libremakepkg)" > "$BUILDDIR/libremakepkg-$CARCH.sh" + chmod +x "$BUILDDIR/libremakepkg-$CARCH.sh" + + if [ "x${REGEN_CONFIG_FRAGMENTS:-no}" == "xyes" ]; then + local url="https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain" + sed -i "/Boring\\/mundane/i \\ +update_config_fragments() {\\ + find \$1/build -iname config.sub -exec curl \"$url;f=config.sub;hb=HEAD\" -o {} \\\\;\\ + find \$1/build -iname config.guess -exec curl \"$url;f=config.guess;hb=HEAD\" -o {} \\\\;\\ +}\\ +hook_pre_build+=(update_config_fragments)" "$BUILDDIR/libremakepkg-$CARCH.sh" + fi + + # patch libremakepkg to disable checks + sed -i 's/makepkg_args=(.*noconfirm[^)]*/& --nocheck/' "$BUILDDIR/libremakepkg-$CARCH.sh" +} diff --git a/src/stage3/patches/dbus.patch b/src/stage3/patches/dbus.patch index c190433..331dff7 100644 --- a/src/stage3/patches/dbus.patch +++ b/src/stage3/patches/dbus.patch @@ -18,12 +18,3 @@ _commit=a723baa2bc7e91fc9b1926cda1ce53e9301de4d8 # tags/dbus-1.12.6^0 source=("git+https://anongit.freedesktop.org/git/dbus/dbus#commit=$_commit" 'dbus.sysusers') -@@ -53,7 +53,7 @@ build() { - - check() { - cd $pkgbase -- make check -+ make check || true - } - - package_dbus() { diff --git a/src/stage3/patches/diffutils.patch b/src/stage3/patches/diffutils.patch deleted file mode 100644 index 79dac1d..0000000 --- a/src/stage3/patches/diffutils.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/PKGBUILD 2018-03-06 15:55:18.647183168 +0100 -+++ b/PKGBUILD 2018-03-06 16:14:05.854223089 +0100 -@@ -25,7 +25,7 @@ build() { - - check() { - cd $pkgname-$pkgver -- make check -+ make check || true - } - - package() { diff --git a/src/stage3/patches/fakeroot.patch b/src/stage3/patches/fakeroot.patch index 912e5a1..3c3aa89 100644 --- a/src/stage3/patches/fakeroot.patch +++ b/src/stage3/patches/fakeroot.patch @@ -1,15 +1,14 @@ --- a/PKGBUILD 2018-03-17 08:59:41.689090995 +0100 +++ b/PKGBUILD 2018-03-17 09:05:37.822823499 +0100 -@@ -13,8 +13,6 @@ url='http://packages.debian.org/fakeroot +@@ -13,7 +13,6 @@ url='http://packages.debian.org/fakeroot groups=(base-devel) install=fakeroot.install depends=(glibc filesystem sed util-linux sh) -makedepends=(po4a) --checkdepends=(sharutils) + checkdepends=(sharutils) source=(http://ftp.debian.org/debian/pool/main/f/$pkgname/${pkgname}_${pkgver}.orig.tar.bz2 silence-dlerror.patch) - md5sums=('fae64c9aeb2c895ead8e1b99bf50c631' -@@ -36,14 +34,11 @@ build() { +@@ -36,9 +34,6 @@ build() { --with-ipc=sysv make @@ -19,9 +18,3 @@ } check() { - cd $pkgname-$pkgver -- make check -+ make check || true - } - - package() { diff --git a/src/stage3/patches/gawk.patch b/src/stage3/patches/gawk.patch deleted file mode 100644 index 565b124..0000000 --- a/src/stage3/patches/gawk.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/PKGBUILD 2018-03-06 17:58:31.648667961 +0100 -+++ b/PKGBUILD 2018-03-06 18:28:52.667438512 +0100 -@@ -25,7 +25,7 @@ build() { - - check() { - cd ${srcdir}/${pkgname}-${pkgver} -- make check -+ make check || true - } - - package() { diff --git a/src/stage3/patches/gc.patch b/src/stage3/patches/gc.patch index 4dcc4cf..453cef8 100644 --- a/src/stage3/patches/gc.patch +++ b/src/stage3/patches/gc.patch @@ -1,6 +1,6 @@ --- a/PKGBUILD 2018-03-12 18:02:55.550559093 +0100 +++ b/PKGBUILD 2018-03-12 18:19:24.997339010 +0100 -@@ -10,27 +10,24 @@ arch=('x86_64') +@@ -10,17 +10,19 @@ arch=('x86_64') url="http://www.hboehm.info/gc/" license=('GPL') depends=('gcc-libs' 'libatomic_ops') @@ -22,13 +22,9 @@ ./configure --prefix=/usr --enable-cplusplus --disable-static sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool make +@@ -10,7 +10,7 @@ arch=('x86_64') } --check() { -- cd ${pkgname}-${pkgver} -- make check --} -- package() { - cd ${pkgname}-${pkgver} + cd bdwgc diff --git a/src/stage3/patches/gcc-libs.patch b/src/stage3/patches/gcc-libs.patch deleted file mode 120000 index 741beb3..0000000 --- a/src/stage3/patches/gcc-libs.patch +++ /dev/null @@ -1 +0,0 @@ -gcc.patch
\ No newline at end of file diff --git a/src/stage3/patches/gcc.patch b/src/stage3/patches/gcc.patch index 56483b7..bfb6018 100644 --- a/src/stage3/patches/gcc.patch +++ b/src/stage3/patches/gcc.patch @@ -59,7 +59,7 @@ --with-system-zlib \ --with-isl \ --enable-__cxa_atexit \ -@@ -106,24 +113,13 @@ build() { +@@ -106,16 +113,13 @@ build() { --enable-install-libiberty \ --with-linker-hash-style=gnu \ --enable-gnu-indirect-function \ @@ -74,18 +74,10 @@ - - # make documentation - make -C $CHOST/libstdc++-v3/doc doc-man-doxygen --} -- --check() { -- cd gcc-build -- -- # do not abort on error as some are "expected" -- make -k check || true -- "$srcdir/gcc/contrib/test_summary" } - package_gcc-libs() { -@@ -139,25 +135,17 @@ package_gcc-libs() { + check() { +@@ -139,25 +143,17 @@ package_gcc-libs() { rm -f "$pkgdir/$_libdir/libgcc_eh.a" for lib in libatomic \ @@ -112,7 +104,7 @@ libquadmath; do make -C $CHOST/$lib DESTDIR="$pkgdir" install-info done -@@ -188,22 +176,21 @@ package_gcc() { +@@ -188,22 +184,18 @@ package_gcc() { install -m755 -t "$pkgdir/${_libdir}/" gcc/{cc1,cc1plus,collect2,lto1} make -C $CHOST/libgcc DESTDIR="$pkgdir" install @@ -132,15 +124,15 @@ + [ "x@MULTILIB@" == "xdisable" ] || make -C $CHOST/32/libstdc++-v3/libsupc++ DESTDIR="$pkgdir" install make DESTDIR="$pkgdir" install-libcc1 - install -d "$pkgdir/usr/share/gdb/auto-load/usr/lib" - mv "$pkgdir"/usr/lib/libstdc++.so.6.*-gdb.py \ - "$pkgdir/usr/share/gdb/auto-load/usr/lib/" +- install -d "$pkgdir/usr/share/gdb/auto-load/usr/lib" +- mv "$pkgdir"/usr/lib/libstdc++.so.6.*-gdb.py \ +- "$pkgdir/usr/share/gdb/auto-load/usr/lib/" - rm "$pkgdir"/usr/lib{,32}/libstdc++.so* + rm -f "$pkgdir"/usr/lib{,32}/libstdc++.so* make DESTDIR="$pkgdir" install-fixincludes make -C gcc DESTDIR="$pkgdir" install-mkheaders -@@ -213,26 +200,16 @@ package_gcc() { +@@ -213,26 +205,16 @@ package_gcc() { ln -s /${_libdir}/liblto_plugin.so \ "$pkgdir/usr/lib/bfd-plugins/" @@ -170,7 +162,7 @@ make -C libcpp DESTDIR="$pkgdir" install make -C gcc DESTDIR="$pkgdir" install-po -@@ -244,16 +221,9 @@ package_gcc() { +@@ -244,16 +226,9 @@ package_gcc() { install -Dm755 "$srcdir/c89" "$pkgdir/usr/bin/c89" install -Dm755 "$srcdir/c99" "$pkgdir/usr/bin/c99" @@ -187,7 +179,7 @@ # Install Runtime Library Exception install -d "$pkgdir/usr/share/licenses/$pkgname/" ln -s /usr/share/licenses/gcc-libs/RUNTIME.LIBRARY.EXCEPTION \ -@@ -269,7 +239,7 @@ package_gcc-fortran() { +@@ -269,7 +244,7 @@ package_gcc-fortran() { cd gcc-build make -C $CHOST/libgfortran DESTDIR="$pkgdir" install-cafexeclibLTLIBRARIES \ install-{toolexeclibDATA,nodist_fincludeHEADERS} diff --git a/src/stage3/patches/git.patch b/src/stage3/patches/git.patch index 3d8dbe1..e2e9c8a 100644 --- a/src/stage3/patches/git.patch +++ b/src/stage3/patches/git.patch @@ -23,15 +23,6 @@ make -C contrib/mw-to-git prefix=/usr all make -C contrib/diff-highlight prefix=/usr } -@@ -76,7 +72,7 @@ check() { - DEFAULT_TEST_TARGET=prove \ - GIT_PROVE_OPTS="$jobs -Q" \ - GIT_TEST_OPTS="--root=/dev/shm/git-test" \ -- test -+ test || true - } - - package() { @@ -87,7 +83,7 @@ package() { USE_LIBPCRE2=1 \ NO_CROSS_DIRECTORY_HARDLINKS=1 \ diff --git a/src/stage3/patches/glib2-docs.patch b/src/stage3/patches/glib2-docs.patch deleted file mode 120000 index 3b42685..0000000 --- a/src/stage3/patches/glib2-docs.patch +++ /dev/null @@ -1 +0,0 @@ -glib2.patch
\ No newline at end of file diff --git a/src/stage3/patches/glib2.patch b/src/stage3/patches/glib2.patch index 65c97fc..82f511b 100644 --- a/src/stage3/patches/glib2.patch +++ b/src/stage3/patches/glib2.patch @@ -1,16 +1,15 @@ --- a/PKGBUILD 2018-03-15 18:28:02.907566766 +0100 +++ b/PKGBUILD 2018-03-15 18:30:17.106683685 +0100 -@@ -10,8 +10,7 @@ url="https://wiki.gnome.org/Projects/GLi +@@ -10,7 +10,7 @@ url="https://wiki.gnome.org/Projects/GLi license=(LGPL2.1) arch=(x86_64) depends=(pcre libffi libutil-linux zlib) -makedepends=(gettext gtk-doc shared-mime-info python libelf git util-linux dbus) --checkdepends=(desktop-file-utils) +makedepends=(gettext python libelf git util-linux dbus) + checkdepends=(desktop-file-utils) optdepends=('python: gdbus-codegen, glib-genmarshal, glib-mkenums, gtester-report' 'libelf: gresource inspection tool') - options=(!emptydirs) -@@ -49,21 +48,15 @@ build() { +@@ -49,7 +48,7 @@ build() { --sysconfdir=/etc \ --with-pcre=system \ --enable-debug=$debug \ @@ -19,13 +18,7 @@ --disable-fam sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool make - } - --check() { -- cd glib -- make check --} -- +@@ -49,7 +48,6 @@ build() { package_glib2() { cd glib make DESTDIR="$pkgdir" install diff --git a/src/stage3/patches/glibc.patch b/src/stage3/patches/glibc.patch index f40ef2d..5db3721 100644 --- a/src/stage3/patches/glibc.patch +++ b/src/stage3/patches/glibc.patch @@ -54,23 +54,6 @@ cd "$srcdir/lib32-glibc-build" export CC="gcc -m32 -mstackrealign" export CXX="g++ -m32 -mstackrealign" -@@ -117,16 +120,6 @@ build() { - - } - --check() { -- cd glibc-build -- -- # remove fortify in preparation to run test-suite -- sed -i '/FORTIFY/d' configparms -- -- # some failures are "expected" -- make check || true --} -- - package_glibc() { - pkgdesc='GNU C Library' - depends=('linux-api-headers>=4.10' tzdata filesystem) @@ -177,7 +170,7 @@ package_glibc() { strip $STRIP_STATIC usr/lib/lib{anl,BrokenLocale,c{,_nonshared},crypt}.a \ usr/lib/lib{dl,g,ieee,mcheck,nsl,pthread{,_nonshared}}.a \ diff --git a/src/stage3/patches/gnutls.patch b/src/stage3/patches/gnutls.patch deleted file mode 100644 index 8849b94..0000000 --- a/src/stage3/patches/gnutls.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/PKGBUILD 2018-03-12 18:25:44.581333194 +0100 -+++ b/PKGBUILD 2018-03-12 18:27:01.264160919 +0100 -@@ -11,7 +11,6 @@ license=('GPL3' 'LGPL2.1') - url="https://www.gnutls.org/" - options=('!zipman') - depends=('gcc-libs' 'libtasn1' 'readline' 'zlib' 'nettle' 'p11-kit' 'libidn' 'libunistring') --checkdepends=('net-tools') - optdepends=('guile: for use with Guile bindings') - source=(https://www.gnupg.org/ftp/gcrypt/gnutls/v3.5/${pkgname}-${pkgver}.tar.xz{,.sig}) - sha256sums=('ae2248d9e78747cf9c469dde81ff8f90b56838b707a0637f3f7d4eee90e80234' -@@ -43,11 +44,6 @@ build() { - make - } - --check() { -- cd ${pkgname}-${pkgver} -- make check --} -- - package() { - cd ${pkgname}-${pkgver} - make DESTDIR="${pkgdir}" install diff --git a/src/stage3/patches/grep.patch b/src/stage3/patches/grep.patch deleted file mode 100644 index 5962c5c..0000000 --- a/src/stage3/patches/grep.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/PKGBUILD 2018-03-09 19:38:16.007751485 +0100 -+++ b/PKGBUILD 2018-03-09 19:48:03.262588122 +0100 -@@ -26,7 +26,7 @@ build() { - - check() { - cd $pkgname-$pkgver -- make check -+ make check || true - } - - package() { diff --git a/src/stage3/patches/guile.patch b/src/stage3/patches/guile.patch deleted file mode 100644 index 8ea17d5..0000000 --- a/src/stage3/patches/guile.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/PKGBUILD 2018-03-15 10:30:50.055073809 +0100 -+++ b/PKGBUILD 2018-03-15 12:33:49.036128775 +0100 -@@ -29,7 +29,7 @@ build() { - - check() { - cd $pkgname-$pkgver -- make check -+ make check || true - } - - package() { diff --git a/src/stage3/patches/hwloc.patch b/src/stage3/patches/hwloc.patch index 4aec2c8..69b035b 100644 --- a/src/stage3/patches/hwloc.patch +++ b/src/stage3/patches/hwloc.patch @@ -9,12 +9,3 @@ optdepends=('cairo' 'libxml2' 'pciutils') options=('!docs') source=(https://www.open-mpi.org/software/hwloc/v1.11/downloads/${pkgname}-${pkgver}.tar.bz2) -@@ -28,7 +34,7 @@ build() { - - check() { - cd hwloc-${pkgver} -- make check -+ make check || true - } - - package() { diff --git a/src/stage3/patches/kmod.patch b/src/stage3/patches/kmod.patch index 93e5842..987d991 100644 --- a/src/stage3/patches/kmod.patch +++ b/src/stage3/patches/kmod.patch @@ -1,15 +1,14 @@ --- a/PKGBUILD 2018-03-06 14:28:22.107022821 +0100 +++ b/PKGBUILD 2018-03-06 14:36:59.958593384 +0100 -@@ -9,8 +9,6 @@ arch=('x86_64') +@@ -9,7 +9,6 @@ arch=('x86_64') url='http://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary' license=('GPL2') depends=('glibc' 'zlib' 'xz') -makedepends=('gtk-doc') --checkdepends=('linux-headers' 'libelf') + checkdepends=('linux-headers' 'libelf') options=('strip' 'debug') provides=('module-init-tools=3.16' 'libkmod.so') - conflicts=('module-init-tools') -@@ -22,32 +20,13 @@ md5sums=('08297dfb6f2b3f625f928ca3278528 +@@ -22,7 +20,7 @@ md5sums=('08297dfb6f2b3f625f928ca3278528 ./configure \ --sysconfdir=/etc \ @@ -18,28 +17,3 @@ --with-xz \ --with-zlib - make - } - --check() { -- # As of kmod v20, the test suite needs to build some kernel modules, and thus -- # needs headers available in order to run. We depend on linux-headers, but -- # this is really only to try and make sure that *some* useable tree of kernel -- # headers exist. The first useable tree we find is good enough, as these -- # modules will never be loaded by tests. -- -- local kdirs=(/usr/lib/modules/*/build/Makefile) -- if [[ ! -f ${kdirs[0]} ]]; then -- printf '==> Unable to find kernel headers to build modules for tests\n' >&2 -- return 1 -- fi -- -- local kver kdir=${kdirs[0]%/Makefile} -- IFS=/ read _ _ _ kver _ <<<"$kdir" -- -- make -C "$pkgname-$pkgver" check KDIR="$kdir" KVER="$kver" --} -- - package() { - make -C "$pkgname-$pkgver" DESTDIR="$pkgdir" install - diff --git a/src/stage3/patches/krb5.patch b/src/stage3/patches/krb5.patch deleted file mode 100644 index 43ec7e8..0000000 --- a/src/stage3/patches/krb5.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/PKGBUILD 2018-03-16 14:35:46.289222874 +0100 -+++ b/PKGBUILD 2018-03-16 15:23:21.738828696 +0100 -@@ -55,6 +55,7 @@ build() { - --without-tcl \ - --enable-dns-for-realm \ - --with-ldap \ -+ --disable-thread-support \ - --without-system-verto - make - } diff --git a/src/stage3/patches/libarchive.patch b/src/stage3/patches/libarchive.patch deleted file mode 100644 index 8a9a5e6..0000000 --- a/src/stage3/patches/libarchive.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/PKGBUILD 2018-03-12 21:48:20.527769065 +0100 -+++ b/PKGBUILD 2018-03-12 22:15:46.597367289 +0100 -@@ -33,7 +33,7 @@ build() { - - check() { - cd $pkgname-$pkgver -- make check -+ make check || true - } - - package() { diff --git a/src/stage3/patches/libatomic_ops.patch b/src/stage3/patches/libatomic_ops.patch index 3fabd70..13868fd 100644 --- a/src/stage3/patches/libatomic_ops.patch +++ b/src/stage3/patches/libatomic_ops.patch @@ -1,6 +1,6 @@ --- a/PKGBUILD 2018-03-12 17:32:57.049007339 +0100 +++ b/PKGBUILD 2018-03-12 17:45:14.783595573 +0100 -@@ -14,26 +14,23 @@ url='https://github.com/ivmai/libatomic_ +@@ -14,15 +14,17 @@ url='https://github.com/ivmai/libatomic_ depends=(glibc) license=(GPL2 MIT) options=(!docs) @@ -22,12 +22,9 @@ ./configure --prefix=/usr --disable-static --enable-shared make } +@@ -14,7 +14,7 @@ url='https://github.com/ivmai/libatomic_ + } --check() { -- cd $pkgname-$pkgver -- make check --} -- package() { - cd $pkgname-$pkgver + cd $pkgname diff --git a/src/stage3/patches/libelf.patch b/src/stage3/patches/libelf.patch deleted file mode 100644 index cfb2e72..0000000 --- a/src/stage3/patches/libelf.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/PKGBUILD 2018-03-09 14:22:14.174432155 +0100 -+++ b/PKGBUILD 2018-03-09 14:34:59.954675699 +0100 -@@ -34,7 +34,7 @@ build() { - check() { - cd ${pkgbase}-${pkgver} - -- make check -+ make check || true - } - - package_elfutils() { diff --git a/src/stage3/patches/libsecret.patch b/src/stage3/patches/libsecret.patch index 7d310a7..e617161 100644 --- a/src/stage3/patches/libsecret.patch +++ b/src/stage3/patches/libsecret.patch @@ -1,16 +1,15 @@ --- a/PKGBUILD 2018-03-15 16:43:18.938199115 +0100 +++ b/PKGBUILD 2018-03-15 17:00:27.931732044 +0100 -@@ -9,8 +9,7 @@ arch=(x86_64) - license=(LGPL) +@@ -9,7 +9,7 @@ arch=(x86_64) url="https://wiki.gnome.org/Projects/Libsecret" depends=(glib2 libgcrypt) --checkdepends=(python-dbus dbus-glib python-gobject gjs) + checkdepends=(python-dbus dbus-glib python-gobject gjs) -makedepends=(intltool docbook-xsl gobject-introspection vala git gtk-doc) +makedepends=(intltool gobject-introspection git gtk-doc) optdepends=('gnome-keyring: key storage service (or use any other service implementing org.freedesktop.secrets)') _commit=998065599c66055dcffa1ef1ddebb947ccd68248 # master source=("git+https://git.gnome.org/browse/libsecret#commit=$_commit") -@@ -29,15 +28,10 @@ prepare() { +@@ -29,7 +28,7 @@ prepare() { build() { cd $pkgname ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \ @@ -19,11 +18,3 @@ make } --check() { -- cd $pkgname -- dbus-run-session make -k check --} -- - package() { - cd $pkgname - make DESTDIR="$pkgdir" install diff --git a/src/stage3/patches/libutil-linux.patch b/src/stage3/patches/libutil-linux.patch deleted file mode 120000 index 70ec2ed..0000000 --- a/src/stage3/patches/libutil-linux.patch +++ /dev/null @@ -1 +0,0 @@ -util-linux.patch
\ No newline at end of file diff --git a/src/stage3/patches/libuv.patch b/src/stage3/patches/libuv.patch index a0d7135..56f7e72 100644 --- a/src/stage3/patches/libuv.patch +++ b/src/stage3/patches/libuv.patch @@ -8,7 +8,7 @@ source=("https://github.com/libuv/libuv/archive/v$pkgver/$pkgname-$pkgver.tar.gz") sha512sums=('4fa879e34c51ae428ebf72ce80873b8d12994ae1560f9d3577a693653bfd5bd4b4fda7ff457b98b5e60fc82546658300401d6545d677f31d2cd66be3d82e02da') -@@ -18,12 +17,11 @@ build() { +@@ -18,7 +17,6 @@ build() { ./autogen.sh ./configure --prefix=/usr make @@ -16,12 +16,6 @@ } check() { - cd $pkgname-$pkgver -- make check -+ make check || true - } - - package() { @@ -39,6 +37,4 @@ package() { "$pkgdir"/usr/share/doc/$pkgname/README.md install -Dm644 ChangeLog \ diff --git a/src/stage3/patches/libxslt.patch b/src/stage3/patches/libxslt.patch deleted file mode 100644 index c0b7cac..0000000 --- a/src/stage3/patches/libxslt.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/PKGBUILD 2018-03-14 20:54:54.175271060 +0100 -+++ b/PKGBUILD 2018-03-14 20:56:09.654946102 +0100 -@@ -11,7 +11,6 @@ arch=(x86_64) - license=(custom) - depends=(libxml2 libgcrypt) - makedepends=(python2 git) --checkdepends=(docbook-xml python) - _commit=32c88216ddbaa0f3491f45bc84ee89285c6a1129 # master - source=("git+https://git.gnome.org/browse/libxslt#commit=$_commit") - sha256sums=('SKIP') -@@ -38,11 +37,6 @@ build() { - make - } - --check() { -- cd $pkgname -- make check --} -- - package() { - cd $pkgname - make DESTDIR="$pkgdir" install diff --git a/src/stage3/patches/make-decross.patch b/src/stage3/patches/make-decross.patch index a578c58..627c263 100644 --- a/src/stage3/patches/make-decross.patch +++ b/src/stage3/patches/make-decross.patch @@ -10,7 +10,7 @@ source=(ftp://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${pkgver}.tar.bz2{,.sig} guile-2.2.patch) md5sums=('15b012617e7c44c0ed482721629577ac' -@@ -20,19 +21,21 @@ validpgpkeys=('3D2554F0A15338AB9AF1BB9D9 +@@ -20,13 +21,15 @@ validpgpkeys=('3D2554F0A15338AB9AF1BB9D9 prepare() { cd ${pkgname}-${pkgver} @@ -27,10 +27,3 @@ make } - check() { - cd ${pkgname}-${pkgver} -- make -k check -+ make -k check || true - } - - package() { diff --git a/src/stage3/patches/make.patch b/src/stage3/patches/make.patch index f2ecfe5..4f7b0f0 100644 --- a/src/stage3/patches/make.patch +++ b/src/stage3/patches/make.patch @@ -9,12 +9,3 @@ patch -p1 -i ${srcdir}/guile-2.2.patch autoreconf -fi } -@@ -32,7 +34,7 @@ build() { - - check() { - cd ${pkgname}-${pkgver} -- make -k check -+ make -k check || true - } - - package() { diff --git a/src/stage3/patches/nettle.patch b/src/stage3/patches/nettle.patch deleted file mode 100644 index 8afb45e..0000000 --- a/src/stage3/patches/nettle.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/PKGBUILD 2018-03-06 17:51:17.168809244 +0100 -+++ b/PKGBUILD 2018-03-06 17:53:43.157644481 +0100 -@@ -10,7 +10,6 @@ arch=('x86_64') - url="https://www.lysator.liu.se/~nisse/nettle" - license=('GPL2') - depends=('gmp') --checkdepends=('valgrind') - source=(https://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz{,.sig}) - sha256sums=('ae7a42df026550b85daca8389b6a60ba6313b0567f374392e54918588a411e94' - 'SKIP') -@@ -24,11 +28,6 @@ build() { - make - } - --check() { -- cd $pkgname-$pkgver -- make -k check --} -- - package() { - cd $pkgname-$pkgver - make DESTDIR="$pkgdir/" install diff --git a/src/stage3/patches/nss-systemd.patch b/src/stage3/patches/nss-systemd.patch deleted file mode 100644 index cf471f1..0000000 --- a/src/stage3/patches/nss-systemd.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- a/PKGBUILD 2018-03-16 18:23:58.112034593 +0100 -+++ b/PKGBUILD 2018-03-16 18:59:17.686017180 +0100 -@@ -19,7 +19,7 @@ arch+=('i686' 'armv7h') - url="https://www.github.com/systemd/systemd" - makedepends=('acl' 'cryptsetup' 'docbook-xsl' 'gperf' 'lz4' 'xz' 'pam' 'libelf' - 'intltool' 'iptables' 'kmod' 'libcap' 'libidn' 'libgcrypt' -- 'libmicrohttpd' 'libxslt' 'util-linux' 'linux-api-headers' -+ 'libxslt' 'util-linux' 'linux-api-headers' - 'python-lxml' 'quota-tools' 'shadow' 'git' - 'meson' 'libseccomp' 'pcre2') - makedepends_i686=('gnu-efi-libs') -@@ -167,6 +167,7 @@ build() { - -Daudit=false - -Dima=false - -Dlz4=true -+ -Dgcrypt=false - - -Ddbuspolicydir=/usr/share/dbus-1/system.d - -Ddefault-dnssec=no -@@ -224,7 +225,7 @@ build() { - - check() { - cd build -- meson test -+ meson test || true - } - - package_systemd() { -@@ -261,7 +262,7 @@ package_systemd() { - rm -rv "$pkgdir"/etc/systemd/system/* - - # we'll create this on installation -- rmdir "$pkgdir"/var/log/journal/remote -+ rm -rf "$pkgdir"/var/log/journal/remote - - # executable (symlinks) shipped with systemd-sysvcompat - rm "$pkgdir"/usr/bin/{halt,init,poweroff,reboot,runlevel,shutdown,telinit} diff --git a/src/stage3/patches/openssl.patch b/src/stage3/patches/openssl.patch index 3cfb21a..f73a089 100644 --- a/src/stage3/patches/openssl.patch +++ b/src/stage3/patches/openssl.patch @@ -16,12 +16,3 @@ "${openssltarget}" \ "-Wa,--noexecstack ${CPPFLAGS} ${CFLAGS} ${LDFLAGS}" -@@ -55,7 +58,7 @@ check() { - # the test fails due to missing write permissions in /etc/ssl - # revert this patch for make test - patch -p0 -R -i "$srcdir/ca-dir.patch" -- make test -+ make test || true - patch -p0 -i "$srcdir/ca-dir.patch" - } - diff --git a/src/stage3/patches/p11-kit.patch b/src/stage3/patches/p11-kit.patch index 7892da5..bbf67ea 100644 --- a/src/stage3/patches/p11-kit.patch +++ b/src/stage3/patches/p11-kit.patch @@ -9,7 +9,7 @@ _commit=f6b7a992e442218a5afdbf8ae1697c53f3f03991 # tags/0.23.10^0 source=("git+https://github.com/p11-glue/p11-kit#commit=$_commit" 0001-Build-and-install-libnssckbi-p11-kit.so.patch) -@@ -41,17 +41,12 @@ build() { +@@ -41,7 +41,7 @@ build() { --sysconfdir=/etc \ --localstatedir=/var \ --libexecdir=/usr/lib \ @@ -18,13 +18,3 @@ --with-module-path=/usr/lib/pkcs11 \ --with-trust-paths=/etc/ca-certificates/trust-source:/usr/share/ca-certificates/trust-source make - } - --check() { -- cd $pkgname -- make check --} -- - package() { - cd $pkgname - make DESTDIR="$pkgdir" install diff --git a/src/stage3/patches/pacman.patch b/src/stage3/patches/pacman.patch index bc56a60..beead35 100644 --- a/src/stage3/patches/pacman.patch +++ b/src/stage3/patches/pacman.patch @@ -1,16 +1,15 @@ --- a/PKGBUILD 2018-03-17 22:43:27.776000901 +0100 +++ b/PKGBUILD 2018-03-17 22:45:57.506623741 +0100 -@@ -20,9 +20,7 @@ groups=('base' 'base-devel' 'base-openrc +@@ -20,8 +20,7 @@ groups=('base' 'base-devel' 'base-openrc depends=('bash' 'glibc' 'libarchive' 'curl' 'gpgme' 'pacman-mirrorlist' 'archlinux-keyring' 'parabola-keyring' 'archlinuxarm-keyring' 'archlinux32-keyring') -makedepends=('asciidoc') -makedepends+=('openssl>=1.1' 'openssl-1.0') # for during openssl 1.0->1.1 rebuild; remove on next rebuild --checkdepends=('python2' 'fakechroot') +makedepends+=('openssl>=1.1') + checkdepends=('python2' 'fakechroot') optdepends=('cron: run specified programs at scheduled times and related tools') provides=("$pkgname-contrib") - conflicts=("$pkgname-contrib" "$pkgname-parabola" 'cacert-dot-org') @@ -45,6 +43,7 @@ sha256sums=('dfd36086ad68564bcd977f4a1fa '19853ea9a2138157bbb334eb7f3a9b3098b88e513678b54b7b4f19d2ffd6ecad' '1b2c8f4ec84d0dc496516880a54b5e4deb78798618c9cf5e284a45303f156e58' @@ -40,17 +39,6 @@ esac myldflags="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" -@@ -108,10 +112,6 @@ build() { - done - } - --check() { -- make -C "$pkgname-$pkgver" check --} -- - package() { - cd "$pkgname-$pkgver" - --- /dev/null 2018-03-05 07:42:50.020223709 +0100 +++ b/pacman.conf.riscv64 2018-03-17 22:43:27.778000923 +0100 @@ -0,0 +1,120 @@ diff --git a/src/stage3/patches/perl.patch b/src/stage3/patches/perl.patch deleted file mode 100644 index 11aeeed..0000000 --- a/src/stage3/patches/perl.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/PKGBUILD 2018-03-09 14:48:16.830352429 +0100 -+++ b/PKGBUILD 2018-03-09 15:39:38.694702052 +0100 -@@ -185,7 +185,7 @@ build() { - - check() { - cd ${srcdir}/${pkgname}-${pkgver} -- TEST_JOBS=$(echo $MAKEFLAGS | sed 's/.*-j\([0-9][0-9]*\).*/\1/') make test_harness -+ TEST_JOBS=$(echo $MAKEFLAGS | sed 's/.*-j\([0-9][0-9]*\).*/\1/') make test_harness || true - # make test - } - diff --git a/src/stage3/patches/python-lxml.patch b/src/stage3/patches/python-lxml.patch index 433fa42..b248878 100644 --- a/src/stage3/patches/python-lxml.patch +++ b/src/stage3/patches/python-lxml.patch @@ -1,6 +1,6 @@ --- a/PKGBUILD 2018-03-15 22:28:13.742085702 +0100 +++ b/PKGBUILD 2018-03-16 08:33:19.888281296 +0100 -@@ -3,16 +3,14 @@ +@@ -3,14 +3,14 @@ # Maintainer: Felix Yan <felixonmars@archlinux.org> pkgbase=python-lxml @@ -13,28 +13,16 @@ url="http://lxml.de/" -makedepends=('libxslt' 'python-setuptools' 'python2-setuptools' 'epydoc' 'python2-pygments' - 'python2-docutils' 'cython' 'cython2') --checkdepends=('python-cssselect' 'python2-cssselect' 'python-html5lib' 'python2-html5lib' -- 'python-beautifulsoup4' 'python2-beautifulsoup4') +makedepends=('libxslt' 'python-setuptools' 'python2-setuptools' + 'cython' 'cython2') + checkdepends=('python-cssselect' 'python2-cssselect' 'python-html5lib' 'python2-html5lib' + 'python-beautifulsoup4' 'python2-beautifulsoup4') source=("https://github.com/lxml/lxml/archive/lxml-$pkgver.tar.gz") - sha512sums=('69c64fc9f34bd8250dffcc32b6dcc93490731cd32778d7257a232fc5a126e74433ce6d4351683b71872cbeccd2c4d5a970e8fc2e631bbc273125be2b7f61ef31') - -@@ -30,17 +28,6 @@ build() { +@@ -30,7 +28,6 @@ build() { cd "$srcdir"/lxml-$pkgver-py2 python2 setup.py build - make PYTHON=python2 html --} -- --check() { -- # TODO: Find a sane way to skip inplace build -- -- cd "$srcdir"/lxml-$pkgver -- make PYTHON=python test -- -- cd "$srcdir"/lxml-$pkgver-py2 -- make PYTHON=python2 test } - package_python-lxml() { + check() { diff --git a/src/stage3/patches/python.patch b/src/stage3/patches/python.patch index b778c0a..6907f42 100644 --- a/src/stage3/patches/python.patch +++ b/src/stage3/patches/python.patch @@ -9,7 +9,14 @@ optdepends=('python-setuptools' 'python-pip' 'sqlite' -@@ -61,30 +61,10 @@ build() { +@@ -55,21 +55,16 @@ build() { + --enable-shared \ + --with-threads \ + --with-computed-gotos \ +- --enable-optimizations \ ++ --disable-optimizations \ + --with-lto \ + --enable-ipv6 \ --with-system-expat \ --with-dbmliborder=gdbm:ndbm \ --with-system-ffi \ @@ -22,22 +29,7 @@ - while ! xvfb-run -a -n "$servernum" /bin/true 2>/dev/null; do servernum=$((servernum+1)); done - - LC_CTYPE=en_US.UTF-8 xvfb-run -a -n "$servernum" make EXTRA_CFLAGS="$CFLAGS" --} -- --check() { -- # test_gdb is expected to fail with LTO -- # test_subprocess hangs on 3.6.3 -- -- cd Python-${pkgver} -- -- # Obtain next free server number for xvfb-run; this even works in a chroot environment. -- export servernum=99 -- while ! xvfb-run -a -n "$servernum" /bin/true 2>/dev/null; do servernum=$((servernum+1)); done -- -- LD_LIBRARY_PATH="${srcdir}/Python-${pkgver}":${LD_LIBRARY_PATH} \ -- LC_CTYPE=en_US.UTF-8 xvfb-run -a -n "$servernum" \ -- "${srcdir}/Python-${pkgver}/python" -m test.regrtest -v -uall -x test_gdb -x test_subprocess + make EXTRA_CFLAGS="$CFLAGS" } - package() { + check() { diff --git a/src/stage3/patches/python2.patch b/src/stage3/patches/python2.patch index fa98172..d0b17f4 100644 --- a/src/stage3/patches/python2.patch +++ b/src/stage3/patches/python2.patch @@ -1,28 +1,19 @@ --- a/PKGBUILD 2018-03-12 18:57:35.511430226 +0100 +++ b/PKGBUILD 2018-03-12 19:00:59.926712159 +0100 -@@ -13,8 +13,6 @@ arch=('x86_64') +@@ -13,7 +13,6 @@ arch=('x86_64') license=('PSF') url="http://www.python.org/" depends=('bzip2' 'gdbm' 'openssl' 'zlib' 'expat' 'sqlite' 'libffi') -makedepends=('tk' 'bluez-libs') --checkdepends=('gdb' 'file' 'xorg-server-xvfb') + checkdepends=('gdb' 'file' 'xorg-server-xvfb') optdepends=('tk: for IDLE' 'python2-setuptools' - 'python2-pip') -@@ -83,16 +81,6 @@ build() { - make - } - --check() { -- # Since 2.7.13, -- # test_replace_overflow (present in test_bytes, test_str, test_string, test_unicode, test_userstring) segfault on i686 -- # test_bigrepeat (present in test_tuple) segfault on i686 -- -- cd Python-${pkgver} -- LD_LIBRARY_PATH="${srcdir}/Python-${pkgver}":${LD_LIBRARY_PATH} \ -- xvfb-run "${srcdir}/Python-${pkgver}/python" -m test.regrtest -v -uall -x test_bytes test_str test_string test_tuple test_unicode test_userstring --} -- - package() { - cd Python-${pkgver} - +@@ -71,7 +70,7 @@ build() { + ./configure --prefix=/usr \ + --enable-shared \ + --with-threads \ +- --enable-optimizations \ ++ --disable-optimizations \ + --with-lto \ + --enable-ipv6 \ + --enable-unicode=ucs4 \ diff --git a/src/stage3/patches/sed.patch b/src/stage3/patches/sed.patch deleted file mode 100644 index c38b951..0000000 --- a/src/stage3/patches/sed.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/PKGBUILD 2018-03-06 10:14:52.100509928 +0100 -+++ b/PKGBUILD 2018-03-06 10:23:13.235185505 +0100 -@@ -26,7 +26,7 @@ build() { - - check() { - cd $pkgname-$pkgver -- make check -+ make check || true - } - - package() { diff --git a/src/stage3/patches/sqlite.patch b/src/stage3/patches/sqlite.patch new file mode 100644 index 0000000..9b8a670 --- /dev/null +++ b/src/stage3/patches/sqlite.patch @@ -0,0 +1,11 @@ +--- a/PKGBUILD 2018-03-31 09:12:38.249279305 +0200 ++++ b/PKGBUILD 2018-03-31 09:28:36.403188494 +0200 +@@ -3,7 +3,7 @@ + # Contributor: Tom Newsom <Jeepster@gmx.co.uk> + + pkgbase="sqlite" +-pkgname=('sqlite' 'sqlite-tcl' 'sqlite-doc' 'sqlite-analyzer') ++pkgname=('sqlite' 'sqlite-tcl' 'sqlite-analyzer') + _srcver=3220000 + _docver=${_srcver} + #_docver=3080001 diff --git a/src/stage3/patches/sudo.patch b/src/stage3/patches/sudo.patch deleted file mode 100644 index c22d2e9..0000000 --- a/src/stage3/patches/sudo.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/PKGBUILD 2018-03-16 20:17:21.482018886 +0100 -+++ b/PKGBUILD 2018-03-16 20:24:29.098611565 +0100 -@@ -50,7 +50,7 @@ build() { - - check() { - cd "$srcdir/$pkgname-$_sudover" -- make check -+ make check || true - } - - package() { diff --git a/src/stage3/patches/systemd.patch b/src/stage3/patches/systemd.patch new file mode 100644 index 0000000..962dab8 --- /dev/null +++ b/src/stage3/patches/systemd.patch @@ -0,0 +1,20 @@ +--- a/PKGBUILD 2018-03-16 18:23:58.112034593 +0100 ++++ b/PKGBUILD 2018-03-16 18:59:17.686017180 +0100 +@@ -85,6 +85,8 @@ sha512sums=('SKIP' + _backports=( + # core: do not free heap-allocated strings (#8391) (FS#57741) + '5cbaad2f6795088db56063d20695c6444595822f' ++ # basic/macros: rename noreturn into _noreturn_ (#8456) ++ '848e863acc51ecfb0f3955c498874588201d9130' + ) + + _reverts=( +@@ -261,7 +262,7 @@ package_systemd() { + rm -rv "$pkgdir"/etc/systemd/system/* + + # we'll create this on installation +- rmdir "$pkgdir"/var/log/journal/remote ++ rm -rf "$pkgdir"/var/log/journal/remote + + # executable (symlinks) shipped with systemd-sysvcompat + rm "$pkgdir"/usr/bin/{halt,init,poweroff,reboot,runlevel,shutdown,telinit} diff --git a/src/stage3/patches/tar.patch b/src/stage3/patches/tar.patch deleted file mode 100644 index 42c8130..0000000 --- a/src/stage3/patches/tar.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/PKGBUILD 2018-03-06 08:25:09.977613412 +0100 -+++ b/PKGBUILD 2018-03-06 08:53:17.325008579 +0100 -@@ -39,7 +39,7 @@ build() { - - check() { - cd $pkgname-$pkgver -- make check -+ make check || true - } - - package() { diff --git a/src/stage3/patches/tcl.patch b/src/stage3/patches/tcl.patch deleted file mode 100644 index ce52789..0000000 --- a/src/stage3/patches/tcl.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/PKGBUILD 2018-03-13 17:17:37.724605816 +0100 -+++ b/PKGBUILD 2018-03-13 17:33:12.217435043 +0100 -@@ -25,11 +25,6 @@ build() { - make - } - --check() { -- cd tcl${pkgver}/unix -- make test --} -- - package() { - cd tcl${pkgver}/unix - make INSTALL_ROOT="${pkgdir}" install install-private-headers diff --git a/src/stage3/prepare_chroot.sh b/src/stage3/prepare_chroot.sh deleted file mode 100644 index 61fd1ba..0000000 --- a/src/stage3/prepare_chroot.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/bash - ############################################################################## - # parabola-riscv64-bootstrap # - # # - # Copyright (C) 2018 Andreas Grapentin # - # # - # This program is free software: you can redistribute it and/or modify # - # it under the terms of the GNU General Public License as published by # - # the Free Software Foundation, either version 3 of the License, or # - # (at your option) any later version. # - # # - # This program is distributed in the hope that it will be useful, # - # but WITHOUT ANY WARRANTY; without even the implied warranty of # - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # - # GNU General Public License for more details. # - # # - # You should have received a copy of the GNU General Public License # - # along with this program. If not, see <http://www.gnu.org/licenses/>. # - ############################################################################## - -set -euo pipefail - -msg "preparing $CARCH librechroot" - -# create directories -mkdir -p "$_pkgdest" "$_logdest" - -# initialize [native] repo -echo -n "checking for $CARCH [native] repo ... " -[ -e "$_pkgdest"/native.db ] && _have_native=yes || _have_native=no -echo $_have_native - -if [ "x$_have_native" == "xno" ]; then - tar -czf "$_pkgdest"/native.db.tar.gz -T /dev/null - tar -czf "$_pkgdest"/native.files.tar.gz -T /dev/null - ln -s native.db.tar.gz "$_pkgdest"/native.db - ln -s native.files.tar.gz "$_pkgdest"/native.files -fi - -# create configurations -mkdir -p "$_builddir"/config - -cat > "$_builddir"/config/pacman.conf << EOF -[options] -Architecture = $CARCH -[native] -Server = file://$topbuilddir/stage3/packages/\$arch -[cross] -Server = file://$topbuilddir/stage2/packages/\$arch -EOF - -cat "$_srcdir"/makepkg.conf.in > "$_builddir"/config/makepkg.conf -cat >> "$_builddir"/config/makepkg.conf << EOF -CARCH="$CARCH" -CHOST="$CHOST" -CFLAGS="-march=$GCC_MARCH -mabi=$GCC_MABI -O2 -pipe -fstack-protector-strong -fno-plt" -CXXFLAGS="-march=$GCC_MARCH -mabi=$GCC_MABI -O2 -pipe -fstack-protector-strong -fno-plt" -MAKEFLAGS="-j$(($(nproc) + 1))" -EOF - -# initialize the chroot using the cross-compiled packages -rm -rf /var/cache/pacman/pkg-$CARCH/* -librechroot \ - -n "$CHOST-stage3" \ - -C "$_builddir"/config/pacman.conf \ - -M "$_builddir"/config/makepkg.conf \ - make - -set +o pipefail -export _chrootdir="$(librechroot -n "$CHOST-stage3" 2>&1 | grep copydir.*: | awk '{print $3}')" -set -o pipefail - -for repo in native cross; do - mkdir -p "$_chrootdir"/$repo/$CARCH - if mount | grep -q "$_chrootdir"/$repo/$CARCH; then umount "$_chrootdir"/$repo/$CARCH; fi -done -mount -o bind "$_pkgdest" "$_chrootdir"/native/$CARCH -mount -o bind "${_pkgdest//stage3/stage2}" "$_chrootdir"/cross/$CARCH - -cat > "$_builddir"/config/pacman.conf << EOF -[options] -Architecture = $CARCH -[native] -Server = file:///native/\$arch -[cross] -Server = file:///cross/\$arch -EOF - -librechroot \ - -n "$CHOST-stage3" \ - -C "$_builddir"/config/pacman.conf \ - -M "$_builddir"/config/makepkg.conf \ - update - -# produce a patched libremakepkg to update config.sub/config.guess where needed -cat $(which libremakepkg) > "$_builddir"/libremakepkg-$CARCH.sh -chmod +x "$_builddir"/libremakepkg-$CARCH.sh - -if [ "x${REGEN_CONFIG_FRAGMENTS:-no}" == "xyes" ]; then - sed -i '/Boring\/mundane/i \ -update_config_fragments() {\ - local url="https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain"\ - find $1/build -iname config.sub -print -exec curl "$url;f=config.sub;hb=HEAD" -o {} \\;\ - find $1/build -iname config.guess -print -exec curl "$url;f=config.guess;hb=HEAD" -o {} \\;\ -}\ -hook_pre_build+=(update_config_fragments)' "$_builddir"/libremakepkg-$CARCH.sh -fi diff --git a/src/stage3/prepare_decross.sh b/src/stage3/prepare_decross.sh deleted file mode 100644 index 3baed74..0000000 --- a/src/stage3/prepare_decross.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash - ############################################################################## - # parabola-riscv64-bootstrap # - # # - # Copyright (C) 2018 Andreas Grapentin # - # # - # This program is free software: you can redistribute it and/or modify # - # it under the terms of the GNU General Public License as published by # - # the Free Software Foundation, either version 3 of the License, or # - # (at your option) any later version. # - # # - # This program is distributed in the hope that it will be useful, # - # but WITHOUT ANY WARRANTY; without even the implied warranty of # - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # - # GNU General Public License for more details. # - # # - # You should have received a copy of the GNU General Public License # - # along with this program. If not, see <http://www.gnu.org/licenses/>. # - ############################################################################## - -set -euo pipefail - -msg "preparing native $CARCH decross'd packages" - -# cross-compiled packages con be a bit derpy. -# rebuild a couple of things using native toolchain and custom patches - -while grep -q -- -decross "$_deptree"; do - _pkgname=$(grep -- -decross "$_deptree" | head -n1 | awk '{print $1}') - _pkgname=${_pkgname%-decross} - - echo -n "checking for $CARCH $_pkgname ... " - [ -f "$_makepkgdir"/$_pkgname-decross/$_pkgname-*.pkg.tar.xz ] && _have_pkg=yes || _have_pkg=no - echo $_have_pkg - - if [ "x$_have_pkg" == "xno" ]; then - _pkgarch=$(pacman -Si $_pkgname | grep '^Architecture' | awk '{print $3}') - - # set arch to $CARCH, unless it is any - [ "x$_pkgarch" == "xany" ] || _pkgarch=$CARCH - - msg "makepkg: $_pkgname" - - rm -rf "$_makepkgdir"/$_pkgname-decross - mkdir -p "$_makepkgdir"/$_pkgname-decross - pushd "$_makepkgdir"/$_pkgname-decross >/dev/null - - _pkgdir="$_makepkgdir"/$_pkgname-decross/pkg/$_pkgname - - fetch_pkgfiles $_pkgname - import_keys - - cp PKGBUILD{,.old} - patch -Np1 -i "$_srcdir"/patches/$_pkgname-decross.patch - cp PKGBUILD{,.in} - - # substitute common variables - _config="https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain" - _config_sub="$_config;f=config.sub;hb=HEAD" - _config_guess="$_config;f=config.guess;hb=HEAD" - sed -i "s#@CONFIG_SUB@#curl \"$_config_sub\"#g; \ - s#@CONFIG_GUESS@#curl \"$_config_guess\"#g;" \ - PKGBUILD - - # enable the target CARCH in arch array - sed -i "s/arch=([^)]*/& $CARCH/" PKGBUILD - - # build the package - chown -R $SUDO_USER "$_makepkgdir"/$_pkgname-decross - PKGDEST=. libremakepkg -n $CHOST-stage3 || failed_build - - notify -c success -u low "*decross* $_pkgname" - - popd >/dev/null - fi - - # install the package - set +o pipefail - yes | librechroot \ - -n "$CHOST-stage3" \ - -C "$_builddir"/config/pacman.conf \ - -M "$_builddir"/config/makepkg.conf \ - install-file "$_makepkgdir"/$_pkgname-decross/$_pkgname-*.pkg.tar.xz - set -o pipefail - - # remove pkg from deptree - sed -i "/^$_pkgname-decross :/d; s/ $_pkgname\b//g" "$_deptree" -done diff --git a/src/stage3/prepare_deptree.sh b/src/stage3/prepare_deptree.sh deleted file mode 100644 index 3b7038a..0000000 --- a/src/stage3/prepare_deptree.sh +++ /dev/null @@ -1,138 +0,0 @@ -#!/bin/bash - ############################################################################## - # parabola-riscv64-bootstrap # - # # - # Copyright (C) 2018 Andreas Grapentin # - # # - # This program is free software: you can redistribute it and/or modify # - # it under the terms of the GNU General Public License as published by # - # the Free Software Foundation, either version 3 of the License, or # - # (at your option) any later version. # - # # - # This program is distributed in the hope that it will be useful, # - # but WITHOUT ANY WARRANTY; without even the implied warranty of # - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # - # GNU General Public License for more details. # - # # - # You should have received a copy of the GNU General Public License # - # along with this program. If not, see <http://www.gnu.org/licenses/>. # - ############################################################################## - -set -euo pipefail - -msg "preparing transitive dependency tree for $_groups (Stage 3)" - -echo -n "checking for complete deptree ... " -[ -f "$_deptree".FULL ] && _have_deptree=yes || _have_deptree=no -echo $_have_deptree - -if [ "x$_have_deptree" == "xno" ]; then - declare -A _tree - _frontier=($(pacman -Sg $_groups | awk '{print $2}')) - - while [ ${#_frontier[@]} -gt 0 ]; do - # pop pkg from frontier - _pkgname=$(echo ${_frontier[0]}) - _frontier=("${_frontier[@]:1}") - - # if seen before, skip, otherwise create entry in dependency tree - [[ -v _tree[$_pkgname] ]] && continue - _tree[$_pkgname]="" - - echo -en "\r pkges: ${#_tree[@]} " - - _pkgdeps=$(pacman -Si $_pkgname | grep '^Depends' | cut -d':' -f2 | sed 's/None//') - - # tweak some build-time dependencies - case $_pkgname in - binutils) - _pkgdeps+=" git dejagnu bc" ;; - blas|cblas|lapack|lapacke|lapack-doc) - _pkgdeps+=" cmake" ;; - boost-libs|boost) - _pkgdeps+=" python-numpy python2-numpy openmpi" ;; - dbus) - _pkgdeps+=" autoconf-archive" ;; - gcc-libs) - _pkgdeps+=" dejagnu libmpc mpfr gmp" ;; - git) - _pkgdeps="${_pkgdeps/curl}" - _pkgdeps="${_pkgdeps/shadow}" ;; - glib2) - _pkgdeps+=" python" ;; - gmp) - _pkgdeps="${_pkgdeps/gcc-libs}" ;; - gobject-introspection-runtime) - _pkgdeps+=" python-mako" ;; - jsoncpp) - _pkgdeps+=" meson" ;; - libaio) - _pkgdeps+=" git" ;; - libatomic_ops) - _pkgdeps+=" git" ;; - libdaemon) - _pkgdeps+=" git" ;; - libffi) - _pkgdeps+=" dejagnu git" ;; - libpsl) - _pkgdeps+=" libxslt" ;; - libsasl) - _pkgdeps+=" libldap krb5 openssl sqlite" ;; - libseccomp) - _pkgdeps+=" git" ;; - libsecret) - _pkgdeps+=" gobject-introspection git intltool gtk-doc" ;; - libtool) - _pkgdeps+=" git help2man" ;; - libxcb) - _pkgdeps+=" libxslt python xorg-util-macros" ;; - libxdmcp) - _pkgdeps+=" xorg-util-macros" ;; - libxml2) - _pkgdeps+=" git python python2" ;; - lz4) - _pkgdeps+=" git" ;; - ninja) - _pkgdeps+=" python2 re2c" ;; - nss-*|libudev|libsystemd*) - _pkgdeps+=" libutil-linux pcre2 git meson gperf python-lxml quota-tools" ;; - patch) - _pkgdeps+=" ed" ;; - python-lxml) - _pkgdeps+=" cython cython2" ;; - python-markupsafe) - _pkgdeps+=" python-setuptools python2-setuptools" ;; - shadow) - _pkgdeps+=" gnome-doc-utils python2" ;; - esac - - # iterate dependencies for pkg - for _dep in $_pkgdeps; do - # translate dependency string to actual package - realdep=$(pacman --noconfirm -Sddw "$_dep" | grep '^Packages' | awk '{print $3}') - realdep=${realdep%-*-*} - # add dependency to tree and frontier - _tree[$_pkgname]="${_tree[$_pkgname]} $realdep" - _frontier+=($realdep) - done - done - - echo -en "\r" - - _tree[libldap]="${_tree[libldap]/libsasl}" - - # write package dependency tree - truncate -s0 "$_deptree".FULL - for i in bash make; do - echo "$i-decross : [ ]" >> "$_deptree".FULL - done - for i in "${!_tree[@]}"; do - echo "$i : [${_tree[$i]} ]" >> "$_deptree".FULL - done -fi - -[ -f "$_deptree" ] || cp "$_deptree"{.FULL,} -chown $SUDO_USER "$_deptree" - -echo " total pkges: $(cat "$_deptree".FULL | wc -l)" -echo " remaining pkges: $(cat "$_deptree" | wc -l)" diff --git a/src/stage3/stage3.sh b/src/stage3/stage3.sh index 93d80f5..0112253 100755 --- a/src/stage3/stage3.sh +++ b/src/stage3/stage3.sh @@ -18,144 +18,133 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## -set -euo pipefail - -msg "Entering Stage 3" -notify "*Bootstrap Entering Stage 3*" - -# set a bunch of convenience variables -_builddir="$topbuilddir"/stage3 -_srcdir="$topsrcdir"/stage3 -_makepkgdir="$_builddir"/$CARCH-makepkg -_deptree="$_builddir"/DEPTREE -_groups="base-devel" -_pkgdest="$_builddir"/packages/$CARCH -_logdest="$_builddir"/makepkglogs - -export PKGDEST="$_pkgdest" -export LOGDEST="$_logdest" - -check_exe librechroot -check_exe libremakepkg -check_exe makepkg - -# make sure that binfmt is *enabled* for stage3 build -echo 1 > /proc/sys/fs/binfmt_misc/status - -# prepare for the build -. "$_srcdir"/prepare_chroot.sh -. "$_srcdir"/prepare_deptree.sh -. "$_srcdir"/prepare_decross.sh - -msg "starting $CARCH native build" - -# keep building packages until the deptree is empty -while [ -s "$_deptree" ]; do - # grab one without unfulfilled dependencies - _pkgname=$(grep '\[ *\]' "$_deptree" | head -n1 | awk '{print $1}') || true - [ -n "$_pkgname" ] || die "could not resolve dependencies. exiting." - - _pkgarch=$(pacman -Si $_pkgname | grep '^Architecture' | awk '{print $3}') - - # set arch to $CARCH, unless it is any - [ "x$_pkgarch" == "xany" ] || _pkgarch=$CARCH - - msg "makepkg: $_pkgname" - msg " remaining packages: $(cat "$_deptree" | wc -l)" - - echo -n "checking for built $_pkgname package ... " - _pkgfile=$(find $_pkgdest -regex "^.*/$_pkgname-[^-]*-[^-]*-[^-]*\.pkg\.tar\.xz\$") - [ -n "$_pkgfile" ] && _have_pkg=yes || _have_pkg=no - echo $_have_pkg - - if [ "x$_have_pkg" == "xno" ]; then - prepare_makepkgdir - - _pkgdir="$_makepkgdir"/$_pkgname/pkg/$_pkgname - - if [ "x$_pkgarch" == "xany" ]; then - # repackage arch=(any) packages - _pkgver=$(pacman -Si $_pkgname | grep '^Version' | awk '{print $3}') - pacman -Sddw --noconfirm --cachedir "$_pkgdest" $_pkgname - elif [ "x$_pkgname" == "xca-certificates-mozilla" ]; then - # repackage ca-certificates-mozilla to avoid building nss - _pkgver=$(pacman -Si $_pkgname | grep '^Version' | awk '{print $3}') - pacman -Sw --noconfirm --cachedir . $_pkgname - mkdir tmp && bsdtar -C tmp -xf $_pkgname-$_pkgver-*.pkg.tar.xz - mkdir -p "$_pkgdir"/usr/share/ - cp -rv tmp/usr/share/ca-certificates/ "$_pkgdir"/usr/share/ - cat > "$_pkgdir"/.PKGINFO << EOF -pkgname = $_pkgname -pkgver = $_pkgver -pkgdesc = Mozilla's set of trusted CA certificates -url = https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS -builddate = $(date '+%s') -size = 0 -arch = $_pkgarch -EOF - cd "$_pkgdir" - env LANG=C bsdtar -czf .MTREE \ - --format=mtree \ - --options='!all,use-set,type,uid,gid,mode,time,size,md5,sha256,link' \ - .PKGINFO * - env LANG=C bsdtar -cf - .MTREE .PKGINFO * | xz -c -z - > \ - "$_pkgdest"/$_pkgname-$_pkgver-$_pkgarch.pkg.tar.xz - else - fetch_pkgfiles $_pkgname - import_keys - - # patch if necessary - cp PKGBUILD{,.old} - [ -f "$_srcdir"/patches/$_pkgname.patch ] && \ - patch -Np1 -i "$_srcdir"/patches/$_pkgname.patch - cp PKGBUILD{,.in} - - # substitute common variables - sed -i \ - "s#@MULTILIB@#${MULTILIB:-disable}#g" \ - PKGBUILD - - # enable the target CARCH in arch array - sed -i "s/arch=([^)]*/& $CARCH/" PKGBUILD - - # build the package - chown -R $SUDO_USER "$_makepkgdir"/$_pkgname - "$_builddir"/libremakepkg-$CARCH.sh -n $CHOST-stage3 || failed_build - fi - - popd >/dev/null - - # update pacman cache - rm -rf /var/cache/pacman/pkg-$CARCH/* - rm -rf "$_pkgdest"/native.{db,files}* - repo-add -q -R "$_pkgdest"/{native.db.tar.gz,*.pkg.tar.xz} - - # install in chroot - _pkgfile=$(find $_pkgdest -regex "^.*/$_pkgname-[^-]*-[^-]*-[^-]*\.pkg\.tar\.xz\$" | head -n1) - set +o pipefail - yes | librechroot \ - -n "$CHOST-stage3" \ - -C "$_builddir"/config/pacman.conf \ - -M "$_builddir"/config/makepkg.conf \ - run pacman -Udd /native/$CARCH/"$(basename "$_pkgfile")" - yes | librechroot \ - -n "$CHOST-stage3" \ - -C "$_builddir"/config/pacman.conf \ - -M "$_builddir"/config/makepkg.conf \ - run pacman -Syyuu - set -o pipefail +# shellcheck source=src/stage3/makepkg.sh +. "$TOPSRCDIR"/stage3/makepkg.sh +# shellcheck source=src/stage3/chroot.sh +. "$TOPSRCDIR"/stage3/chroot.sh + +stage3_makepkg() { + local pkgname="${1%-decross}" + local prefix=() + [ "x$1" != "x$pkgname" ] && prefix=(-p decross) + + package_fetch_upstream_pkgfiles "$pkgname" || return + package_import_keys "$pkgname" || return + package_patch "${prefix[@]}" "$pkgname" || return + + # substitute common variables + sed "s#@MULTILIB@#${MULTILIB:-disable}#g" \ + PKGBUILD.in > PKGBUILD + + package_enable_arch "$CARCH" + + # check built dependencies + local dep + for dep in $(srcinfo_builddeps -n); do + deptree_check_depend "$1" "$dep" || return + done + for dep in $(srcinfo_rundeps "$1"); do + deptree_check_depend "$1" "$dep" || return + done + + # postpone build if necessary + deptree_is_satisfyable "$1" || return 0 + + # don't rebuild if already exists + check_pkgfile "$PKGDEST" "$1" && return + + # disable checkdepends + echo "checkdepends=()" >> PKGBUILD + + if [ "x$1" != "x$pkgname" ]; then + # a bit of magic for -decross builds + PKGDEST=. "$BUILDDIR/libremakepkg-$CARCH.sh" -n "$CHOST"-stage3 || return + local pkgfiles pkgfile + pkgfiles=("$pkgname"-*.pkg.tar.xz); pkgfile="${pkgfiles[0]}" + mv -v "$pkgfile" "$PKGDEST/${pkgfile/$pkgname/$1}" + else + # regular build otherwise + "$BUILDDIR/libremakepkg-$CARCH.sh" -n "$CHOST"-stage3 || return fi +} - # remove pkg from deptree - sed -i "/^$_pkgname :/d; s/ / /g; s/ $_pkgname / /g; s/ */ /g" "$_deptree" +stage3_package_build() { + local pkgarch + pkgarch=$(pkgarch "${1%-decross}") || return - full=$(cat "$_deptree".FULL | wc -l) - curr=$(expr $full - $(cat "$_deptree" | wc -l)) - notify -c success -u low "*$curr/$full* $_pkgname" -done + if [ "x$pkgarch" == "xany" ] || [ "x$1" == "xca-certificates-mozilla" ]; then + package_reuse_upstream "$1" || return + else + stage3_makepkg "$1" || return + fi -# unmount -umount "$_chrootdir"/native/$CARCH -umount "$_chrootdir"/cross/$CARCH + # postpone on unmet dependencies + deptree_is_satisfyable "$1" || return 0 + + # update repo + rm -rf /var/cache/pacman/pkg-"$CARCH"/* + rm -rf "$PKGDEST"/native.{db,files}* + repo-add -q -R "$PKGDEST"/{native.db.tar.gz,*.pkg.tar.xz} +} + +stage3_package_install() { + local pkgfile + pkgfile=$(find "$PKGDEST" -regex "^.*/$1-[^-]*-[^-]*-[^-]*\\.pkg\\.tar\\.xz\$" | head -n1) + [ -n "$pkgfile" ] || { error "$1: pkgfile not found"; return "$ERROR_MISSING"; } + + yes | librechroot \ + -n "$CHOST-stage3" \ + -C "$BUILDDIR"/config/pacman.conf \ + -M "$BUILDDIR"/config/makepkg.conf \ + run pacman -Udd /repos/native/"$CARCH"/"$(basename "$pkgfile")" || return + yes | librechroot \ + -n "$CHOST-stage3" \ + -C "$BUILDDIR"/config/pacman.conf \ + -M "$BUILDDIR"/config/makepkg.conf \ + run pacman -Syyuu || return +} + +stage3() { + msg -n "Entering Stage 3" + + local groups=(base-devel) + local decross=(bash make) + + export BUILDDIR="$TOPBUILDDIR"/stage3 + export SRCDIR="$TOPSRCDIR"/stage3 + export MAKEPKGDIR="$BUILDDIR"/$CARCH-makepkg + export DEPTREE="$BUILDDIR"/DEPTREE + export PKGDEST="$BUILDDIR"/packages/$CARCH + export PKGPOOL="$PKGDEST" + export LOGDEST="$BUILDDIR"/makepkglogs + export DEPPATH=("$PKGDEST" "${PKGDEST/stage3/stage2}") + + mkdir -p "$PKGDEST" "$PKGPOOL" "$LOGDEST" + chown "$SUDO_USER" "$PKGDEST" "$PKGPOOL" "$LOGDEST" + + binfmt_enable + + prepare_stage3_makepkg || die -e "$ERROR_BUILDFAIL" "failed to prepare $CARCH makepkg" + prepare_stage3_chroot || die -e "$ERROR_BUILDFAIL" "failed to prepare $CARCH chroot" + prepare_deptree "${groups[@]}" || die -e "$ERROR_BUILDFAIL" "failed to prepare DEPTREE" + + local pkg + for pkg in "${decross[@]}"; do + deptree_add_entry "$pkg-decross" + done + + echo "remaining pkges: $(wc -l < "$DEPTREE") / $(wc -l < "$DEPTREE".FULL)" + if [ -s "$DEPTREE" ]; then + check_exe -r librechroot libremakepkg + + for pkg in "${decross[@]}"; do + package_build stage3_package_build stage3_package_install "$pkg-decross" || return + done + + # build packages from deptree + packages_build_all stage3_package_build stage3_package_install || return + fi -echo "all packages built." + # cleanup + umount_stage3_chrootdir +} diff --git a/src/stage4/prepare_deptree.sh b/src/stage4/chroot.sh index d5f512a..5bd90e5 100644 --- a/src/stage4/prepare_deptree.sh +++ b/src/stage4/chroot.sh @@ -18,32 +18,54 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## -set -euo pipefail - -msg "preparing transitive dependency tree for $_groups (Stage 4)" - -echo -n "checking for complete deptree ... " -[ -f "$_deptree".FULL ] && _have_deptree=yes || _have_deptree=no -echo $_have_deptree - -if [ "x$_have_deptree" == "xno" ]; then - truncate -s0 "$_deptree".FULL - - for _group in $_groups; do - for _pkg in $(pacman -Sg $_group | awk '{print $2}'); do - _realpkg=$(pacman --noconfirm -Sddw "$_pkg" | grep '^Packages' | awk '{print $3}') - _realpkg="${_realpkg%-*-*}" - if ! grep -q "^$_realpkg :" "$_deptree".FULL; then - echo "$_realpkg : [ ] # $_group" >> "$_deptree".FULL - else - sed -i "s/^$_realpkg : \[.*/&, $_group/" "$_deptree".FULL - fi - done - done -fi - -[ -f "$_deptree" ] || cp "$_deptree"{.FULL,} -chown $SUDO_USER "$_deptree" - -echo " total pkges: $(cat "$_deptree".FULL | wc -l)" -echo " remaining pkges: $(cat "$_deptree" | wc -l)" +check_stage4_chroot() { + echo -n "checking for $CARCH chroot ... " + + local have_chroot=yes + [ -e "$1" ] || have_chroot=no + echo $have_chroot + + [ "x$have_chroot" == "xyes" ] || return "$ERROR_MISSING" +} + +build_stage4_chroot() { + rm -rf /var/cache/pacman/pkg-"$CARCH"/* + librechroot -n "$CHOST-stage4" \ + -C "$BUILDDIR"/config/pacman-bootstrap.conf \ + -M "$BUILDDIR"/config/makepkg.conf \ + make || return +} + +umount_stage4_chrootdir() { + local chrootdir + chrootdir="$(librechroot -n "$CHOST-stage4" 2>&1 | grep "copydir.*:" | awk '{print $3}')" + + umount "$chrootdir"/repos/repos/ + umount "$chrootdir"/repos/native/ + + trap - INT TERM EXIT +} + +mount_stage4_chrootdir() { + mkdir -p "$1"/{repos,native} + if mount | grep -q "$1"/repos; then umount "$1"/repos; fi + if mount | grep -q "$1"/native; then umount "$1"/native; fi + mount -o bind "$TOPBUILDDIR/stage4/packages" "$1"/repos + mount -o bind "$TOPBUILDDIR/stage3/packages" "$1"/native + + trap 'umount_stage4_chrootdir' INT TERM EXIT +} + +prepare_stage4_chroot() { + local chrootdir + chrootdir="$(librechroot -n "$CHOST-stage4" 2>&1 | grep "copydir.*:" | awk '{print $3}')" + + check_stage4_chroot "$chrootdir" || build_stage4_chroot "$chrootdir" || return + + mount_stage3_chrootdir "$chrootdir" + + librechroot -n "$CHOST-stage4" \ + -C "$BUILDDIR"/config/pacman.conf \ + -M "$BUILDDIR"/config/makepkg.conf \ + update || return +} diff --git a/src/stage4/makepkg.sh b/src/stage4/makepkg.sh new file mode 100644 index 0000000..11c7024 --- /dev/null +++ b/src/stage4/makepkg.sh @@ -0,0 +1,84 @@ +#!/bin/bash + ############################################################################## + # parabola-riscv64-bootstrap # + # # + # Copyright (C) 2018 Andreas Grapentin # + # # + # This program is free software: you can redistribute it and/or modify # + # it under the terms of the GNU General Public License as published by # + # the Free Software Foundation, either version 3 of the License, or # + # (at your option) any later version. # + # # + # This program is distributed in the hope that it will be useful, # + # but WITHOUT ANY WARRANTY; without even the implied warranty of # + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # + # GNU General Public License for more details. # + # # + # You should have received a copy of the GNU General Public License # + # along with this program. If not, see <http://www.gnu.org/licenses/>. # + ############################################################################## + +prepare_stage4_makepkg() { + mkdir -p "$BUILDDIR"/config + + cat > "$BUILDDIR"/config/pacman-bootstrap.conf << EOF +[options] +Architecture = $CARCH +[libre] +Server = file://$TOPBUILDDIR/stage4/packages/\$repo/os/\$arch +[core] +Server = file://$TOPBUILDDIR/stage4/packages/\$repo/os/\$arch +[extra] +Server = file://$TOPBUILDDIR/stage4/packages/\$repo/os/\$arch +[community] +Server = file://$TOPBUILDDIR/stage4/packages/\$repo/os/\$arch +[native] +Server = file://$TOPBUILDDIR/stage3/packages/\$arch +EOF + + cat > "$BUILDDIR"/config/pacman.conf << EOF +[options] +Architecture = $CARCH +[libre] +Server = file:///repos/\$repo/os/\$arch +[core] +Server = file:///repos/\$repo/os/\$arch +[extra] +Server = file:///repos/\$repo/os/\$arch +[community] +Server = file:///repos/\$repo/os/\$arch +[native] +Server = file:///native/\$arch +EOF + + cat >> "$BUILDDIR"/config/makepkg.conf << EOF +CARCH="$CARCH" +CHOST="$CHOST" +CFLAGS="-march=$GCC_MARCH -mabi=$GCC_MABI -O2 -pipe -fstack-protector-strong -fno-plt" +CXXFLAGS="-march=$GCC_MARCH -mabi=$GCC_MABI -O2 -pipe -fstack-protector-strong -fno-plt" +MAKEFLAGS="-j$(($(nproc) + 1))" +EOF + + local repo + for repo in libre core extra community; do + local repodir="$PKGDEST/../$repo/os/$CARCH" + check_repo "$repodir" "$repo" || make_repo "$repodir" "$repo" + done + + # patch libremakepkg to update config.sub/config.guess + cat "$(which libremakepkg)" > "$BUILDDIR/libremakepkg-$CARCH.sh" + chmod +x "$BUILDDIR/libremakepkg-$CARCH.sh" + + if [ "x${REGEN_CONFIG_FRAGMENTS:-no}" == "xyes" ]; then + local url="https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain" + sed -i "/Boring\\/mundane/i \\ +update_config_fragments() {\\ + find \$1/build -iname config.sub -exec curl \"$url;f=config.sub;hb=HEAD\" -o {} \\\\;\\ + find \$1/build -iname config.guess -exec curl \"$url;f=config.guess;hb=HEAD\" -o {} \\\\;\\ +}\\ +hook_pre_build+=(update_config_fragments)" "$BUILDDIR/libremakepkg-$CARCH.sh" + fi + + # patch libremakepkg to disable checks + sed -i 's/makepkg_args=(.*noconfirm[^)]*/& --nocheck/' "$BUILDDIR/libremakepkg-$CARCH.sh" +} diff --git a/src/stage4/patches/archlinuxarm-keyring.patch b/src/stage4/patches/archlinuxarm-keyring.patch deleted file mode 100644 index ef0372e..0000000 --- a/src/stage4/patches/archlinuxarm-keyring.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/PKGBUILD 2018-03-19 19:58:13.014101363 +0100 -+++ b/PKGBUILD 2018-03-19 20:00:52.026776851 +0100 -@@ -14,6 +14,7 @@ source=("http://archlinuxarm.org/builder - "http://archlinuxarm.org/builder/src/${pkgname}-${pkgver}.tar.gz.sig") - sha256sums=('1bff06fee35a13afaa4bf6b62a833a157f3e3abcb66bc57e11d30d6d0c4f9351' - 'SKIP') -+validpgpkeys=('68B3537F39A313B3E574D06777193F152BDBE6A6') - - package() { - cd "${srcdir}/${pkgname}-${pkgver}" diff --git a/src/stage4/patches/autoconf.patch b/src/stage4/patches/autoconf.patch deleted file mode 100644 index 9fed73c..0000000 --- a/src/stage4/patches/autoconf.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/PKGBUILD 2018-03-21 18:40:39.584461795 +0100 -+++ b/PKGBUILD 2018-03-21 21:01:09.778810341 +0100 -@@ -41,7 +41,8 @@ build() { - - check() { - cd ${srcdir}/${pkgname}-${pkgver} -- make check -+ # benign test failures in cross-arch chroot -+ make check || true - } - - package() { diff --git a/src/stage4/patches/cairo.patch b/src/stage4/patches/cairo.patch deleted file mode 100644 index 0468fe5..0000000 --- a/src/stage4/patches/cairo.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/PKGBUILD 2018-03-27 14:19:51.905313429 +0200 -+++ b/PKGBUILD 2018-03-27 14:23:41.821763186 +0200 -@@ -10,7 +10,7 @@ url="https://cairographics.org/" - arch=(x86_64) - license=(LGPL MPL) - depends=(libpng libxrender libxext fontconfig pixman glib2 lzo) --makedepends=(librsvg gtk2 poppler-glib libspectre gtk-doc valgrind git) -+makedepends=(librsvg gtk2 poppler-glib libspectre gtk-doc git) - _commit=1ed124ace201946177eab962d3b07bb2fedf9026 # master - source=("git+https://anongit.freedesktop.org/git/cairo#commit=$_commit" - utf-8.diff) diff --git a/src/stage4/patches/cups.patch b/src/stage4/patches/cups.patch deleted file mode 100644 index 558ec11..0000000 --- a/src/stage4/patches/cups.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/PKGBUILD 2018-03-27 10:27:04.635102862 +0200 -+++ b/PKGBUILD 2018-03-27 11:04:46.046025901 +0200 -@@ -10,7 +10,7 @@ license=('GPL') - url="https://www.cups.org/" - makedepends=('libtiff' 'libpng' 'acl' 'pam' 'xdg-utils' 'krb5' 'gnutls' - 'cups-filters' 'bc' 'colord' 'xinetd' 'gzip' 'autoconf' 'libusb' 'dbus' -- 'avahi' 'hicolor-icon-theme' 'systemd' 'inetutils' 'libpaper' 'valgrind') -+ 'avahi' 'hicolor-icon-theme' 'systemd' 'inetutils' 'libpaper') - source=(https://github.com/apple/cups/releases/download/v${pkgver}/cups-${pkgver}-source.tar.gz{,.sig} - cups.logrotate cups.pam - cups.sysusers guid.patch diff --git a/src/stage4/patches/docbook-dsssl.patch b/src/stage4/patches/docbook-dsssl.patch deleted file mode 100644 index 03db896..0000000 --- a/src/stage4/patches/docbook-dsssl.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/PKGBUILD 2018-03-27 21:20:58.398058462 +0200 -+++ b/PKGBUILD 2018-03-27 21:40:09.943685533 +0200 -@@ -26,6 +26,7 @@ prepare() { - - package(){ - cd "${pkgname}-${pkgver}" -+ MAKEFLAGS= - make install \ - BINDIR="${pkgdir}/usr/bin" \ - DESTDIR="${pkgdir}/usr/share/sgml/docbook/dsssl-stylesheets-${pkgver}" \ diff --git a/src/stage4/patches/gawk.patch b/src/stage4/patches/gawk.patch deleted file mode 100644 index a6286e0..0000000 --- a/src/stage4/patches/gawk.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/PKGBUILD 2018-03-21 07:47:28.538565741 +0100 -+++ b/PKGBUILD 2018-03-21 08:04:36.575616264 +0100 -@@ -25,7 +25,8 @@ build() { - - check() { - cd ${srcdir}/${pkgname}-${pkgver} -- make check -+ # benign testsuite failure when networking is disabled -+ make check || true - } - - package() { diff --git a/src/stage4/patches/gc.patch b/src/stage4/patches/gc.patch index d605999..453cef8 100644 --- a/src/stage4/patches/gc.patch +++ b/src/stage4/patches/gc.patch @@ -1,6 +1,6 @@ ---- a/PKGBUILD 2018-03-26 21:42:59.260326150 +0200 -+++ b/PKGBUILD 2018-03-26 21:52:32.189131233 +0200 -@@ -10,27 +10,24 @@ arch=('x86_64') +--- a/PKGBUILD 2018-03-12 18:02:55.550559093 +0100 ++++ b/PKGBUILD 2018-03-12 18:19:24.997339010 +0100 +@@ -10,17 +10,19 @@ arch=('x86_64') url="http://www.hboehm.info/gc/" license=('GPL') depends=('gcc-libs' 'libatomic_ops') @@ -22,13 +22,9 @@ ./configure --prefix=/usr --enable-cplusplus --disable-static sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool make +@@ -10,7 +10,7 @@ arch=('x86_64') } --check() { -- cd ${pkgname}-${pkgver} -- make check --} -- package() { - cd ${pkgname}-${pkgver} + cd bdwgc diff --git a/src/stage4/patches/glib2.patch b/src/stage4/patches/glib2.patch deleted file mode 100644 index 9b0ca2a..0000000 --- a/src/stage4/patches/glib2.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/PKGBUILD 2018-03-26 19:33:05.952086933 +0200 -+++ b/PKGBUILD 2018-03-26 20:25:45.245769186 +0200 -@@ -57,7 +57,8 @@ build() { - - check() { - cd glib -- make check -+ # benign testsuite failure in cross-arch chroot -+ make check || true - } - - package_glib2() { diff --git a/src/stage4/patches/gnutls.patch b/src/stage4/patches/gnutls.patch deleted file mode 100644 index 228cea1..0000000 --- a/src/stage4/patches/gnutls.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/PKGBUILD 2018-03-27 13:30:38.593524988 +0200 -+++ b/PKGBUILD 2018-03-27 14:20:41.564845862 +0200 -@@ -45,7 +45,8 @@ build() { - - check() { - cd ${pkgname}-${pkgver} -- make check -+ # benign test failure in cross-arch chroot -+ make check || true - } - - package() { diff --git a/src/stage4/patches/grep.patch b/src/stage4/patches/grep.patch deleted file mode 100644 index 4f26f04..0000000 --- a/src/stage4/patches/grep.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/PKGBUILD 2018-03-21 10:09:30.154295409 +0100 -+++ b/PKGBUILD 2018-03-21 10:33:34.400187479 +0100 -@@ -26,6 +26,8 @@ build() { - - check() { - cd $pkgname-$pkgver -+ # fix a benign testsuite failure under qemu-static -+ sed -i 's/unlimited/65536/' tests/pcre-jitstack - make check - } - diff --git a/src/stage4/patches/gstreamer.patch b/src/stage4/patches/gstreamer.patch deleted file mode 100644 index 9815239..0000000 --- a/src/stage4/patches/gstreamer.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/PKGBUILD 2018-03-27 23:24:38.053903697 +0200 -+++ b/PKGBUILD 2018-03-27 23:33:14.198418696 +0200 -@@ -10,7 +10,7 @@ url="https://gstreamer.freedesktop.org/" - arch=(x86_64) - license=(LGPL) - depends=(libxml2 glib2 libunwind libcap libelf) --makedepends=(gtk-doc gobject-introspection autoconf-archive git valgrind bash-completion) -+makedepends=(gtk-doc gobject-introspection autoconf-archive git bash-completion) - checkdepends=(gmp gsl gtk3) - _commit=80e0e90d00bb358ca9dc071cf6de010ec5ae2644 # tags/1.14.0^0 - install=gstreamer.install diff --git a/src/stage4/patches/guile.patch b/src/stage4/patches/guile.patch deleted file mode 100644 index a54cdcb..0000000 --- a/src/stage4/patches/guile.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/PKGBUILD 2018-03-15 10:30:50.055073809 +0100 -+++ b/PKGBUILD 2018-03-15 12:33:49.036128775 +0100 -@@ -29,7 +29,8 @@ build() { - - check() { - cd $pkgname-$pkgver -- make check -+ # benign testsuite failure in cross-arch chroot -+ make check || true - } - - package() { diff --git a/src/stage4/patches/iana-etc.patch b/src/stage4/patches/iana-etc.patch deleted file mode 100644 index 512d2b9..0000000 --- a/src/stage4/patches/iana-etc.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/PKGBUILD 2018-03-19 17:18:55.602994824 +0100 -+++ b/PKGBUILD 2018-03-19 17:20:22.332769036 +0100 -@@ -13,7 +13,7 @@ backup=('etc/'{protocols,services}) - source=('https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml' - 'https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml' - 'LICENSE') --sha256sums=('e0be507688063ececbc13908c7eced6e16c8aca351d8febbeb3dd09f64a82709' -+sha256sums=('9fbe6c0789133b703a4bfda41c12386e38ff48e4546b6a2e96fccd9efe776199' - '4992fbc5453d0feb48492e6abda96bf9285ff4d2516f6924a0f92f773dc4cea2' - 'dd37e92942d5a4024f1c77df49d61ca77fc6284691814903a741785df61f78cb') - diff --git a/src/stage4/patches/libaio.patch b/src/stage4/patches/libaio.patch index 09bae70..306cff9 100644 --- a/src/stage4/patches/libaio.patch +++ b/src/stage4/patches/libaio.patch @@ -29,9 +29,8 @@ check() { - cd "$srcdir/$pkgname-$pkgver" -- make partcheck + cd "$srcdir/$pkgname" -+ make partcheck || true + make partcheck } package() { diff --git a/src/stage4/patches/libarchive.patch b/src/stage4/patches/libarchive.patch deleted file mode 100644 index d2cd650..0000000 --- a/src/stage4/patches/libarchive.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/PKGBUILD 2018-03-22 14:17:02.153136554 +0100 -+++ b/PKGBUILD 2018-03-22 14:35:26.493045159 +0100 -@@ -33,7 +33,8 @@ build() { - - check() { - cd $pkgname-$pkgver -- make check -+ # benign testsuite failure under cross-arch chroot -+ make check || true - } - - package() { diff --git a/src/stage4/patches/libatomic_ops.patch b/src/stage4/patches/libatomic_ops.patch index 3fabd70..13868fd 100644 --- a/src/stage4/patches/libatomic_ops.patch +++ b/src/stage4/patches/libatomic_ops.patch @@ -1,6 +1,6 @@ --- a/PKGBUILD 2018-03-12 17:32:57.049007339 +0100 +++ b/PKGBUILD 2018-03-12 17:45:14.783595573 +0100 -@@ -14,26 +14,23 @@ url='https://github.com/ivmai/libatomic_ +@@ -14,15 +14,17 @@ url='https://github.com/ivmai/libatomic_ depends=(glibc) license=(GPL2 MIT) options=(!docs) @@ -22,12 +22,9 @@ ./configure --prefix=/usr --disable-static --enable-shared make } +@@ -14,7 +14,7 @@ url='https://github.com/ivmai/libatomic_ + } --check() { -- cd $pkgname-$pkgver -- make check --} -- package() { - cd $pkgname-$pkgver + cd $pkgname diff --git a/src/stage4/patches/libelf.patch b/src/stage4/patches/libelf.patch deleted file mode 100644 index 040514a..0000000 --- a/src/stage4/patches/libelf.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/PKGBUILD 2018-03-22 12:03:27.863763369 +0100 -+++ b/PKGBUILD 2018-03-22 12:18:53.948883581 +0100 -@@ -34,7 +34,8 @@ build() { - check() { - cd ${pkgbase}-${pkgver} - -- make check -+ # testsuite does weird things in cross-arch chroot. rerun in VM! -+ make check || true - } - - package_elfutils() { diff --git a/src/stage4/patches/libfbclient.patch b/src/stage4/patches/libfbclient.patch deleted file mode 100644 index ebcc632..0000000 --- a/src/stage4/patches/libfbclient.patch +++ /dev/null @@ -1,79 +0,0 @@ ---- a/PKGBUILD 2018-03-27 21:21:45.773612046 +0200 -+++ b/PKGBUILD 2018-03-27 21:45:54.408574372 +0200 -@@ -14,16 +14,20 @@ options=('!makeflags') - source=(http://downloads.sourceforge.net/firebird/Firebird-$pkgver-0.tar.bz2 - firebird-c++11.patch - firebird-c++14.patch -- LICENSE) -+ LICENSE -+ 0001-firebird-riscv-support.patch) - md5sums=('fb34241e96f9707604bf6cd78357d5a2' - '5094347a8298143ca147edd49b552fe9' - 'a02710203cee81b4f48b7bdca3b1b33f' -- '0d61798861e159c85dbdf0f30fe2f2ce') -+ '0d61798861e159c85dbdf0f30fe2f2ce' -+ '287a91af029d7b91f3e41cbe4a2bd342') - - prepare() { - cd $srcdir/Firebird-$pkgver-0 - patch -Np1 -i ../firebird-c++11.patch - patch -Np0 -i ../firebird-c++14.patch -+ # https://github.com/FirebirdSQL/firebird/commit/1e8e7858db84750a77006d307bf28e9686f9414e -+ patch -Np1 -i ../0001-firebird-riscv-support.patch - } - - build() { ---- /dev/null 2018-03-21 10:59:45.661284739 +0100 -+++ b/0001-firebird-riscv-support.patch 2018-03-27 21:45:45.246470426 +0200 -@@ -0,0 +1,51 @@ -+diff --git a/configure.ac b/configure.ac -+index ee114415b6..235dc373d4 100644 -+--- a/configure.in -++++ b/configure.in -+@@ -249,6 +249,18 @@ dnl CPU_TYPE=ppc64 -+ SHRLIB_EXT=so -+ ;; -+ -++ riscv64*-*-linux*) -++ MAKEFILE_PREFIX=linux_riscv64 -++ INSTALL_PREFIX=linux -++ PLATFORM=LINUX -++ AC_DEFINE(LINUX, 1, [Define this if OS is Linux]) -++ EDITLINE_FLG=Y -++ SHRLIB_EXT=so -++ STD_EDITLINE=true -++ STD_ICU=true -++ libdir=/usr/lib64 -++ ;; -++ -+ powerpc64le-*-linux*) -+ MAKEFILE_PREFIX=linux_powerpc64el -+ INSTALL_PREFIX=linux -+diff --git a/src/jrd/common.h b/src/jrd/common.h -+index 9f2c8c067f..7d67bf5845 100644 -+--- a/src/jrd/common.h -++++ b/src/jrd/common.h -+@@ -139,6 +139,10 @@ -+ #define IMPLEMENTATION isc_info_db_impl_linux_arm // 75 -+ #endif /* ARM */ -+ -++#ifdef __riscv -++#define IMPLEMENTATION isc_info_db_impl_linux_riscv64 // 86 -++#endif /* __riscv */ -++ -+ #ifdef sparc -+ #define IMPLEMENTATION isc_info_db_impl_linux_sparc /* 65 */ -+ #define RISC_ALIGNMENT -+diff --git a/src/jrd/inf_pub.h b/src/jrd/inf_pub.h -+index a3513f98be..df61e9c498 100644 -+--- a/src/jrd/inf_pub.h -++++ b/src/jrd/inf_pub.h -+@@ -256,6 +256,8 @@ enum info_db_implementations -+ isc_info_db_impl_linux_arm64 = 84, -+ isc_info_db_impl_linux_ppc64el = 85, -+ -++ isc_info_db_impl_linux_riscv64 = 86, -++ -+ isc_info_db_impl_last_value // Leave this LAST! -+ }; -+ diff --git a/src/stage4/patches/linux-libre-firmware.patch b/src/stage4/patches/linux-libre-firmware.patch deleted file mode 100644 index 6482343..0000000 --- a/src/stage4/patches/linux-libre-firmware.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/PKGBUILD 2018-03-19 20:17:44.647454342 +0100 -+++ b/PKGBUILD 2018-03-19 20:25:11.605615751 +0100 -@@ -13,7 +13,7 @@ makedepends=('git' 'gmp') - arch=('any') - url="https://jxself.org/git/?p=linux-libre-firmware.git;a=summary" - license=('GPL2' 'GPL3') --depends=('ath9k-htc-firmware' 'openfwwf') -+depends=('openfwwf') - provides=('linux-firmware') - conflicts=('linux-firmware' - 'linux-firmware-git' -@@ -60,6 +60,7 @@ pkgver() { - - build() { - cd "${srcdir}/${pkgname}" -+ MAKEFLAGS="" - make cis dsp56k isci keyspan_pda #av7110 carl9170fw usbdux - } - diff --git a/src/stage4/patches/make.patch b/src/stage4/patches/make.patch index b37edd2..a71388c 100644 --- a/src/stage4/patches/make.patch +++ b/src/stage4/patches/make.patch @@ -9,11 +9,3 @@ patch -p1 -i ${srcdir}/guile-2.2.patch autoreconf -fi } -@@ -32,6 +34,7 @@ build() { - - check() { - cd ${pkgname}-${pkgver} -+ export PERL_USE_UNSAFE_INC=1 - make -k check - } - diff --git a/src/stage4/patches/meson.patch b/src/stage4/patches/meson.patch deleted file mode 100644 index a624886..0000000 --- a/src/stage4/patches/meson.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/PKGBUILD 2018-03-25 21:55:28.996219660 +0200 -+++ b/PKGBUILD 2018-03-26 15:21:25.437467723 +0200 -@@ -15,16 +15,20 @@ checkdepends=('gcc-objc' 'vala' 'rust' ' - 'cython' 'gtkmm3' 'gtest' 'gmock' 'protobuf' 'wxgtk' 'python-gobject' 'gobject-introspection' - 'itstool' 'gtk3' 'java-environment=8' 'gtk-doc' 'llvm' 'clang' 'sdl2' 'graphviz' - 'doxygen' 'vulkan-validation-layers' 'openmpi' 'openssh' 'mercurial' 'gtk-sharp-2' -- 'qt5-tools' 'libwmf' 'dmd' 'valgrind') -+ 'qt5-tools' 'libwmf' 'dmd') - source=(https://github.com/mesonbuild/meson/releases/download/${pkgver}/meson-${pkgver}.tar.gz{,.asc} -- arch-meson) -+ arch-meson -+ 0001-logfile-encoding-utf-8.patch) - sha512sums=('50bcc299d69a3649a3aa3582322c548af44c2771d65e57c79eae9d67ccb256a17e534649ee5080f50f6f9d4e5d717a1b1a28b3ef4684468094b16bbed8864846' - 'SKIP' -- 'e901f87f3ee1baa7b9aedb79bd5c9e50898a5695ac938f7f8420d8e81f526a09f07ceedadb65975437efa5a68fcf581110a040f579f2530437d1e6eb5addea76') -+ 'e901f87f3ee1baa7b9aedb79bd5c9e50898a5695ac938f7f8420d8e81f526a09f07ceedadb65975437efa5a68fcf581110a040f579f2530437d1e6eb5addea76' -+ 'e79873a0357242517cd86599fca9e03b0c3811f8feb343d958f3e9a0ebd56bc15e73db7f1bc2fbf11b463b847b9bc034ea7087d85963b59bc017eea95a565b3a') - validpgpkeys=('95181F4EED14FDF4E41B518D3BF4693BFEEB9428') # Jussi Pakkanen <jpakkane@gmail.com> - - prepare() { - cd ${pkgname}-${pkgver} -+ # fix encoding errors in systemd test suite -+ patch -Np1 -i ../0001-logfile-encoding-utf-8.patch - } - - build() { diff --git a/src/stage4/patches/nettle.patch b/src/stage4/patches/nettle.patch deleted file mode 100644 index 68588e7..0000000 --- a/src/stage4/patches/nettle.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/PKGBUILD 2018-03-27 14:06:55.153495508 +0200 -+++ b/PKGBUILD 2018-03-27 14:22:35.533060606 +0200 -@@ -10,7 +10,6 @@ arch=('x86_64') - url="https://www.lysator.liu.se/~nisse/nettle" - license=('GPL2') - depends=('gmp') --checkdepends=('valgrind') - source=(https://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz{,.sig}) - sha256sums=('ae7a42df026550b85daca8389b6a60ba6313b0567f374392e54918588a411e94' - 'SKIP') diff --git a/src/stage4/patches/ninja.patch b/src/stage4/patches/ninja.patch deleted file mode 100644 index 146edbd..0000000 --- a/src/stage4/patches/ninja.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/PKGBUILD 2018-03-27 19:55:50.890298523 +0200 -+++ b/PKGBUILD 2018-03-27 20:42:24.594821191 +0200 -@@ -23,14 +23,6 @@ build() { - emacs -Q --batch -f batch-byte-compile misc/ninja-mode.el - } - --check() { -- cd ninja-$pkgver -- -- python2 ./configure.py -- ./ninja ninja_test -- ./ninja_test --gtest_filter=-SubprocessTest.SetWithLots --} -- - package() { - cd ninja-$pkgver - diff --git a/src/stage4/patches/openssh.patch b/src/stage4/patches/openssh.patch deleted file mode 100644 index a74f84b..0000000 --- a/src/stage4/patches/openssh.patch +++ /dev/null @@ -1,991 +0,0 @@ ---- a/openssl-1.1.0.patch 2018-03-26 14:51:21.269973068 +0200 -+++ b/openssl-1.1.0.patch 2018-03-26 14:51:37.212129950 +0200 -@@ -1,7 +1,7 @@ --diff -aurp old/auth-pam.c new/auth-pam.c ----- old/auth-pam.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/auth-pam.c 2018-03-23 10:05:03.886621278 -1000 --@@ -128,6 +128,10 @@ extern u_int utmp_len; -+diff -Naur old/auth-pam.c new/auth-pam.c -+--- old/auth-pam.c 2017-10-03 21:49:05.363829772 -1000 -++++ new/auth-pam.c 2017-10-03 21:55:50.869718862 -1000 -+@@ -128,6 +128,10 @@ - typedef pthread_t sp_pthread_t; - #else - typedef pid_t sp_pthread_t; -@@ -12,10 +12,10 @@ diff -aurp old/auth-pam.c new/auth-pam.c - #endif - - struct pam_ctxt { --diff -aurp old/cipher.c new/cipher.c ----- old/cipher.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/cipher.c 2018-03-23 10:05:03.886621278 -1000 --@@ -297,7 +297,10 @@ cipher_init(struct sshcipher_ctx **ccp, -+diff -Naur old/cipher.c new/cipher.c -+--- old/cipher.c 2017-10-03 21:49:05.367162904 -1000 -++++ new/cipher.c 2017-10-03 21:55:50.869718862 -1000 -+@@ -297,7 +297,10 @@ - goto out; - } - } -@@ -27,7 +27,7 @@ diff -aurp old/cipher.c new/cipher.c - ret = SSH_ERR_LIBCRYPTO_ERROR; - goto out; - } --@@ -483,7 +486,7 @@ cipher_get_keyiv(struct sshcipher_ctx *c -+@@ -486,7 +489,7 @@ - len, iv)) - return SSH_ERR_LIBCRYPTO_ERROR; - } else -@@ -36,7 +36,7 @@ diff -aurp old/cipher.c new/cipher.c - #endif - return 0; - } --@@ -517,14 +520,19 @@ cipher_set_keyiv(struct sshcipher_ctx *c -+@@ -520,14 +523,19 @@ - EVP_CTRL_GCM_SET_IV_FIXED, -1, (void *)iv)) - return SSH_ERR_LIBCRYPTO_ERROR; - } else -@@ -59,9 +59,9 @@ diff -aurp old/cipher.c new/cipher.c - #endif - - int --diff -aurp old/cipher.h new/cipher.h ----- old/cipher.h 2018-03-22 16:21:14.000000000 -1000 --+++ new/cipher.h 2018-03-23 10:05:03.886621278 -1000 -+diff -Naur old/cipher.h new/cipher.h -+--- old/cipher.h 2017-10-03 21:49:05.367162904 -1000 -++++ new/cipher.h 2017-10-03 21:55:50.869718862 -1000 - @@ -46,7 +46,18 @@ - #define CIPHER_DECRYPT 0 - -@@ -81,10 +81,10 @@ diff -aurp old/cipher.h new/cipher.h - - const struct sshcipher *cipher_by_name(const char *); - const char *cipher_warning_message(const struct sshcipher_ctx *); --diff -aurp old/configure new/configure ----- old/configure 2018-03-23 03:30:17.000000000 -1000 --+++ new/configure 2018-03-23 10:05:03.888621444 -1000 --@@ -13076,7 +13076,6 @@ if ac_fn_c_try_run "$LINENO"; then : -+diff -Naur old/configure new/configure -+--- old/configure 2017-10-03 21:49:05.410493626 -1000 -++++ new/configure 2017-10-03 22:01:49.159050540 -1000 -+@@ -12688,7 +12688,6 @@ - 100*) ;; # 1.0.x - 200*) ;; # LibreSSL - *) -@@ -92,10 +92,10 @@ diff -aurp old/configure new/configure - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ssl_library_ver" >&5 --diff -aurp old/dh.c new/dh.c ----- old/dh.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/dh.c 2018-03-23 10:05:03.888621444 -1000 --@@ -211,14 +211,15 @@ choose_dh(int min, int wantbits, int max -+diff -Naur old/dh.c new/dh.c -+--- old/dh.c 2017-10-03 21:49:05.370496037 -1000 -++++ new/dh.c 2017-10-03 21:55:50.869718862 -1000 -+@@ -212,14 +212,15 @@ - /* diffie-hellman-groupN-sha1 */ - - int -@@ -113,7 +113,7 @@ diff -aurp old/dh.c new/dh.c - logit("invalid public DH value: negative"); - return 0; - } --@@ -231,7 +232,8 @@ dh_pub_is_valid(DH *dh, BIGNUM *dh_pub) -+@@ -232,7 +233,8 @@ - error("%s: BN_new failed", __func__); - return 0; - } -@@ -123,7 +123,7 @@ diff -aurp old/dh.c new/dh.c - BN_cmp(dh_pub, tmp) != -1) { /* pub_exp > p-2 */ - BN_clear_free(tmp); - logit("invalid public DH value: >= p-1"); --@@ -242,14 +244,14 @@ dh_pub_is_valid(DH *dh, BIGNUM *dh_pub) -+@@ -243,14 +245,14 @@ - for (i = 0; i <= n; i++) - if (BN_is_bit_set(dh_pub, i)) - bits_set++; -@@ -140,7 +140,7 @@ diff -aurp old/dh.c new/dh.c - return 0; - } - return 1; --@@ -259,9 +261,13 @@ int -+@@ -260,9 +262,13 @@ - dh_gen_key(DH *dh, int need) - { - int pbits; -@@ -156,7 +156,7 @@ diff -aurp old/dh.c new/dh.c - need > INT_MAX / 2 || 2 * need > pbits) - return SSH_ERR_INVALID_ARGUMENT; - if (need < 256) --@@ -270,10 +276,13 @@ dh_gen_key(DH *dh, int need) -+@@ -271,10 +277,13 @@ - * Pollard Rho, Big step/Little Step attacks are O(sqrt(n)), - * so double requested need here. - */ -@@ -174,7 +174,7 @@ diff -aurp old/dh.c new/dh.c - return SSH_ERR_LIBCRYPTO_ERROR; - } - return 0; --@@ -282,16 +291,27 @@ dh_gen_key(DH *dh, int need) -+@@ -283,16 +292,27 @@ - DH * - dh_new_group_asc(const char *gen, const char *modulus) - { -@@ -209,7 +209,7 @@ diff -aurp old/dh.c new/dh.c - } - - /* --@@ -306,8 +326,8 @@ dh_new_group(BIGNUM *gen, BIGNUM *modulu -+@@ -307,8 +327,8 @@ - - if ((dh = DH_new()) == NULL) - return NULL; -@@ -220,10 +220,10 @@ diff -aurp old/dh.c new/dh.c - - return (dh); - } --diff -aurp old/dh.h new/dh.h ----- old/dh.h 2018-03-22 16:21:14.000000000 -1000 --+++ new/dh.h 2018-03-23 10:05:03.889621527 -1000 --@@ -42,7 +42,7 @@ DH *dh_new_group18(void); -+diff -Naur old/dh.h new/dh.h -+--- old/dh.h 2017-10-03 21:49:05.370496037 -1000 -++++ new/dh.h 2017-10-03 21:55:50.869718862 -1000 -+@@ -42,7 +42,7 @@ - DH *dh_new_group_fallback(int); - - int dh_gen_key(DH *, int); -@@ -232,9 +232,9 @@ diff -aurp old/dh.h new/dh.h - - u_int dh_estimate(int); - --diff -aurp old/digest-openssl.c new/digest-openssl.c ----- old/digest-openssl.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/digest-openssl.c 2018-03-23 10:05:03.889621527 -1000 -+diff -Naur old/digest-openssl.c new/digest-openssl.c -+--- old/digest-openssl.c 2017-10-03 21:49:05.370496037 -1000 -++++ new/digest-openssl.c 2017-10-03 21:55:50.869718862 -1000 - @@ -43,7 +43,7 @@ - - struct ssh_digest_ctx { -@@ -244,7 +244,7 @@ diff -aurp old/digest-openssl.c new/dige - }; - - struct ssh_digest { --@@ -106,20 +106,21 @@ ssh_digest_bytes(int alg) -+@@ -106,20 +106,21 @@ - size_t - ssh_digest_blocksize(struct ssh_digest_ctx *ctx) - { -@@ -270,7 +270,7 @@ diff -aurp old/digest-openssl.c new/dige - free(ret); - return NULL; - } --@@ -132,7 +133,7 @@ ssh_digest_copy_state(struct ssh_digest_ -+@@ -132,7 +133,7 @@ - if (from->alg != to->alg) - return SSH_ERR_INVALID_ARGUMENT; - /* we have bcopy-style order while openssl has memcpy-style */ -@@ -279,7 +279,7 @@ diff -aurp old/digest-openssl.c new/dige - return SSH_ERR_LIBCRYPTO_ERROR; - return 0; - } --@@ -140,7 +141,7 @@ ssh_digest_copy_state(struct ssh_digest_ -+@@ -140,7 +141,7 @@ - int - ssh_digest_update(struct ssh_digest_ctx *ctx, const void *m, size_t mlen) - { -@@ -288,7 +288,7 @@ diff -aurp old/digest-openssl.c new/dige - return SSH_ERR_LIBCRYPTO_ERROR; - return 0; - } --@@ -161,7 +162,7 @@ ssh_digest_final(struct ssh_digest_ctx * -+@@ -161,7 +162,7 @@ - return SSH_ERR_INVALID_ARGUMENT; - if (dlen < digest->digest_len) /* No truncation allowed */ - return SSH_ERR_INVALID_ARGUMENT; -@@ -297,7 +297,7 @@ diff -aurp old/digest-openssl.c new/dige - return SSH_ERR_LIBCRYPTO_ERROR; - if (l != digest->digest_len) /* sanity */ - return SSH_ERR_INTERNAL_ERROR; --@@ -172,7 +173,7 @@ void -+@@ -172,7 +173,7 @@ - ssh_digest_free(struct ssh_digest_ctx *ctx) - { - if (ctx != NULL) { -@@ -306,10 +306,10 @@ diff -aurp old/digest-openssl.c new/dige - explicit_bzero(ctx, sizeof(*ctx)); - free(ctx); - } --diff -aurp old/kexdhc.c new/kexdhc.c ----- old/kexdhc.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/kexdhc.c 2018-03-23 10:05:03.889621527 -1000 --@@ -81,11 +81,16 @@ kexdh_client(struct ssh *ssh) -+diff -Naur old/kexdhc.c new/kexdhc.c -+--- old/kexdhc.c 2017-10-03 21:49:05.373829169 -1000 -++++ new/kexdhc.c 2017-10-03 21:55:50.869718862 -1000 -+@@ -81,11 +81,16 @@ - goto out; - } - debug("sending SSH2_MSG_KEXDH_INIT"); -@@ -329,7 +329,7 @@ diff -aurp old/kexdhc.c new/kexdhc.c - #ifdef DEBUG_KEXDH - DHparams_print_fp(stderr, kex->dh); - fprintf(stderr, "pub= "); --@@ -169,6 +174,9 @@ input_kex_dh(int type, u_int32_t seq, st -+@@ -169,6 +174,9 @@ - - /* calc and verify H */ - hashlen = sizeof(hash); -@@ -339,7 +339,7 @@ diff -aurp old/kexdhc.c new/kexdhc.c - if ((r = kex_dh_hash( - kex->hash_alg, - kex->client_version_string, --@@ -176,11 +184,13 @@ input_kex_dh(int type, u_int32_t seq, st -+@@ -176,11 +184,13 @@ - sshbuf_ptr(kex->my), sshbuf_len(kex->my), - sshbuf_ptr(kex->peer), sshbuf_len(kex->peer), - server_host_key_blob, sbloblen, -@@ -354,11 +354,22 @@ diff -aurp old/kexdhc.c new/kexdhc.c - + } - - if ((r = sshkey_verify(server_host_key, signature, slen, hash, hashlen, -- kex->hostkey_alg, ssh->compat)) != 0) --diff -aurp old/kexdhs.c new/kexdhs.c ----- old/kexdhs.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/kexdhs.c 2018-03-23 10:58:58.126733207 -1000 --@@ -163,6 +163,9 @@ input_kex_dh_init(int type, u_int32_t se -+ ssh->compat)) != 0) -+diff -Naur old/kexdhs.c new/kexdhs.c -+--- old/kexdhs.c 2017-10-03 21:49:05.373829169 -1000 -++++ new/kexdhs.c 2017-10-03 21:55:50.869718862 -1000 -+@@ -87,6 +87,10 @@ -+ ssh_dispatch_set(ssh, SSH2_MSG_KEXDH_INIT, &input_kex_dh_init); -+ r = 0; -+ out: -++ if (r != 0) { -++ if (kex->dh) DH_free(kex->dh); -++ kex->dh = NULL; -++ } -+ return r; -+ } -+ -+@@ -163,6 +167,9 @@ - goto out; - /* calc H */ - hashlen = sizeof(hash); -@@ -368,7 +379,7 @@ diff -aurp old/kexdhs.c new/kexdhs.c - if ((r = kex_dh_hash( - kex->hash_alg, - kex->client_version_string, --@@ -171,10 +174,12 @@ input_kex_dh_init(int type, u_int32_t se -+@@ -171,10 +178,12 @@ - sshbuf_ptr(kex->my), sshbuf_len(kex->my), - server_host_key_blob, sbloblen, - dh_client_pub, -@@ -383,7 +394,7 @@ diff -aurp old/kexdhs.c new/kexdhs.c - - /* save session id := H */ - if (kex->session_id == NULL) { --@@ -195,12 +200,17 @@ input_kex_dh_init(int type, u_int32_t se -+@@ -195,12 +204,17 @@ - /* destroy_sensitive_data(); */ - - /* send server hostkey, DH pubkey 'f' and singed H */ -@@ -403,10 +414,10 @@ diff -aurp old/kexdhs.c new/kexdhs.c - - if ((r = kex_derive_keys_bn(ssh, hash, hashlen, shared_secret)) == 0) - r = kex_send_newkeys(ssh); --diff -aurp old/kexgexc.c new/kexgexc.c ----- old/kexgexc.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/kexgexc.c 2018-03-23 11:00:00.132866201 -1000 --@@ -118,11 +118,17 @@ input_kex_dh_gex_group(int type, u_int32 -+diff -Naur old/kexgexc.c new/kexgexc.c -+--- old/kexgexc.c 2017-10-03 21:49:05.373829169 -1000 -++++ new/kexgexc.c 2017-10-03 21:55:50.869718862 -1000 -+@@ -118,11 +118,17 @@ - p = g = NULL; /* belong to kex->dh now */ - - /* generate and send 'e', client DH public key */ -@@ -428,7 +439,22 @@ diff -aurp old/kexgexc.c new/kexgexc.c - debug("SSH2_MSG_KEX_DH_GEX_INIT sent"); - #ifdef DEBUG_KEXDH - DHparams_print_fp(stderr, kex->dh); --@@ -212,6 +218,10 @@ input_kex_dh_gex_reply(int type, u_int32 -+@@ -134,10 +140,12 @@ -+ ssh_dispatch_set(ssh, SSH2_MSG_KEX_DH_GEX_REPLY, &input_kex_dh_gex_reply); -+ r = 0; -+ out: -+- if (p) -++ if (r != 0) { -+ BN_clear_free(p); -+- if (g) -+ BN_clear_free(g); -++ DH_free(kex->dh); -++ kex->dh = NULL; -++ } -+ return r; -+ } -+ -+@@ -214,6 +222,10 @@ - - /* calc and verify H */ - hashlen = sizeof(hash); -@@ -439,7 +465,7 @@ diff -aurp old/kexgexc.c new/kexgexc.c - if ((r = kexgex_hash( - kex->hash_alg, - kex->client_version_string, --@@ -220,12 +230,14 @@ input_kex_dh_gex_reply(int type, u_int32 -+@@ -222,12 +234,14 @@ - sshbuf_ptr(kex->peer), sshbuf_len(kex->peer), - server_host_key_blob, sbloblen, - kex->min, kex->nbits, kex->max, -@@ -456,11 +482,11 @@ diff -aurp old/kexgexc.c new/kexgexc.c - + } - - if ((r = sshkey_verify(server_host_key, signature, slen, hash, -- hashlen, kex->hostkey_alg, ssh->compat)) != 0) --diff -aurp old/kexgexs.c new/kexgexs.c ----- old/kexgexs.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/kexgexs.c 2018-03-23 11:03:06.045049721 -1000 --@@ -101,11 +101,16 @@ input_kex_dh_gex_request(int type, u_int -+ hashlen, ssh->compat)) != 0) -+diff -Naur old/kexgexs.c new/kexgexs.c -+--- old/kexgexs.c 2017-10-03 21:49:05.373829169 -1000 -++++ new/kexgexs.c 2017-10-03 21:55:50.869718862 -1000 -+@@ -101,11 +101,16 @@ - goto out; - } - debug("SSH2_MSG_KEX_DH_GEX_GROUP sent"); -@@ -480,7 +506,18 @@ diff -aurp old/kexgexs.c new/kexgexs.c - - /* Compute our exchange value in parallel with the client */ - if ((r = dh_gen_key(kex->dh, kex->we_need * 8)) != 0) --@@ -191,6 +196,10 @@ input_kex_dh_gex_init(int type, u_int32_ -+@@ -115,6 +120,10 @@ -+ ssh_dispatch_set(ssh, SSH2_MSG_KEX_DH_GEX_INIT, &input_kex_dh_gex_init); -+ r = 0; -+ out: -++ if (r != 0) { -++ DH_free(kex->dh); -++ kex->dh = NULL; -++ } -+ return r; -+ } -+ -+@@ -191,6 +200,10 @@ - goto out; - /* calc H */ - hashlen = sizeof(hash); -@@ -491,7 +528,7 @@ diff -aurp old/kexgexs.c new/kexgexs.c - if ((r = kexgex_hash( - kex->hash_alg, - kex->client_version_string, --@@ -199,12 +208,14 @@ input_kex_dh_gex_init(int type, u_int32_ -+@@ -199,12 +212,14 @@ - sshbuf_ptr(kex->my), sshbuf_len(kex->my), - server_host_key_blob, sbloblen, - kex->min, kex->nbits, kex->max, -@@ -509,7 +546,7 @@ diff -aurp old/kexgexs.c new/kexgexs.c - - /* save session id := H */ - if (kex->session_id == NULL) { --@@ -225,12 +236,17 @@ input_kex_dh_gex_init(int type, u_int32_ -+@@ -225,12 +240,17 @@ - /* destroy_sensitive_data(); */ - - /* send server hostkey, DH pubkey 'f' and singed H */ -@@ -529,10 +566,10 @@ diff -aurp old/kexgexs.c new/kexgexs.c - - if ((r = kex_derive_keys_bn(ssh, hash, hashlen, shared_secret)) == 0) - r = kex_send_newkeys(ssh); --diff -aurp old/monitor.c new/monitor.c ----- old/monitor.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/monitor.c 2018-03-23 10:05:03.890621610 -1000 --@@ -595,10 +595,12 @@ mm_answer_moduli(int sock, Buffer *m) -+diff -Naur old/monitor.c new/monitor.c -+--- old/monitor.c 2017-10-03 21:49:05.377162302 -1000 -++++ new/monitor.c 2017-10-03 21:55:50.869718862 -1000 -+@@ -586,10 +586,12 @@ - buffer_put_char(m, 0); - return (0); - } else { -@@ -547,10 +584,10 @@ diff -aurp old/monitor.c new/monitor.c - - DH_free(dh); - } --diff -aurp old/openbsd-compat/openssl-compat.c new/openbsd-compat/openssl-compat.c ----- old/openbsd-compat/openssl-compat.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/openbsd-compat/openssl-compat.c 2018-03-23 10:05:03.890621610 -1000 --@@ -75,7 +75,6 @@ ssh_OpenSSL_add_all_algorithms(void) -+diff -Naur old/openbsd-compat/openssl-compat.c new/openbsd-compat/openssl-compat.c -+--- old/openbsd-compat/openssl-compat.c 2017-10-03 21:49:05.397161097 -1000 -++++ new/openbsd-compat/openssl-compat.c 2017-10-03 21:55:50.886387486 -1000 -+@@ -75,7 +75,6 @@ - /* Enable use of crypto hardware */ - ENGINE_load_builtin_engines(); - ENGINE_register_all_complete(); -@@ -558,10 +595,10 @@ diff -aurp old/openbsd-compat/openssl-co - } - #endif - --diff -aurp old/regress/unittests/sshkey/test_file.c new/regress/unittests/sshkey/test_file.c ----- old/regress/unittests/sshkey/test_file.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/regress/unittests/sshkey/test_file.c 2018-03-23 10:05:03.890621610 -1000 --@@ -60,9 +60,14 @@ sshkey_file_tests(void) -+diff -Naur old/regress/unittests/sshkey/test_file.c new/regress/unittests/sshkey/test_file.c -+--- old/regress/unittests/sshkey/test_file.c 2017-10-03 21:49:05.387161699 -1000 -++++ new/regress/unittests/sshkey/test_file.c 2017-10-03 21:55:50.883053761 -1000 -+@@ -60,9 +60,14 @@ - a = load_bignum("rsa_1.param.n"); - b = load_bignum("rsa_1.param.p"); - c = load_bignum("rsa_1.param.q"); -@@ -579,7 +616,7 @@ diff -aurp old/regress/unittests/sshkey/ - BN_free(a); - BN_free(b); - BN_free(c); --@@ -151,9 +156,14 @@ sshkey_file_tests(void) -+@@ -151,9 +156,14 @@ - a = load_bignum("dsa_1.param.g"); - b = load_bignum("dsa_1.param.priv"); - c = load_bignum("dsa_1.param.pub"); -@@ -597,10 +634,10 @@ diff -aurp old/regress/unittests/sshkey/ - BN_free(a); - BN_free(b); - BN_free(c); --diff -aurp old/regress/unittests/sshkey/test_sshkey.c new/regress/unittests/sshkey/test_sshkey.c ----- old/regress/unittests/sshkey/test_sshkey.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/regress/unittests/sshkey/test_sshkey.c 2018-03-23 10:05:03.890621610 -1000 --@@ -197,9 +197,14 @@ sshkey_tests(void) -+diff -Naur old/regress/unittests/sshkey/test_sshkey.c new/regress/unittests/sshkey/test_sshkey.c -+--- old/regress/unittests/sshkey/test_sshkey.c 2017-10-03 21:49:05.387161699 -1000 -++++ new/regress/unittests/sshkey/test_sshkey.c 2017-10-03 21:55:50.883053761 -1000 -+@@ -197,9 +197,14 @@ - k1 = sshkey_new(KEY_RSA); - ASSERT_PTR_NE(k1, NULL); - ASSERT_PTR_NE(k1->rsa, NULL); -@@ -618,7 +655,7 @@ diff -aurp old/regress/unittests/sshkey/ - sshkey_free(k1); - TEST_DONE(); - --@@ -207,8 +212,13 @@ sshkey_tests(void) -+@@ -207,8 +212,13 @@ - k1 = sshkey_new(KEY_DSA); - ASSERT_PTR_NE(k1, NULL); - ASSERT_PTR_NE(k1->dsa, NULL); -@@ -634,7 +671,7 @@ diff -aurp old/regress/unittests/sshkey/ - sshkey_free(k1); - TEST_DONE(); - --@@ -234,9 +244,14 @@ sshkey_tests(void) -+@@ -234,9 +244,14 @@ - k1 = sshkey_new_private(KEY_RSA); - ASSERT_PTR_NE(k1, NULL); - ASSERT_PTR_NE(k1->rsa, NULL); -@@ -652,7 +689,7 @@ diff -aurp old/regress/unittests/sshkey/ - ASSERT_INT_EQ(sshkey_add_private(k1), 0); - sshkey_free(k1); - TEST_DONE(); --@@ -245,8 +260,13 @@ sshkey_tests(void) -+@@ -245,8 +260,13 @@ - k1 = sshkey_new_private(KEY_DSA); - ASSERT_PTR_NE(k1, NULL); - ASSERT_PTR_NE(k1->dsa, NULL); -@@ -668,7 +705,7 @@ diff -aurp old/regress/unittests/sshkey/ - ASSERT_INT_EQ(sshkey_add_private(k1), 0); - sshkey_free(k1); - TEST_DONE(); --@@ -285,18 +305,28 @@ sshkey_tests(void) -+@@ -285,18 +305,28 @@ - ASSERT_INT_EQ(sshkey_generate(KEY_RSA, 1024, &kr), 0); - ASSERT_PTR_NE(kr, NULL); - ASSERT_PTR_NE(kr->rsa, NULL); -@@ -703,7 +740,7 @@ diff -aurp old/regress/unittests/sshkey/ - TEST_DONE(); - - #ifdef OPENSSL_HAS_ECC --@@ -323,9 +353,14 @@ sshkey_tests(void) -+@@ -323,9 +353,14 @@ - ASSERT_PTR_NE(kr, k1); - ASSERT_INT_EQ(k1->type, KEY_RSA); - ASSERT_PTR_NE(k1->rsa, NULL); -@@ -721,7 +758,7 @@ diff -aurp old/regress/unittests/sshkey/ - TEST_DONE(); - - TEST_START("equal KEY_RSA/demoted KEY_RSA"); --@@ -339,8 +374,13 @@ sshkey_tests(void) -+@@ -339,8 +374,13 @@ - ASSERT_PTR_NE(kd, k1); - ASSERT_INT_EQ(k1->type, KEY_DSA); - ASSERT_PTR_NE(k1->dsa, NULL); -@@ -737,10 +774,10 @@ diff -aurp old/regress/unittests/sshkey/ - TEST_DONE(); - - TEST_START("equal KEY_DSA/demoted KEY_DSA"); --diff -aurp old/ssh-dss.c new/ssh-dss.c ----- old/ssh-dss.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/ssh-dss.c 2018-03-23 10:05:03.891621693 -1000 --@@ -53,6 +53,7 @@ ssh_dss_sign(const struct sshkey *key, u -+diff -Naur old/ssh-dss.c new/ssh-dss.c -+--- old/ssh-dss.c 2017-10-03 21:49:05.403827361 -1000 -++++ new/ssh-dss.c 2017-10-03 21:55:50.869718862 -1000 -+@@ -53,6 +53,7 @@ - DSA_SIG *sig = NULL; - u_char digest[SSH_DIGEST_MAX_LENGTH], sigblob[SIGBLOB_LEN]; - size_t rlen, slen, len, dlen = ssh_digest_bytes(SSH_DIGEST_SHA1); -@@ -748,7 +785,7 @@ diff -aurp old/ssh-dss.c new/ssh-dss.c - struct sshbuf *b = NULL; - int ret = SSH_ERR_INVALID_ARGUMENT; - --@@ -76,15 +77,16 @@ ssh_dss_sign(const struct sshkey *key, u -+@@ -76,15 +77,16 @@ - goto out; - } - -@@ -767,9 +804,9 @@ diff -aurp old/ssh-dss.c new/ssh-dss.c - + BN_bn2bin(r, sigblob + SIGBLOB_LEN - INTBLOB_LEN - rlen); - + BN_bn2bin(s, sigblob + SIGBLOB_LEN - slen); - -- if ((b = sshbuf_new()) == NULL) { -- ret = SSH_ERR_ALLOC_FAIL; --@@ -154,17 +156,26 @@ ssh_dss_verify(const struct sshkey *key, -+ if (compat & SSH_BUG_SIGBLOB) { -+ if (sigp != NULL) { -+@@ -176,17 +178,26 @@ - } - - /* parse signature */ -@@ -800,10 +837,10 @@ diff -aurp old/ssh-dss.c new/ssh-dss.c - - /* sha1 the data */ - if ((ret = ssh_digest_memory(SSH_DIGEST_SHA1, data, datalen, --diff -aurp old/ssh-ecdsa.c new/ssh-ecdsa.c ----- old/ssh-ecdsa.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/ssh-ecdsa.c 2018-03-23 10:05:03.891621693 -1000 --@@ -80,9 +80,14 @@ ssh_ecdsa_sign(const struct sshkey *key, -+diff -Naur old/ssh-ecdsa.c new/ssh-ecdsa.c -+--- old/ssh-ecdsa.c 2017-10-03 21:49:05.403827361 -1000 -++++ new/ssh-ecdsa.c 2017-10-03 21:55:50.869718862 -1000 -+@@ -80,9 +80,14 @@ - ret = SSH_ERR_ALLOC_FAIL; - goto out; - } -@@ -820,7 +857,7 @@ diff -aurp old/ssh-ecdsa.c new/ssh-ecdsa - if ((ret = sshbuf_put_cstring(b, sshkey_ssh_name_plain(key))) != 0 || - (ret = sshbuf_put_stringb(b, bb)) != 0) - goto out; --@@ -150,11 +155,27 @@ ssh_ecdsa_verify(const struct sshkey *ke -+@@ -151,11 +156,27 @@ - ret = SSH_ERR_ALLOC_FAIL; - goto out; - } -@@ -850,10 +887,10 @@ diff -aurp old/ssh-ecdsa.c new/ssh-ecdsa - if (sshbuf_len(sigbuf) != 0) { - ret = SSH_ERR_UNEXPECTED_TRAILING_DATA; - goto out; --diff -aurp old/ssh-keygen.c new/ssh-keygen.c ----- old/ssh-keygen.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/ssh-keygen.c 2018-03-23 10:05:03.891621693 -1000 --@@ -493,11 +493,33 @@ do_convert_private_ssh2_from_blob(u_char -+diff -Naur old/ssh-keygen.c new/ssh-keygen.c -+--- old/ssh-keygen.c 2017-10-03 21:49:05.403827361 -1000 -++++ new/ssh-keygen.c 2017-10-03 21:55:50.869718862 -1000 -+@@ -496,11 +496,33 @@ - - switch (key->type) { - case KEY_DSA: -@@ -892,7 +929,7 @@ diff -aurp old/ssh-keygen.c new/ssh-keyg - break; - case KEY_RSA: - if ((r = sshbuf_get_u8(b, &e1)) != 0 || --@@ -514,16 +536,52 @@ do_convert_private_ssh2_from_blob(u_char -+@@ -517,16 +539,52 @@ - e += e3; - debug("e %lx", e); - } -@@ -951,7 +988,7 @@ diff -aurp old/ssh-keygen.c new/ssh-keyg - if ((r = ssh_rsa_generate_additional_parameters(key)) != 0) - fatal("generate RSA parameters failed: %s", ssh_err(r)); - break; --@@ -633,7 +691,7 @@ do_convert_from_pkcs8(struct sshkey **k, -+@@ -636,7 +694,7 @@ - identity_file); - } - fclose(fp); -@@ -960,7 +997,7 @@ diff -aurp old/ssh-keygen.c new/ssh-keyg - case EVP_PKEY_RSA: - if ((*k = sshkey_new(KEY_UNSPEC)) == NULL) - fatal("sshkey_new failed"); --@@ -657,7 +715,7 @@ do_convert_from_pkcs8(struct sshkey **k, -+@@ -660,7 +718,7 @@ - #endif - default: - fatal("%s: unsupported pubkey type %d", __func__, -@@ -969,10 +1006,10 @@ diff -aurp old/ssh-keygen.c new/ssh-keyg - } - EVP_PKEY_free(pubkey); - return; --diff -aurp old/ssh-pkcs11-client.c new/ssh-pkcs11-client.c ----- old/ssh-pkcs11-client.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/ssh-pkcs11-client.c 2018-03-23 10:05:03.892621777 -1000 --@@ -144,12 +144,13 @@ pkcs11_rsa_private_encrypt(int flen, con -+diff -Naur old/ssh-pkcs11-client.c new/ssh-pkcs11-client.c -+--- old/ssh-pkcs11-client.c 2017-10-03 21:49:05.403827361 -1000 -++++ new/ssh-pkcs11-client.c 2017-10-03 21:55:50.869718862 -1000 -+@@ -143,12 +143,13 @@ - static int - wrap_key(RSA *rsa) - { -@@ -991,10 +1028,10 @@ diff -aurp old/ssh-pkcs11-client.c new/s - return (0); - } - --diff -aurp old/ssh-pkcs11.c new/ssh-pkcs11.c ----- old/ssh-pkcs11.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/ssh-pkcs11.c 2018-03-23 10:05:03.892621777 -1000 --@@ -67,7 +67,7 @@ struct pkcs11_key { -+diff -Naur old/ssh-pkcs11.c new/ssh-pkcs11.c -+--- old/ssh-pkcs11.c 2017-10-03 21:49:05.403827361 -1000 -++++ new/ssh-pkcs11.c 2017-10-03 21:55:50.869718862 -1000 -+@@ -67,7 +67,7 @@ - struct pkcs11_provider *provider; - CK_ULONG slotidx; - int (*orig_finish)(RSA *rsa); -@@ -1003,7 +1040,7 @@ diff -aurp old/ssh-pkcs11.c new/ssh-pkcs - char *keyid; - int keyid_len; - }; --@@ -326,13 +326,15 @@ pkcs11_rsa_wrap(struct pkcs11_provider * -+@@ -326,13 +326,15 @@ - k11->keyid = xmalloc(k11->keyid_len); - memcpy(k11->keyid, keyid_attrib->pValue, k11->keyid_len); - } -@@ -1026,7 +1063,7 @@ diff -aurp old/ssh-pkcs11.c new/ssh-pkcs - RSA_set_app_data(rsa, k11); - return (0); - } --@@ -512,10 +514,19 @@ pkcs11_fetch_keys_filter(struct pkcs11_p -+@@ -512,10 +514,19 @@ - if ((rsa = RSA_new()) == NULL) { - error("RSA_new failed"); - } else { -@@ -1050,7 +1087,7 @@ diff -aurp old/ssh-pkcs11.c new/ssh-pkcs - } - } else { - cp = attribs[2].pValue; --@@ -525,16 +536,19 @@ pkcs11_fetch_keys_filter(struct pkcs11_p -+@@ -525,17 +536,20 @@ - == NULL) { - error("d2i_X509 failed"); - } else if ((evp = X509_get_pubkey(x509)) == NULL || -@@ -1064,7 +1101,8 @@ diff -aurp old/ssh-pkcs11.c new/ssh-pkcs - == NULL) { - error("RSAPublicKey_dup"); - } -- X509_free(x509); -+ if (x509) -+ X509_free(x509); - } - - if (rsa && rsa->n && rsa->e && - + { -@@ -1074,7 +1112,7 @@ diff -aurp old/ssh-pkcs11.c new/ssh-pkcs - pkcs11_rsa_wrap(p, slotidx, &attribs[0], rsa) == 0) { - if ((key = sshkey_new(KEY_UNSPEC)) == NULL) - fatal("sshkey_new failed"); --@@ -554,6 +568,7 @@ pkcs11_fetch_keys_filter(struct pkcs11_p -+@@ -555,6 +569,7 @@ - } else if (rsa) { - RSA_free(rsa); - } -@@ -1082,28 +1120,17 @@ diff -aurp old/ssh-pkcs11.c new/ssh-pkcs - for (i = 0; i < 3; i++) - free(attribs[i].pValue); - } --diff -aurp old/ssh-rsa.c new/ssh-rsa.c ----- old/ssh-rsa.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/ssh-rsa.c 2018-03-23 10:05:03.892621777 -1000 --@@ -84,7 +84,6 @@ ssh_rsa_generate_additional_parameters(s -- { -- BIGNUM *aux = NULL; -- BN_CTX *ctx = NULL; --- BIGNUM d; -- int r; -- -- if (key == NULL || key->rsa == NULL || --@@ -99,16 +98,27 @@ ssh_rsa_generate_additional_parameters(s -- } -- BN_set_flags(aux, BN_FLG_CONSTTIME); -- --- BN_init(&d); --- BN_with_flags(&d, key->rsa->d, BN_FLG_CONSTTIME); --- --- if ((BN_sub(aux, key->rsa->q, BN_value_one()) == 0) || --- (BN_mod(key->rsa->dmq1, &d, aux, ctx) == 0) || --- (BN_sub(aux, key->rsa->p, BN_value_one()) == 0) || --- (BN_mod(key->rsa->dmp1, &d, aux, ctx) == 0)) { -+diff -Naur old/ssh-rsa.c new/ssh-rsa.c -+--- old/ssh-rsa.c 2017-10-03 21:49:05.403827361 -1000 -++++ new/ssh-rsa.c 2017-10-03 22:06:32.005937158 -1000 -+@@ -99,13 +99,27 @@ -+ } -+ rsa = key->rsa; -+ -+- if ((BN_sub(aux, rsa->q, BN_value_one()) == 0) || -+- (BN_mod(rsa->dmq1, rsa->d, aux, ctx) == 0) || -+- (BN_sub(aux, rsa->p, BN_value_one()) == 0) || -+- (BN_mod(rsa->dmp1, rsa->d, aux, ctx) == 0)) { - + { - + const BIGNUM *q, *d, *p; - + BIGNUM *dmq1=NULL, *dmp1=NULL; -@@ -1112,13 +1139,13 @@ diff -aurp old/ssh-rsa.c new/ssh-rsa.c - + r = SSH_ERR_ALLOC_FAIL; - + goto out; - + } --+ RSA_get0_key(key->rsa, NULL, NULL, &d); --+ RSA_get0_factors(key->rsa, &p, &q); -++ RSA_get0_key(rsa, NULL, NULL, &d); -++ RSA_get0_factors(rsa, &p, &q); - + if ((BN_sub(aux, q, BN_value_one()) == 0) || - + (BN_mod(dmq1, d, aux, ctx) == 0) || - + (BN_sub(aux, p, BN_value_one()) == 0) || - + (BN_mod(dmp1, d, aux, ctx) == 0) || --+ RSA_set0_crt_params(key->rsa, dmp1, dmq1, NULL) == 0) { -++ RSA_set0_crt_params(rsa, dmp1, dmq1, NULL) == 0) { - r = SSH_ERR_LIBCRYPTO_ERROR; - + BN_clear_free(dmp1); - + BN_clear_free(dmq1); -@@ -1128,7 +1155,7 @@ diff -aurp old/ssh-rsa.c new/ssh-rsa.c - r = 0; - out: - BN_clear_free(aux); --@@ -139,7 +149,7 @@ ssh_rsa_sign(const struct sshkey *key, u -+@@ -136,7 +150,7 @@ - if (key == NULL || key->rsa == NULL || hash_alg == -1 || - sshkey_type_plain(key->type) != KEY_RSA) - return SSH_ERR_INVALID_ARGUMENT; -@@ -1137,7 +1164,7 @@ diff -aurp old/ssh-rsa.c new/ssh-rsa.c - return SSH_ERR_KEY_LENGTH; - slen = RSA_size(key->rsa); - if (slen <= 0 || slen > SSHBUF_MAX_BIGNUM) --@@ -211,7 +221,7 @@ ssh_rsa_verify(const struct sshkey *key, -+@@ -210,7 +224,7 @@ - sshkey_type_plain(key->type) != KEY_RSA || - sig == NULL || siglen == 0) - return SSH_ERR_INVALID_ARGUMENT; -@@ -1146,10 +1173,10 @@ diff -aurp old/ssh-rsa.c new/ssh-rsa.c - return SSH_ERR_KEY_LENGTH; - - if ((b = sshbuf_from(sig, siglen)) == NULL) --diff -aurp old/sshkey.c new/sshkey.c ----- old/sshkey.c 2018-03-22 16:21:14.000000000 -1000 --+++ new/sshkey.c 2018-03-23 10:05:03.893621860 -1000 --@@ -274,10 +274,18 @@ sshkey_size(const struct sshkey *k) -+diff -Naur old/sshkey.c new/sshkey.c -+--- old/sshkey.c 2017-10-03 21:49:05.407160494 -1000 -++++ new/sshkey.c 2017-10-03 22:16:31.124964276 -1000 -+@@ -264,10 +264,18 @@ - #ifdef WITH_OPENSSL - case KEY_RSA: - case KEY_RSA_CERT: -@@ -1169,7 +1196,7 @@ diff -aurp old/sshkey.c new/sshkey.c - case KEY_ECDSA: - case KEY_ECDSA_CERT: - return sshkey_curve_nid_to_bits(k->ecdsa_nid); --@@ -482,26 +490,53 @@ sshkey_new(int type) -+@@ -466,28 +474,55 @@ - #ifdef WITH_OPENSSL - case KEY_RSA: - case KEY_RSA_CERT: -@@ -1182,7 +1209,8 @@ diff -aurp old/sshkey.c new/sshkey.c - + (e = BN_new()) == NULL) { - + BN_free(n); - + BN_free(e); -- RSA_free(rsa); -+ if (rsa != NULL) -+ RSA_free(rsa); - free(k); - return NULL; - } -@@ -1210,7 +1238,8 @@ diff -aurp old/sshkey.c new/sshkey.c - + BN_free(q); - + BN_free(g); - + BN_free(pubkey); -- DSA_free(dsa); -+ if (dsa != NULL) -+ DSA_free(dsa); - free(k); - return NULL; - } -@@ -1229,7 +1258,7 @@ diff -aurp old/sshkey.c new/sshkey.c - k->dsa = dsa; - break; - case KEY_ECDSA: --@@ -539,6 +574,51 @@ sshkey_add_private(struct sshkey *k) -+@@ -523,6 +558,51 @@ - #ifdef WITH_OPENSSL - case KEY_RSA: - case KEY_RSA_CERT: -@@ -1281,7 +1310,7 @@ diff -aurp old/sshkey.c new/sshkey.c - #define bn_maybe_alloc_failed(p) (p == NULL && (p = BN_new()) == NULL) - if (bn_maybe_alloc_failed(k->rsa->d) || - bn_maybe_alloc_failed(k->rsa->iqmp) || --@@ -547,13 +627,28 @@ sshkey_add_private(struct sshkey *k) -+@@ -531,13 +611,28 @@ - bn_maybe_alloc_failed(k->rsa->dmq1) || - bn_maybe_alloc_failed(k->rsa->dmp1)) - return SSH_ERR_ALLOC_FAIL; -@@ -1310,7 +1339,7 @@ diff -aurp old/sshkey.c new/sshkey.c - case KEY_ECDSA: - case KEY_ECDSA_CERT: - /* Cannot do anything until we know the group */ --@@ -677,16 +772,34 @@ sshkey_equal_public(const struct sshkey -+@@ -655,16 +750,34 @@ - #ifdef WITH_OPENSSL - case KEY_RSA_CERT: - case KEY_RSA: -@@ -1353,7 +1382,7 @@ diff -aurp old/sshkey.c new/sshkey.c - # ifdef OPENSSL_HAS_ECC - case KEY_ECDSA_CERT: - case KEY_ECDSA: --@@ -775,12 +888,17 @@ to_blob_buf(const struct sshkey *key, st -+@@ -742,12 +855,17 @@ - case KEY_DSA: - if (key->dsa == NULL) - return SSH_ERR_INVALID_ARGUMENT; -@@ -1375,7 +1404,7 @@ diff -aurp old/sshkey.c new/sshkey.c - break; - # ifdef OPENSSL_HAS_ECC - case KEY_ECDSA: --@@ -796,10 +914,14 @@ to_blob_buf(const struct sshkey *key, st -+@@ -763,10 +881,14 @@ - case KEY_RSA: - if (key->rsa == NULL) - return SSH_ERR_INVALID_ARGUMENT; -@@ -1392,7 +1421,7 @@ diff -aurp old/sshkey.c new/sshkey.c - break; - #endif /* WITH_OPENSSL */ - case KEY_ED25519: --@@ -1740,13 +1862,32 @@ sshkey_from_private(const struct sshkey -+@@ -1643,13 +1765,32 @@ - case KEY_DSA_CERT: - if ((n = sshkey_new(k->type)) == NULL) - return SSH_ERR_ALLOC_FAIL; -@@ -1429,7 +1458,7 @@ diff -aurp old/sshkey.c new/sshkey.c - break; - # ifdef OPENSSL_HAS_ECC - case KEY_ECDSA: --@@ -1770,11 +1911,23 @@ sshkey_from_private(const struct sshkey -+@@ -1673,11 +1814,23 @@ - case KEY_RSA_CERT: - if ((n = sshkey_new(k->type)) == NULL) - return SSH_ERR_ALLOC_FAIL; -@@ -1455,7 +1484,7 @@ diff -aurp old/sshkey.c new/sshkey.c - break; - #endif /* WITH_OPENSSL */ - case KEY_ED25519: --@@ -1995,12 +2148,27 @@ sshkey_from_blob_internal(struct sshbuf -+@@ -1875,12 +2028,27 @@ - ret = SSH_ERR_ALLOC_FAIL; - goto out; - } -@@ -1486,7 +1515,7 @@ diff -aurp old/sshkey.c new/sshkey.c - ret = SSH_ERR_KEY_LENGTH; - goto out; - } --@@ -2020,13 +2188,36 @@ sshkey_from_blob_internal(struct sshbuf -+@@ -1900,13 +2068,36 @@ - ret = SSH_ERR_ALLOC_FAIL; - goto out; - } -@@ -1527,7 +1556,7 @@ diff -aurp old/sshkey.c new/sshkey.c - #ifdef DEBUG_PK - DSA_print_fp(stderr, key->dsa, 8); - #endif --@@ -2327,26 +2518,63 @@ sshkey_demote(const struct sshkey *k, st -+@@ -2140,26 +2331,63 @@ - goto fail; - /* FALLTHROUGH */ - case KEY_RSA: -@@ -1599,7 +1628,7 @@ diff -aurp old/sshkey.c new/sshkey.c - break; - case KEY_ECDSA_CERT: - if ((ret = sshkey_cert_copy(k, pk)) != 0) --@@ -2496,11 +2724,17 @@ sshkey_certify_custom(struct sshkey *k, -+@@ -2281,11 +2509,17 @@ - switch (k->type) { - #ifdef WITH_OPENSSL - case KEY_DSA_CERT: -@@ -1621,7 +1650,7 @@ diff -aurp old/sshkey.c new/sshkey.c - break; - # ifdef OPENSSL_HAS_ECC - case KEY_ECDSA_CERT: --@@ -2513,9 +2747,15 @@ sshkey_certify_custom(struct sshkey *k, -+@@ -2298,9 +2532,15 @@ - break; - # endif /* OPENSSL_HAS_ECC */ - case KEY_RSA_CERT: -@@ -1639,7 +1668,7 @@ diff -aurp old/sshkey.c new/sshkey.c - break; - #endif /* WITH_OPENSSL */ - case KEY_ED25519_CERT: --@@ -2702,42 +2942,67 @@ sshkey_private_serialize_opt(const struc -+@@ -2474,42 +2714,67 @@ - switch (key->type) { - #ifdef WITH_OPENSSL - case KEY_RSA: -@@ -1723,7 +1752,7 @@ diff -aurp old/sshkey.c new/sshkey.c - break; - # ifdef OPENSSL_HAS_ECC - case KEY_ECDSA: --@@ -2851,18 +3116,61 @@ sshkey_private_deserialize(struct sshbuf -+@@ -2585,18 +2850,61 @@ - r = SSH_ERR_ALLOC_FAIL; - goto out; - } -@@ -1792,7 +1821,7 @@ diff -aurp old/sshkey.c new/sshkey.c - break; - # ifdef OPENSSL_HAS_ECC - case KEY_ECDSA: --@@ -2921,29 +3229,104 @@ sshkey_private_deserialize(struct sshbuf -+@@ -2655,29 +2963,104 @@ - r = SSH_ERR_ALLOC_FAIL; - goto out; - } -@@ -1911,7 +1940,7 @@ diff -aurp old/sshkey.c new/sshkey.c - r = SSH_ERR_KEY_LENGTH; - goto out; - } --@@ -3707,7 +4090,6 @@ translate_libcrypto_error(unsigned long -+@@ -3395,7 +3778,6 @@ - switch (pem_reason) { - case EVP_R_BAD_DECRYPT: - return SSH_ERR_KEY_WRONG_PASSPHRASE; -@@ -1919,7 +1948,7 @@ diff -aurp old/sshkey.c new/sshkey.c - case EVP_R_DECODE_ERROR: - #ifdef EVP_R_PRIVATE_KEY_DECODE_ERROR - case EVP_R_PRIVATE_KEY_DECODE_ERROR: --@@ -3772,7 +4154,7 @@ sshkey_parse_private_pem_fileblob(struct -+@@ -3460,7 +3842,7 @@ - r = convert_libcrypto_error(); - goto out; - } -@@ -1928,7 +1957,7 @@ diff -aurp old/sshkey.c new/sshkey.c - (type == KEY_UNSPEC || type == KEY_RSA)) { - if ((prv = sshkey_new(KEY_UNSPEC)) == NULL) { - r = SSH_ERR_ALLOC_FAIL; --@@ -3787,11 +4169,11 @@ sshkey_parse_private_pem_fileblob(struct -+@@ -3475,11 +3857,11 @@ - r = SSH_ERR_LIBCRYPTO_ERROR; - goto out; - } -@@ -1942,7 +1971,7 @@ diff -aurp old/sshkey.c new/sshkey.c - (type == KEY_UNSPEC || type == KEY_DSA)) { - if ((prv = sshkey_new(KEY_UNSPEC)) == NULL) { - r = SSH_ERR_ALLOC_FAIL; --@@ -3803,7 +4185,7 @@ sshkey_parse_private_pem_fileblob(struct -+@@ -3491,7 +3873,7 @@ - DSA_print_fp(stderr, prv->dsa, 8); - #endif - #ifdef OPENSSL_HAS_ECC diff --git a/src/stage4/patches/openssl.patch b/src/stage4/patches/openssl.patch index e8f4e9c..e930372 100644 --- a/src/stage4/patches/openssl.patch +++ b/src/stage4/patches/openssl.patch @@ -16,13 +16,3 @@ "${openssltarget}" \ "-Wa,--noexecstack ${CPPFLAGS} ${CFLAGS} ${LDFLAGS}" -@@ -55,7 +58,8 @@ check() { - # the test fails due to missing write permissions in /etc/ssl - # revert this patch for make test - patch -p0 -R -i "$srcdir/ca-dir.patch" -- make test -+ # benign test suite failure in cross-arch chroot -+ make test || true - patch -p0 -i "$srcdir/ca-dir.patch" - } - diff --git a/src/stage4/patches/orc.patch b/src/stage4/patches/orc.patch deleted file mode 100644 index 96c9712..0000000 --- a/src/stage4/patches/orc.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/PKGBUILD 2018-03-27 22:20:01.300573718 +0200 -+++ b/PKGBUILD 2018-03-27 23:30:52.102898304 +0200 -@@ -11,7 +11,7 @@ url="https://cgit.freedesktop.org/gstrea - arch=(x86_64) - license=(custom) - depends=(glibc) --makedepends=(valgrind git gtk-doc meson) -+makedepends=(git gtk-doc meson) - _commit=31cb4bfc51de81b5c2569abdcff830b83c74499c # tags/orc-0.4.28^0 - source=("git+https://anongit.freedesktop.org/git/gstreamer/orc#commit=$_commit") - sha256sums=('SKIP') diff --git a/src/stage4/patches/p11-kit.patch b/src/stage4/patches/p11-kit.patch deleted file mode 100644 index d34e1d6..0000000 --- a/src/stage4/patches/p11-kit.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/PKGBUILD 2018-03-27 08:51:01.256864425 +0200 -+++ b/PKGBUILD 2018-03-27 09:20:57.402037131 +0200 -@@ -49,7 +49,8 @@ build() { - - check() { - cd $pkgname -- make check -+ # testsuite does not terminate in cross-arch chroot? -+ # make check - } - - package() { diff --git a/src/stage4/patches/perl.patch b/src/stage4/patches/perl.patch deleted file mode 100644 index 20e75ca..0000000 --- a/src/stage4/patches/perl.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/PKGBUILD 2018-03-21 13:03:38.445555399 +0100 -+++ b/PKGBUILD 2018-03-21 14:27:08.020533449 +0100 -@@ -185,7 +185,8 @@ build() { - - check() { - cd ${srcdir}/${pkgname}-${pkgver} -- TEST_JOBS=$(echo $MAKEFLAGS | sed 's/.*-j\([0-9][0-9]*\).*/\1/') make test_harness -+ # test suite fails in cross-arch chroot, but it's probably okay. -+ TEST_JOBS=$(echo $MAKEFLAGS | sed 's/.*-j\([0-9][0-9]*\).*/\1/') make test_harness || true - # make test - } - diff --git a/src/stage4/patches/python2.patch b/src/stage4/patches/python2.patch deleted file mode 100644 index a59f6e9..0000000 --- a/src/stage4/patches/python2.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/PKGBUILD 2018-03-25 21:53:23.069659893 +0200 -+++ b/PKGBUILD 2018-03-26 06:51:00.797288518 +0200 -@@ -14,7 +14,7 @@ license=('PSF') - url="http://www.python.org/" - depends=('bzip2' 'gdbm' 'openssl' 'zlib' 'expat' 'sqlite' 'libffi') - makedepends=('tk' 'bluez-libs') --checkdepends=('gdb' 'file' 'xorg-server-xvfb') -+checkdepends=('file' 'xorg-server-xvfb') - optdepends=('tk: for IDLE' - 'python2-setuptools' - 'python2-pip') -@@ -90,7 +90,7 @@ check() { - - cd Python-${pkgver} - LD_LIBRARY_PATH="${srcdir}/Python-${pkgver}":${LD_LIBRARY_PATH} \ -- xvfb-run "${srcdir}/Python-${pkgver}/python" -m test.regrtest -v -uall -x test_bytes test_str test_string test_tuple test_unicode test_userstring -+ xvfb-run "${srcdir}/Python-${pkgver}/python" -m test.regrtest -v -uall -x test_gdb test_bytes test_str test_string test_tuple test_unicode test_userstring - } - - package() { diff --git a/src/stage4/patches/sudo.patch b/src/stage4/patches/sudo.patch deleted file mode 100644 index 00dfedf..0000000 --- a/src/stage4/patches/sudo.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/PKGBUILD 2018-03-22 10:55:11.647821966 +0100 -+++ b/PKGBUILD 2018-03-22 11:23:35.529522040 +0100 -@@ -50,7 +50,8 @@ build() { - - check() { - cd "$srcdir/$pkgname-$_sudover" -- make check -+ # sudo testsuite does weird things in cross-arch chroot -+ make check || true - } - - package() { diff --git a/src/stage4/patches/systemd.patch b/src/stage4/patches/systemd.patch index f65720a..97523f9 100644 --- a/src/stage4/patches/systemd.patch +++ b/src/stage4/patches/systemd.patch @@ -34,16 +34,6 @@ # apply FSDG patches local _patch for _patch in "$srcdir"/????-FSDG-*.patch; do -@@ -224,7 +233,8 @@ build() { - - check() { - cd build -- meson test -+ # cross-arch chroot is a bit weird again -+ meson test || true - } - - package_systemd() { --- /dev/null 2018-03-21 10:59:45.661284739 +0100 +++ b/0001-rename-noreturn-into-_noreturn_.patch 2018-03-24 19:42:11.766029988 +0100 @@ -0,0 +1,198 @@ diff --git a/src/stage4/patches/tar.patch b/src/stage4/patches/tar.patch deleted file mode 100644 index 6104668..0000000 --- a/src/stage4/patches/tar.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/PKGBUILD 2018-03-21 16:16:11.764544777 +0100 -+++ b/PKGBUILD 2018-03-21 16:46:30.139593426 +0100 -@@ -39,7 +39,8 @@ build() { - - check() { - cd $pkgname-$pkgver -- make check -+ # benign testsuite failures under cross-arch qemu-static chroot -+ make check || true - } - - package() { diff --git a/src/stage4/patches/tcl.patch b/src/stage4/patches/tcl.patch deleted file mode 100644 index ccc9f0a..0000000 --- a/src/stage4/patches/tcl.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/PKGBUILD 2018-03-26 23:30:35.601886802 +0200 -+++ b/PKGBUILD 2018-03-27 08:00:17.252668141 +0200 -@@ -27,6 +27,8 @@ build() { - - check() { - cd tcl${pkgver}/unix -+ # http tests fail due to missing network in the chroot -+ rm ../tests/{socket,http{,11}}.test - make test - } - diff --git a/src/stage4/prepare_chroot.sh b/src/stage4/prepare_chroot.sh deleted file mode 100644 index aab75de..0000000 --- a/src/stage4/prepare_chroot.sh +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/bash - ############################################################################## - # parabola-riscv64-bootstrap # - # # - # Copyright (C) 2018 Andreas Grapentin # - # # - # This program is free software: you can redistribute it and/or modify # - # it under the terms of the GNU General Public License as published by # - # the Free Software Foundation, either version 3 of the License, or # - # (at your option) any later version. # - # # - # This program is distributed in the hope that it will be useful, # - # but WITHOUT ANY WARRANTY; without even the implied warranty of # - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # - # GNU General Public License for more details. # - # # - # You should have received a copy of the GNU General Public License # - # along with this program. If not, see <http://www.gnu.org/licenses/>. # - ############################################################################## - -set -euo pipefail - -msg "preparing $CARCH librechroot" - -# create directories -mkdir -p "$_pkgdest" "$_logdest" - -# initialize repos -mkdir -p "$_pkgdest"/{pool,staging} -for repo in libre core extra community; do - echo -n "checking for $CARCH [$repo] repo ... " - [ -e "$_pkgdest"/$repo/os/$CARCH/$repo.db ] && _have_repo=yes || _have_repo=no - echo $_have_repo - - mkdir -p "$_pkgdest"/$repo/os/$CARCH - if [ "x$_have_repo" == "xno" ]; then - tar -czf "$_pkgdest"/$repo/os/$CARCH/$repo.db.tar.gz -T /dev/null - tar -czf "$_pkgdest"/$repo/os/$CARCH/$repo.files.tar.gz -T /dev/null - ln -s $repo.db.tar.gz "$_pkgdest"/$repo/os/$CARCH/$repo.db - ln -s $repo.files.tar.gz "$_pkgdest"/$repo/os/$CARCH/$repo.files - fi -done - -# create configurations -mkdir -p "$_builddir"/config - -cat > "$_builddir"/config/pacman.conf << EOF -[options] -Architecture = $CARCH -[libre] -Server = file://$topbuilddir/stage4/packages/\$repo/os/\$arch -[core] -Server = file://$topbuilddir/stage4/packages/\$repo/os/\$arch -[extra] -Server = file://$topbuilddir/stage4/packages/\$repo/os/\$arch -[community] -Server = file://$topbuilddir/stage4/packages/\$repo/os/\$arch -[native] -Server = file://$topbuilddir/stage3/packages/\$arch -EOF - -cat "$_srcdir"/makepkg.conf.in > "$_builddir"/config/makepkg.conf -cat >> "$_builddir"/config/makepkg.conf << EOF -CARCH="$CARCH" -CHOST="$CHOST" -CFLAGS="-march=$GCC_MARCH -mabi=$GCC_MABI -O2 -pipe -fstack-protector-strong -fno-plt" -CXXFLAGS="-march=$GCC_MARCH -mabi=$GCC_MABI -O2 -pipe -fstack-protector-strong -fno-plt" -MAKEFLAGS="-j$(($(nproc) + 1))" -EOF - -# initialize the chroot -rm -rf /var/cache/pacman/pkg-$CARCH/* -librechroot \ - -n "$CHOST-stage4" \ - -C "$_builddir"/config/pacman.conf \ - -M "$_builddir"/config/makepkg.conf \ - make - -set +o pipefail -export _chrootdir="$(librechroot -n "$CHOST-stage4" 2>&1 | grep copydir.*: | awk '{print $3}')" -set -o pipefail - -# mount repo in chroot -mkdir -p "$_chrootdir"/{repos,native} -if mount | grep -q "$_chrootdir"/repos; then umount "$_chrootdir"/repos; fi -if mount | grep -q "$_chrootdir"/native; then umount "$_chrootdir"/native; fi -mount -o bind "$topbuilddir/stage4/packages" "$_chrootdir"/repos -mount -o bind "$topbuilddir/stage3/packages" "$_chrootdir"/native - -cat > "$_builddir"/config/pacman.conf << EOF -[options] -Architecture = $CARCH -[libre] -Server = file:///repos/\$repo/os/\$arch -[core] -Server = file:///repos/\$repo/os/\$arch -[extra] -Server = file:///repos/\$repo/os/\$arch -[community] -Server = file:///repos/\$repo/os/\$arch -[native] -Server = file:///native/\$arch -EOF - -librechroot \ - -n "$CHOST-stage4" \ - -C "$_builddir"/config/pacman.conf \ - -M "$_builddir"/config/makepkg.conf \ - update - -# produce a patched libremakepkg to update config.sub/config.guess where needed -cat $(which libremakepkg) > "$_builddir"/libremakepkg-$CARCH.sh -chmod +x "$_builddir"/libremakepkg-$CARCH.sh -if [ "x${REGEN_CONFIG_FRAGMENTS:-no}" == "xyes" ]; then - sed -i '/Boring\/mundane/i \ -update_config_fragments() {\ - local url="https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain"\ - find $1/build -iname config.sub -print -exec curl "$url;f=config.sub;hb=HEAD" -o {} \\;\ - find $1/build -iname config.guess -print -exec curl "$url;f=config.guess;hb=HEAD" -o {} \\;\ -}\ -hook_pre_build+=(update_config_fragments)' "$_builddir"/libremakepkg-$CARCH.sh -fi diff --git a/src/stage4/stage4.sh b/src/stage4/stage4.sh index 174dc1b..682c0e5 100644 --- a/src/stage4/stage4.sh +++ b/src/stage4/stage4.sh @@ -18,205 +18,123 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## -set -euo pipefail - -msg "Entering Stage 4" -notify "*Bootstrap Entering Stage 4*" - -# set a bunch of convenience variables -_builddir="$topbuilddir"/stage4 -_srcdir="$topsrcdir"/stage4 -_makepkgdir="$_builddir"/$CARCH-makepkg -_deptree="$_builddir"/DEPTREE -_groups="base base-devel" -_pkgdest="$_builddir"/packages -_logdest="$_builddir"/makepkglogs - -export PKGDEST="$_pkgdest/staging" -export LOGDEST="$_logdest" - -check_exe librechroot -check_exe libremakepkg - -# make sure that binfmt is *enabled* for stage4 build -echo 1 > /proc/sys/fs/binfmt_misc/status - -# prepare for the build -. "$_srcdir"/prepare_chroot.sh -. "$_srcdir"/prepare_deptree.sh - -msg "starting $CARCH native build (phase 2)" - -# keep building packages until the deptree is empty -while [ -s "$_deptree" ]; do - # grab one without unfulfilled dependencies - _pkgname=$(grep '\[ *\]' "$_deptree" | head -n1 | awk '{print $1}') || true - [ -n "$_pkgname" ] || die "could not resolve dependencies. exiting." - - msg "makepkg: $_pkgname" - msg " remaining packages: $(cat "$_deptree" | wc -l)" - - prepare_makepkgdir - fetch_pkgfiles $_pkgname - import_keys - - # produce pkgbase - echo -n "checking for pkgbase ... " - _srcinfo=$(sudo -u $SUDO_USER makepkg --config "$_builddir"/config/makepkg.conf --printsrcinfo) - _pkgbase=$(echo "$_srcinfo" | grep '^pkgbase =' | awk '{print $3}') - [ -n "$_pkgbase" ] || _pkgbase=$_pkgname - echo "$_pkgbase" - - # patch if necessary - cp PKGBUILD{,.old} - [ -f "$_srcdir"/patches/$_pkgbase.patch ] && \ - patch -Np1 -i "$_srcdir"/patches/$_pkgbase.patch - cp PKGBUILD{,.in} - chown -R $SUDO_USER "$_makepkgdir"/$_pkgname +# shellcheck source=src/stage4/makepkg.sh +. "$TOPSRCDIR"/stage4/makepkg.sh +# shellcheck source=src/stage4/chroot.sh +. "$TOPSRCDIR"/stage4/chroot.sh + +stage4_makepkg() { + package_fetch_upstream_pkgfiles "$1" || return + package_import_keys "$1" || return + package_patch "$1" || return # substitute common variables - sed -i \ - "s#@MULTILIB@#${MULTILIB:-disable}#g" \ - PKGBUILD - - # enable the target CARCH in arch array, unless it is already 'any' - sed -i "/arch=(.*\bany\b.*)/!s/arch=([^)]*/& $CARCH/" PKGBUILD - - # scan dependencies and update deptree - set +o pipefail - _needs_postpone=no - _srcinfo=$(sudo -u $SUDO_USER makepkg --config "$_builddir"/config/makepkg.conf --printsrcinfo) - _builddeps=$(echo "$_srcinfo" | awk '/^pkgbase = /,/^$/{print}' \ - | grep ' \(make\|check\|\)depends =' | awk '{print $3}') - _rundeps=$(echo "$_srcinfo" | awk '/^pkgname = '$_pkgname'$/,/^$/{print}' \ - | grep ' depends =' | awk '{print $3}') - # make sure all deps (build-time and run-time) are in deptree - for _dep in $_builddeps $_rundeps; do - _realdep="" - make_realdep "$_dep" - if [ -z "$_realdep" ]; then - if [ "x$KEEP_GOING" == "xyes" ]; then - notify -c error "$_pkgname: failed to translate dependency string '$_dep'" - _needs_postpone=yes - break - else - die "$_pkgname: failed to translate dependency string '$_dep'" - fi - fi - - case $_realdep in - gcc-ada|gcc-go|gdb|valgrind|lib32*) - if [ "x$KEEP_GOING" == "xyes" ]; then - notify -c error "$_pkgname: known bad package pulled in : '$_realdep'" - _needs_postpone=yes - break - else - die "$_pkgname: known bad package pulled in : '$_realdep'" - fi ;; - esac - - if ! grep -q "^$_realdep :" "$_deptree".FULL; then - echo "$_realdep : [ ] # $_pkgname" >> "$_deptree".FULL - echo "$_realdep : [ ] # $_pkgname" >> "$_deptree" - else - sed -i "/#.* $_pkgname\(\$\|[ ,]\)/! s/^$_realdep : \[.*/&, $_pkgname/" "$_deptree"{,.FULL} - fi - done + sed "s#@MULTILIB@#${MULTILIB:-disable}#g" \ + PKGBUILD.in > PKGBUILD - # bad package was pulled in, postpone - if [ "x$_needs_postpone" == "xyes" ]; then - sed -i "s/^$_pkgname : \[/& FIXME/" "$_deptree" - popd >/dev/null - continue - fi + package_enable_arch "$CARCH" - # postpone build on missing build-time deps - for _dep in $_builddeps; do - _realdep="" - make_realdep "$_dep" - [ -n "$_realdep" ] || die "failed to translate dependency string '$_dep'" - - echo -n "checking for built dependency $_realdep ... " - _depfile=$(find $_pkgdest/pool $topbuilddir/stage3/packages/ \ - -regex "^.*/$_realdep-[^-]*-[^-]*-[^-]*\.pkg\.tar\.xz\$") - [ -n "$_depfile" ] && _have_dep=yes || _have_dep=no - echo $_have_dep - - if [ "x$_have_dep" == "xno" ]; then - sed -i "s/^$_pkgname : \[/& $_realdep/" "$_deptree"{,.FULL} - _needs_postpone=yes - fi + # check built dependencies + local dep + for dep in $(srcinfo_builddeps -n); do + deptree_check_depend "$1" "$dep" || return + done + for dep in $(srcinfo_rundeps "$1"); do + deptree_check_depend "$1" "$dep" || return done - set -o pipefail - # missing stuff - put back to deptree and try again. - if [ "x$_needs_postpone" == "xyes" ]; then - popd >/dev/null - continue - fi + # postpone build if necessary + deptree_is_satisfyable "$1" || return 0 + + # don't rebuild if already exists + check_pkgfile "$PKGPOOL" "$1" && return - echo -n "checking for built $_pkgname package ... " - _pkgfile=$(find $_pkgdest/pool -regex "^.*/$_pkgname-[^-]*-[^-]*-[^-]*\.pkg\.tar\.xz\$") - [ -n "$_pkgfile" ] && _have_pkg=yes || _have_pkg=no - echo $_have_pkg - - if [ "x$_have_pkg" == "xno" ]; then - # clean staging - rm -f "$_pkgdest"/staging/* - - # clean package cache - rm -rfv /var/cache/pacman/pkg/* - rm -rfv /var/cache/pacman/pkg-$CARCH/* - # build the package - _build_failed=no - "$_builddir"/libremakepkg-$CARCH.sh -n $CHOST-stage4 || failed_build $_pkgbase - - # if we continued after a failed build, mark the entry in the deptree and continue - if [ "x$_build_failed" == "xyes" ]; then - sed -i "s/^$_pkgname : \[/& FIXME/" "$_deptree" - popd >/dev/null - continue - fi - - # release the package - _pkgrepo=$(cat .REPO) - for f in "$_pkgdest"/staging/*; do - ln -fs ../../../pool/$(basename "$f") "$_pkgdest"/$_pkgrepo/os/$CARCH/$(basename "$f") - mv $f "$_pkgdest"/pool/ - done - - rm -rf "$_pkgdest"/$_pkgrepo/os/$CARCH/$_pkgrepo.{db,files}* - repo-add -q -R "$_pkgdest"/$_pkgrepo/os/$CARCH/{$_pkgrepo.db.tar.gz,*.pkg.tar.xz} - - # install in chroot - _pkgfile=$(find $_pkgdest/pool -regex "^.*/$_pkgname-[^-]*-[^-]*-[^-]*\.pkg\.tar\.xz\$" \ - | head -n1) - set +o pipefail - yes | librechroot \ - -n "$CHOST-stage4" \ - -C "$_builddir"/config/pacman.conf \ - -M "$_builddir"/config/makepkg.conf \ - run pacman -Udd /repos/pool/"$(basename "$_pkgfile")" - yes | librechroot \ - -n "$CHOST-stage4" \ - -C "$_builddir"/config/pacman.conf \ - -M "$_builddir"/config/makepkg.conf \ - run pacman -Syyuu - set -o pipefail + # disable checkdepends + echo "checkdepends=()" >> PKGBUILD + + # regular build otherwise + "$BUILDDIR/libremakepkg-$CARCH.sh" -n "$CHOST"-stage4 || return +} + +stage4_package_build() { + local pkgarch + pkgarch=$(pkgarch "$1") || return + + # clean staging + rm -f "$PKGDEST"/* + + if [ "x$pkgarch" == "xany" ] || [ "x$1" == "xca-certificates-mozilla" ]; then + package_reuse_upstream "$1" || return + else + stage4_makepkg "$1" || return fi - # remove pkg from deptree - sed -i "/^$_pkgname :/d; s/ / /g; s/ $_pkgname / /g; s/ */ /g" "$_deptree" + # postpone on unmet dependencies + deptree_is_satisfyable "$1" || return 0 - # full=$(cat "$_deptree".FULL | wc -l) - # curr=$(expr $full - $(cat "$_deptree" | wc -l)) - # notify -c success -u low "*$curr/$full* $_pkgname" + # release the package + local pkgfile pkgname pkgrepo + for pkgfile in "$PKGDEST"/*; do + pkgname="${pkgfile%-*-*-*}" + pkgrepo=$(package_get_upstream_repo "$pkgname") + pushd "$PKGDEST/../$pkgrepo/os/$CARCH" >/dev/null || return - popd >/dev/null -done + ln -fs ../../../pool/"$(basename "$pkgfile")" "$(basename "$pkgfile")" + mv "$pkgfile" "$PKGPOOL" + repo-add -qR "$pkgrepo.db.tar.gz" "$(basename "$pkgfile")" -# unmount -umount "$_chrootdir"/native -umount "$_chrootdir"/repos + popd >/dev/null || return + done +} + +stage4_package_install() { + local pkgfile + pkgfile=$(find "$PKGPOOL" -regex "^.*/$1-[^-]*-[^-]*-[^-]*\\.pkg\\.tar\\.xz\$" | head -n1) + [ -n "$pkgfile" ] || { error "$1: pkgfile not found"; return "$ERROR_MISSING"; } + + yes | librechroot \ + -n "$CHOST-stage4" \ + -C "$BUILDDIR"/config/pacman.conf \ + -M "$BUILDDIR"/config/makepkg.conf \ + run pacman -Udd /repos/pool/"$(basename "$pkgfile")" || return + yes | librechroot \ + -n "$CHOST-stage4" \ + -C "$BUILDDIR"/config/pacman.conf \ + -M "$BUILDDIR"/config/makepkg.conf \ + run pacman -Syyuu || return +} + +stage4() { + msg -n "Entering Stage 4" + + local groups=(base-devel) + + export BUILDDIR="$TOPBUILDDIR"/stage4 + export SRCDIR="$TOPSRCDIR"/stage4 + export MAKEPKGDIR="$BUILDDIR"/$CARCH-makepkg + export DEPTREE="$BUILDDIR"/DEPTREE + export PKGDEST="$BUILDDIR"/packages/staging + export PKGPOOL="$BUILDDIR"/packages/pool + export LOGDEST="$BUILDDIR"/makepkglogs + export DEPPATH=("$PKGPOOL" "${BUILDDIR/stage4/stage3}/packages/$CARCH") + + mkdir -p "$PKGDEST" "$PKGPOOL" "$LOGDEST" + chown "$SUDO_USER" "$PKGDEST" "$PKGPOOL" "$LOGDEST" + + binfmt_enable + + prepare_stage4_makepkg || die -e "$ERROR_BUILDFAIL" "failed to prepare $CARCH makepkg" + prepare_stage4_chroot || die -e "$ERROR_BUILDFAIL" "failed to prepare $CARCH chroot" + prepare_deptree "${groups[@]}" || die -e "$ERROR_BUILDFAIL" "failed to prepare DEPTREE" + + echo "remaining pkges: $(wc -l < "$DEPTREE") / $(wc -l < "$DEPTREE".FULL)" + if [ -s "$DEPTREE" ]; then + check_exe -r librechroot libremakepkg + + # build packages from deptree + packages_build_all stage4_package_build stage4_package_install || return + fi -echo "all packages built." + # cleanup + umount_stage4_chrootdir +} |