aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-08-29 20:05:43 -0400
committerB. Watson <urchlay@slackware.uk>2026-08-29 20:05:43 -0400
commit8a78cfe513eb112585a5c5660fcbeb7cb3c58719 (patch)
tree2b68046bd6191912987b1dcfc4241802acd4d916
parente78ea5d2fdc2263be14bb25f9094b590e0b9dc84 (diff)
downloadsbostuff-8a78cfe513eb112585a5c5660fcbeb7cb3c58719.tar.gz
sbodeps: allow -iq/-qi, add -m.
-rwxr-xr-xsbodeps41
-rwxr-xr-xsbonewmaint45
2 files changed, 66 insertions, 20 deletions
diff --git a/sbodeps b/sbodeps
index 62561c2..41e421d 100755
--- a/sbodeps
+++ b/sbodeps
@@ -47,17 +47,25 @@ print_installed_status() {
pkg_is_installed $1 >/dev/null && echo " (installed)" || echo " (NOT installed)"
}
+print_with_maint() {
+ local info=$(/bin/ls $SBOROOT/*/$1/$1.info 2>/dev/null | head -1)
+ local MAINTAINER
+ local EMAIL
+ source "$info"
+ echo "$1: $MAINTAINER <$EMAIL>"
+}
+
find_deps() {
local i
local req
local REQUIRES
local info=$(/bin/ls $SBOROOT/*/$2/$2.info 2>/dev/null | head -1)
- if [ -z "$info" ]; then
- echo "$SELF: $2: no such package" 1>&2
- RETVAL=1
- return;
- fi
+ if [ -z "$info" ]; then
+ echo "$SELF: $2: no such package" 1>&2
+ RETVAL=1
+ return;
+ fi
eval $(grep ^REQUIRES= $info)
if [ "$REQUIRES" = "" ]; then
@@ -86,11 +94,12 @@ QUEUE=yes
while [ "$argsdone" != "yes" ]; do
case "$1" in
-h|-help|--help) usage; exit 0 ;;
- -iq|-qi) QUEUE=yes ; IGNORE=yes ; shift ;;
- -it|-ti) QUEUE=no ; IGNORE=yes ; shift ;;
+ -iq|-qi) QUEUE=yes ; IGNORE=yes ; shift ;;
+ -it|-ti) QUEUE=no ; IGNORE=yes ; shift ;;
-t) QUEUE=no ; shift ;;
-q) QUEUE=yes ; shift ;;
-i) IGNORE=yes ; shift ;;
+ -m) SHOWMAINT=yes ; shift ;;
-*) echo "Unknown option $1"; usage; exit 1 ;;
*) argsdone=yes ;;
esac
@@ -105,8 +114,8 @@ if [ "$QUEUE" = "yes" ]; then
fi
if [ ! -e "$SBOROOT/system" ]; then
- echo "$SELF: path \"$SBOROOT\" doesn't look like an SBo repo, set SBOROOT in environment" 1>&2
- exit 1
+ echo "$SELF: path \"$SBOROOT\" doesn't look like an SBo repo, set SBOROOT in environment" 1>&2
+ exit 1
fi
RETVAL=0
@@ -117,10 +126,10 @@ for arg; do
echo -n $arg
print_installed_status $arg
if [ "$QUEUE" = "yes" ]; then
- if ! pkg_is_installed $arg || [ "$IGNORE" = "yes" ]; then
- echo 0 $arg >> $QTMPFILE
- fi
- fi
+ if ! pkg_is_installed $arg || [ "$IGNORE" = "yes" ]; then
+ echo 0 $arg >> $QTMPFILE
+ fi
+ fi
find_deps 1 $arg
done
@@ -137,7 +146,11 @@ if [ "$QUEUE" = "yes" -a -e "$QTMPFILE" ]; then
r=seen_$(echo $q | sed 's,[^A-Za-z0-9_],_,g')
s=${!r} # bash indirect variable ref, yay
if [ "$s" != "yes" ]; then
- echo $q
+ if [ "$SHOWMAINT" = "yes" ]; then
+ print_with_maint $q
+ else
+ echo $q
+ fi
eval $r="yes"
fi
done
diff --git a/sbonewmaint b/sbonewmaint
index ec40774..4e2c8f4 100755
--- a/sbonewmaint
+++ b/sbonewmaint
@@ -1,16 +1,30 @@
#!/bin/sh
+SELF="$( basename $0 )"
+
+warn() {
+ echo "$SELF: warning: $@" 1>&2
+}
+
+die() {
+ echo "$SELF: fatal: $@" 1>&2
+ exit 1
+}
+
# read config fresh, rather than use the env.
if [ -e ~/.sbostuff.cfg ]; then
source ~/.sbostuff.cfg
else
- echo "$( basename $0 ): warning: can't find ~/.sbostuff.cfg"
+ warn "can't find ~/.sbostuff.cfg"
fi
NAME="$1"
EMAIL="$2"
if [ "$NAME" = "me" -a "$EMAIL" = "" ]; then
+ if [ "$SBO_NAME" = "" -o "$SBO_EMAIL" = "" ]; then
+ die "can't use 'me' without SBO_NAME and SBO_EMAIL in the env"
+ fi
NAME="$SBO_NAME"
EMAIL="$SBO_EMAIL"
elif [ "$NAME" = "nobody" -o "$NAME" = "orphaned" ]; then
@@ -27,13 +41,32 @@ fi
INFO="$( echo *.info )"
if [ ! -e "$INFO" ]; then
- echo "No (or multiple) .info file in current dir" 1>&2
+ die "No (or multiple) .info file in current dir"
exit 1
fi
-sed -i "/^MAINTAINER=/s,\"[^\"]*\",\"$NAME\"," "$INFO"
-sed -i "/^EMAIL=/s,\"[^\"]*\",\"$EMAIL\"," "$INFO"
+cp "$INFO" "$INFO.bak"
+sed -i \
+ -e "/^MAINTAINER=/s,\"[^\"]*\",\"$NAME\"," "$INFO" \
+ -e "/^EMAIL=/s,\"[^\"]*\",\"$EMAIL\"," "$INFO"
+
+if cmp -s "$INFO" "$INFO.bak"; then
+ warn "No change to .info file"
+ exit 0
+fi
-PAGER=cat git diff .
+if colordiff --version &>/dev/null; then
+ DIFF=colordiff
+else
+ DIFF=diff
+fi
+
+$DIFF -u "$INFO.bak" "$INFO"
+
+if git rev-parse &>/dev/null; then
+ echo
+ echo "Don't forget to do this:"
+ echo " git commit -a -m'New maintainer'"
+fi
-echo "git commit -a -m'New maintainer'"
+rm -f "$INFO.bak"