diff options
author | Erich Eckner <git@eckner.net> | 2017-05-05 13:47:34 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-05-05 13:47:34 +0200 |
commit | c07a766fd1fd4bcf6d3373fb9de63808472c23bb (patch) | |
tree | e5694b8b9454798e9afb39e09148eaa3114bb1e9 /bin | |
parent | 8c66f32a02cfe7e8c9552282286c18b531b765b9 (diff) | |
download | builder-c07a766fd1fd4bcf6d3373fb9de63808472c23bb.tar.xz |
bin/get-package-updates: include modifications of packages
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/common-functions | 63 | ||||
-rwxr-xr-x | bin/get-package-updates | 7 |
2 files changed, 55 insertions, 15 deletions
diff --git a/bin/common-functions b/bin/common-functions index 765610c..7e89119 100755 --- a/bin/common-functions +++ b/bin/common-functions @@ -8,18 +8,58 @@ find_pkgbuild() { - for prefix in "${repo_paths["packages"]}" "${repo_paths["community"]}"; do - [ -d "${prefix}/$1" ] || continue - ls "${prefix}/$1/repos/$2-"*"/PKGBUILD" 2> /dev/null && break - done | \ - tr ' ' '\n' | \ - grep -v -- '-i686/PKGBUILD$' | \ - grep -v -- '-\(staging\|testing\)-[^/]\+/PKGBUILD$' | \ - sort | \ - tail -n1 + local PKGBUILD='' repo file + + if [ -f "${repo_paths["archlinux32"]}/$2/$1/PKGBUILD" ]; then + # If this package has some modification, + repo="$(find_git_repository_to_package_repository "$2")" + if ! [ -d "${repo_paths["${repo}"]}/$1" ]; then + # create some dummy files if it is also new. + mkdir -p "${repo_paths["${repo}"]}/$1/repos/$2-x86_64" + touch "${repo_paths["${repo}"]}/$1/repos/$2-x86_64/PKGBUILD" + fi + fi + + for repo in "${!repo_paths[@]}"; do + if [ "${repo}" == "archlinux32" ]; then + continue + fi + if ! [ -d "${repo_paths["${repo}"]}/$1" ]; then + continue + fi + PKGBUILD="$( + ls "${repo_paths["${repo}"]}/$1/repos/$2-"*"/PKGBUILD" 2> /dev/null | \ + tr ' ' '\n' | \ + grep -v -- '-i686/PKGBUILD$' | \ + grep -v -- '-\(staging\|testing\)-[^/]\+/PKGBUILD$' | \ + sort | \ + tail -n1 + )" + if [ -n "${PKGBUILD}" ]; then + echo "${PKGBUILD}" + if [ -f "${repo_paths["archlinux32"]}/$2/$1/PKGBUILD" ] && \ + [ ! -f "${PKGBUILD}.changes-applied" ]; then + # If this package has modifications (or is new), apply them now: + # append PKGBUILD + cat "${repo_paths["archlinux32"]}/$2/$1/PKGBUILD" >> \ + "${PKGBUILD}" + # copy (and overwrite) other files + for file in "${repo_paths["archlinux32"]}/$2/$1/"*; do + if [ -f "${file}" ] && [ "${file##*/}" != "PKGBUILD" ]; then + cp "${file}" "${PKGBUILD%/*}/" + fi + done + touch "${PKGBUILD}.changes-applied" + fi + break + fi + done } find_repository_with_commit() { + + local repository + for repository in "${!repo_paths[@]}"; do if [ "$(git -C "${repo_paths["${repository}"]}" cat-file -t "$1" 2> /dev/null)" == "commit" ]; then echo "${repository}" @@ -28,9 +68,13 @@ find_repository_with_commit() { done >&2 echo "can't find repository with commit '$1'" exit 1 + } find_git_repository_to_package_repository() { + + local repository + for repository in "${!repo_paths[@]}"; do if [ "${repository}" == "archlinux32" ]; then continue @@ -52,4 +96,5 @@ find_git_repository_to_package_repository() { done >&2 echo "can't find git repository with package repository '$1'" exit 1 + } diff --git a/bin/get-package-updates b/bin/get-package-updates index c466d8e..af5cb15 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -4,9 +4,6 @@ # Details: # https://github.com/archlinux32/builder/wiki/Build-system#get-package-updates -# TODO: -# include repository of package customizations - . "${0%/*}/../conf/default.conf" # Create a lock file for build list. @@ -113,8 +110,6 @@ echo 'Extract dependencies of packages.' # Put the list in the proper build order. # First, we extract the dependencies of each package. -# TODO: -# package modifications need to be included here mkdir -p "${work_dir}/package-infos" @@ -122,7 +117,7 @@ rm -f "${work_dir}/build-order" touch "${work_dir}/build-order" while read -r package git_revision mod_git_revision repository; do - PKGBUILD="$(find_pkgbuild "${package}" "${repository}")" + PKGBUILD="$(find_pkgbuild "${package}" "${repository}" "${mod_git_revision}")" if [ ! -r "${PKGBUILD}" ]; then echo "can't find PKGBUILD to package '${package}' from repository '${repository}': '${PKGBUILD}'" |