Skip to content

Commit fb4bf96

Browse files
feat(makerepropkg): support conf.d makepkg config files from buildtool
Previously we have only copied the passed makepkg.conf file into the chroot, which misses build flags for additional language specific files that makepkg supports. Fix this by extracting all conf.d makepkg config files from the detected devtools archive. Component: makerepropkg Co-authored-by: Christian Heusel <[email protected]>
1 parent 96eff02 commit fb4bf96

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

doc/man/makerepropkg.1.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ Options
4949
Set the pacman cache directory.
5050

5151
*-M* <file>::
52-
Location of a makepkg config file.
52+
Location of a makepkg config file. Specific additions (e.g. build flags for
53+
additional languages) can be placed in '<file>.d/*.conf'.
5354

5455
*-l* <chroot>::
5556
The directory name to use as the chroot namespace

src/makerepropkg.in

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,36 @@ get_makepkg_conf() {
9393
local fname=${1}
9494
local arch="${2}"
9595
local makepkg_conf="${3}"
96+
9697
if ! buildtool_file=$(get_pkgfile "${fname}"); then
97-
error "failed to retrieve ${fname}"
98+
error "failed to retrieve ${fname}"
99+
return 1
100+
fi
101+
buildtool_file="${buildtool_file/file:\/\//}"
102+
msg "using makepkg.conf from ${fname}"
103+
104+
# try to handle config of legacy devtools
105+
if bsdtar --list --file "${buildtool_file}" "usr/share/devtools/makepkg-${arch}.conf" &>/dev/null; then
106+
bsdtar --extract --to-stdout --fast-read --file "${buildtool_file}" "usr/share/devtools/makepkg-${arch}.conf" > "${makepkg_conf}"
107+
return $?
108+
fi
109+
110+
msg2 "extracting ${arch}.conf from devtools archive"
111+
if ! bsdtar --extract --to-stdout --fast-read --file "${buildtool_file}" "usr/share/devtools/makepkg.conf.d/${arch}.conf" > "${makepkg_conf}"; then
112+
error "failed to extract 'usr/share/devtools/makepkg.conf.d/${arch}.conf' from devtools archive"
98113
return 1
99114
fi
100-
msg2 "using makepkg.conf from ${fname}"
101-
if ! bsdtar xOqf "${buildtool_file/file:\/\//}" "usr/share/devtools/makepkg.conf.d/${arch}.conf" > "${makepkg_conf}"; then
102-
bsdtar xOqf "${buildtool_file/file:\/\//}" "usr/share/devtools/makepkg-${arch}.conf" > "${makepkg_conf}"
103-
fi
115+
116+
mkdir --parents "${makepkg_conf}.d"
117+
if bsdtar --list --file "${buildtool_file}" "usr/share/devtools/makepkg.conf.d/conf.d" &>/dev/null; then
118+
msg2 "extracting conf.d from devtools archive"
119+
bsdtar --extract --file "${buildtool_file}" --cd "${makepkg_conf}.d" --strip-components 4 "usr/share/devtools/makepkg.conf.d/conf.d"
120+
fi
121+
if bsdtar --list --file "${buildtool_file}" "usr/share/devtools/makepkg.conf.d/${arch}.conf.d" &>/dev/null; then
122+
msg2 "extracting ${arch}.conf.d from devtools archive"
123+
bsdtar --extract --file "${buildtool_file}" --cd "${makepkg_conf}.d" --strip-components 4 "usr/share/devtools/makepkg.conf.d/${arch}.conf.d"
124+
fi
125+
104126
return 0
105127
}
106128

0 commit comments

Comments
 (0)