build_haiku_image: Distinguish between system (activated) and unactivated packages.

Previously, all packages on the image, both activated and unactivated,
were in $systemPackages, so if a package actually in /system/packages
had a dependency in the Installer optional package area, the dependency
checking would see no problem but the generated image would be broken.

Now, packages going into /system/packages are treated separately
from those going elsewhere, and error checks added so the above
condition will not occur.

(I ran into this while working on the build-package upgrade
in the following commits.)
This commit is contained in:
Augustin Cavalier 2020-04-19 17:53:10 -04:00
parent 5e15819d86
commit dd419e59dc
2 changed files with 40 additions and 9 deletions

View File

@ -887,13 +887,20 @@ rule AddPackagesAndRepositoryVariablesToContainerScript script : container
: $(HAIKU_UPDATE_ALL_PACKAGES) ;
# Add variable "systemPackages" with the packages copied/updated.
local allPackages = [ on $(container) return $(HAIKU_PACKAGES_IN_IMAGE) ] ;
local systemPackages = [ on $(container) return $(HAIKU_SYSTEM_PACKAGES_IN_IMAGE) ] ;
if $(updateOnly) && ! [ IncludeAllTargetsInContainer $(container) ] {
allPackages = [ FilterContainerUpdateTargets $(allPackages)
systemPackages = [ FilterContainerUpdateTargets $(systemPackages)
: [ on $(container) return $(HAIKU_INCLUDE_IN_CONTAINER_VAR) ] ] ;
}
AddTargetVariableToScript $(script) : $(systemPackages) : systemPackages ;
AddTargetVariableToScript $(script) : $(allPackages) : systemPackages ;
# Add variable "otherPackages" with the packages copied/updated.
local otherPackages = [ on $(container) return $(HAIKU_OTHER_PACKAGES_IN_IMAGE) ] ;
if $(updateOnly) && ! [ IncludeAllTargetsInContainer $(container) ] {
otherPackages = [ FilterContainerUpdateTargets $(otherPackages)
: [ on $(container) return $(HAIKU_INCLUDE_IN_CONTAINER_VAR) ] ] ;
}
AddTargetVariableToScript $(script) : $(otherPackages) : otherPackages ;
# Generate the repository package lists and add variables for the
# repositories.
@ -1036,9 +1043,16 @@ rule AddPackageFilesToHaikuImage location : packages : flags
# info
packages = [ FFilterByBuildFeatures $(packages) ] ;
HAIKU_PACKAGES_IN_IMAGE on $(HAIKU_IMAGE_CONTAINER_NAME)
= [ on $(HAIKU_IMAGE_CONTAINER_NAME) return $(HAIKU_PACKAGES_IN_IMAGE) ]
$(packages) ;
if $(location[1]) = system && $(location[2]) = packages && ! $(location[3]) {
HAIKU_SYSTEM_PACKAGES_IN_IMAGE on $(HAIKU_IMAGE_CONTAINER_NAME)
= [ on $(HAIKU_IMAGE_CONTAINER_NAME) return $(HAIKU_SYSTEM_PACKAGES_IN_IMAGE) ]
$(packages) ;
} else {
HAIKU_OTHER_PACKAGES_IN_IMAGE on $(HAIKU_IMAGE_CONTAINER_NAME)
= [ on $(HAIKU_IMAGE_CONTAINER_NAME) return $(HAIKU_OTHER_PACKAGES_IN_IMAGE) ]
$(packages) ;
}
if nameFromMetaInfo in $(flags) {
AddFilesToHaikuImage $(location) : $(packages)
@ -1570,7 +1584,7 @@ rule BuildCDBootImage image : bootfloppy : bootefi : extrafiles
Depends $(image) : $(bootefi) ;
Depends $(image) : $(extrafiles) ;
BOOTIMG on $(image) = $(bootfloppy) ;
if $(HAIKU_NIGHTLY_BUILD) = 1 {
VOLID on $(image) = haiku-nightly-$(TARGET_ARCH) ;
} else {

View File

@ -6,7 +6,8 @@ set -o errexit
# outputDir
# tmpDir
# addBuildCompatibilityLibDir
# systemPackages - lists of the hpkg packages copied/updated
# systemPackages - lists of the hpkg packages copied/updated into /system/packages
# otherPackages - lists of the hpkg packages copied/updated into other (optional) places
# repositories - all repository files
# downloadDir
# The following are only for image types:
@ -305,13 +306,29 @@ if [ -n "$resolvePackageDependencies" ]; then
packageUrls=`$getPackageDependencies $repositories -- $systemPackages`
for packageUrl in $packageUrls; do
packageFileName=`basename $packageUrl`
if [ "$otherPackages" != "${otherPackages#*$packageFileName}" ]; then
echo "ERROR: $packageFileName is a dependency of a package installed in /system/packages," \
"but it is in another (i.e. unactivated) package directory!"
exit 1
fi
packageFilePath="$downloadDir/$packageFileName"
downloadFile $packageUrl "$packageFilePath"
$cp "${sPrefix}$packageFilePath" "${tPrefix}system/packages"
systemPackages="$systemPackages $packageFilePath"
done
fi
# validate dependencies of optional packages
packageUrls=`$getPackageDependencies $repositories -- $systemPackages $otherPackages`
packageFileNames=""
for packageUrl in $packageUrls; do
packageFileNames="$packageFileNames `basename $packageUrl`"
done
if [ ! -z "$packageFileNames" ]; then
echo "ERROR: Some of the unactivated (i.e. optional) packages have the following unmet dependencies:"
echo $packageFileNames
exit 1
fi
fi
# install default settings for packages
for packageFile in $systemPackages; do