From 93244a0d4d8e4496f9e1d81204d8cc6669b4794a Mon Sep 17 00:00:00 2001 From: Dillard Blom Date: Sat, 26 Sep 2026 17:14:19 +0200 Subject: [PATCH] Fix fifth Codex finding: app_name silently empty without xpath installed app_name now comes from xpath against appinfo/info.xml (needed so packaging works regardless of what this checkout is named - see the git-archive fix). If xpath isn't installed, $(shell ...) just returns an empty string rather than failing the build: --prefix=$(app_name)/ would silently become --prefix=/, producing a broken, wrongly-rooted archive with no indication anything went wrong. Previously app_name came from the checkout directory name, so this failure mode didn't exist. Added a check-app-name prerequisite to source/appstore/sign that fails loudly if app_name is empty. --- Makefile | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9c84042..047fa00 100644 --- a/Makefile +++ b/Makefile @@ -122,15 +122,26 @@ dist: # flags repeated per target. That also means source and appstore now # produce the same archive; both targets are kept for compatibility with # anything that invokes one of them by name. +# +# app_name comes from `xpath` (see its definition above) - if that binary +# is missing, $(shell ...) silently returns an empty string rather than +# failing the build, which would turn --prefix=$(app_name)/ below into +# --prefix=/ and produce a broken, unusably-rooted archive with no +# indication anything went wrong. Fail loudly instead. +.PHONY: check-app-name +check-app-name: + @test -n "$(app_name)" || \ + (echo "app_name is empty - is 'xpath' (libxml2-utils/perl-XML-XPath) installed?" >&2; exit 1) + .PHONY: source -source: +source: check-app-name rm -rf $(source_build_directory) mkdir -p $(source_build_directory) git archive --format=tar --prefix=$(app_name)/ HEAD | gzip > $(source_package_name).tar.gz # Builds the source package for the app store, ignores php and js tests .PHONY: appstore -appstore: +appstore: check-app-name rm -rf $(appstore_build_directory) mkdir -p $(appstore_build_directory) git archive --format=tar --prefix=$(app_name)/ HEAD | gzip > $(appstore_package_name).tar.gz @@ -141,7 +152,7 @@ test: composer $(CURDIR)/vendor/phpunit/phpunit/phpunit -c phpunit.integration.xml .PHONY: sign -sign: +sign: check-app-name @openssl dgst -sha512 -sign ~/.nextcloud/certificates/$(app_name).key $(appstore_package_name).tar.gz |openssl base64 VERSION := $(shell xpath -q -e "//info/version/text()" appinfo/info.xml)