Move creating the Haiku repo info to jam

* PreprocessPackageInfo rule: Pull out new rule
PreprocessPackageOrRepositoryInfo which does the sed substituation and
optionally the filtering through the C preprocessor.
* HaikuRepository rule: Generate the repository info file (from the
given template). No longer do that in the build_haiku_repository
script.
This commit is contained in:
Ingo Weinhold 2014-01-18 23:25:49 +01:00
parent af559cd6ee
commit 12c19e6362
5 changed files with 85 additions and 40 deletions

View File

@ -50,11 +50,57 @@ rule PreprocessPackageInfo source : directory : architecture
;
local target = $(source:BSG=package-info)-package-info ;
if $(HAIKU_BOOTSTRAP_BUILD) {
target = $(target)-bootstrap ;
}
MakeLocate $(target) : $(directory) ;
PreprocessPackageOrRepositoryInfo $(target) : $(source) : $(architecture)
: $(secondaryArchitecture) : useCPP ;
# Update requires in the package info.
if ! $(HAIKU_BOOTSTRAP_BUILD) {
local updateRequiresFiles =
<build>update_package_requires
[ on <repository>HaikuPorts return $(HAIKU_REPOSITORY_CACHE_FILE) ]
;
Depends $(target) : $(updateRequiresFiles) ;
UpdatePackageInfoRequires $(target) : $(updateRequiresFiles) ;
}
return $(target) ;
}
actions UpdatePackageInfoRequires
{
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
"$(2[1])" "$(1)" "$(2[2])"
}
rule PreprocessPackageOrRepositoryInfo target : source : architecture
: secondaryArchitecture : flags
{
# PreprocessPackageOrRepositoryInfo <target> : <source> : <architecture>
# : [ <secondaryArchitecture> ] [ : <flags> ] ;
# Preprocesses the package or repository info template file <source> by
# performing several placeholder substitutions and optionally filtering it
# through the C preprocessor.
#
# <target> - The generated preprocessed file.
# <source> - The package or repository info template file.
# <architecture> - The primary packaging architecture.
# <secondaryArchitecture> - If given, the secondary packaging architecture
# the package targets. Otherwise the primary architecture is targeted.
# <flags>:
# useCPP - Filter the source file through the C preprocessor after the
# placeholder substitutions have been performed.
local defines = HAIKU_PACKAGING_ARCH=$(architecture) ;
local sedReplacements = %HAIKU_PACKAGING_ARCH%,$(architecture) ;
if $(HAIKU_BOOTSTRAP_BUILD) {
defines += HAIKU_BOOTSTRAP_BUILD ;
target = $(target)-bootstrap ;
}
if $(secondaryArchitecture) {
defines += HAIKU_SECONDARY_PACKAGING_ARCH=$(secondaryArchitecture) ;
@ -68,39 +114,29 @@ rule PreprocessPackageInfo source : directory : architecture
}
local revisionFile = [ DetermineEffectiveHaikuRevision ] ;
local updateRequiresFiles ;
local haikuPortsRepositoryFile ;
if ! $(HAIKU_BOOTSTRAP_BUILD) {
updateRequiresFiles =
<build>update_package_requires
[ on <repository>HaikuPorts return $(HAIKU_REPOSITORY_CACHE_FILE) ]
;
Depends $(target) : $(source) $(revisionFile) ;
if useCPP in $(flags) {
PREPROCESSOR on $(target)
= "|" $(HOST_CC) -E -w [ FDefines $(defines) ] - ;
} else {
PREPROCESSOR on $(target) = ;
}
MakeLocate $(target) : $(directory) ;
Depends $(target) : $(source) $(revisionFile) $(updateRequiresFiles) ;
CCDEFS on $(target) = [ FDefines $(defines) ] ;
HAIKU_SED_REPLACEMENTS on $(target) = "-e s,$(sedReplacements),g" ;
PreprocessPackageInfo1 $(target) : $(source) $(revisionFile)
$(updateRequiresFiles) ;
return $(target) ;
PreprocessPackageOrRepositoryInfo1 $(target) : $(source) $(revisionFile) ;
}
actions PreprocessPackageInfo1
actions PreprocessPackageOrRepositoryInfo1
{
revision=`cat $(2[2])`
version=$(HAIKU_VERSION)_${revision}
sed $(HAIKU_SED_REPLACEMENTS) \
-e s,%HAIKU_VERSION%,$(HAIKU_VERSION)_${revision}-1, < $(2[1]) \
| $(HOST_CC) -E -w $(CCDEFS) - -o $(1)
if [ -n "$(2[4]:E)" ]; then
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
"$(2[3])" "$(1)" "$(2[4])" || exit 1
fi
-e s,%HAIKU_VERSION%,${version}-1, \
-e s,%HAIKU_VERSION_NO_REVISION%,${version}, $(2[1]) \
$(PREPROCESSOR) > $(1)
}

View File

@ -677,12 +677,30 @@ actions BuildRemoteHaikuPortsRepository1
}
rule HaikuRepository repository : repoInfo : packages
rule HaikuRepository repository : repoInfoTemplate : packages
{
# HaikuRepository <repository> : <repoInfoTemplate> : <packages> ;
# Builds the Haiku repository from the given packages and repository info
# template. <repository> must already be located.
local architecture = $(HAIKU_PACKAGING_ARCH) ;
local secondaryArchitecture ;
if $(TARGET_PACKAGING_ARCH) != $(architecture) {
secondaryArchitecture = $(TARGET_PACKAGING_ARCH) ;
}
local repositoriesDir = $(HAIKU_PACKAGE_REPOSITORIES_DIR_$(architecture)) ;
# build the repository info
local repoInfo = $(repository:G=repository-info)-info ;
MakeLocate $(repoInfo) : $(repositoriesDir) ;
PreprocessPackageOrRepositoryInfo $(repoInfo) : $(repoInfoTemplate)
: $(architecture) : $(secondaryArchitecture) ;
# prepare the script that initializes the shell variables
local initVariablesScript = $(repository)-repository-init-vars ;
MakeLocate $(initVariablesScript)
: $(HAIKU_PACKAGE_REPOSITORIES_DIR_$(HAIKU_PACKAGING_ARCH)) ;
: $(HAIKU_PACKAGE_REPOSITORIES_DIR_$(architecture)) ;
Always $(initVariablesScript) ;
local script = $(initVariablesScript) ;

View File

@ -4,7 +4,7 @@ local haikuRepository = <repository>haiku ;
MakeLocate $(haikuRepository)
: $(HAIKU_PACKAGE_REPOSITORIES_DIR_$(HAIKU_PACKAGING_ARCH)) ;
local repoInfo = <repository-info>haiku ;
local repoInfo = <repository-info-template>haiku ;
SEARCH on $(repoInfo) = $(HAIKU_TOP)/src/data/repository_infos ;
local secondaryArchs = $(TARGET_PACKAGING_ARCHS[2-]) ;

View File

@ -35,17 +35,8 @@ for packageFile in "$@"; do
cp "$packageFile" "$packageDir/$fileName"
done
# prepare the repo info file
fileName=`basename "$packageDir"/haiku-*.hpkg .hpkg`
version=${fileName#*-}
version=${version%%-*}
arch=${fileName##*-}
sed -e "s/%HAIKU_ARCHITECTURE%/$arch/g" \
-e "s/%HAIKU_VERSION%/$version/g" \
"$repoInfo" > "$repositoryDir/repo.info"
# build the repository file
cp "$repoInfo" "$repositoryDir/repo.info"
"$packageRepo" create -C "$repositoryDir" "$repositoryDir/repo.info" \
"$packageDir"/*.hpkg

View File

@ -1,6 +1,6 @@
name Haiku
vendor "Haiku Project"
summary "The Haiku repository (for Haiku %HAIKU_VERSION%)"
summary "The Haiku repository (for Haiku %HAIKU_VERSION_NO_REVISION%)"
priority 1
url http://packages.haiku-os.org/haiku/master/repo/%HAIKU_ARCHITECTURE%/%HAIKU_VERSION%
architecture %HAIKU_ARCHITECTURE%
url http://packages.haiku-os.org/haiku/master/repo/%HAIKU_PACKAGING_ARCH%/%HAIKU_VERSION_NO_REVISION%
architecture %HAIKU_PACKAGING_ARCH%