aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Stephen P. Bennett <spb@exherbo.org> 2006-04-13 23:21:59 +0000
committerAvatar Stephen P. Bennett <spb@exherbo.org> 2006-04-13 23:21:59 +0000
commit1a6379297c35455625a398e88636d6b64452344e (patch)
treeb9bc8733baadbca3ec7dddf8662cd521392e0205
parent3459959744fa90d5a88fa411f4a28c647d5a330a (diff)
downloadpaludis-1a6379297c35455625a398e88636d6b64452344e.tar.gz
paludis-1a6379297c35455625a398e88636d6b64452344e.tar.xz
Initial CONFIG_PROTECT support.
-rw-r--r--ebuild/builtin_unmerge.bash8
-rwxr-xr-xebuild/utils/merge36
-rwxr-xr-xebuild/utils/unmerge19
3 files changed, 58 insertions, 5 deletions
diff --git a/ebuild/builtin_unmerge.bash b/ebuild/builtin_unmerge.bash
index 4fd8ae6..f329c6b 100644
--- a/ebuild/builtin_unmerge.bash
+++ b/ebuild/builtin_unmerge.bash
@@ -28,6 +28,14 @@ builtin_unmerge()
eval "${v}='$(< ${dbdir}/${v} )' || die \"Load key ${v} failed\""
done
+ eval $(bzcat "${dbdir}/environment.bz2" | while read line; do
+ if [[ ${line%%=*} == CONFIG_PROTECT ]]; then
+ echo "CONFIG_PROTECT='${line#*=} ${CONFIG_PROTECT}'"
+ elif [[ ${line%%=*} == CONFIG_PROTECT_MASK ]]; then
+ echo "CONFIG_PROTECT_MASK='${line#*=} ${CONFIG_PROTECT_MASK}'"
+ fi
+ done)
+
${PALUDIS_EBUILD_MODULES_DIR}/utils/unmerge "${ROOT}/" "${dbdir}/CONTENTS" \
|| die "unmerge failed"
diff --git a/ebuild/utils/merge b/ebuild/utils/merge
index a79fbdc..29eac03 100755
--- a/ebuild/utils/merge
+++ b/ebuild/utils/merge
@@ -50,6 +50,16 @@ if ! > "${contents}" ; then
exit 247
fi
+make_cfgpro_filename()
+{
+ local fn="${1}" i=0
+ while [[ -e "${2}/${fn}" ]]; do
+ fn="._cfg$(printf '%.4i' ${i})${1}"
+ (( ++i ))
+ done
+ echo ${fn}
+}
+
merge_this()
{
if [[ ! -d "${1}" ]] || [[ ! -d "${2}" ]] ; then
@@ -107,11 +117,31 @@ merge_this()
r=1
fi
else
- if ! cp --remove-destination -pR -- "${f}" "${2}"/ ; then
- echo "error installing file ${f}"
+ local cfgpro=
+ for c in ${CONFIG_PROTECT}; do
+ if [[ ${2#${top_dst}} == "${c}"/* ]]; then
+ cfgpro=yes
+ for cm in ${CONFIG_PROTECT_MASK}; do
+ if [[ ${2#${top_dst}} == "${cm}"/* ]]; then
+ cfgpro=
+ fi
+ done
+ fi
+ done
+ local fn=${f}
+ if [[ -n ${cfgpro} &&
+ -e ${2}/${ff} &&
+ "$(md5sum ${f} |cut -d\ -f 1)" != "$(md5sum ${2}/${ff} |cut -d\ -f 1)" ]]; then
+ fn="${1}/$(make_cfgpro_filename ${ff} ${2})"
+ if [[ ${fn} != ${f} ]]; then
+ mv "${f}" "${fn}"
+ fi
+ fi
+ if ! cp --remove-destination -pR -- "${fn}" "${2}"/ ; then
+ echo "error installing file ${fn}"
r=1
else
- if [[ -f "${f}" ]] ; then
+ if [[ -f "${fn}" ]] ; then
echo -n "obj ${2#${top_dst}}/${ff} " >> ${contents}
echo -n "$(md5sum -- ${2}/${ff} | cut -d' ' -f1 ) " >> ${contents}
echo -n "$(stat -c '%Y' -- ${2}/${ff} )" >> ${contents}
diff --git a/ebuild/utils/unmerge b/ebuild/utils/unmerge
index b12a3ba..ef3129d 100755
--- a/ebuild/utils/unmerge
+++ b/ebuild/utils/unmerge
@@ -71,8 +71,23 @@ while read entry ; do
elif [[ $(stat -c '%Y' -- "${ROOT}/${items[1]}" ) != "${items[3]}" ]] ; then
echo "skip !time ${items[1]}"
else
- echo "remove ${items[1]}"
- rm -f "${ROOT}/${items[1]}"
+ cfgpro=
+ for c in ${CONFIG_PROTECT}; do
+ if [[ ${items[1]} == "${c%/}"/* ]]; then
+ cfgpro="yes"
+ for cm in ${CONFIG_PROTECT_MASK}; do
+ if [[ ${items[1]} == "${cm}"/* ]]; then
+ cfgpro=
+ fi
+ done
+ fi
+ done
+ if [[ -n ${cfgpro} ]]; then
+ echo "cfgpro ${items[1]}"
+ else
+ echo "remove ${items[1]}"
+ rm -f "${ROOT}/${items[1]}"
+ fi
fi
;;