mirror of https://github.com/aredn/aredn.git
build: Update final image names for CircleCI automation
This commit is contained in:
parent
ec4bf4eca3
commit
0f4eeef0a8
41
Makefile
41
Makefile
|
@ -5,9 +5,6 @@ include openwrt.mk
|
||||||
MAINTARGET=$(word 1, $(subst -, ,$(TARGET)))
|
MAINTARGET=$(word 1, $(subst -, ,$(TARGET)))
|
||||||
SUBTARGET=$(word 2, $(subst -, ,$(TARGET)))
|
SUBTARGET=$(word 2, $(subst -, ,$(TARGET)))
|
||||||
|
|
||||||
# export for test script use
|
|
||||||
export AREDNSUBTARGET=$(SUBTARGET)
|
|
||||||
|
|
||||||
GIT_BRANCH=$(shell git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
|
GIT_BRANCH=$(shell git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
|
||||||
GIT_COMMIT=$(shell git rev-parse --short HEAD)
|
GIT_COMMIT=$(shell git rev-parse --short HEAD)
|
||||||
|
|
||||||
|
@ -17,14 +14,12 @@ OPENWRT_DIR=$(TOP_DIR)/openwrt
|
||||||
TARGET_CONFIG=$(TOP_DIR)/configs/common.config $(TOP_DIR)/configs/$(MAINTARGET)-$(SUBTARGET).config
|
TARGET_CONFIG=$(TOP_DIR)/configs/common.config $(TOP_DIR)/configs/$(MAINTARGET)-$(SUBTARGET).config
|
||||||
UMASK=umask 022
|
UMASK=umask 022
|
||||||
|
|
||||||
# set variables based on private or travis-ci build
|
# set variables based on private or CircleCI build
|
||||||
ifeq ($(TRAVIS),true)
|
ifeq ($(CIRCLECI),true)
|
||||||
$(info Travis-CI build ...)
|
$(info CircleCI build ...)
|
||||||
FW_VERSION=$(TRAVIS_BUILD_NUMBER)-$(TRAVIS_COMMIT)
|
FW_VERSION=$(PRIVATE_BUILD_VERSION)-$(GIT_COMMIT)
|
||||||
FW_REPO=$(TRAVIS_BUILD_PACKAGES)
|
|
||||||
else
|
else
|
||||||
FW_VERSION=$(PRIVATE_BUILD_VERSION)-$(GIT_BRANCH)-$(GIT_COMMIT)
|
FW_VERSION=$(PRIVATE_BUILD_VERSION)-$(GIT_BRANCH)-$(GIT_COMMIT)
|
||||||
FW_REPO=$(PRIVATE_BUILD_PACKAGES)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# test for existing $TARGET-config or abort
|
# test for existing $TARGET-config or abort
|
||||||
|
@ -51,7 +46,7 @@ $(OPENWRT_DIR): .stamp-openwrt-removed
|
||||||
|
|
||||||
# clean up openwrt working copy
|
# clean up openwrt working copy
|
||||||
openwrt-clean: stamp-clean-openwrt-cleaned .stamp-openwrt-cleaned
|
openwrt-clean: stamp-clean-openwrt-cleaned .stamp-openwrt-cleaned
|
||||||
.stamp-openwrt-cleaned: | $(OPENWRT_DIR) openwrt-clean-bin
|
.stamp-openwrt-cleaned: | $(OPENWRT_DIR)
|
||||||
cd $(OPENWRT_DIR); \
|
cd $(OPENWRT_DIR); \
|
||||||
./scripts/feeds clean && \
|
./scripts/feeds clean && \
|
||||||
git clean -dff && git fetch && git reset --hard HEAD && \
|
git clean -dff && git fetch && git reset --hard HEAD && \
|
||||||
|
@ -63,9 +58,6 @@ openwrt-clean: stamp-clean-openwrt-cleaned .stamp-openwrt-cleaned
|
||||||
ln -sf $(TOP_DIR)/files $(OPENWRT_DIR)/
|
ln -sf $(TOP_DIR)/files $(OPENWRT_DIR)/
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
openwrt-clean-bin:
|
|
||||||
rm -rf $(OPENWRT_DIR)/bin
|
|
||||||
|
|
||||||
# update openwrt and checkout specified commit
|
# update openwrt and checkout specified commit
|
||||||
openwrt-update: .stamp-openwrt-updated .stamp-unpatched
|
openwrt-update: .stamp-openwrt-updated .stamp-unpatched
|
||||||
.stamp-openwrt-updated: stamp-clean-openwrt-updated .stamp-openwrt-cleaned
|
.stamp-openwrt-updated: stamp-clean-openwrt-updated .stamp-openwrt-cleaned
|
||||||
|
@ -132,7 +124,7 @@ $(OPENWRT_DIR)/.config: .stamp-feeds-updated $(TARGET_CONFIG) .stamp-build_rev a
|
||||||
cat $(TARGET_CONFIG) >$(OPENWRT_DIR)/.config
|
cat $(TARGET_CONFIG) >$(OPENWRT_DIR)/.config
|
||||||
echo "CONFIG_VERSION_NUMBER=\"$(FW_VERSION)\"" >>$(OPENWRT_DIR)/.config
|
echo "CONFIG_VERSION_NUMBER=\"$(FW_VERSION)\"" >>$(OPENWRT_DIR)/.config
|
||||||
echo "$(FW_VERSION)" >$(TOP_DIR)/files/etc/mesh-release
|
echo "$(FW_VERSION)" >$(TOP_DIR)/files/etc/mesh-release
|
||||||
echo "CONFIG_VERSION_REPO=\"$(FW_REPO)\"" >>$(OPENWRT_DIR)/.config
|
echo "CONFIG_VERSION_REPO=\"$(PRIVATE_BUILD_PACKAGES)\"" >>$(OPENWRT_DIR)/.config
|
||||||
$(UMASK); \
|
$(UMASK); \
|
||||||
$(MAKE) -C $(OPENWRT_DIR) defconfig
|
$(MAKE) -C $(OPENWRT_DIR) defconfig
|
||||||
|
|
||||||
|
@ -143,16 +135,23 @@ prepare: stamp-clean-prepared .stamp-prepared
|
||||||
|
|
||||||
# compile
|
# compile
|
||||||
compile: stamp-clean-compiled .stamp-compiled
|
compile: stamp-clean-compiled .stamp-compiled
|
||||||
.stamp-compiled: .stamp-prepared .stamp-feeds-updated openwrt-clean-bin | $(TOP_DIR)/firmware
|
.stamp-compiled: .stamp-prepared .stamp-feeds-updated | $(TOP_DIR)/firmware
|
||||||
$(TOP_DIR)/scripts/tests-prebuild.sh
|
$(TOP_DIR)/scripts/tests-prebuild.sh
|
||||||
$(UMASK); \
|
$(UMASK); \
|
||||||
$(MAKE) -C $(OPENWRT_DIR) $(MAKE_ARGS)
|
$(MAKE) -C $(OPENWRT_DIR) $(MAKE_ARGS)
|
||||||
for FILE in `find $(TOP_DIR)/firmware/targets/ -name "*factory.bin" -o -name "*sysupgrade.bin" \
|
for FILE in `find $(TOP_DIR)/firmware/targets/ -path "*packages" -prune -o \( -type f -a \
|
||||||
-o -name "*.manifest" -o -name "*-mikrotik-vmlinux-initramfs.elf"`; do \
|
! \( -name "*factory.bin" -o -name "*sysupgrade.bin" -o -name "*.manifest" -o \
|
||||||
[ -e "$$FILE" ] || continue; \
|
-name "*-mikrotik-vmlinux-initramfs.elf" -o -name sha256sums -o -name config.seed \) \
|
||||||
NEWNAME="$${FILE/openwrt-/AREDN-}"; \
|
-print \)`; do rm $$FILE; \
|
||||||
NEWNAME="$${NEWNAME/ar71xx-generic-/}"; \
|
done;
|
||||||
|
for FILE in `find $(TOP_DIR)/firmware/targets/ -type f -a \
|
||||||
|
\( -name "*ar71xx-generic-*" -o -name "*squashfs-*" \
|
||||||
|
-o -name "*$(GIT_COMMIT)-?????-*" -o -name "aredn*ar71xx-mikrotik*" \
|
||||||
|
\) -print`; do \
|
||||||
|
NEWNAME="$${FILE/ar71xx-generic-/}"; \
|
||||||
NEWNAME="$${NEWNAME/squashfs-/}"; \
|
NEWNAME="$${NEWNAME/squashfs-/}"; \
|
||||||
|
NEWNAME="$${NEWNAME/$(GIT_COMMIT)-?????-/$(GIT_COMMIT)-}"; \
|
||||||
|
NEWNAME="$${NEWNAME/ar71xx-mikrotik-/mikrotik-}"; \
|
||||||
mv "$$FILE" "$$NEWNAME"; \
|
mv "$$FILE" "$$NEWNAME"; \
|
||||||
done;
|
done;
|
||||||
$(TOP_DIR)/scripts/tests-postbuild.sh
|
$(TOP_DIR)/scripts/tests-postbuild.sh
|
||||||
|
@ -177,6 +176,6 @@ stamp-clean:
|
||||||
clean: stamp-clean .stamp-openwrt-cleaned
|
clean: stamp-clean .stamp-openwrt-cleaned
|
||||||
|
|
||||||
|
|
||||||
.PHONY: openwrt-clean openwrt-clean-bin openwrt-update patch feeds-update prepare compile stamp-clean clean always
|
.PHONY: openwrt-clean openwrt-update patch feeds-update prepare compile stamp-clean clean always
|
||||||
.NOTPARALLEL:
|
.NOTPARALLEL:
|
||||||
.FORCE:
|
.FORCE:
|
||||||
|
|
|
@ -65,4 +65,5 @@ CONFIG_PACKAGE_libiwinfo-lua=y
|
||||||
CONFIG_PACKAGE_luaposix=y
|
CONFIG_PACKAGE_luaposix=y
|
||||||
CONFIG_IMAGEOPT=y
|
CONFIG_IMAGEOPT=y
|
||||||
CONFIG_VERSIONOPT=y
|
CONFIG_VERSIONOPT=y
|
||||||
|
CONFIG_VERSION_DIST="AREDN"
|
||||||
|
|
||||||
|
|
|
@ -34,31 +34,11 @@
|
||||||
LICENSE
|
LICENSE
|
||||||
|
|
||||||
|
|
||||||
# Variables that may need adjusting as time goes on
|
|
||||||
|
|
||||||
# update to add/remove device image targets
|
|
||||||
GENERIC_COUNT=23
|
|
||||||
MIKROTIK_COUNT=3
|
|
||||||
|
|
||||||
# END Variables that may need adjusting
|
|
||||||
|
|
||||||
. "$SCRIPTBASE/sh2ju.sh"
|
. "$SCRIPTBASE/sh2ju.sh"
|
||||||
|
|
||||||
# Check the count of image files named AREDN-*
|
# Check the count of image files named AREDN-*
|
||||||
|
|
||||||
case $AREDNSUBTARGET in
|
if [ "$(find ./openwrt/bin/* -maxdepth 4 -name "aredn*" | wc -l)" -gt "2" ]
|
||||||
mikrotik)
|
|
||||||
EXPECTEDFILESCOUNT=$MIKROTIK_COUNT
|
|
||||||
;;
|
|
||||||
generic)
|
|
||||||
EXPECTEDFILESCOUNT=$GENERIC_COUNT
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
EXPECTEDFILESCOUNT=0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ "$(find ./openwrt/bin/* -maxdepth 4 -name "AREDN*" | wc -l)" -eq "$EXPECTEDFILESCOUNT" ]
|
|
||||||
then
|
then
|
||||||
juLog -name="AREDN_image_files_exist" true
|
juLog -name="AREDN_image_files_exist" true
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue