Adjust to changed HaikuPorts repository layout

The package kit actually requires the files "repo", "repo.info",
"repo.sha256" to be located under the repository base URL, so the
approach to name the repository file "repo-<hash>" doesn't work.
Now there's a directory "<hash>" which contains the files.

This commit moves the computation of the hash and downloading the
repository file from the build_haiku_image script to the jam build
system. The repo.info is also downloaded and a repository config file
is generated.
This commit is contained in:
Ingo Weinhold 2013-07-06 02:29:51 +02:00
parent f4e265d53c
commit d72ce06673
6 changed files with 88 additions and 35 deletions

View File

@ -64,6 +64,7 @@ for repository in HaikuPorts {
= [ FDirName $(repositoriesDirectory) $(repository) ] ;
local file = [ Glob $(repositoryDirectory) : $(HAIKU_PACKAGING_ARCH) ] ;
if $(file) {
HAIKU_REPOSITORY_JAMFILE = $(file) ;
include $(file) ;
}
}

View File

@ -1240,11 +1240,16 @@ HAIKU_APP_TEST_DIR ?= [ FDirName $(HAIKU_TEST_DIR) apps ] ;
HAIKU_APP_TEST_LIB_DIR ?= [ FDirName $(HAIKU_APP_TEST_DIR) lib ] ;
HAIKU_TMP_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) tmp ] ;
HAIKU_PACKAGES_DIR = [ FDirName $(TARGET_COMMON_DEBUG_OBJECT_DIR)
packages ] ;
HAIKU_PACKAGES_BUILD_DIR = [ FDirName $(TARGET_COMMON_DEBUG_OBJECT_DIR)
packages_build ] ;
HAIKU_PACKAGE_INFOS_DIR = [ FDirName $(HAIKU_TOP) src data package_infos ] ;
HAIKU_PACKAGING_BASE_DIR = [ FDirName $(TARGET_OBJECT_BASE_DIR)
$(HAIKU_PACKAGING_ARCH) packaging ] ;
HAIKU_PACKAGES_DIR = [ FDirName $(HAIKU_PACKAGING_BASE_DIR)
packages ] ;
HAIKU_PACKAGES_BUILD_DIR = [ FDirName $(HAIKU_PACKAGING_BASE_DIR)
packages_build ] ;
HAIKU_PACKAGE_REPOSITORIES_DIR = [ FDirName $(HAIKU_PACKAGING_BASE_DIR)
repositories ] ;
HAIKU_PACKAGE_INFOS_DIR = [ FDirName $(HAIKU_TOP) src data
package_infos ] ;
TARGET_TEST_DIR ?= [ FDirName $(HAIKU_TEST_DIR)
$(TARGET_PLATFORM) ] ;

View File

@ -463,20 +463,13 @@ AddTargetVariableToScript $(script) : $(commonPackages) : commonPackages ;
# Generate the repository package lists and add variables for the repositories.
local repository ;
local repositoryFiles ;
for repository in $(HAIKU_REPOSITORIES) {
local packageListFile = $(repository:G=repository-package-list) ;
MakeLocate $(packageListFile)
: [ FDirName $(TARGET_OBJECT_BASE_DIR) $(HAIKU_PACKAGING_ARCH) ] ;
Always $(packageListFile) ;
GeneratedRepositoryPackageList $(packageListFile) : $(repository) ;
AddTargetVariableToScript $(script) : $(packageListFile)
: repositoryPackageList_$(repository:G=) ;
AddVariableToScript $(script) : repositoryUrl_$(repository:G=)
: [ on $(repository) return $(HAIKU_REPOSITORY_URL) ] ;
repositoryFiles
+= [ on $(repository) return $(HAIKU_REPOSITORY_CACHE_FILE) ] ;
}
AddVariableToScript $(script) : repositories : $(HAIKU_REPOSITORIES:G=) ;
AddTargetVariableToScript $(script) : $(repositoryFiles) : repositories ;
# create the other scripts
HAIKU_IMAGE_MAKE_DIRS_SCRIPT = <HaikuImage>haiku.image-make-dirs ;

View File

@ -39,8 +39,8 @@ rule AddRepositoryPackages repository : architecture : packages : sourcePackages
}
rule PackageRepository repository : architecture : url : anyPackages : packages
: sourcePackages
rule PackageRepository repository : architecture : repositoryUrl : packagesUrl
: anyPackages : packages : sourcePackages
{
repository = $(repository:G=repository) ;
@ -49,12 +49,52 @@ rule PackageRepository repository : architecture : url : anyPackages : packages
}
HAIKU_REPOSITORIES += $(repository) ;
HAIKU_REPOSITORY_URL on $(repository) = $(url) ;
HAIKU_REPOSITORY_URL on $(repository) = $(repositoryUrl) ;
HAIKU_REPOSITORY_PACKAGES_URL on $(repository) = $(packagesUrl) ;
HAIKU_REPOSITORY_DEFINITION_FILE on $(repository)
= $(HAIKU_REPOSITORY_JAMFILE) ;
AddRepositoryPackages $(repository) : any : $(anyPackages)
: $(sourcePackages) ;
AddRepositoryPackages $(repository) : $(architecture) : $(packages)
: $(sourcePackages) ;
# build package list file
local packageListFile = $(repository:G=repository-package-list)-packages ;
MakeLocate $(packageListFile) : $(HAIKU_PACKAGE_REPOSITORIES_DIR) ;
GeneratedRepositoryPackageList $(packageListFile) : $(repository) ;
# build package list checksum file
local packagesChecksumFile
= $(repository:G=repository-package-checksum)-checksum ;
MakeLocate $(packagesChecksumFile) : $(HAIKU_PACKAGE_REPOSITORIES_DIR) ;
Depends $(packagesChecksumFile) : $(packageListFile) ;
ChecksumFileSHA256 $(packagesChecksumFile) : $(packageListFile) ;
# download repository info file
local repositoryInfo = $(repository:G=repository-info)-info ;
MakeLocate $(repositoryInfo) : $(HAIKU_PACKAGE_REPOSITORIES_DIR) ;
local repoUrl = [ on $(repository) return $(HAIKU_REPOSITORY_URL) ] ;
DownloadLocatedFile $(repositoryInfo)
: "$(repoUrl)/`cat $source`/repo.info"
: $(packagesChecksumFile) ;
# download repository file
local repositoryFile = $(repository:G=repository-cache) ;
MakeLocate $(repositoryFile) : $(HAIKU_PACKAGE_REPOSITORIES_DIR) ;
local repoUrl = [ on $(repository) return $(HAIKU_REPOSITORY_URL) ] ;
DownloadLocatedFile $(repositoryFile)
: "$(repoUrl)/`cat $source`/repo"
: $(packagesChecksumFile) ;
# build repository config file
local repositoryConfig = $(repository:G=repository-config)-config ;
MakeLocate $(repositoryConfig) : $(HAIKU_PACKAGE_REPOSITORIES_DIR) ;
RepositoryConfig $(repositoryConfig) : $(repositoryInfo)
: $(packagesChecksumFile) : $(repository) ;
HAIKU_REPOSITORY_CACHE_FILE on $(repository) = $(repositoryFile) ;
HAIKU_REPOSITORY_CONFIG_FILE on $(repository) = $(repositoryConfig) ;
}
@ -69,6 +109,10 @@ rule GeneratedRepositoryPackageList target : repository
fileNames += [ on $(package) return $(HAIKU_PACKAGE_FILE_NAME) ] ;
}
local definitionFile
= [ on $(repository) return $(HAIKU_REPOSITORY_DEFINITION_FILE) ] ;
Depends $(target) : $(definitionFile) ;
HAIKU_REPOSITORY_PACKAGE_FILE_NAMES on $(target) = $(fileNames) ;
GeneratedRepositoryPackageList1 $(target) ;
}
@ -82,6 +126,26 @@ actions GeneratedRepositoryPackageList1
}
rule RepositoryConfig repoConfig : repoInfo : packagesChecksumFile : repository
{
repository = $(repository:G=repository) ;
HAIKU_REPOSITORY_URL on $(repoConfig)
= [ on $(repository) return $(HAIKU_REPOSITORY_URL) ] ;
Depends $(repoConfig)
: <build>create_repository_config $(repoInfo) $(packagesChecksumFile) ;
RepositoryConfig1 $(repoConfig)
: <build>create_repository_config $(repoInfo) $(packagesChecksumFile) ;
}
actions RepositoryConfig1
{
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
$(2[1]) $(HAIKU_REPOSITORY_URL)/`cat $(2[3])` $(2[2]) $(1)
}
rule IsPackageAvailable package
{
if $(package) in $(HAIKU_AVAILABLE_PACKAGES) {
@ -107,7 +171,8 @@ rule PackageURL packageName
= [ on $(packageFamily) return $(HAIKU_PACKAGE_VERSIONS[1]) ] ;
local fileName = [ on $(package) return $(HAIKU_PACKAGE_FILE_NAME) ] ;
local repository = [ on $(package) return $(HAIKU_PACKAGE_REPOSITORY) ] ;
local baseUrl = [ on $(repository) return $(HAIKU_REPOSITORY_URL) ] ;
local baseUrl
= [ on $(repository) return $(HAIKU_REPOSITORY_PACKAGES_URL) ] ;
return $(baseUrl)/$(fileName) ;
}

View File

@ -1,5 +1,6 @@
PackageRepository HaikuPorts
: x86_gcc2
: http://haiku-files.org/files/repo
: http://haiku-files.org/files/hpkg
:
# architecture "any" packages

View File

@ -8,6 +8,7 @@ set -o errexit
# addBuildCompatibilityLibDir
# systemPackages, commonPackages - lists of the hpkg packages copied/updated
# (in "system" and "common" respectively)
# repositories - all repository files
# downloadDir
# The following are only for image types:
# installDir
@ -306,21 +307,8 @@ done
if [ -n "$resolvePackageDependencies" ]; then
echo "Resolving package dependencies ..."
repoFiles=
for repository in $repositories; do
eval 'repositoryPackageList=$repositoryPackageList_'$repository
eval 'repositoryUrl=$repositoryUrl_'$repository
packageListHash=`sha256sum $repositoryPackageList \
| sed -r 's,([^[:space:]]*).*,\1,'`
repoFileName=repo-$packageListHash
repoFileUrl="$repositoryUrl/repos/$repoFileName"
repoFilePath="$downloadDir/$repoFileName"
downloadFile $repoFileUrl $repoFilePath
repoFiles="$repoFiles $repoFilePath"
done
# additional packages for system
packageUrls=`$getPackageDependencies $repoFiles -- $systemPackages`
packageUrls=`$getPackageDependencies $repositories -- $systemPackages`
for packageUrl in $packageUrls; do
packageFileName=`basename $packageUrl`
packageFilePath="$downloadDir/$packageFileName"
@ -330,7 +318,7 @@ if [ -n "$resolvePackageDependencies" ]; then
done
# additional packages for common
packageUrls=`$getPackageDependencies $repoFiles -- $systemPackages \
packageUrls=`$getPackageDependencies $repositories -- $systemPackages \
$commonPackages`
for packageUrl in $packageUrls; do
packageFileName=`basename $packageUrl`