Add DetermineEffectiveHaikuRevision rule

Simplifies PreprocessPackageInfo a bit.
This commit is contained in:
Ingo Weinhold 2014-01-18 21:39:04 +01:00
parent d4bfbab374
commit af559cd6ee
2 changed files with 27 additions and 3 deletions

View File

@ -377,6 +377,7 @@ rule DetermineHaikuRevision
if ! [ on $(gitIndex) return $(HAIKU_GIT_REVISION_DETERMINED) ] {
HAIKU_GIT_REVISION_DETERMINED on $(gitIndex) = 1 ;
MakeLocate $(revisionFile) : $(HAIKU_BUILD_OUTPUT_DIR) ;
LocalClean clean : $(revisionFile) ;
if $(HAIKU_REVISION) {
DetermineHaikuRevision2 $(revisionFile) ;
} else if [ Glob [ FDirName $(HAIKU_TOP) .git ] : index ] {
@ -404,6 +405,29 @@ actions DetermineHaikuRevision2
}
rule DetermineEffectiveHaikuRevision
{
local revisionFile = <haiku-rootdir>effective-haiku-revision ;
if ! [ on $(revisionFile) return $(HAIKU_EFFECTIVE_REVISION_DETERMINED) ] {
HAIKU_EFFECTIVE_REVISION_DETERMINED on $(revisionFile) = 1 ;
MakeLocate $(revisionFile) : $(HAIKU_BUILD_OUTPUT_DIR) ;
local rawRevision = [ DetermineHaikuRevision ] ;
Depends $(revisionFile) : $(rawRevision) ;
DetermineEffectiveHaikuRevision1 $(revisionFile) : $(rawRevision) ;
LocalClean clean : $(revisionFile) ;
}
return $(revisionFile) ;
}
actions DetermineEffectiveHaikuRevision1
{
revision=`sed -n 's,^\(hrev[0-9]*\).*,\1,p' "$(2:E=unknown-revision)"`
echo "${revision:-0}" > "$(1)"
}
rule DataFileToSourceFile sourceFile : dataFile : dataVariable : sizeVariable
{
sourceFile = [ FGristFiles $(sourceFile) ] ;

View File

@ -67,7 +67,7 @@ rule PreprocessPackageInfo source : directory : architecture
+= %HAIKU_SECONDARY_PACKAGING_ARCH_SUFFIX%, ;
}
local revisionFile = [ DetermineHaikuRevision ] ;
local revisionFile = [ DetermineEffectiveHaikuRevision ] ;
local updateRequiresFiles ;
local haikuPortsRepositoryFile ;
if ! $(HAIKU_BOOTSTRAP_BUILD) {
@ -92,9 +92,9 @@ rule PreprocessPackageInfo source : directory : architecture
actions PreprocessPackageInfo1
{
revision=`sed -n 's,^\(hrev[0-9]*\).*,\1,p' $(2[2])`
revision=`cat $(2[2])`
sed $(HAIKU_SED_REPLACEMENTS) \
-e s,%HAIKU_VERSION%,$(HAIKU_VERSION)_${revision:-0}-1, < $(2[1]) \
-e s,%HAIKU_VERSION%,$(HAIKU_VERSION)_${revision}-1, < $(2[1]) \
| $(HOST_CC) -E -w $(CCDEFS) - -o $(1)
if [ -n "$(2[4]:E)" ]; then