diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a562adf9..b71b1ebb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,8 @@ jobs: matrix: target: [aarch64, x86_64] fail-fast: false + outputs: + build_id: ${{ steps.vars.outputs.INFIX_BUILD_ID }} steps: - name: Cleanup Build Folder run: | @@ -38,6 +40,16 @@ jobs: - name: Set Build Variables id: vars run: | + if [ -n "${{ github.event.pull_request.head.sha }}" ]; then + # Since PRs are built from an internally generated merge + # commit, reverse lookups of PRs and/or commits from + # image version information are cumbersome. Therefore: + # explicitly set a build id that references both the PR + # and the commit. + printf "INFIX_BUILD_ID=pr%d.%.7s\n" \ + "${{ github.event.number }}" "${{ github.event.pull_request.head.sha }}" \ + | tee -a $GITHUB_OUTPUT $GITHUB_ENV + fi if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then if [ "${{ github.event.inputs.minimal }}" == "true" ]; then flavor="_minimal" @@ -132,6 +144,11 @@ jobs: - name: Set Build Variables id: vars run: | + if [ -n "${{ needs.build.outputs.build_id }}" ]; then + echo "INFIX_BUILD_ID=${{ needs.build.outputs.build_id }}" \ + >>$GITHUB_ENV + fi + if [ "$GITHUB_REF_NAME" != "main" ]; then flavor="_minimal" else diff --git a/board/common/mkrauc.sh b/board/common/mkrauc.sh index a528c7fa..6cb30c28 100755 --- a/board/common/mkrauc.sh +++ b/board/common/mkrauc.sh @@ -2,8 +2,6 @@ set -e -GIT_VERSION=$(git -C "$BR2_EXTERNAL_INFIX_PATH" describe --always --dirty --tags) - name=$1 compat=$2 sign=$3 @@ -26,7 +24,7 @@ cp -f "$BINARIES_DIR/rootfs.itbh" "$work/rootfs.itbh" cat >"$work/manifest.raucm" < "$TARGET_DIR/etc/os-release" -echo "$INFIX_TAGLINE $VERSION -- $(date +"%b %e %H:%M %Z %Y")" > "$TARGET_DIR/etc/version" +echo "$INFIX_TAGLINE $INFIX_VERSION -- $(date +"%b %e %H:%M %Z %Y")" > "$TARGET_DIR/etc/version" # In case of ambguities, this is what the image was built from cp "$BR2_CONFIG" "$TARGET_DIR/usr/share/infix/config" diff --git a/doc/ChangeLog.md b/doc/ChangeLog.md index c661b668..969b8ced 100644 --- a/doc/ChangeLog.md +++ b/doc/ChangeLog.md @@ -12,6 +12,7 @@ All notable changes to the project are documented in this file. - Add support for more mDNS settings: allow/deny interfaces, acting as "reflector" and filtering of reflected services. Issue #678 - Review of default `sysctl` settings, issue #829 + - Upgrade Linux kernel to 6.12.1 (presumed LTS) ### Fixes diff --git a/doc/branding.md b/doc/branding.md index a73b2fe1..be3b5847 100644 --- a/doc/branding.md +++ b/doc/branding.md @@ -370,22 +370,30 @@ But you can of course use only two numbers, *major.minor*, as well. > with your own versioning scheme. -### `INFIX_RELEASE` +### Specifying Versioning Information -This global variable **must be** a lower-case string (no spaces or -other characters outside of 0–9, a–z, '.', '_' and '-') identifying -the operating system version, excluding any OS name information or -release code name, and suitable for processing by scripts or usage -in generated filenames. +Two optional environment variables control the version information +recorded in images. Both of these **must be** a lower-case string (no +spaces or other characters outside of 0–9, a–z, '.', '_' and '-') +identifying the operating system version, excluding any OS name +information or release code name, and suitable for processing by +scripts or usage in generated filenames. + +#### `INFIX_BUILD_ID` + +Used for `BUILD_ID` in `/etc/os-release`. + +**Default:** `$(git describe --always --dirty --tags)`, from the _top +directory_. By default, the top directory refers to the root of the +Infix source tree, but this can be changed by setting the branding +variable `INFIX_OEM_PATH`, e.g. in a `defconfig` file or via `make +menuconfig`, to the path of an enclosing br2-external. + +#### `INFIX_RELEASE` Used for `VERSION` and `VERSION_ID` in `/etc/os-release` and generated file names like disk images, etc. -**Default:** generated using `git describe --always --dirty --tags`, -with an additional `-C $infix_path`. This variable defaults to the -Infix tree and can be changed by setting the menuconfig branding -variable `INFIX_OEM_PATH` to that of the br2-external. It is also -possible to set the `GIT_VERSION` variable in your `post-build.sh` -script to change how the VCS version is extracted. +**Default:** `${INFIX_BUILD_ID}` [NanoPi R2S]: https://github.com/kernelkit/infix/blob/main/board/aarch64/r2s/rootfs/etc/factory-config.cfg diff --git a/external.mk b/external.mk index 18c3c019..773e586f 100644 --- a/external.mk +++ b/external.mk @@ -1,9 +1,7 @@ -IXMSG = printf "\e[37;44m>>> $(call qstrip,$(1))\e[0m\n" - +include $(BR2_EXTERNAL_INFIX_PATH)/infix.mk include $(sort $(wildcard $(BR2_EXTERNAL_INFIX_PATH)/package/*/*.mk)) include $(BR2_EXTERNAL_INFIX_PATH)/board/common/common.mk -include $(BR2_EXTERNAL_INFIX_PATH)/board/$(patsubst "%",%,$(BR2_ARCH))/board.mk -include $(BR2_EXTERNAL_INFIX_PATH)/infix.mk include $(BR2_EXTERNAL_INFIX_PATH)/test/test.mk .PHONY: local.mk diff --git a/infix.mk b/infix.mk index d710f494..1a91fb28 100644 --- a/infix.mk +++ b/infix.mk @@ -1 +1,11 @@ +IXMSG = printf "\e[37;44m>>> $(call qstrip,$(1))\e[0m\n" + +INFIX_TOPDIR = $(if $(INFIX_OEM_PATH),$(INFIX_OEM_PATH),$(BR2_EXTERNAL_INFIX_PATH)) + +# Unless the user specifies an explicit build id, source it from git. +# The build id also becomes the image version, unless an official +# release is being built. +export INFIX_BUILD_ID ?= $(shell git -C $(INFIX_TOPDIR) describe --dirty --always --tags) +export INFIX_VERSION = $(if $(INFIX_RELEASE),$(INFIX_RELEASE),$(INFIX_BUILD_ID)) + INFIX_CFLAGS:=-Wall -Werror -Wextra -Wno-unused-parameter -Wformat=2 -Wformat-overflow=2 -Winit-self -Wstrict-overflow=4 -Wno-format-truncation -Wno-format-nonliteral diff --git a/test/infamy/netns.py b/test/infamy/netns.py index 8f3cbe11..daa970b7 100644 --- a/test/infamy/netns.py +++ b/test/infamy/netns.py @@ -139,6 +139,10 @@ class IsolatedMacVlans: f"{a[0]:02x}:{a[1]:02x}:{a[2]:02x}:" + \ f"{a[3]:02x}:{a[4]:02x}:{a[5]:02x}" + class CallException: + def __init__(self, inner): + self.inner = inner + def _ns_call(self, fn, tx): pid = self.sleeper.pid @@ -150,7 +154,12 @@ class IsolatedMacVlans: setns(nns, CLONE_NEWNET) os.close(nns) - tx.send(fn()) + try: + ret = fn() + except Exception as e: + ret = IsolatedMacVlans.CallException(e) + + tx.send(ret) tx.close() def call(self, fn): @@ -161,6 +170,9 @@ class IsolatedMacVlans: ret = rx.recv() rx.close() proc.join() + + if type(ret) == IsolatedMacVlans.CallException: + raise ret.inner return ret def _mangle_subprocess_args(self, args, kwargs): diff --git a/test/test.mk b/test/test.mk index 5ac14555..34901600 100644 --- a/test/test.mk +++ b/test/test.mk @@ -6,12 +6,6 @@ test-specification := $(O)/images/test-specification.pdf UNIT_TESTS ?= $(test-dir)/case/all-repo.yaml $(test-dir)/case/all-unit.yaml TESTS ?= $(test-dir)/case/all.yaml -ifeq ($INFIX_OEM_PATH), "") -GIT_PATH = $(INFIX_OEM_PATH) -else -GIT_PATH = $(BR2_EXTERNAL_INFIX_PATH) -endif -GIT_VERSION = $(shell git -C $(GIT_PATH) describe --dirty --always --tags) base := -b $(base-dir) @@ -39,7 +33,7 @@ test-sh: test-spec: @esc_infix_name="$(echo $(INFIX_NAME) | sed 's/\//\\\//g')"; \ - sed 's/{REPLACE}/$(subst ",,$(esc_infix_name)) $(GIT_VERSION)/' $(spec-dir)/Readme.adoc.in > $(spec-dir)/Readme.adoc + sed 's/{REPLACE}/$(subst ",,$(esc_infix_name)) $(INFIX_VERSION)/' $(spec-dir)/Readme.adoc.in > $(spec-dir)/Readme.adoc @$(spec-dir)/generate_spec.py -d $(test-dir)/case -r $(BR2_EXTERNAL_INFIX_PATH) @asciidoctor-pdf --failure-level INFO --theme $(spec-dir)/theme.yml -a pdf-fontsdir=$(spec-dir)/fonts -o $(test-specification) $(spec-dir)/Readme.adoc