-
Notifications
You must be signed in to change notification settings - Fork 3
/
update_ebuild.sh
executable file
·68 lines (53 loc) · 1.88 KB
/
update_ebuild.sh
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# For convert go.sum to EGO_SUM
# cat go.sum |awk '{print $1 " " $2}'|while read line; do echo \"${line}\"; done
temp_file=$(mktemp "/tmp/$(basename "$0").XXXXXX")
#
# Fix tabs in old metadata.xml
#
#find -iname metadata.xml| while read file; do
# expand -i -t8 ${file} >"${temp_file}"
# unexpand --first-only -t4 "${temp_file}" >${file}
#done
#
# Update varibales
#
sed -i 's/^PYTHON_COMPAT=.*/PYTHON_COMPAT=( python3_{10..13} python3_13t pypy3 )/' */*/*.ebuild
#sed -i 's/^EAPI=.*/EAPI=8/' */*/*.ebuild
#
# Trim and convert indents to tabs
#
find . -type f | grep -v ".svn\|CVS\|CVSROOT\|.git\|.idea\|eclass" | while read -r file; do
if file "${file}" | grep -v 'unified diff' | grep -q text; then
sed -i -e 's/[ \t]*$//' "${file}"
unexpand --first-only "${file}" | awk '/^$/ {nlstack=nlstack "\n";next;} {printf "%s",nlstack; nlstack=""; print;}' >"${temp_file}"
cat "${temp_file}" >"${file}"
fi
done
rm -f "${temp_file}" 2>/dev/null
find . -name "*.ebuild" | while read -r ebuild; do
sed -i '/^# Copyright/d' "${ebuild}"
sed -i '/^# Distributed/d' "${ebuild}"
sed -i "1s/^/# Distributed under the terms of the GNU General Public License v2\n/" "${ebuild}"
sed -i "1s/^/# Copyright 1999-$(date +%Y) Gentoo Authors\n/" "${ebuild}"
metadata=$(dirname "${ebuild}")/metadata.xml
if [ ! -e "${metadata}" ]; then
tee "${metadata}" <<EOF >/dev/null
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person" proxied="yes">
<email>[email protected]</email>
<name>Fco. Javier Félix</name>
</maintainer>
<maintainer type="project" proxied="proxy">
<email>[email protected]</email>
<name>Proxy Maintainers</name>
</maintainer>
</pkgmetadata>
EOF
fi
ebuild "${ebuild}" digest 2>/dev/null
#ebuild "${ebuild}" clean manifest prepare 2>/dev/null
done
/usr/bin/pkgcheck scan --net