-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmacportsmissing
executable file
·43 lines (38 loc) · 1.26 KB
/
macportsmissing
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
#!/usr/bin/env bash
#######################################################################
# Made by : Ewoud Dronkert
# Licence : GNU GPL v3
# Platform : macOS
# Requires : bash, MacPorts, grep, awk, sed
# Location : ~/bin/, /usr/local/bin
# Name : macportsmissing
# Version : 1.0.2
# Date : 2020-10-30
# Purpose : Check if all py38 packages also exist as py39
#######################################################################
SEARCH='py38'
REPLACE='py39'
PRESENT=0
MISSING=0
echo "MacPorts packages installed for ${SEARCH}, missing for ${REPLACE}:"
for NAME in $(port installed | grep -F "${SEARCH}" | awk '{print $1}' | sed "s/${SEARCH}/${REPLACE}/")
do
# Search result will show package name at the start if found
if port search "${NAME}" | grep -q "^${NAME}"; then
(( PRESENT++ ))
else
(( MISSING++ ))
echo "${NAME}" # show missing package
fi
done
echo
if (( MISSING > 0 )); then
echo "Present: ${PRESENT}"
echo "Missing: ${MISSING}"
echo "To test which installed ports recursively depend on '${SEARCH}-example', use:"
echo " port rdependents ${SEARCH}-example"
elif (( PRESENT > 0 )); then
echo "All ${PRESENT} installed ${SEARCH} ports are available for ${REPLACE}."
else
echo "No ports are installed for ${SEARCH}."
fi