-
Notifications
You must be signed in to change notification settings - Fork 3
Unify python-gardenlinux-lib based feature and cname parsing
#115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
NotTheEvilOne
wants to merge
1
commit into
main
Choose a base branch
from
feature/python-lib-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,10 +10,11 @@ export BASH_ENV := make_bash_env | |
|
|
||
| MAKEFLAGS += --no-builtin-rules | ||
|
|
||
| lastword = $(word $(words $1),$1) | ||
| prelastword = $(word $(words $1),_ $1) | ||
| cname_version = $(call lastword,$(subst -, ,$1)) | ||
| cname_arch = $(call prelastword,$(subst -, ,$1)) | ||
| cname_parts = $(subst _, , $(subst -, , $1)) | ||
| cname_gl_commit = $(lastword $(call cname_parts,$1)) | ||
| gl_version = $(lastword $(filter-out $(call cname_gl_commit,$1), $(call cname_parts,$1))) | ||
| cname_gl_version = $(call gl_version,$1)-$(call cname_gl_commit,$1) | ||
| cname_arch = $(lastword $(filter-out $(call gl_version,$1) $(call cname_gl_commit,$1), $(call cname_parts,$1))) | ||
|
|
||
| define require_var = | ||
| ifndef $1 | ||
|
|
@@ -24,11 +25,13 @@ endef | |
| required_vars := REPO COMMIT TIMESTAMP DEFAULT_VERSION TEMPFS_SIZE | ||
| $(foreach var,$(required_vars),$(eval $(call require_var,$(var)))) | ||
|
|
||
| PARSE_FEATURES_ARGS := | ||
| GL_ALLOW_FRANKENSTEIN := | ||
| ifdef ALLOW_FRANKENSTEIN | ||
| PARSE_FEATURES_ARGS := --allow-frankenstein | ||
| GL_ALLOW_FRANKENSTEIN := true | ||
| endif | ||
|
|
||
| export GL_ALLOW_FRANKENSTEIN | ||
|
|
||
| SHORT_COMMIT := $(shell head -c 8 <<< '$(COMMIT)') | ||
|
|
||
| DEFAULT_ARCH := $(shell dpkg --print-architecture) | ||
|
|
@@ -43,22 +46,22 @@ clean: | |
| .build/%.sentinel: | ||
| true | ||
|
|
||
| .build/bootstrap-%-$(SHORT_COMMIT).tar: $$(shell ./make_repo_sentinel $$(REPO) $$(call cname_version,$$*)) | ||
| .build/bootstrap-%.tar: $$(shell ./make_repo_sentinel $$(REPO) $$(call gl_version,$$*)) | ||
| target '$@' | ||
| info 'bootstrapping $*-$(SHORT_COMMIT)' | ||
| info 'bootstrapping $*' | ||
| arch='$(call cname_arch,$*)' | ||
| version='$(call cname_version,$*)' | ||
| version='$(call gl_version,$*)' | ||
| ./bootstrap "$$arch" "$$version" '$(REPO)' keyring.gpg '$@' | ||
|
|
||
| .build/%-$(SHORT_COMMIT).tar: .build/bootstrap-$$(call cname_arch,$$*)-$$(call cname_version,$$*)-$(SHORT_COMMIT).tar $(shell ./make_directory_sentinel features) $(shell ./make_directory_sentinel cert) | ||
| .build/%.tar: .build/bootstrap-$$(call cname_arch,$$*)-$$(call cname_gl_version,$$*).tar $(shell ./make_directory_sentinel features) $(shell ./make_directory_sentinel cert) | ||
| target '$@' '$<' | ||
| info 'configuring rootfs $*-$(SHORT_COMMIT)' | ||
| features="$$(./parse_features $(PARSE_FEATURES_ARGS) --feature-dir features --cname '$*' features)" | ||
| features_platforms="$$(./parse_features $(PARSE_FEATURES_ARGS) --feature-dir features --cname '$*' platforms)" | ||
| features_elements="$$(./parse_features $(PARSE_FEATURES_ARGS) --feature-dir features --cname '$*' elements)" | ||
| features_flags="$$(./parse_features $(PARSE_FEATURES_ARGS) --feature-dir features --cname '$*' flags)" | ||
| features="$$(gl-features-parse --feature-dir features --default-arch '$$(DEFAULT_ARCH)' --cname '$*' features)" | ||
| features_platforms="$$(gl-features-parse --feature-dir features --default-arch '$$(DEFAULT_ARCH)' --cname '$*'platforms)" | ||
| features_elements="$$(gl-features-parse --feature-dir features --default-arch '$$(DEFAULT_ARCH)' --cname '$*'elements)" | ||
| features_flags="$$(gl-features-parse --feature-dir features --default-arch '$$(DEFAULT_ARCH)' --cname '$*'flags)" | ||
| BUILDER_CNAME='$*' | ||
| BUILDER_VERSION='$(call cname_version,$*)' | ||
| BUILDER_VERSION='$(call gl_version,$*)' | ||
| BUILDER_ARCH='$(call cname_arch,$*)' | ||
| BUILDER_TIMESTAMP='$(TIMESTAMP)' | ||
| BUILDER_COMMIT='$(COMMIT)' | ||
|
|
@@ -70,17 +73,17 @@ clean: | |
| ./configure '$(word 1,$^)' '$@' | ||
|
|
||
| define artifact_template = | ||
| .build/%-$(SHORT_COMMIT).$1: $$$$(shell COMMIT=$(SHORT_COMMIT) ./make_get_image_dependencies '$$$$@') $$(shell ./make_directory_sentinel features) $$(shell ./make_directory_sentinel cert) | ||
| .build/%.$1: $$$$(shell COMMIT=$(SHORT_COMMIT) ./make_get_image_dependencies '$$$$@') $$(shell ./make_directory_sentinel features) $$(shell ./make_directory_sentinel cert) | ||
| script='$$(word 1,$$^)' | ||
| input='$$(word 2,$$^)' | ||
| target '$$@' "$$$$input" | ||
| info 'building $1 image $$*' | ||
| features="$$$$(./parse_features $(PARSE_FEATURES_ARGS) --feature-dir features --cname '$$*' features)" | ||
| features_platforms="$$$$(./parse_features $(PARSE_FEATURES_ARGS) --feature-dir features --cname '$$*' platforms)" | ||
| features_elements="$$$$(./parse_features $(PARSE_FEATURES_ARGS) --feature-dir features --cname '$$*' elements)" | ||
| features_flags="$$$$(./parse_features $(PARSE_FEATURES_ARGS) --feature-dir features --cname '$$*' flags)" | ||
| features="$$$$(gl-features-parse --feature-dir features --default-arch '$$(DEFAULT_ARCH)' --cname '$$*' features)" | ||
| features_platforms="$$$$(gl-features-parse --feature-dir features --default-arch '$$(DEFAULT_ARCH)' --cname '$$*' platforms)" | ||
| features_elements="$$$$(gl-features-parse --feature-dir features --default-arch '$$(DEFAULT_ARCH)' --cname '$$*' elements)" | ||
| features_flags="$$$$(gl-features-parse --feature-dir features --default-arch '$$(DEFAULT_ARCH)' --cname '$$*' flags)" | ||
| BUILDER_CNAME='$$*' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see above |
||
| BUILDER_VERSION='$$(call cname_version,$$*)' | ||
| BUILDER_VERSION='$$(call gl_version,$$*)' | ||
| BUILDER_ARCH='$$(call cname_arch,$$*)' | ||
| BUILDER_TIMESTAMP='$$(TIMESTAMP)' | ||
| BUILDER_COMMIT='$$(COMMIT)' | ||
|
|
@@ -94,15 +97,15 @@ endef | |
|
|
||
| $(foreach artifact_rule,$(shell ./make_get_artifact_rules),$(eval $(call artifact_template,$(artifact_rule)))) | ||
|
|
||
| .build/%-$(SHORT_COMMIT).artifacts: $$(shell COMMIT=$(SHORT_COMMIT) ./make_list_build_artifacts '$$*') | ||
| .build/%.artifacts: $$(shell COMMIT=$(SHORT_COMMIT) DEFAULT_VERSION=$(DEFAULT_VERSION) NATIVE_ARCH=$(NATIVE_ARCH) ./make_list_build_artifacts '$$*') | ||
| target '$@' | ||
| echo -n > '$@' | ||
| for f in $^; do | ||
| basename "$$f" | tee -a '$@' | ||
| echo "$$(basename "$$f").log" | tee -a '$@' | ||
| done | ||
|
|
||
| %: .build/$$(shell ./parse_features $(PARSE_FEATURES_ARGS) --feature-dir features --default-arch '$$(DEFAULT_ARCH)' --default-version '$$(DEFAULT_VERSION)' --cname '$$*')-$(SHORT_COMMIT).artifacts | ||
| %: .build/$$(shell gl-features-parse --feature-dir features --default-arch '$$(DEFAULT_ARCH)' --default-version '$$(DEFAULT_VERSION)-$$(SHORT_COMMIT)' --cname '$$*').artifacts | ||
| ln -f -s -r '$<' '.build/$*' | ||
|
|
||
| # prevents match anything rule from applying to Makefile and image/convert scripts | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the change from
.build/%-$(SHORT_COMMIT).tarto.build/%.tar$*would now include the commit. This would break the expected value in this field that is later exported into/etc/os-release. Other tools (e.g. gardenlinux-update) rely on the format of this value so we can not just change this without good reason.