index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
-rwxr-xr-x | bin/common-functions | 75 |
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}" } |