summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2018-02-22 11:31:06 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2018-02-22 11:31:06 +0100
commitc0d2fbfd31227e114abbd2440a7ac99ee606f1e9 (patch)
tree493a7600b39cb9cf8c90318254c83208ef6e6309
parentfd8bbbc755c8dd44fd6ffe0c3f065600f2eb569f (diff)
downloadbootstrap32-c0d2fbfd31227e114abbd2440a7ac99ee606f1e9.tar.xz
first working packages on stage 2
-rw-r--r--TODOS16
-rwxr-xr-xbuild_stage1_package.sh4
-rwxr-xr-xbuild_stage2_package.sh60
-rwxr-xr-xprepare_stage2_repo.sh9
4 files changed, 77 insertions, 12 deletions
diff --git a/TODOS b/TODOS
index 106829c..be32c1b 100644
--- a/TODOS
+++ b/TODOS
@@ -33,7 +33,9 @@ general bugs:
- make a wrapper for sed in DESCR, which is actually able to detect whether
the patch was successful or not. Avoid hard to detect errors, when the
upstream PKGBUILD(s) change.
-
+- stage 1 and stage 2 scripts have things in common which should probably
+ be dealt with not by copy pasting code
+
stage1 issues:
- stage1: cdrom installs keyrings without having a gpg binary
- 32 MB is not enough when installing packages => add a swap as first action!
@@ -53,7 +55,11 @@ stage1 issues:
- there is really no need to copy stage 1 repo /packages/i486 onto the hdd
stage2 issues:
-- make: recursive tarkets like all-recursive don't work, neither with cross-compiled
- make nor with the recompiled make on the stage1 system.
- => rebuilding bash on the target works, but it's a workaround:
- https://unix.stackexchange.com/questions/389022/make-unable-to-recurse-for-autoconf-like-projects/423448#423448
+- make: recursive targets like all-recursive don't work, the root cause is bash,
+ see https://unix.stackexchange.com/questions/389022/make-unable-to-recurse-for-autoconf-like-projects/423448#423448
+ => rebuilding bash on the target as first package works, but it's a workaround
+- cross-compiled pacman has issues with repos:
+ error: could not register 'temp' database (wrong or NULL argument passed)
+ error: no usable package repositories configured.
+ => we cannot install via the [temp] repo
+
diff --git a/build_stage1_package.sh b/build_stage1_package.sh
index 53cfae9..af4016c 100755
--- a/build_stage1_package.sh
+++ b/build_stage1_package.sh
@@ -116,8 +116,8 @@ if test "$(pacman --config "$STAGE1_CHROOT/etc/pacman.conf" -r "$STAGE1_CHROOT"
# there, packages seem to reappear in old versions)
rm -rf $STAGE1_CHROOT/var/cache/pacman/pkg/*
- rm -rf $STAGE1_CHROOT/packages/$TARGET_CPU/temp.db*
- rm -rf $STAGE1_CHROOT/packages/$TARGET_CPU/temp.files*
+ rm -rf $STAGE1_CHROOT/packages/$TARGET_CPU/temp.db*
+ rm -rf $STAGE1_CHROOT/packages/$TARGET_CPU/temp.files*
repo-add $STAGE1_CHROOT/packages/$TARGET_CPU/temp.db.tar.gz $STAGE1_CHROOT/packages/$TARGET_CPU/*pkg.tar.xz
# install into chroot via pacman
diff --git a/build_stage2_package.sh b/build_stage2_package.sh
index de6643a..feeb7f0 100755
--- a/build_stage2_package.sh
+++ b/build_stage2_package.sh
@@ -16,9 +16,9 @@ PACKAGE=$1
. "$SCRIPT_DIR/$TARGET_CPU-stage2/template/DESCR"
-if test "$(find "$STAGE2_PACKAGES" -regex ".*/$PACKAGE-.*pkg\\.tar\\.xz"n | wc -l)" = 0; then
+if test "$(find "$STAGE2_PACKAGES" -regex ".*/$PACKAGE-.*pkg\\.tar\\.xz" | wc -l)" = 0; then
echo "Building package $PACKAGE."
-
+
cd $STAGE2_BUILD || exit 1
# clean up old build
@@ -98,7 +98,59 @@ if test "$(find "$STAGE2_PACKAGES" -regex ".*/$PACKAGE-.*pkg\\.tar\\.xz"n | wc -
tail "$PACKAGE.log"
- #~ if test $RES = 0; then
- #~ fi
+ if test $RES = 0; then
+
+ # copy to our package folder in the first stage chroot
+
+ ssh -i $CROSS_HOME/.ssh/id_rsa root@$STAGE1_MACHINE_IP bash -c "'
+ cd /build/$PACKAGE
+ rm -f ./*debug*.pkg.tar.xz
+ cp -v ./*.pkg.tar.xz /packages/$TARGET_CPU/.
+ '"
+
+ # redo the whole pacman cache and repo (always running into trouble
+ # there, packages seem to reappear in old versions)
+
+ ssh -i $CROSS_HOME/.ssh/id_rsa root@$STAGE1_MACHINE_IP bash -c "'
+ rm -rf /var/cache/pacman/pkg/*
+ rm -rf /packages/$TARGET_CPU/temp.db*
+ rm -rf /packages/$TARGET_CPU/temp.files*
+ repo-add /packages/$TARGET_CPU/temp.db.tar.gz /packages/$TARGET_CPU/*pkg.tar.xz
+ '"
+
+ # install onto stage 1 system via pacman
+
+ ssh -i $CROSS_HOME/.ssh/id_rsa root@$STAGE1_MACHINE_IP bash -c "'
+ # TODO: broken [temp] repo
+ #pacman --noconfirm -Syy $PACKAGE
+ pacman --noconfirm -U /packages/$TARGET_CPU/$PACKAGE-*.pkg.tar.xz
+ if test $ADDITIONAL_INSTALL_PACKAGE != ""; then
+ #pacman --noconfirm -Syy $ADDITIONAL_INSTALL_PACKAGE
+ pacman --noconfirm -U /packages/$TARGET_CPU/$ADDITIONAL_INSTALL_PACKAGE-*.pkg.tar.xz
+ fi
+ '"
+
+ # copy packages from target machine and replace our local version with it
+
+ tmp_dir=$(mktemp -d 'tmp.compute-dependencies.0.XXXXXXXXXX' --tmpdir)
+ trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
+
+ mv "$STAGE2_BUILD/$PACKAGE/$PACKAGE.log" "$tmp_dir"
+ cd "$STAGE2_BUILD" || exit 1
+ rm -rf "$PACKAGE"
+ scp -i $CROSS_HOME/.ssh/id_rsa -rC build@$STAGE1_MACHINE_IP:/build/"$PACKAGE" "$STAGE2_BUILD/."
+ mv "$tmp_dir/$PACKAGE.log" "$STAGE2_BUILD/$PACKAGE/."
+ mv -vf "$STAGE2_BUILD/$PACKAGE/"*.pkg.tar.xz "$STAGE2_PACKAGES/."
+
+ echo "Built package $PACKAGE."
+
+ else
+ echo "ERROR building package $PACKAGE"
+ exit 1
+ fi
+
+ cd $STAGE2_BUILD || exit 1
+else
+ echo "$PACKAGE exists."
fi
diff --git a/prepare_stage2_repo.sh b/prepare_stage2_repo.sh
index 5ce5f00..5f7455a 100755
--- a/prepare_stage2_repo.sh
+++ b/prepare_stage2_repo.sh
@@ -20,7 +20,14 @@ if test ! -d $STAGE2_BUILD; then
# TODO: check makepkg in stage1 hdd
# TODO: makepkg patch to run as root or add a build user to hdd
# TODO: we assume we have on cpu for now on the target
-
+ # TODO: fix pacman.conf in stage1:
+ # architecture?
+ # mirrorlist
+ # pacman.conf: remove standard repos, add temp repo:
+ # [temp]
+ #SigLevel = Never
+ #Server = file:///packages/$arch
+
echo "Prepared the stage 2 build environment."
fi