[buildpkg] add build mirror option
This commit is contained in:
parent
1f55e4ba5a
commit
b2aab968ed
5 changed files with 33 additions and 15 deletions
|
@ -53,6 +53,7 @@ display_settings(){
|
||||||
msg2 "work_dir: ${work_dir}"
|
msg2 "work_dir: ${work_dir}"
|
||||||
msg2 "sets_dir_pkg: ${sets_dir_pkg}"
|
msg2 "sets_dir_pkg: ${sets_dir_pkg}"
|
||||||
msg2 "cache_dir_pkg: ${cache_dir_pkg}"
|
msg2 "cache_dir_pkg: ${cache_dir_pkg}"
|
||||||
|
msg2 "build_mirror: ${build_mirror}/${branch}"
|
||||||
# msg2 "pacman_conf: ${pacman_conf}"
|
# msg2 "pacman_conf: ${pacman_conf}"
|
||||||
# msg2 "makepkg_conf: ${makepkg_conf}"
|
# msg2 "makepkg_conf: ${makepkg_conf}"
|
||||||
# msg2 "mirrors_conf: ${mirrors_conf}"
|
# msg2 "mirrors_conf: ${mirrors_conf}"
|
||||||
|
@ -163,7 +164,7 @@ pacman_conf="${PKGDATADIR}/pacman-${pacman_conf_arch}.conf"
|
||||||
makepkg_conf="${PKGDATADIR}/makepkg-${arch}.conf"
|
makepkg_conf="${PKGDATADIR}/makepkg-${arch}.conf"
|
||||||
mirrors_conf="${PKGDATADIR}/pacman-mirrors-${branch}.conf"
|
mirrors_conf="${PKGDATADIR}/pacman-mirrors-${branch}.conf"
|
||||||
|
|
||||||
mkchroot_args+=(-L -C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf})
|
mkchroot_args+=(-L -C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -B "${build_mirror}/${branch}")
|
||||||
|
|
||||||
mkchrootpkg_args+=(-r ${work_dir})
|
mkchrootpkg_args+=(-r ${work_dir})
|
||||||
|
|
||||||
|
|
|
@ -30,14 +30,15 @@ usage() {
|
||||||
echo ' -r <list> Bind mountargs ro'
|
echo ' -r <list> Bind mountargs ro'
|
||||||
echo ' -w <list> Bind mountargs rw'
|
echo ' -w <list> Bind mountargs rw'
|
||||||
echo ' List format [src1:target1,...,srcN:targetN]'
|
echo ' List format [src1:target1,...,srcN:targetN]'
|
||||||
echo ' -L Use fast mirrorlist for pkgbuilding'
|
# echo ' -L Use fast mirrorlist for pkgbuilding'
|
||||||
|
echo ' -B Use custom build mirror'
|
||||||
echo ' -h This message'
|
echo ' -h This message'
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
orig_argv=("$@")
|
orig_argv=("$@")
|
||||||
|
|
||||||
while getopts 'hLC:M:S:c:r:w:' arg; do
|
while getopts 'hBC:M:S:c:r:w:' arg; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
C) pac_conf="$OPTARG" ;;
|
C) pac_conf="$OPTARG" ;;
|
||||||
M) makepkg_conf="$OPTARG" ;;
|
M) makepkg_conf="$OPTARG" ;;
|
||||||
|
@ -45,7 +46,8 @@ while getopts 'hLC:M:S:c:r:w:' arg; do
|
||||||
c) cache_dir="$OPTARG" ;;
|
c) cache_dir="$OPTARG" ;;
|
||||||
r) mountargs_ro="$OPTARG" ;;
|
r) mountargs_ro="$OPTARG" ;;
|
||||||
w) mountargs_rw="$OPTARG" ;;
|
w) mountargs_rw="$OPTARG" ;;
|
||||||
L) build_locales=true ;;
|
# L) build_locales=true ;;
|
||||||
|
B) build_mirror="$OPTARG" ;;
|
||||||
h|?) usage ;;
|
h|?) usage ;;
|
||||||
*) error "invalid argument '$arg'"; usage ;;
|
*) error "invalid argument '$arg'"; usage ;;
|
||||||
esac
|
esac
|
||||||
|
@ -73,14 +75,18 @@ copy_hostconf () {
|
||||||
[[ -n $makepkg_conf ]] && cp $makepkg_conf "$1/etc/makepkg.conf"
|
[[ -n $makepkg_conf ]] && cp $makepkg_conf "$1/etc/makepkg.conf"
|
||||||
[[ -n $mirrors_conf ]] && cp ${mirrors_conf} "$1/etc/pacman-mirrors.conf"
|
[[ -n $mirrors_conf ]] && cp ${mirrors_conf} "$1/etc/pacman-mirrors.conf"
|
||||||
|
|
||||||
if ${build_locales};then
|
# if ${build_locales};then
|
||||||
local host_mirror=$(pacman -Sddp community/manjaro-tools 2>/dev/null | sed -E "s#(.*/)(.*/)community/.*#\1branch/\$repo/\$arch#")
|
# local host_mirror=$(pacman -Sddp community/manjaro-tools 2>/dev/null | sed -E "s#(.*/)(.*/)community/.*#\1branch/\$repo/\$arch#")
|
||||||
[[ $host_mirror == *file://* ]] && host_mirror_path=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g')
|
# [[ $host_mirror == *file://* ]] && host_mirror_path=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g')
|
||||||
|
#
|
||||||
local branch=$(cat "$1/etc/pacman-mirrors.conf" | grep '^Branch=' | sed 's/Branch=\s*//g')
|
# local branch=$(cat "$1/etc/pacman-mirrors.conf" | grep '^Branch=' | sed 's/Branch=\s*//g')
|
||||||
|
#
|
||||||
host_mirror=$(echo "$host_mirror" | sed -E "s#/branch/#/${branch}/#")
|
# host_mirror=$(echo "$host_mirror" | sed -E "s#/branch/#/${branch}/#")
|
||||||
echo "Server = $host_mirror" > "$1/etc/pacman.d/mirrorlist"
|
# echo "Server = $host_mirror" > "$1/etc/pacman.d/mirrorlist"
|
||||||
|
if [[ -n ${build_mirror} ]];then
|
||||||
|
# source $1/etc/pacman-mirrors.conf
|
||||||
|
build_mirror=${build_mirror}'/$repo/$arch'
|
||||||
|
echo "Server = ${build_mirror}" > "$1/etc/pacman.d/mirrorlist"
|
||||||
else
|
else
|
||||||
source $1/etc/pacman-mirrors.conf
|
source $1/etc/pacman-mirrors.conf
|
||||||
sed -e "s|/stable|/${Branch}|g" -i "$1/etc/pacman.d/mirrorlist"
|
sed -e "s|/stable|/${Branch}|g" -i "$1/etc/pacman.d/mirrorlist"
|
||||||
|
|
|
@ -25,19 +25,21 @@ usage() {
|
||||||
echo ' -S <file> Location of a pacman-mirrors config file'
|
echo ' -S <file> Location of a pacman-mirrors config file'
|
||||||
echo ' -c <dir> Set pacman cache'
|
echo ' -c <dir> Set pacman cache'
|
||||||
echo ' -L Use build locale.gen en/de'
|
echo ' -L Use build locale.gen en/de'
|
||||||
|
echo ' -B Use custom build mirror'
|
||||||
echo ' -h This message'
|
echo ' -h This message'
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
orig_argv=("$@")
|
orig_argv=("$@")
|
||||||
|
|
||||||
while getopts 'hLC:M:S:c:' arg; do
|
while getopts 'hLC:M:S:c:B:' arg; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
C) pac_conf="$OPTARG" ;;
|
C) pac_conf="$OPTARG" ;;
|
||||||
M) makepkg_conf="$OPTARG" ;;
|
M) makepkg_conf="$OPTARG" ;;
|
||||||
S) mirrors_conf="$OPTARG" ;;
|
S) mirrors_conf="$OPTARG" ;;
|
||||||
c) cache_dir="$OPTARG" ;;
|
c) cache_dir="$OPTARG" ;;
|
||||||
L) build_locales=true; bl_args+=(-L) ;;
|
L) build_locales=true ;;
|
||||||
|
B) build_mirror="$OPTARG" ;;
|
||||||
h|?) usage ;;
|
h|?) usage ;;
|
||||||
*) error "invalid argument '$arg'"; usage ;;
|
*) error "invalid argument '$arg'"; usage ;;
|
||||||
esac
|
esac
|
||||||
|
@ -90,7 +92,7 @@ exec chroot-run \
|
||||||
${pac_conf:+-C "$pac_conf"} \
|
${pac_conf:+-C "$pac_conf"} \
|
||||||
${makepkg_conf:+-M "$makepkg_conf"} \
|
${makepkg_conf:+-M "$makepkg_conf"} \
|
||||||
${mirrors_conf:+-S "$mirrors_conf"} \
|
${mirrors_conf:+-S "$mirrors_conf"} \
|
||||||
|
${build_mirror:+-B "$build_mirror"} \
|
||||||
${cache_dir:+-c "$cache_dir"} \
|
${cache_dir:+-c "$cache_dir"} \
|
||||||
${bl_args[*]} \
|
|
||||||
"$working_dir" locale-gen
|
"$working_dir" locale-gen
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
# default pkg buildset; name without .set extension
|
# default pkg buildset; name without .set extension
|
||||||
# buildset_pkg=default
|
# buildset_pkg=default
|
||||||
|
|
||||||
|
# custom build mirror server
|
||||||
|
# build_mirror=http://mirror.netzspielplatz.de/manjaro/packages
|
||||||
|
|
||||||
############# eudev specific #############
|
############# eudev specific #############
|
||||||
|
|
||||||
# This is only useful if you compile packages against eudev
|
# This is only useful if you compile packages against eudev
|
||||||
|
|
|
@ -213,6 +213,12 @@ load_config(){
|
||||||
buildset_pkg='default'
|
buildset_pkg='default'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n ${build_mirror} ]];then
|
||||||
|
build_mirror=${build_mirror}
|
||||||
|
else
|
||||||
|
build_mirror='http://mirror.netzspielplatz.de/manjaro/packages'
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -n ${blacklist_trigger[@]} ]];then
|
if [[ -n ${blacklist_trigger[@]} ]];then
|
||||||
blacklist_trigger=${blacklist_trigger[@]}
|
blacklist_trigger=${blacklist_trigger[@]}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue