diff options
author | Andreas Grapentin <andreas@grapentin.org> | 2018-02-10 16:25:02 +0100 |
---|---|---|
committer | Andreas Grapentin <andreas@grapentin.org> | 2018-02-10 16:25:02 +0100 |
commit | 63020fa3aa2c4f703d0df0299aa2f45cecfd55ad (patch) | |
tree | aa68f183053903cf228fe5b53a7c2898f7856b78 /src/stage1 | |
parent | dd313cff902916d465a0c43adfce2873fe5ad50c (diff) |
deptree resolution is possible.
Diffstat (limited to 'src/stage1')
-rw-r--r-- | src/stage1/build_from_deptree.sh | 57 | ||||
-rw-r--r-- | src/stage1/ca-certificates-utils-shim.sh | 7 | ||||
-rw-r--r-- | src/stage1/create_package_tree.sh | 9 | ||||
-rw-r--r-- | src/stage1/gcc-libs-shim.sh | 7 | ||||
-rw-r--r-- | src/stage1/glibc-shim.sh | 9 | ||||
-rw-r--r-- | src/stage1/repackage_arch_any.sh | 37 |
6 files changed, 111 insertions, 15 deletions
diff --git a/src/stage1/build_from_deptree.sh b/src/stage1/build_from_deptree.sh new file mode 100644 index 0000000..836a790 --- /dev/null +++ b/src/stage1/build_from_deptree.sh @@ -0,0 +1,57 @@ +#!/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 -eu + +# 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}') + [ -n "$_pkgname" ] || die "could not resolve cyclic dependencies. exiting." + + _pkgver=$(pacman -Qi $_pkgname | grep '^Version' | awk '{print $3}') + _pkgdir="$_makepkgdir"/$_pkgname/pkg/$_pkgname + + msg "makepkg: $_pkgname-$_pkgver-$_arch.pkg.tar.xz" + msg " remaining pkges: $(cat "$_deptree" | wc -l)" + + if [ ! -f "$_makepkgdir"/$_pkgname-$_pkgver-$_arch.pkg.tar.xz ]; then + rm -rf "$_makepkgdir"/$_pkgname + mkdir -pv "$_makepkgdir"/$_pkgname + pushd "$_makepkgdir"/$_pkgname >/dev/null + + + popd >/dev/null + + # rm -rf "$_makepkgdir"/$_pkgname + fi + +# cp -av "$_makepkgdir"/$_pkgname-$_pkgver-any.pkg.tar.xz "$_chrootdir"/packages/$_arch +# +# rm -rf "$_chrootdir"/var/cache/pacman/pkg/* +# rm -rf "$_chrootdir"/packages/$_arch/repo.{db,files}* +# repo-add -q -R "$_chrootdir"/packages/$_arch/{repo.db.tar.gz,*.pkg.tar.xz} +# pacman --noscriptlet --noconfirm --force -dd --config "$_chrootdir"/etc/pacman.conf \ +# -r "$_chrootdir" -Syy $_pkgname + + # remove pkg from deptree + sed -i "/^$_pkgname :/d; s/ $_pkgname\b//g" "$_deptree" +done + diff --git a/src/stage1/ca-certificates-utils-shim.sh b/src/stage1/ca-certificates-utils-shim.sh index fbd1847..b48098d 100644 --- a/src/stage1/ca-certificates-utils-shim.sh +++ b/src/stage1/ca-certificates-utils-shim.sh @@ -21,7 +21,7 @@ set -eu _pkgname=ca-certificates-utils-shim -_pkgver=$(pacman -Qi ${_pkgname%-*} | grep '^Version' | cut -d':' -f2 | tr -d [:space:]) +_pkgver=$(pacman -Qi ${_pkgname%-*} | grep '^Version' | awk '{print $3}') _pkgdir="$_makepkgdir"/$_pkgname/pkg/$_pkgname msg "makepkg: $_pkgname-$_pkgver-$_arch.pkg.tar.xz" @@ -70,6 +70,7 @@ cp -av "$_makepkgdir"/$_pkgname-$_pkgver-$_arch.pkg.tar.xz "$_chrootdir"/package rm -rf "$_chrootdir"/var/cache/pacman/pkg/* rm -rf "$_chrootdir"/packages/$_arch/repo.{db,files}* -repo-add -R "$_chrootdir"/packages/$_arch/{repo.db.tar.gz,*.pkg.tar.xz} -pacman --noconfirm --config "$_chrootdir"/etc/pacman.conf -r "$_chrootdir" -Syy $_pkgname +repo-add -q -R "$_chrootdir"/packages/$_arch/{repo.db.tar.gz,*.pkg.tar.xz} +pacman --noscriptlet --noconfirm --force -d --config "$_chrootdir"/etc/pacman.conf \ + -r "$_chrootdir" -Syy $_pkgname diff --git a/src/stage1/create_package_tree.sh b/src/stage1/create_package_tree.sh index f93b85c..4d5fdb3 100644 --- a/src/stage1/create_package_tree.sh +++ b/src/stage1/create_package_tree.sh @@ -22,8 +22,6 @@ set -eu msg "creating transitive dependency tree for $_groups" -_deptree="$_builddir"/DEPTREE - if [ ! -f "$_deptree" ]; then declare -A _tree @@ -48,11 +46,12 @@ if [ ! -f "$_deptree" ]; then done # log package dependency tree - echo "" > "$_deptree" + truncate -s0 "$_deptree".FULL for i in "${!_tree[@]}"; do - echo " ${i} : [${_tree[$i]} ]" >> "$_deptree" + echo "${i} : [${_tree[$i]} ]" >> "$_deptree".FULL done fi -echo "total pkges: $(cat "$_deptree" | wc -l)" +cp "$_deptree"{.FULL,} +echo "total pkges: $(cat "$_deptree" | wc -l)" diff --git a/src/stage1/gcc-libs-shim.sh b/src/stage1/gcc-libs-shim.sh index bc6b2e4..2a48da3 100644 --- a/src/stage1/gcc-libs-shim.sh +++ b/src/stage1/gcc-libs-shim.sh @@ -21,7 +21,7 @@ set -eu _pkgname=gcc-libs-shim -_pkgver=$(pacman -Qi $_target-gcc | grep '^Version' | cut -d':' -f2 | tr -d [:space:]) +_pkgver=$(pacman -Qi $_target-gcc | grep '^Version' | awk '{print $3}') _pkgdir="$_makepkgdir"/$_pkgname/pkg/$_pkgname msg "makepkg: $_pkgname-$_pkgver-$_arch.pkg.tar.xz" @@ -70,5 +70,6 @@ cp -av "$_makepkgdir"/$_pkgname-$_pkgver-$_arch.pkg.tar.xz "$_chrootdir"/package rm -rf "$_chrootdir"/var/cache/pacman/pkg/* rm -rf "$_chrootdir"/packages/$_arch/repo.{db,files}* -repo-add -R "$_chrootdir"/packages/$_arch/{repo.db.tar.gz,*.pkg.tar.xz} -pacman --noconfirm --config "$_chrootdir"/etc/pacman.conf -r "$_chrootdir" -Syy $_pkgname +repo-add -q -R "$_chrootdir"/packages/$_arch/{repo.db.tar.gz,*.pkg.tar.xz} +pacman --noscriptlet --noconfirm --force -dd --config "$_chrootdir"/etc/pacman.conf \ + -r "$_chrootdir" -Syy $_pkgname diff --git a/src/stage1/glibc-shim.sh b/src/stage1/glibc-shim.sh index 9787dd9..49009f9 100644 --- a/src/stage1/glibc-shim.sh +++ b/src/stage1/glibc-shim.sh @@ -21,7 +21,7 @@ set -eu _pkgname=glibc-shim -_pkgver=$(pacman -Qi $_target-glibc | grep '^Version' | cut -d':' -f2 | tr -d [:space:]) +_pkgver=$(pacman -Qi $_target-glibc | grep '^Version' | awk '{print $3}') _pkgdir="$_makepkgdir"/$_pkgname/pkg/$_pkgname msg "makepkg: $_pkgname-$_pkgver-$_arch.pkg.tar.xz" @@ -31,7 +31,7 @@ if [ ! -f "$_makepkgdir"/$_pkgname-$_pkgver-$_arch.pkg.tar.xz ]; then mkdir -pv "$_makepkgdir"/$_pkgname pushd "$_makepkgdir"/$_pkgname >/dev/null - # to produce glibc shim from gcc, we need the package + # to produce glibc shim from glibc, we need the package pacman -Sw --noconfirm --cachedir . $_target-glibc mkdir tmp && bsdtar -C tmp -xf $_target-glibc-$_pkgver-*.pkg.tar.xz @@ -79,5 +79,6 @@ cp -av "$_makepkgdir"/$_pkgname-$_pkgver-$_arch.pkg.tar.xz "$_chrootdir"/package rm -rf "$_chrootdir"/var/cache/pacman/pkg/* rm -rf "$_chrootdir"/packages/$_arch/repo.{db,files}* -repo-add -R "$_chrootdir"/packages/$_arch/{repo.db.tar.gz,*.pkg.tar.xz} -pacman --noconfirm --config "$_chrootdir"/etc/pacman.conf -r "$_chrootdir" -Syy $_pkgname +repo-add -q -R "$_chrootdir"/packages/$_arch/{repo.db.tar.gz,*.pkg.tar.xz} +pacman --noscriptlet --noconfirm --force -dd --config "$_chrootdir"/etc/pacman.conf \ + -r "$_chrootdir" -Syy $_pkgname diff --git a/src/stage1/repackage_arch_any.sh b/src/stage1/repackage_arch_any.sh index 4629908..37b08b0 100644 --- a/src/stage1/repackage_arch_any.sh +++ b/src/stage1/repackage_arch_any.sh @@ -20,4 +20,41 @@ set -eu +_packages=$(cat "$_builddir"/DEPTREE | cut -d' ' -f1) +# we can simply repackage anything with arch=('any'), no compilation needed. +for _pkgname in $_packages; do + _pkgarch=$(pacman -Si $_pkgname | grep '^Architecture' | awk '{print $3}') + [ "x$_pkgarch" == "xany" ] || continue + + _pkgver=$(pacman -Qi $_pkgname | grep '^Version' | awk '{print $3}') + _pkgdir="$_makepkgdir"/$_pkgname/pkg/$_pkgname + + msg "makepkg: $_pkgname-$_pkgver-any.pkg.tar.xz" + msg " remaining pkges: $(cat "$_deptree" | wc -l)" + + if [ ! -f "$_makepkgdir"/$_pkgname-$_pkgver-any.pkg.tar.xz ]; then + rm -rf "$_makepkgdir"/$_pkgname + mkdir -pv "$_makepkgdir"/$_pkgname + pushd "$_makepkgdir"/$_pkgname >/dev/null + + # download the package + pacman -Sw --noconfirm --cachedir . $_pkgname + cp $_pkgname-$_pkgver-any.pkg.tar.xz "$_makepkgdir"/ + + popd >/dev/null + + # rm -rf "$_makepkgdir"/$_pkgname + fi + + cp -av "$_makepkgdir"/$_pkgname-$_pkgver-any.pkg.tar.xz "$_chrootdir"/packages/$_arch + + rm -rf "$_chrootdir"/var/cache/pacman/pkg/* + rm -rf "$_chrootdir"/packages/$_arch/repo.{db,files}* + repo-add -q -R "$_chrootdir"/packages/$_arch/{repo.db.tar.gz,*.pkg.tar.xz} + pacman --noscriptlet --noconfirm --force -dd --config "$_chrootdir"/etc/pacman.conf \ + -r "$_chrootdir" -Syy $_pkgname + + # remove pkg from deptree + sed -i "/^$_pkgname :/d; s/ $_pkgname / /" "$_deptree" +done |