Add target for building a Haiku package repository

* Add rule HaikuRepository to build a repository from a repository info
  file and a list of package files. It calls a build_haiku_repository
  script which does all the work.
* Add target <repository>haiku for building the Haiku package
repository.
  It should be built via "jam -q @alpha-raw build <repository>haiku";
  the build profile is only needed to activate all build features.
This commit is contained in:
Ingo Weinhold 2013-11-23 01:46:04 +01:00
parent 8e0eb17508
commit d85bab41bd
5 changed files with 123 additions and 0 deletions

View File

@ -73,6 +73,7 @@ include [ FDirName $(HAIKU_BUILD_RULES_DIR) images CDBootImage ] ;
include [ FDirName $(HAIKU_BUILD_RULES_DIR) images CDBootPPCImage ] ;
include [ FDirName $(HAIKU_BUILD_RULES_DIR) images HaikuCD ] ;
include [ FDirName $(HAIKU_BUILD_RULES_DIR) images AnybootImage ] ;
include [ FDirName $(HAIKU_BUILD_RULES_DIR) repositories Haiku ] ;
# Check whether all requested optional packages do actually exist.
local package ;

View File

@ -675,3 +675,40 @@ actions BuildRemoteHaikuPortsRepository1
ssh $remote "build_repository_for_testing.sh $branch $repoArch"
}
rule HaikuRepository repository : repoInfo : packages
{
# prepare the script that initializes the shell variables
local initVariablesScript = $(repository)-repository-init-vars ;
MakeLocate $(initVariablesScript)
: $(HAIKU_PACKAGE_REPOSITORIES_DIR_$(HAIKU_PACKAGING_ARCH)) ;
Always $(initVariablesScript) ;
local script = $(initVariablesScript) ;
AddVariableToScript $(script) : addBuildCompatibilityLibDir
: $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ;
AddVariableToScript $(script) : sha256 : $(HOST_SHA256) ;
AddVariableToScript $(script) : sedExtendedRegex
: $(HOST_EXTENDED_REGEX_SED) ;
AddTargetVariableToScript $(script) : <build>package ;
AddTargetVariableToScript $(script) : <build>package_repo : packageRepo ;
# call the build actions
local mainScript = build_haiku_repository ;
SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
Depends $(repository) : $(mainScript) $(initVariablesScript) $(repoInfo)
$(packages) ;
HaikuRepository1 $(repository) : $(mainScript) $(initVariablesScript)
$(repoInfo) $(packages) ;
Always $(repository) ;
RmTemps $(repository) : $(initVariablesScript) ;
}
actions HaikuRepository1
{
$(2[1]) "$(2[2])" "$(1)" "$(2[3-])"
}

View File

@ -0,0 +1,23 @@
# Builds the Haiku packages repository.
local haikuRepository = <repository>haiku ;
MakeLocate $(haikuRepository)
: $(HAIKU_PACKAGE_REPOSITORIES_DIR_$(HAIKU_PACKAGING_ARCH)) ;
local repoInfo = <repository-info>haiku ;
SEARCH on $(repoInfo) = $(HAIKU_TOP)/src/data/repository_infos ;
local secondaryArchs = $(TARGET_PACKAGING_ARCHS[2-]) ;
local packages =
haiku
haiku_devel
haiku_loader
haiku_userguide
haiku_welcome
makefile_engine
haiku_$(secondaryArchs)
haiku_$(secondaryArchs)_devel
;
HaikuRepository $(haikuRepository) : $(repoInfo) : $(packages:S=.hpkg) ;

View File

@ -0,0 +1,56 @@
#!/bin/sh
#
# Usage: build_haiku_repository <initScript> <repositoryDir> <repoInfo>
# <packages> ...
set -o errexit
if [ $# -le 2 ]; then
echo "$0: Missing parameters!" >&2
exit 1
fi
. $1
shift
repositoryDir="$1"
repoInfo="$2"
shift 2
# the remaining arguments are the packages
# this adds the build library dir to LD_LIBRARY_PATH
eval "$addBuildCompatibilityLibDir"
# create a clean repository directory
rm -rf "$repositoryDir"
mkdir "$repositoryDir"
packageDir="$repositoryDir/packages"
mkdir "$packageDir"
# Get the canonical names for the packages and copy them to the package
# directory.
for packageFile in "$@"; do
fileName=`"$package" info -f "%fileName%" "$packageFile"`
cp "$packageFile" "$packageDir/$fileName"
done
# prepare the repo info file
fileName=`basename "$packageDir"/haiku-*.hpkg .hpkg`
version=${fileName#*-}
version=${version%%-*}
arch=${fileName##*-}
sed -e "s/%HAIKU_ARCHITECTURE%/$arch/g" \
-e "s/%HAIKU_VERSION%/$version/g" \
"$repoInfo" > "$repositoryDir/repo.info"
# build the repository file
"$packageRepo" create -C "$repositoryDir" "$repositoryDir/repo.info" \
"$packageDir"/*.hpkg
# create the checksum file
$sha256 "$repositoryDir/repo" \
| $sedExtendedRegex 's,([^[:space:]]*).*,\1,' > "$repositoryDir/repo.sha256"
# The sed part is only necessary for sha256sum, but it doesn't harm for
# sha256 either.

View File

@ -0,0 +1,6 @@
name Haiku
vendor "Haiku Project"
summary "The Haiku repository (for Haiku %HAIKU_VERSION%)"
priority 1
url http://packages.haiku-os.org/haiku/master/repo/%HAIKU_ARCHITECTURE%/%HAIKU_VERSION%
architecture %HAIKU_ARCHITECTURE%