[arch-releng] [PATCH 10/10] Use the host's package cache
Pierre Schmitz
pierre at archlinux.de
Sat Jun 23 05:40:12 EDT 2012
Signed-off-by: Pierre Schmitz <pierre at archlinux.de>
---
configs/releng/build.sh | 16 ++++++++++++----
1 Datei geändert, 12 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-)
diff --git a/configs/releng/build.sh b/configs/releng/build.sh
index 73f80fe..3a3ef02 100755
--- a/configs/releng/build.sh
+++ b/configs/releng/build.sh
@@ -13,7 +13,14 @@ verbose=""
cmd_args=""
script_path=$(readlink -f ${0%/*})
-pacman_conf="${script_path}/pacman.conf"
+
+setup_workdir() {
+ cache_dirs=($(pacman -v 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g'))
+ mkdir -p "${work_dir}"
+ pacman_conf="${work_dir}/pacman.conf"
+ sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${cache_dirs[@]})|g" \
+ "${script_path}/pacman.conf" > "${pacman_conf}"
+}
# Base installation (root-image)
make_basefs() {
@@ -169,7 +176,7 @@ make_usr_share() {
# Make [core] repository, keep "any" pkgs in a separate fs (makes more "dual-iso" friendly)
make_core_repo() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
- local _url _urls _pkg_name _dst _pkgs _cache_dir _cache_dirs
+ local _url _urls _pkg_name _dst _pkgs _cache_dir
mkdir -p ${work_dir}/repo-core-any
mkdir -p ${work_dir}/repo-core-${arch}
mkdir -p ${work_dir}/pacman.db/var/lib/pacman
@@ -178,11 +185,10 @@ make_core_repo() {
<(grep -v ^# ${script_path}/core.exclude.${arch} | sort | sed 's@^@core/@'))
_urls=$(pacman --config "${pacman_conf}" -Sddp -r ${work_dir}/pacman.db ${_pkgs})
pacman --config "${pacman_conf}" -Swdd -r ${work_dir}/pacman.db --noprogressbar --noconfirm ${_pkgs}
- _cache_dirs=($(pacman --config "${pacman_conf}" -v 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g'))
for _url in ${_urls}; do
_pkg_name=${_url##*/}
_dst=${work_dir}/repo-core-${arch}/${_pkg_name}
- for _cache_dir in ${_cache_dirs[@]}; do
+ for _cache_dir in ${cache_dirs[@]}; do
if [[ -e "${_cache_dir}/${_pkg_name}" ]]; then
cp "${_cache_dir}/${_pkg_name}" ${_dst}
fi
@@ -431,6 +437,8 @@ if [[ ${command_mode} == "single" ]]; then
work_dir=${work_dir}/${arch}
fi
+setup_workdir
+
case "${command_name}" in
build)
case "${command_mode}" in
--
1.7.11
More information about the arch-releng
mailing list