aboutsummaryrefslogtreecommitdiff
blob: fd44026c6de7a7262e015cfcab11f0d9b71be91c (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
52
53
54
#! /usr/bin/env bash

set -u

# list-repo-updates.sh
#
# Show a list of packages which exist with identical versions in both the main
# Gentoo repo and also in this overlay where the upstream version is installed.
#

debug="${DEBUG:-}"
trace="${TRACE:-}"

[[ " ${*:-} " =~ \ -(h|-help)\  ]] && {
	echo "$( basename "${0}" ) [EROOT]"
	exit 0
}
[[ " ${*:-} " =~ \ -(v|-verbose)\  ]] && {
	debug=1
}

root="${1:-${EROOT:-${EPREFIX:-/}}}"
(( debug )) && echo >&2 "DEBUG: Using root '${root:-/}'"

repo='srcshelton'
overlay="$( portageq get_repo_path "${root:-/}" "${repo}" )/" || {
	echo >&2 "ERROR: Cannot find filesystem path for repo '${repo}'"
	exit 1
}
[[ -n "${overlay:-}" && -d "${overlay}" ]] || {
	echo >&2 "ERROR: Cannot access directory '${overlay:-}' for repo '${repo}'"
	exit 1
}
(( debug )) && echo >&2 "DEBUG: Using overlay directory '${overlay}'"

(( trace )) && set -o xtrace

declare -i rc=0
find "${overlay}" -mindepth 3 -maxdepth 3 -name \*.ebuild |
	sed "s|^${overlay}|| ; s/\.ebuild$//" |
	cut -d'/' -f 1,3 |
	while read -r d; do
		[[ -d /var/db/pkg/${d} ]] &&
			echo "${d}"
	done |
	sed 's/^/~/' |
	xargs emerge -vp |
	grep '::gentoo'
rc=${?}

(( trace )) && set +o xtrace

exit $(( ! rc ))