summaryrefslogtreecommitdiffstats
path: root/scripts/list-unreleased.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 20:32:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 20:32:59 +0000
commit4d57e0a8dab2139a631a21aab862487481548702 (patch)
treef7cea0b9939e2ecb7a301de6c83bada29452046d /scripts/list-unreleased.sh
parentInitial commit. (diff)
downloaddevscripts-4d57e0a8dab2139a631a21aab862487481548702.tar.xz
devscripts-4d57e0a8dab2139a631a21aab862487481548702.zip
Adding upstream version 2.23.7.upstream/2.23.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/list-unreleased.sh')
-rwxr-xr-xscripts/list-unreleased.sh92
1 files changed, 92 insertions, 0 deletions
diff --git a/scripts/list-unreleased.sh b/scripts/list-unreleased.sh
new file mode 100755
index 0000000..05ed06b
--- /dev/null
+++ b/scripts/list-unreleased.sh
@@ -0,0 +1,92 @@
+#!/bin/bash
+
+# Script searches for packages with pending changes (UNRELEASED) and
+# either lists them or displays the relevant changelog entry.
+
+# Usage: list-unreleased [-cR]
+# -c : display pending changes
+# -R : don't recurse
+
+# Copyright: Frans Pop <elendil@planet.nl>, 2007
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option)
+# any later version.
+
+PATHS=""
+DO_CL=""
+RECURSE=1
+
+while true; do
+ case "$1" in
+ "")
+ break ;;
+ -c)
+ DO_CL=1
+ ;;
+ -R)
+ RECURSE=
+ ;;
+ -*)
+ echo "unrecognized argument '$1'"
+ exit 1
+ ;;
+ *)
+ PATHS="${PATHS:+$PATHS }$1"
+ ;;
+ esac
+ shift
+done
+
+[ "$PATHS" ] || PATHS=.
+
+vcs_dirs='\(\.\(svn\|hg\|git\|bzr\)\|_darcs\|_MTN\|CVS\)'
+get_list() {
+ local path="$1"
+
+ for dir in $(
+ if [ "$RECURSE" ]; then
+ find "$path" -type d ! -regex "$vcs_dirs"
+ else
+ find "$path" -maxdepth 1 -type d ! -regex "$vcs_dirs"
+ fi
+ ); do
+ changelog="$dir/debian/changelog"
+ if [ -f "$changelog" ] ; then
+ if head -n1 "$changelog" | grep -q UNRELEASED; then
+ echo $dir
+ fi
+ fi
+ done | sort
+}
+
+print_cl() {
+ local package="$1"
+ changelog="$package/debian/changelog"
+
+ # Check if more than one UNRELEASED entry at top of changelog
+ Ucount=$(grep "^[^ ]" $changelog | \
+ head -n2 | grep -c UNRELEASED)
+ if [ $Ucount -eq 1 ]; then
+ sed -n "1,/^ --/p" $changelog
+ else
+ echo "ERROR: changelog has more than one UNRELEASED entry!"
+ # Second sed is to add back a blank line between entries
+ sed -n "/^[^ ].*UNRELEASED/,/^ --/p" $changelog | \
+ sed '2,$s/^\([^ ]\)/\n\1/'
+ fi
+}
+
+first=""
+for path in $PATHS; do
+ if [ -z "$DO_CL" ]; then
+ echo "$(get_list "$path" | sed "s:^\./::")"
+ else
+ for package in $(get_list "$path"); do
+ [ -z "$first" ] || echo -e "\n====================\n"
+ first=1
+
+ print_cl "$package"
+ done
+ fi
+done