Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
makerepropkg: use correct devtools makepkg.conf files from dist
Browse files Browse the repository at this point in the history
Use the recorded buildtool in order to download the matching dist
package and use the appropriate makepkg.conf for reproducing the
package. This is required as the flags are not recorded in the BUILDINFO
hence we need to provide the matching config that declared those flags.
anthraxx committed Nov 11, 2021
1 parent 7dd29df commit 300ae7d
Showing 2 changed files with 32 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
V=20210202
BUILDTOOLVER ?= $(V)-git

PREFIX = /usr/local
MANDIR = $(PREFIX)/share/man
@@ -92,7 +93,7 @@ edit = sed -e "s|@pkgdatadir[@]|$(PREFIX)/share/devtools|g"
%: %.in Makefile lib/common.sh
@echo "GEN $@"
@$(RM) "$@"
@{ echo -n 'm4_changequote([[[,]]])'; cat $@.in; } | m4 -P --define=m4_devtools_version=$V | $(edit) >$@
@{ echo -n 'm4_changequote([[[,]]])'; cat $@.in; } | m4 -P --define=m4_devtools_version=$(BUILDTOOLVER) | $(edit) >$@
@chmod a-w "$@"
@chmod +x "$@"
@bash -O extglob -n "$@"
31 changes: 30 additions & 1 deletion makerepropkg.in
Original file line number Diff line number Diff line change
@@ -81,6 +81,17 @@ get_pkgfile() {
return 1
}

get_makepkg_conf() {
local fname=${1}
local makepkg_conf="${2}"
if ! buildtool_file=$(get_pkgfile "${fname}"); then
error "failed to retrieve ${fname}"
exit 1
fi
msg2 "using makepkg.conf from ${fname}"
bsdtar xOqf "${buildtool_file/file:\/\//}" usr/share/devtools/makepkg-x86_64.conf > "${makepkg_conf}"
}

usage() {
cat << __EOF__
usage: ${BASH_SOURCE[0]##*/} [options] <package_file>
@@ -185,7 +196,25 @@ for fname in "${installed[@]}"; do
exit 1
fi
done
printf '%s\n' "${allpkgfiles[@]}" | mkarchroot -M @pkgdatadir@/makepkg-x86_64.conf -U "${archroot_args[@]}" "${buildroot}"/root - || exit 1

trap 'rm -rf $TEMPDIR' EXIT INT TERM QUIT
TEMPDIR=$(mktemp -d --tmpdir makerepropkg.XXXXXXXXXX)

makepkg_conf="${TEMPDIR}/makepkg.conf"
# anything before buildtool support is pinned to last none buildtool devtools
if [[ -z "${BUILDTOOL}" ]]; then
get_makepkg_conf "devtools-20210202-3-any" "${makepkg_conf}"
# prefere to assume devtools up until matching makepkg version so repository packages remain reproducible
elif [[ "${BUILDTOOL}" = makepkg ]] && (( $(vercmp "${BUILDTOOLVER}" 6.0.1) <= 0 )); then
get_makepkg_conf "devtools-20210202-3-any" "${makepkg_conf}"
# all devtools builds
elif [[ "${BUILDTOOL}" = devtools ]]; then
get_makepkg_conf "${BUILDTOOL}-${BUILDTOOLVER}" "${makepkg_conf}"
# fallback to current makepkg.conf
else
makepkg_conf=@pkgdatadir@/makepkg-x86_64.conf
fi
printf '%s\n' "${allpkgfiles[@]}" | mkarchroot -M "${makepkg_conf}" -U "${archroot_args[@]}" "${buildroot}"/root - || exit 1

# use makechrootpkg to prep the build directory
makechrootpkg -r "${buildroot}" -l "${chroot}" -- --packagelist || exit 1

0 comments on commit 300ae7d

Please sign in to comment.