diff options
author | Erich Eckner <git@eckner.net> | 2017-07-28 09:52:07 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-07-28 09:52:07 +0200 |
commit | 1c98ccb945dac97012b2bc6969ec337ce8fbb12e (patch) | |
tree | c6cb24f087be0f61a6388ce6c929186c81ce4e25 /bin/common-functions | |
parent | f3b57546352b1fb096490b2c3d5bfe4975db674a (diff) | |
download | builder-1c98ccb945dac97012b2bc6969ec337ce8fbb12e.tar.xz |
switch from our mksrcinfo to "makepkg --printsrcinfo"
Diffstat (limited to 'bin/common-functions')
-rwxr-xr-x | bin/common-functions | 75 |
1 files changed, 18 insertions, 57 deletions
diff --git a/bin/common-functions b/bin/common-functions index 9c0e96e..7b16c1a 100755 --- a/bin/common-functions +++ b/bin/common-functions @@ -431,10 +431,12 @@ make_source_info() { local mod_git_revision="$4" local output="$5" - local git_repo="$(find_repository_with_commit "${git_revision}")" + local git_repo local PKGBUILD local PKGBUILD_mod - local content + local tmp_file + + git_repo="$(find_repository_with_commit "${git_revision}")" if [ -z "${git_repo}" ]; then return 1 @@ -442,70 +444,29 @@ make_source_info() { find_pkgbuilds "${package}" "${repository}" "${git_repo}" "${git_revision}" "${mod_git_revision}" + tmp_file="$(mktemp "${work_dir}/tmp.XXXXXX")" + if [ -n "${PKGBUILD}" ]; then - content="$( - eval git -C "$(printf '"${repo_paths__%s}"' "${git_repo}")" 'archive "${git_revision}" -- "${PKGBUILD}"' | \ - tar -Ox - )" - else - unset content + eval git -C "$(printf '"${repo_paths__%s}"' "${git_repo}")" 'archive "${git_revision}" -- "${PKGBUILD}"' | \ + tar -Ox >> \ + "${tmp_file}" fi if [ -n "${PKGBUILD_mod}" ]; then - content="$( - printf '%s\n' \ - "${content}" \ - "$( - git -C "${repo_paths__archlinux32}" archive "${mod_git_revision}" -- "${PKGBUILD_mod}" | \ - tar -Ox - )" - )" + git -C "${repo_paths__archlinux32}" archive "${mod_git_revision}" -- "${PKGBUILD_mod}" | \ + tar -Ox >> \ + "${tmp_file}" fi - bail_out() { - err=$? - recursively_umount_and_rm "${overlays_dir}" - exit ${err} - } - - overlays_dir="$(mktemp -d "${work_dir}/tmp.XXXXXX")" - - sudo mount -t tmpfs none "${overlays_dir}" || \ - bail_out - - mkdir \ - "${overlays_dir}/lower" \ - "${overlays_dir}/upper" \ - "${overlays_dir}/work" \ - "${overlays_dir}/merged" + sed -i '/^\$Id\$$/d' "${tmp_file}" - echo "${content}" | \ - sed '/^\$Id\$$/d' > \ - "${overlays_dir}/lower/PKGBUILD" - - mkdir "${overlays_dir}/lower/etc" - hexdump -n 16 -e '4/4 "%08x" 1 "\n"' /dev/urandom > \ - "${overlays_dir}/lower/etc/machine-id" - - sudo mount -t overlay overlay -o lowerdir="${overlays_dir}/lower":"/",upperdir="${overlays_dir}/upper",workdir="${overlays_dir}/work" "${overlays_dir}/merged" || \ - bail_out - - sudo systemd-nspawn -q \ - -D "${overlays_dir}/merged" \ - --register=no \ - ${base_dir}/bin/mksrcinfo || \ - bail_out - - sudo umount -l "${overlays_dir}/merged" || \ - bail_out - - mv \ - "${overlays_dir}/upper/.SRCINFO" \ + ( + cd "${tmp_file%/*}" + makepkg --printsrcinfo + ) > \ "${output}" - sudo umount -l "${overlays_dir}" || \ - bail_out - rmdir "${overlays_dir}" + rm -f "${tmp_file}" } |