Add support for explicitly preventing rebuilding packages

Due to depending on dynamically built files, package files will always
be rebuilt when they are needed (e.g. when an image is built). The build
variable HAIKU_DONT_REBUILD_PACKAGES can be defined to prevent
rebuilding existing package files (even ones that are out-of-date).

Main target for this change is buildbot. We want to make sure that the
packages in the repository it builds are exactly identical to the ones
in the images, which may not be the case when the packages are rebuilt
(due to different timestamps of contained files). The respective build
order should be:

1. Build repository.
2. Without cleaning the generated directory, build different image types
   with HAIKU_DONT_REBUILD_PACKAGES defined.
This commit is contained in:
Ingo Weinhold 2014-01-18 16:08:14 +01:00
parent c1bcd68267
commit 495b360b6b

View File

@ -26,6 +26,16 @@ rule HaikuPackage package
}
HAIKU_CONTAINER_ALWAYS_CREATE_DIRECTORIES on $(package) = 1 ;
# If HAIKU_DONT_REBUILD_PACKAGES is defined, don't rebuild an existing
# package.
if $(HAIKU_DONT_REBUILD_PACKAGES) {
local file = [ Glob $(HAIKU_PACKAGES_DIR_$(HAIKU_PACKAGING_ARCH))
: $(package:BS) ] ;
if $(file) {
HAIKU_DONT_REBUILD_PACKAGE on $(package) = 1 ;
}
}
}
@ -102,6 +112,15 @@ rule BuildHaikuPackage package : packageInfo
secondaryArchitecture = $(TARGET_PACKAGING_ARCH) ;
}
MakeLocate $(package) : $(HAIKU_PACKAGES_DIR_$(architecture)) ;
# Don't rebuild an existing package, if requested.
if [ on $(package) return $(HAIKU_DONT_REBUILD_PACKAGE) ] {
NoUpdate $(package) ;
BuildHaikuPackageDummy $(package) ;
return ;
}
local grist = [ FHaikuPackageGrist $(package) ] ;
local tempDir
@ -111,7 +130,6 @@ rule BuildHaikuPackage package : packageInfo
# build the package info and locate the package
packageInfo = [ PreprocessPackageInfo $(packageInfo) : $(tempDir)
: $(architecture) : $(secondaryArchitecture) ] ;
MakeLocate $(package) : $(HAIKU_PACKAGES_DIR_$(architecture)) ;
Depends $(package) : $(packageInfo) ;
# prepare the script that initializes the shell variables
@ -175,85 +193,120 @@ actions BuildHaikuPackage1
}
actions BuildHaikuPackageDummy
{
# do nothing
}
rule FDontRebuildCurrentPackage
{
on $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
return $(HAIKU_DONT_REBUILD_PACKAGE) ;
}
rule AddDirectoryToPackage directoryTokens : attributeFiles
{
return [ AddDirectoryToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(directoryTokens) : $(attributeFiles) ] ;
if ! [ FDontRebuildCurrentPackage ] {
return [ AddDirectoryToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(directoryTokens) : $(attributeFiles) ] ;
}
}
rule AddFilesToPackage directory : targets : destName
{
AddFilesToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE) : $(directory)
: $(targets) : $(destName) ;
if ! [ FDontRebuildCurrentPackage ] {
AddFilesToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(directory) : $(targets) : $(destName) ;
}
}
rule AddSymlinkToPackage directoryTokens : linkTarget : linkName
{
linkTarget = $(linkTarget:J=/) ;
if ! [ FDontRebuildCurrentPackage ] {
linkTarget = $(linkTarget:J=/) ;
AddSymlinkToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(directoryTokens) : $(linkTarget) : $(linkName) ;
AddSymlinkToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(directoryTokens) : $(linkTarget) : $(linkName) ;
}
}
rule CopyDirectoryToPackage directoryTokens : sourceDirectory
: targetDirectoryName : excludePatterns : flags
{
CopyDirectoryToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(directoryTokens) : $(sourceDirectory) : $(targetDirectoryName)
: $(excludePatterns) : $(flags) ;
if ! [ FDontRebuildCurrentPackage ] {
CopyDirectoryToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(directoryTokens) : $(sourceDirectory) : $(targetDirectoryName)
: $(excludePatterns) : $(flags) ;
}
}
rule AddHeaderDirectoryToPackage dirTokens : dirName : flags
{
AddHeaderDirectoryToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(dirTokens) : $(dirName) : $(flags) ;
if ! [ FDontRebuildCurrentPackage ] {
AddHeaderDirectoryToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(dirTokens) : $(dirName) : $(flags) ;
}
}
rule AddWifiFirmwareToPackage driver : subDirToExtract : archive
: extract
{
AddWifiFirmwareToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(driver) : $(subDirToExtract) : $(archive) : $(extract) ;
if ! [ FDontRebuildCurrentPackage ] {
AddWifiFirmwareToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(driver) : $(subDirToExtract) : $(archive) : $(extract) ;
}
}
rule ExtractArchiveToPackage dirTokens : archiveFile : flags : extractedSubDir
{
ExtractArchiveToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(dirTokens) : $(archiveFile) : $(flags) : $(extractedSubDir) ;
if ! [ FDontRebuildCurrentPackage ] {
ExtractArchiveToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(dirTokens) : $(archiveFile) : $(flags) : $(extractedSubDir) ;
}
}
rule AddDriversToPackage relativeDirectoryTokens : targets
{
AddDriversToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(relativeDirectoryTokens) : $(targets) ;
if ! [ FDontRebuildCurrentPackage ] {
AddDriversToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(relativeDirectoryTokens) : $(targets) ;
}
}
rule AddNewDriversToPackage relativeDirectoryTokens : targets
{
AddNewDriversToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(relativeDirectoryTokens) : $(targets) ;
if ! [ FDontRebuildCurrentPackage ] {
AddNewDriversToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(relativeDirectoryTokens) : $(targets) ;
}
}
rule AddBootModuleSymlinksToPackage targets
{
AddBootModuleSymlinksToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(targets) ;
if ! [ FDontRebuildCurrentPackage ] {
AddBootModuleSymlinksToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(targets) ;
}
}
rule AddLibrariesToPackage directory : libs
{
AddLibrariesToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(directory) : $(libs) ;
if ! [ FDontRebuildCurrentPackage ] {
AddLibrariesToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
: $(directory) : $(libs) ;
}
}