Files
gentoo-zh/scripts/thin_manifest_clean.sh
T
Lan Yixun d333fd15d6 thin manifest: script which doing the Manifest cleanup
why I wrote this script, since I don't have all the packages sources!@

the goal of this scrtipt is :
1) clean all file's checksum which already managed by git
  (means file's checksum belong to this overlay will be removed)
2) keep the source code/tarballs/patch which should fetch from external
  (means file not belong to this overlay need to be preserved)

hope I don't break anything

Signed-off-by: Lan Yixun <dennis.yxun@gmail.com>
2012-06-15 15:51:20 +08:00

40 lines
617 B
Bash
Executable File

#!/bin/bash
. /etc/init.d/functions.sh
OVERLAY=/var/lib/layman/gentoo-zh
einfo "clean thin Manifest"
remove() {
M=$1/Manifest
if [[ ! -e ${M} ]]; then
# ewarn "$(basename $1) not exist"
return
fi
einfo "$2: clean up: $(basename $1)"
sed -i -e '/ebuild/d' $M
sed -i -e '/metadata/d' $M
sed -i -e '/ChangeLog/d' $M
if [[ -d $1/files ]]; then
for i in $(find $1/files -type f ); do
V=${i##*\/}
sed -i -e "/${V}/d" $M
done
fi
sed -i -e '/^$/d' $M
if [[ ! -s ${M} ]]; then
# einfo "remove empty: $M"
rm $M
fi
}
C=0
for i in $(find ${OVERLAY} -maxdepth 2 -and -type d) ; do
C=$((C+1))
remove $i $C
done