From 2ae3c649431bf5888b98d8b7b8712e1a7c7b59b5 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Thu, 24 Jul 2014 20:52:40 +0200 Subject: [PATCH] Improve IsPackageAvailable() * When adjusting the package name for the secondary architecture, it is unclear where exactly in the package name the architecture specifier is. To remedy, we try all possible positions until we find the package (or there are no other possibilities). --- build/jam/RepositoryRules | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/build/jam/RepositoryRules b/build/jam/RepositoryRules index 4520b8158a..c2fba17ac9 100644 --- a/build/jam/RepositoryRules +++ b/build/jam/RepositoryRules @@ -510,18 +510,31 @@ rule FSplitPackageName packageName } -rule IsPackageAvailable package : flags +rule IsPackageAvailable packageName : flags { # for a secondary architecture adjust the package name if $(TARGET_PACKAGING_ARCH) != $(TARGET_PACKAGING_ARCHS[1]) && ! nameResolved in $(flags) { - local splitName = [ FSplitPackageName $(package) ] ; - splitName = $(splitName[1]) $(TARGET_PACKAGING_ARCH) $(splitName[2-]) ; - package = $(splitName:J=_) ; + # The position of the secondary architecture within the package name + # is not well defined, so we scan for it starting from the back. + local packageNameHead = $(packageName) ; + local packageNameTail = ; + while $(packageNameHead) { + local splitName = [ FSplitPackageName $(packageNameHead) ] ; + splitName = $(splitName[1]) $(TARGET_PACKAGING_ARCH) $(splitName[2]) + $(packageNameTail) ; + packageName = $(splitName:J=_) ; + if $(packageName) in $(HAIKU_AVAILABLE_PACKAGES) { + return $(packageName) ; + } + local splitHead = [ Match "(.*)_([^_]*)" : $(packageNameHead) ] ; + packageNameHead = $(splitHead[1]) ; + packageNameTail = $(splitHead[2]) $(packageNameTail) ; + } } - if $(package) in $(HAIKU_AVAILABLE_PACKAGES) { - return $(package) ; + if $(packageName) in $(HAIKU_AVAILABLE_PACKAGES) { + return $(packageName) ; } return ;