summaryrefslogtreecommitdiff
blob: b05b15ce4e0c8bb38999028841876f9464fdae51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash

OVERLAY="$(portageq get_repo_path / xfce-dev)"
PORTDIR="$(portageq portdir)"

# collect ebuilds
pushd "${OVERLAY}" >/dev/null
pkgs=$(echo */*/*.ebuild)
popd >/dev/null

changes=0

for i in ${pkgs}; do
	# get cat/pkg
	atom=( $(qatom ${i/\/*\//\/}) )
	CAT=${atom[0]}
	PN=${atom[1]}

	# get source ebuild's header
	declare -a src
	src=( ${PORTDIR}/${CAT}/${PN}/${PN}-*.ebuild )
	src=${src[-1]}
	srcheader=$(grep "^# \$Header: " ${src})

	# get destination ebuild's header
	dst=${OVERLAY}/${i}
	dstheader=$(grep "^# \$Header: " ${dst})

	if [ "${srcheader}" != "${dstheader}" ]; then
		# copy new ebuild
		cp -f ${src} ${dst}

		# remove any stabl keywords
		ekeyword ~all ${dst} >/dev/null

		# XXX remove this when xfconf-live merged into xfconf
		# remove SRC_URI
		sed -i -e "/^SRC_URI/d" ${dst}
		# fix eclass usage
		sed -i -e "/^inherit/s/xfconf/xfconf-live/" ${dst}
		sed -i -r "s/xfconf(_(src|pkg))/xfconf-live\1/" ${dst}

		let changes="$changes + 1"
	fi
done

if [ ${changes} -gt 0 ]; then
	echo ${changes} ebuilds synced, please review the changes
else
	echo Everything up to date
fi