CI: use install-pmbootstrap.sh from ci-common repo (MR 1147)

This script is used by multiple repositories by now, let's make sure we
only have one place where we need to maintain it. The version in
ci-common is shellchecked and displays less output for 'pmbootstrap
init' again (unless it fails, then it shows the whole log).
This commit is contained in:
Oliver Smith 2020-04-11 22:40:32 +02:00 committed by Daniele Debernardi
parent 1ca30ec53f
commit 8f79b6f5b2
No known key found for this signature in database
GPG key ID: 5782FCF5DAE9AF60
2 changed files with 6 additions and 51 deletions

View file

@ -67,7 +67,8 @@ aports-static:
stage: first
<<: *only-default
before_script:
- .gitlab-ci/install_pmbootstrap.sh pytest
- wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
- sh ./install_pmbootstrap.sh pytest
script:
- apk -q add git
- su pmos -c ".gitlab-ci/run_testcases.sh"
@ -102,7 +103,8 @@ kernel-kconfig:
- device/*/linux-*/config-*
- main/linux-*/config-*
before_script:
- .gitlab-ci/install_pmbootstrap.sh pytest
- wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
- sh ./install_pmbootstrap.sh pytest
script:
- su pmos -c "pmbootstrap kconfig check"
@ -122,6 +124,7 @@ aports-build:
stage: second
<<: *only-default
before_script:
- .gitlab-ci/install_pmbootstrap.sh git
- wget "https://gitlab.com/postmarketOS/ci-common/-/raw/master/install_pmbootstrap.sh"
- sh ./install_pmbootstrap.sh
script:
- PYTHONUNBUFFERED=1 su pmos -c ".gitlab-ci/build_changed_aports.py"

View file

@ -1,48 +0,0 @@
#!/bin/sh -e
# Copyright 2020 Oliver Smith
# SPDX-License-Identifier: GPL-3.0-or-later
# usage: install_pmbootstrap.sh [ADDITIONAL_PACKAGE, ...]
# Config: pmbootstrap tag (or branch)
tag="master"
# Get download URL and pmaports path
url="https://gitlab.com/postmarketOS/pmbootstrap.git"
pmaports="$(cd $(dirname $0)/..; pwd -P)"
# Set up depends and binfmt_misc
depends="coreutils openssl python3 sudo git $@"
echo "Installing dependencies: $depends"
apk -q add $depends
mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
# Create pmos user
echo "Creating pmos user"
adduser -D pmos
chown -R pmos:pmos .
echo 'pmos ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# Download pmbootstrap (to /tmp/pmbootstrap)
echo "Downloading pmbootstrap ($tag): $url"
cd /tmp
git clone -q "$url"
git -C pmbootstrap checkout -q "$tag"
# Install to $PATH and init
ln -s /tmp/pmbootstrap/pmbootstrap.py /usr/local/bin/pmbootstrap
echo "Initializing pmbootstrap"
if ! su pmos -c "yes '' | pmbootstrap -q --aports '$pmaports' --details-to-stdout init"; then
echo "ERROR: pmbootstrap init failed!"
echo
echo "Most likely, this means that pmbootstrap requires a newer"
echo "pmaports version. Please rebase on the official pmaports.git"
echo "master branch and try again."
echo
echo "Let us know in the chat or issues if you have trouble with that"
echo "and we will be happy to help. Sorry for the inconvenience."
echo
echo "(If that does not help, click on 'Browse' in the 'Job artifacts'"
echo "next to this log output, and have a look at log.txt.)"
exit 1
fi
echo ""