From dd419e59dcdc1dacec64aec3433288111445d7c8 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Sun, 19 Apr 2020 17:53:10 -0400 Subject: [PATCH] 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.) --- build/jam/ImageRules | 28 +++++++++++++++++++++------- build/scripts/build_haiku_image | 21 +++++++++++++++++++-- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/build/jam/ImageRules b/build/jam/ImageRules index 5c11609dc9..b97bc975c3 100644 --- a/build/jam/ImageRules +++ b/build/jam/ImageRules @@ -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 { diff --git a/build/scripts/build_haiku_image b/build/scripts/build_haiku_image index 29b9bfe163..c9fe219f07 100755 --- a/build/scripts/build_haiku_image +++ b/build/scripts/build_haiku_image @@ -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