From 5840a4815fb4e34c957a0edca4d0563f5b06d8ff Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Fri, 23 Sep 2016 01:17:05 +0200 Subject: travis: use only repositories at same or higher level than target repo --- .travis/build-pkgs | 20 ++++++++++++++++++++ .travis/common.sh | 1 + .travis/install-alpine | 2 +- .travis/repositories | 3 --- 4 files changed, 22 insertions(+), 4 deletions(-) delete mode 100644 .travis/repositories (limited to '.travis') diff --git a/.travis/build-pkgs b/.travis/build-pkgs index b1dd9cca4e..57bbadd9f3 100755 --- a/.travis/build-pkgs +++ b/.travis/build-pkgs @@ -31,6 +31,24 @@ changed_abuilds() { ap builddirs -d "$(pwd)/$repo" $aports 2>/dev/null | xargs -I% basename % } +# Replaces /etc/apk/repositories with repositories at $MIRROR_URI that are on +# the same or higher level than the given repo (main > community > testing) +# and after that runs `apk update`. +# +# $1: the target repository; main, community, or testing +set_repositories_for() { + local target_repo="$1" + local repos_file='/etc/apk/repositories' + + printf '' > $repos_file + local repo; for repo in main community testing; do + printf '%s\n' "$MIRROR_URI/$repo" >> $repos_file + [ "$repo" = "$target_repo" ] && break + done + + apk update +} + cd "$CLONE_DIR" @@ -53,6 +71,8 @@ echo 'Diffstat:' git --no-pager diff --color --stat "$commit_range" for repo in $(changed_repos "$commit_range"); do + set_repositories_for "$repo" + for pkgname in $(changed_abuilds "$repo" "$commit_range"); do qname="$repo/$pkgname" diff --git a/.travis/common.sh b/.travis/common.sh index bf4b2ff945..27260128aa 100644 --- a/.travis/common.sh +++ b/.travis/common.sh @@ -3,6 +3,7 @@ readonly ALPINE_ROOT='/mnt/alpine' readonly ALPINE_USER='alpine' readonly CLONE_DIR="${CLONE_DIR:-$(pwd)}" +readonly MIRROR_URI='http://dl-cdn.alpinelinux.org/alpine/edge' # Runs commands inside the Alpine chroot. alpine_run() { diff --git a/.travis/install-alpine b/.travis/install-alpine index 756bbd8baf..a9ac855529 100755 --- a/.travis/install-alpine +++ b/.travis/install-alpine @@ -21,8 +21,8 @@ title 'Installing Alpine Linux' mkdir -p "$ALPINE_ROOT"/etc/apk cd "$ALPINE_ROOT" +echo "$MIRROR_URI/main" > etc/apk/repositories cp -R "$CLONE_DIR"/.travis/keys etc/apk/keys -cp "$CLONE_DIR"/.travis/repositories etc/apk/repositories cp /etc/resolv.conf etc/resolv.conf /tmp/sbin/apk.static \ diff --git a/.travis/repositories b/.travis/repositories deleted file mode 100644 index 4bfbbae6ef..0000000000 --- a/.travis/repositories +++ /dev/null @@ -1,3 +0,0 @@ -http://dl-cdn.alpinelinux.org/alpine/edge/main -http://dl-cdn.alpinelinux.org/alpine/edge/community -http://dl-cdn.alpinelinux.org/alpine/edge/testing -- cgit v1.2.3