Skip to content

Commit

Permalink
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.
  • Loading branch information
anthraxx authored and jelly committed Nov 10, 2021
1 parent 7dd29df commit bebcffd
Show file tree
Hide file tree
Showing 2 changed files with 18 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
Expand Down Expand Up @@ -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 "$@"
Expand Down
17 changes: 16 additions & 1 deletion makerepropkg.in
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,22 @@ 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=@pkgdatadir@/makepkg-x86_64.conf
if [[ "${BUILDTOOL}" = devtools ]]; then
fname=${BUILDTOOL}-${BUILDTOOLVER}
if ! buildtool_file=$(get_pkgfile "${fname}"); then
error "failed to retrieve ${fname}"
exit 1
fi
msg2 "using makepkg.conf from ${fname}"
makepkg_conf="${TEMPDIR}/makepkg.conf"
bsdtar xOqf "${buildtool_file/file:\/\//}" usr/share/devtools/makepkg-x86_64.conf > "${makepkg_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
Expand Down

0 comments on commit bebcffd

Please sign in to comment.