index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
-rwxr-xr-x | bin/common-functions | 111 | ||||
-rwxr-xr-x | bin/db-update | 7 | ||||
-rwxr-xr-x | bin/get-package-updates | 77 |
diff --git a/bin/common-functions b/bin/common-functions index 4e875f9..f5e1d39 100755 --- a/bin/common-functions +++ b/bin/common-functions @@ -55,8 +55,7 @@ apply_package_customizations() { exit 1 fi - local repo - local package + local repo package repo="$(pwd)" package="${repo%/*/*}" @@ -141,3 +140,111 @@ package_locked_broken_or_blocked() { [ -f "${work_dir}/package-states/$1.$2.$3.$4.broken" ] || \ [ -f "${work_dir}/package-states/$1.$2.$3.$4.blocked" ] } + +# generate_package_metadata $package $git_revision $mod_git_revision $repository +# or +# generate_package_metadata $package.$git_revision.$mod_git_revision.$repository +# generate the meta data files of a package (dependencies, built packages, ...) + +generate_package_metadata() { + + local package="$1" + local git_revision="$2" + local mod_git_revision="$3" + local repository="$4" + local file_prefix file PKGBUILD + + if [ $# -eq 1 ]; then + # second form + repository="${package##*.}" + package="${package%.*}" + mod_git_revision="${package##*.}" + package="${package%.*}" + git_revision="${package##*.}" + package="${package%.*}" + fi + + file_prefix="${work_dir}/package-infos/${package}.${git_revision}.${mod_git_revision}" + + if [ -e "${file_prefix}.builds" ] && \ + [ -e "${file_prefix}.depends" ] && \ + [ -e "${file_prefix}.needs" ] && \ + [ -e "${file_prefix}.packages" ]; then + return 0 + fi + + git -C "${repo_paths["$(find_repository_with_commit "${git_revision}")"]}" checkout "${git_revision}" + git -C "${repo_paths["$(find_repository_with_commit "${mod_git_revision}")"]}" checkout "${mod_git_revision}" + + PKGBUILD="$(find_pkgbuild "${package}" "${repository}")" + + if [ ! -r "${PKGBUILD}" ]; then + echo "can't find PKGBUILD to package '${package}' from repository '${repository}': '${PKGBUILD}'" + exit 1 + fi + + ( + cd "${PKGBUILD%/*}" + apply_package_customizations + grep -q '\$CARCH' 'PKGBUILD' && \ + CARCH=i686 makepkg --printsrcinfo > \ + "${file_prefix}.SRCINFO" || \ + mksrcinfo -o "${file_prefix}.SRCINFO" + ) + + # otherwise this just calls for trouble + sed -i '/=\s*$/d' "${file_prefix}.SRCINFO" + + # extract "builds" = provides \cup pkgname + grep '^\('$'\t''provides\|pkgname\) = ' "${file_prefix}.SRCINFO" | \ + cut -d= -f2 | \ + sed 's|^\s\+||; s|[<>]$||' | \ + sort -u > \ + "${file_prefix}.builds" + + # extract "packages" = pkgname + grep '^pkgname = ' "${file_prefix}.SRCINFO" | \ + cut -d= -f2 | \ + sed 's|^\s\+||; s|[<>]$||' | \ + sort -u > \ + "${file_prefix}.packages" + + # extract "needs" = ( makedepends \cup checkdepends ) \setminus "builds" + ( + grep '^'$'\t''\(makedepends\|checkdepends\) = ' "${file_prefix}.SRCINFO" | \ + cut -d= -f2 | \ + sed 's|^\s\+||; s|[<>]$||' | \ + sort -u + sed 'p' "${file_prefix}.builds" + ) | \ + sort | \ + uniq -u > \ + "${file_prefix}.needs" + + # extract "depends" = makedepends \cup checkdepends \cup depends + ( + sed -n '/^pkgname = /q;/^'$'\t''depends = /p' "${file_prefix}.SRCINFO" + grep '^'$'\t''\(makedepends\|checkdepends\) = ' "${file_prefix}.SRCINFO" + ) | \ + cut -d= -f2 | \ + sed 's|^\s\+||; s|[<>]$||' | \ + sort -u > \ + "${file_prefix}.depends" + + rm "${file_prefix}.SRCINFO" + +} + +# delete_old_metadata +# delete old (=unneeded) meta data of packages + +delete_old_metadata() +{ + true +# ls -1 "${file_prefix%.*.*}."* 2> /dev/null | \ +# sed 's|^.*/||' | \ +# grep "^${package//./\\.}"'\.\([0-9a-f]\{40\}\.\)\{2\}\(builds\|depends\|needs\|packages\|SRCINFO\)$' | \ +# while read file; do +# rm "${work_dir}/package-infos/${file}" +# done +} diff --git a/bin/db-update b/bin/db-update index 630d99c..58e9eaf 100755 --- a/bin/db-update +++ b/bin/db-update @@ -133,12 +133,7 @@ keep_packages='' while [ -n "${new_keep_packages}" ]; do for package in ${new_keep_packages}; do - if [ ! -f "${work_dir}/package-infos/${package%.*}.depends" ]; then - echo "missing meta data for an not unstageable package ('${package}') - abort unstaging!" - keep_packages='' - done_packages='' - break - fi + generate_package_metadata "${package}" done if [ -z "${done_packages}" ]; then break diff --git a/bin/get-package-updates b/bin/get-package-updates index c3b49a7..9fb1759 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -189,79 +189,7 @@ mkdir -p "${work_dir}/package-infos" while read -r package git_revision mod_git_revision repository; do - file_prefix="${work_dir}/package-infos/${package}.${git_revision}.${mod_git_revision}" - - # extract infos from PKGBUILD if not existent yet - if [ ! -e "${file_prefix}.builds" ] || \ - [ ! -e "${file_prefix}.depends" ] || \ - [ ! -e "${file_prefix}.needs" ] || \ - [ ! -e "${file_prefix}.packages" ]; then - # delete cached values of old versions of this PKGBUILD - ls -1 "${file_prefix%.*.*}."* 2> /dev/null | \ - sed 's|^.*/||' | \ - grep "^${package//./\\.}"'\.\([0-9a-f]\{40\}\.\)\{2\}\(builds\|depends\|needs\|packages\|SRCINFO\)$' | \ - while read file; do - rm "${work_dir}/package-infos/${file}" - done - - PKGBUILD="$(find_pkgbuild "${package}" "${repository}")" - - if [ ! -r "${PKGBUILD}" ]; then - echo "can't find PKGBUILD to package '${package}' from repository '${repository}': '${PKGBUILD}'" - exit 1 - fi - - ( - cd "${PKGBUILD%/*}" - apply_package_customizations - grep -q '\$CARCH' 'PKGBUILD' && \ - CARCH=i686 makepkg --printsrcinfo > \ - "${file_prefix}.SRCINFO" || \ - mksrcinfo -o "${file_prefix}.SRCINFO" - ) - - # otherwise this just calls for trouble - sed -i '/=\s*$/d' "${file_prefix}.SRCINFO" - - # extract "builds" = provides \cup pkgname - grep '^\('$'\t''provides\|pkgname\) = ' "${file_prefix}.SRCINFO" | \ - cut -d= -f2 | \ - sed 's|^\s\+||; s|[<>]$||' | \ - sort -u > \ - "${file_prefix}.builds" - - # extract "packages" = pkgname - grep '^pkgname = ' "${file_prefix}.SRCINFO" | \ - cut -d= -f2 | \ - sed 's|^\s\+||; s|[<>]$||' | \ - sort -u > \ - "${file_prefix}.packages" - - # extract "needs" = ( makedepends \cup checkdepends ) \setminus "builds" - ( - grep '^'$'\t''\(makedepends\|checkdepends\) = ' "${file_prefix}.SRCINFO" | \ - cut -d= -f2 | \ - sed 's|^\s\+||; s|[<>]$||' | \ - sort -u - sed 'p' "${file_prefix}.builds" - ) | \ - sort | \ - uniq -u > \ - "${file_prefix}.needs" - - # extract "depends" = makedepends \cup checkdepends \cup depends - ( - sed -n '/^pkgname = /q;/^'$'\t''depends = /p' "${file_prefix}.SRCINFO" - grep '^'$'\t''\(makedepends\|checkdepends\) = ' "${file_prefix}.SRCINFO" - ) | \ - cut -d= -f2 | \ - sed 's|^\s\+||; s|[<>]$||' | \ - sort -u > \ - "${file_prefix}.depends" - - rm "${file_prefix}.SRCINFO" - - fi + generate_package_metadata "${package}" "${git_revision}" "${mod_git_revision}" "${repository}" done < "${work_dir}/build-list.new" @@ -390,6 +318,9 @@ rm -rf --one-file-system "${work_dir}/build-list.loops" mv "${work_dir}/${file}.new" "${work_dir}/${file}" done +# Delete old package meta data +delete_old_metadata + # Remove the lock file rm -f "${build_list_lock_file}" |