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.
This commit is contained in:
@@ -122,15 +122,26 @@ dist:
|
|||||||
# flags repeated per target. That also means source and appstore now
|
# flags repeated per target. That also means source and appstore now
|
||||||
# produce the same archive; both targets are kept for compatibility with
|
# produce the same archive; both targets are kept for compatibility with
|
||||||
# anything that invokes one of them by name.
|
# 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
|
.PHONY: source
|
||||||
source:
|
source: check-app-name
|
||||||
rm -rf $(source_build_directory)
|
rm -rf $(source_build_directory)
|
||||||
mkdir -p $(source_build_directory)
|
mkdir -p $(source_build_directory)
|
||||||
git archive --format=tar --prefix=$(app_name)/ HEAD | gzip > $(source_package_name).tar.gz
|
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
|
# Builds the source package for the app store, ignores php and js tests
|
||||||
.PHONY: appstore
|
.PHONY: appstore
|
||||||
appstore:
|
appstore: check-app-name
|
||||||
rm -rf $(appstore_build_directory)
|
rm -rf $(appstore_build_directory)
|
||||||
mkdir -p $(appstore_build_directory)
|
mkdir -p $(appstore_build_directory)
|
||||||
git archive --format=tar --prefix=$(app_name)/ HEAD | gzip > $(appstore_package_name).tar.gz
|
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
|
$(CURDIR)/vendor/phpunit/phpunit/phpunit -c phpunit.integration.xml
|
||||||
|
|
||||||
.PHONY: sign
|
.PHONY: sign
|
||||||
sign:
|
sign: check-app-name
|
||||||
@openssl dgst -sha512 -sign ~/.nextcloud/certificates/$(app_name).key $(appstore_package_name).tar.gz |openssl base64
|
@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)
|
VERSION := $(shell xpath -q -e "//info/version/text()" appinfo/info.xml)
|
||||||
|
|||||||
Reference in New Issue
Block a user