diff options
author | Carlo Landmeter <clandmeter@alpinelinux.org> | 2019-04-06 22:53:47 +0000 |
---|---|---|
committer | Carlo Landmeter <clandmeter@alpinelinux.org> | 2019-04-06 22:53:47 +0000 |
commit | 32a5fa40e4a12b1fa0cfc5871935719a80fcdb07 (patch) | |
tree | 63df8d045e737e7a1118627cce746f76f320e285 | |
parent | 24d21534d31b1e5841278f99f6b1f5451762786c (diff) | |
download | alpine-drone-ci-32a5fa40e4a12b1fa0cfc5871935719a80fcdb07.tar.bz2 alpine-drone-ci-32a5fa40e4a12b1fa0cfc5871935719a80fcdb07.tar.xz |
build: setup own workspace
Do not use Drone's workspace but instead setup our own.
This means cloning a shallow copy of aports and git am the PR patch from github.
-rw-r--r-- | files/etc/skel/.gitconfig | 3 | ||||
-rwxr-xr-x | scripts/build.sh | 17 |
2 files changed, 16 insertions, 4 deletions
diff --git a/files/etc/skel/.gitconfig b/files/etc/skel/.gitconfig new file mode 100644 index 0000000..818ea76 --- /dev/null +++ b/files/etc/skel/.gitconfig @@ -0,0 +1,3 @@ +[user] + email = alpine-infra@lists.alpinelinux.org + name = buildozer diff --git a/scripts/build.sh b/scripts/build.sh index fba14c9..8b5ad67 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -2,9 +2,11 @@ set -eu -readonly APORTSDIR=$HOME/drone/aports +readonly APORTSDIR=$HOME/aports +readonly REPODEST=$HOME/packages readonly REPOS="main community testing" readonly MIRROR=http://dl-cdn.alpinelinux.org/alpine +readonly REPOURL=https://github.com/alpinelinux/aports msg() { local color=${2:-green} @@ -35,7 +37,6 @@ get_release() { build_aport() { local repo="$1" aport="$2" cd "$APORTSDIR/$repo/$aport" - sudo chown buildozer . abuild -r } @@ -71,9 +72,16 @@ setup_system() { sudo apk -U upgrade -a || apk fix || die "Failed to up/downgrade system" abuild-keygen -ain sudo sed -i 's/JOBS=[0-9]*/JOBS=$(nproc)/' /etc/abuild.conf - sudo install -do buildozer "$HOME"/drone/packages + mkdir -p "$REPODEST" } +create_workspace() { + msg "Cloning aports and applying PR$DRONE_PULL_REQUEST" + git clone --depth=1 --branch $DRONE_COMMIT_BRANCH $REPOURL $APORTSDIR + wget -qO- $REPOURL/pull/$DRONE_PULL_REQUEST.patch | git -C $APORTSDIR am +} + + sysinfo() { printf ">>> Host system information (arch: %s, release: %s) <<<\n" "$(apk --print-arch)" "$(get_release)" printf "- Number of Cores: %s\n" $(nproc) @@ -85,7 +93,8 @@ aport_ok= aport_ng= sysinfo || true -setup_system +setup_system || die "Failed to setup system" +create_workspace || die "Failed to create workspace" for repo in $(changed_repos); do set_repositories_for "$repo" |