From b056beb2f8ab8471bc4dfef087149894d6bc3eb9 Mon Sep 17 00:00:00 2001 From: Martin Kennedy Date: Mon, 15 Feb 2021 16:29:00 +0000 Subject: [PATCH] Rework the builder targets so we may use different remotes Now, in order to set up the builder at a given remote @ commit , we will want to make ${docker_src}/built/openwrt-builder-remote_commit.sentinel ... and then use the openwrt-builder-remote_commit image as a base. New remotes can / should be added to openwrt-remotes.txt. Honestly this oughta have been under the openwrt dir but, eh. --- Makefile | 15 +++++++++++++-- openwrt-builder-commit.dockerfile | 13 ++++++++++--- openwrt-remotes.txt | 2 ++ 3 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 openwrt-remotes.txt diff --git a/Makefile b/Makefile index 2f5cdcc..f877958 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,17 @@ ${docker_src}/built/debian_10.sentinel: ${docker_src}/built/openwrt-builder-%.sentinel: \ ${docker_src}/openwrt-builder-commit.dockerfile \ - ${docker_src}/built/openwrt-builder.sentinel - cd ${docker_src}; docker build -f $< --build-arg=commit=$* --tag openwrt-builder-$* .; \ + ${docker_src}/built/openwrt-builder.sentinel \ + ${docker_src}/openwrt-remotes.txt + cd ${docker_src}; \ + rev=$*; \ + if [ "$rev" != "$${rev%_*}" ]; then \ + remote=$(shell echo $* | cut -d_ -f1); \ + commit=$(shell echo $* | cut -d_ -f2); \ + remoteurl=$(shell echo $* | cut -d_ -f1 | xargs -I{} grep -e "^{}" ${docker_src}/openwrt-remotes.txt | cut -d ' ' -f2); \ + docker build -f $< --build-arg=remote="$$remote" --build-arg=commit="$$commit" --build-arg=remoteurl="$$remoteurl" --tag openwrt-builder-$* .; \ + else \ + commit=$(shell echo $*); \ + docker build -f $< --build-arg=commit="$$commit" --tag openwrt-builder-$* . ; \ + fi; \ touch $@; diff --git a/openwrt-builder-commit.dockerfile b/openwrt-builder-commit.dockerfile index b7c3119..a4998ab 100644 --- a/openwrt-builder-commit.dockerfile +++ b/openwrt-builder-commit.dockerfile @@ -1,10 +1,17 @@ FROM openwrt-builder -ARG commit +ARG remote="origin" + +ARG remoteurl="https://git.laboratoryb.org/hurricos/openwrt-mirror" + +ARG commit="master" RUN cd ${openwrt_dir} \ - && git pull origin master \ - && git checkout ${commit} \ + && ( git remote add ${remote} ${remoteurl} --tags || true ) + +RUN cd ${openwrt_dir} \ + && git fetch --all \ + && git checkout ${remote}/${commit} \ && ./scripts/feeds update -a \ && ./scripts/feeds install -a diff --git a/openwrt-remotes.txt b/openwrt-remotes.txt new file mode 100644 index 0000000..ce283bb --- /dev/null +++ b/openwrt-remotes.txt @@ -0,0 +1,2 @@ +mirror https://git.laboratoryb.org/hurricos/openwrt-mirror +local https://git.laboratoryb.org/hurricos/openwrt