aboutsummaryrefslogtreecommitdiff
path: root/pkgs/common-updater
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2019-04-12 18:22:06 +0200
committerJan Tojnar <jtojnar@gmail.com>2020-09-19 17:02:54 +0200
commitd351cea9f3a041c88d79fe9be5467bc7faabb4a4 (patch)
tree94393b935734b3542fcaa710d778a3e9823d677e /pkgs/common-updater
parent5adbeb13c5ae590ea31bf5599c54b9b604edc380 (diff)
common-updater-scripts: add --print-changes flag
Printing the changed file and new version can be used to commit the changes to git.
Diffstat (limited to 'pkgs/common-updater')
-rwxr-xr-xpkgs/common-updater/scripts/update-source-version12
1 files changed, 11 insertions, 1 deletions
diff --git a/pkgs/common-updater/scripts/update-source-version b/pkgs/common-updater/scripts/update-source-version
index 6a66f94597f4..ba628fd2a445 100755
--- a/pkgs/common-updater/scripts/update-source-version
+++ b/pkgs/common-updater/scripts/update-source-version
@@ -11,7 +11,7 @@ die() {
usage() {
echo "Usage: $scriptName <attr> <version> [<new-source-hash>] [<new-source-url>]"
echo " [--version-key=<version-key>] [--system=<system>] [--file=<file-to-update>]"
- echo " [--ignore-same-hash]"
+ echo " [--ignore-same-hash] [--print-changes]"
}
args=()
@@ -33,6 +33,9 @@ for arg in "$@"; do
--ignore-same-hash)
ignoreSameHash="true"
;;
+ --print-changes)
+ printChanges="true"
+ ;;
--help)
usage
exit 0
@@ -102,6 +105,9 @@ fi
if [[ "$oldVersion" = "$newVersion" ]]; then
echo "$scriptName: New version same as old version, nothing to do." >&2
+ if [ -n "$printChanges" ]; then
+ printf '[]\n'
+ fi
exit 0
fi
@@ -197,3 +203,7 @@ fi
rm -f "$nixFile.bak"
rm -f "$attr.fetchlog"
+
+if [ -n "$printChanges" ]; then
+ printf '[{"attrPath":"%s","oldVersion":"%s","newVersion":"%s","files":["%s"]}]\n' "$attr" "$oldVersion" "$newVersion" "$nixFile"
+fi