summaryrefslogtreecommitdiff
blob: 286579aa4753c126d8372b32bd5e30a026dd2d60 (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
#!/bin/bash

source /sbin/functions.sh

if [[ ! -f "${1:-.}"/profiles/repo_name ]]; then
    eerror "You need to create profiles/repo_name"
    exit 1
fi

ebegin "Generating thirdpartymirrors"
if type -p paludis &>/dev/null; then
    find "${1:-.}" -name '*.ebuild' | sed 's|^\./\([^/]*\)/[^/]*\(/[^/]*\).ebuild$|=\1\2::'"$(<"${1:-.}"/profiles/repo_name)"'|' | xargs paludis -qM | grep '^[[:space:]]*SRC_URI: ' | sed -e 's|mirror://[^ ]*|\n&\n|g' | sed -ne '/mirror/s|mirror://\([^/]*\)[^ ]*|\1|gp' | sort -u | xargs -i% grep '^%[[:space:]]' "$(paludis --configuration-variable gentoo location)"/profiles/thirdpartymirrors > "${1:-.}"/profiles/thirdpartymirrors
else
    fgrep -r --include '*.ebuild' mirror:// "${1:-.}" | sed 's|^.*mirror://\([^/]*\).*|\1|' | sort -u | xargs -i% grep '^%[[:space:]]' "$(portageq portdir)"/profiles/thirdpartymirrors > "${1:-.}"/profiles/thirdpartymirrors
fi
eend

ebegin "Generating categories"
find "${1:-.}" -maxdepth 1 -mindepth 1 -type d -not -name licenses -not -name profiles -not -name '.*' | sed 's:^.*/::' | sort > "${1:-.}"/profiles/categories
eend

ebegin "Generating arch.list"
if type -p paludis &>/dev/null; then
    find "${1:-.}" -name '*.ebuild' | sed 's|^\./\([^/]*\)/[^/]*\(/[^/]*\).ebuild$|=\1\2::'"$(<"${1:-.}"/profiles/repo_name)"'|' | xargs paludis -qM | grep '^[[:space:]]*KEYWORDS: ' | cut -d : -f 2- | sed -e 's/-\*//g' -e 's/\([[:space:]]\)[~-]/\1/g' -e 's/^[[:space:]]*//' -e 's/ /\n/g' | sort -u > "${1:-.}"/profiles/arch.list
else
    fgrep -hr --include '*.ebuild' KEYWORDS . | awk -F \" '{print " " $2}' | sed -e 's/-\*//g' -e 's/\([[:space:]]\)[~-]/\1/g' -e 's/^[[:space:]]*//' -e 's/ /\n/g' | sort -u > "${1:-.}"/profiles/arch.list
fi
eend