summaryrefslogtreecommitdiff
path: root/git-interface/git-update.py
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2015-09-29 08:03:26 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2015-09-29 20:54:55 +0200
commit612300b39c3c19153fa4efa6cbb539c53f5f71ea (patch)
tree03174c8119262196c0c1dcb878fb2e82ed18c6f8 /git-interface/git-update.py
parent693e4b50a3fb57f90d802806fd1b8b78f21bd499 (diff)
Show a warning if .SRCINFO is unchanged
Warn users when a remote ref update does not change the content of .SRCINFO such that users are reminded of updating package meta data. Implements FS#46130. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'git-interface/git-update.py')
-rwxr-xr-xgit-interface/git-update.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/git-interface/git-update.py b/git-interface/git-update.py
index 4698382..b418525 100755
--- a/git-interface/git-update.py
+++ b/git-interface/git-update.py
@@ -169,6 +169,9 @@ def die(msg):
sys.stderr.write("error: {:s}\n".format(msg))
exit(1)
+def warn(msg):
+ sys.stderr.write("warning: {:s}\n".format(msg))
+
def die_commit(msg, commit):
sys.stderr.write("error: The following error " +
"occurred when parsing commit\n")
@@ -282,6 +285,13 @@ for commit in walker:
if not fname in commit.tree:
die_commit('missing source file: {:s}'.format(fname), str(commit.id))
+# Display a warning if .SRCINFO is unchanged.
+if sha1_old != "0000000000000000000000000000000000000000":
+ srcinfo_id_old = repo[sha1_old].tree['.SRCINFO'].id
+ srcinfo_id_new = repo[sha1_new].tree['.SRCINFO'].id
+ if srcinfo_id_old == srcinfo_id_new:
+ warn(".SRCINFO unchanged. The package database will not be updated!")
+
# Read .SRCINFO from the HEAD commit.
srcinfo_raw = repo[repo[sha1_new].tree['.SRCINFO'].id].data.decode()
srcinfo_raw = srcinfo_raw.split('\n')