Stefan Tauner has uploaded this change for review. ( https://review.coreboot.org/21834
Change subject: fixup! Convert flashrom to git
......................................................................
fixup! Convert flashrom to git
refine the pre-push hook:
- refine wording as discussed in an earlier review(!)
- get rid of the concept of precious brances - all of them on the
upstream repos are precious (this is a change in the face of
using gerrit instead of a native git repository for staging purposes)
- likewise, only allow new versioned stable branches and no feature
branches there
Change-Id: I1d4b4a7ef2673cabee980ec4a7d7d5fbebdcaed1
---
M util/git-hooks/pre-push
1 file changed, 18 insertions(+), 21 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/34/21834/1
diff --git a/util/git-hooks/pre-push b/util/git-hooks/pre-push
index 5bae8d2..e3df0c5 100755
--- a/util/git-hooks/pre-push
+++ b/util/git-hooks/pre-push
@@ -22,15 +22,17 @@
zero=0000000000000000000000000000000000000000
upstream_pattern="github\.com.flashrom/flashrom(\.git)?|flashrom\.org.git/flashrom(\.git)?"
-precious_branches="stable staging"
-# Only care about the upstream repository
+# Only care about the upstream repositories
if echo "$url" | grep -q -v -E "$upstream_pattern" ; then
exit 0
fi
while read local_ref local_sha remote_ref remote_sha ; do
- if [ "$remote_ref" != "refs/heads/staging" -a "$remote_ref" != "refs/heads/stable" ]; then
+
+ # only allow the stable and staging branches as well as versioned stable branches...
+ version=$(expr ${remote_ref#*refs/heads/} : '\(\([0-9]\+\.\)\+\([0-9]\+\)\)$')
+ if [ "$remote_ref" != "refs/heads/staging" -a "$remote_ref" != "refs/heads/stable" -a -z "$version" ]; then
echo "Feature branches not allowed ($remote_ref)." >&2
exit 1
fi
@@ -40,32 +42,27 @@
exit 1
fi
- if [ "$remote_sha" = "$zero" ]; then
- echo "No new branches allowed." >&2
- exit 1
- fi
-
# Check for Signed-off-by and Acked-by
commit=$(git rev-list -n 1 --all-match --invert-grep -E \
- --grep '^Signed-off-by: .+ <.+@.+\..+>$' --grep '^Acked-by: .+ <.+@.+\..+>$' \
+ --grep '^Signed-off-by: .+ <.+@.+\..+>$' \
+ --grep '^Acked-by: .+ <.+@.+\..+>$' \
"$remote_sha..$local_sha")
if [ -n "$commit" ]; then
- echo "Commit $local_sha in $local_ref is missing either \"Signed-off-by\"" \
- " or \"Acked-by\" lines, not pushing." >&2
+ echo "Neither \"Signed-off-by\" nor \"Acked-by\" were found in commit $local_sha in " \
+ "$local_ref, not pushing." >&2
exit 1
fi
- # Make _really_ sure we do not rewrite precious history
- for lbranch in $precious_branches ; do
- if [ "$remote_ref" = "refs/heads/$lbranch" ]; then
- nonreachable=$(git rev-list $remote_sha ^$local_sha | head -1)
- if [ -n "$nonreachable" ]; then
- echo "Only fast-forward pushes are allowed on $lbranch." >&2
- echo "$nonreachable is not included in $remote_sha while pushing to $remote_ref" >&2
- exit 1
- fi
+ # Make _really_ sure we do not rewrite history of any head/branch
+ if [ "${remote_ref#*refs/heads/}" != "$remote_ref" ]; then
+ nonreachable=$(git rev-list $remote_sha ^$local_sha | head -1)
+ if [ -n "$nonreachable" ]; then
+ echo "Only fast-forward pushes are allowed on branches." >&2
+ echo "At least $nonreachable is not included in $remote_sha while pushing to " \
+ "$remote_ref" >&2
+ exit 1
fi
- done
+ fi
# FIXME: check commit log format (subject without full stop at the end etc).
# FIXME: do buildbot checks if authorized?
--
To view, visit https://review.coreboot.org/21834
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: staging
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1d4b4a7ef2673cabee980ec4a7d7d5fbebdcaed1
Gerrit-Change-Number: 21834
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Tauner <stefan.tauner(a)gmx.at>
Stefan Tauner has uploaded this change for review. ( https://review.coreboot.org/21833
Change subject: fixup! Convert flashrom to git
......................................................................
fixup! Convert flashrom to git
- update the commit-msg to check for duplicate signoffs/acks
Change-Id: Ia36147e673cceb6d175884b40d4bdd00015b96dc
---
M util/git-hooks/commit-msg
1 file changed, 18 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/33/21833/1
diff --git a/util/git-hooks/commit-msg b/util/git-hooks/commit-msg
index 3b3d541..6dfe2d4 100755
--- a/util/git-hooks/commit-msg
+++ b/util/git-hooks/commit-msg
@@ -6,6 +6,10 @@
#
# Copyright (C) 2009 The Android Open Source Project
#
+# Any other changes including test_duplicate_signoffs_acks
+#
+# Copyright (C) 2017 Stefan Tauner
+#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -188,5 +192,18 @@
git hash-object -t commit --stdin
}
+# Test for duplicate signoffs/acks
+test_duplicate_signoffs_acks() {
+ test "" = "$(grep -i '^(Signed-off-by|Acked-by): ' "$MSG" |
+ sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
+ echo "Duplicate Signed-off-by or Acked-by lines." >&2
+ exit 1
+ }
+}
-add_ChangeId
+main() {
+ test_duplicate_signoffs_acks
+ add_ChangeId
+}
+
+main
--
To view, visit https://review.coreboot.org/21833
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: staging
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia36147e673cceb6d175884b40d4bdd00015b96dc
Gerrit-Change-Number: 21833
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Tauner <stefan.tauner(a)gmx.at>
Stefan Tauner has uploaded this change for review. ( https://review.coreboot.org/21832
Change subject: fixup! Convert flashrom to git
......................................................................
fixup! Convert flashrom to git
- update the commit-msg hook to the latest one provided by Gerrit.
However, disable the (new) code that would avoid adding Change-IDs
to fixup/squash commits as needed on the staging branch
Change-Id: I2f2d7ae58dcd7d3e55959e18fe664df10bc3cc41
---
M util/git-hooks/commit-msg
1 file changed, 27 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/32/21832/1
diff --git a/util/git-hooks/commit-msg b/util/git-hooks/commit-msg
index 82f0581..3b3d541 100755
--- a/util/git-hooks/commit-msg
+++ b/util/git-hooks/commit-msg
@@ -1,6 +1,8 @@
#!/bin/sh
#
-# Part of Gerrit Code Review (http://code.google.com/p/gerrit/)
+# Change-ID amending from Gerrit Code Review 2.14.2
+#
+# Part of Gerrit Code Review (https://www.gerritcodereview.com/)
#
# Copyright (C) 2009 The Android Open Source Project
#
@@ -17,14 +19,16 @@
# limitations under the License.
#
-CHANGE_ID_AFTER="Bug|Issue"
+unset GREP_OPTIONS
+
+CHANGE_ID_AFTER="Bug|Depends-On|Issue|Test|Feature|Fixes|Fixed|Staging-ID"
MSG="$1"
# Check for, and add if missing, a unique Change-Id
#
add_ChangeId() {
clean_message=`sed -e '
- /^diff --git a\/.*/{
+ /^diff --git .*/{
s///
q
}
@@ -36,8 +40,19 @@
return
fi
+ # *Do* add Change-Id to temp commits (original code bails out here)
+ # if echo "$clean_message" | head -1 | grep -q '^\(fixup\|squash\)!'
+ # then
+ # return
+ # fi
+
+ if test "false" = "`git config --bool --get gerrit.createChangeId`"
+ then
+ return
+ fi
+
# Does Change-Id: already exist? if so, exit (no change).
- if grep -i '^Change-Id: I[0-9a-f]\{40\}$' "$MSG" >/dev/null
+ if grep -i '^Change-Id:' "$MSG" >/dev/null
then
return
fi
@@ -49,6 +64,10 @@
# Solaris AWK is just too broken
AWK=/usr/xpg4/bin/awk
fi
+
+ # Get core.commentChar from git config or use default symbol
+ commentChar=`git config --get core.commentChar`
+ commentChar=${commentChar:-#}
# How this works:
# - parse the commit message as (textLine+ blankLine*)*
@@ -68,13 +87,13 @@
blankLines = 0
}
- # Skip lines starting with "#" without any spaces before it.
- /^#/ { next }
+ # Skip lines starting with commentChar without any spaces before it.
+ /^'"$commentChar"'/ { next }
# Skip the line starting with the diff command and everything after it,
# up to the end of the file, assuming it is only patch data.
# If more than one line before the diff was empty, strip all but one.
- /^diff --git a/ {
+ /^diff --git / {
blankLines = 0
while (getline) { }
next
@@ -151,7 +170,7 @@
if (unprinted) {
print "Change-Id: I'"$id"'"
}
- }' "$MSG" > $T && mv $T "$MSG" || rm -f $T
+ }' "$MSG" > "$T" && mv "$T" "$MSG" || rm -f "$T"
}
_gen_ChangeIdInput() {
echo "tree `git write-tree`"
--
To view, visit https://review.coreboot.org/21832
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: staging
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2f2d7ae58dcd7d3e55959e18fe664df10bc3cc41
Gerrit-Change-Number: 21832
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Tauner <stefan.tauner(a)gmx.at>
Stefan Tauner has uploaded this change for review. ( https://review.coreboot.org/21831
Change subject: fixup! Convert flashrom to git
......................................................................
fixup! Convert flashrom to git
- wrap a line in the hook installer. The line still exceeds our
maximum limit by two chars but it makes no sense to break
apart the one long argument IMHO
Change-Id: I0e931fbb5902d2714d5399c1d1bfac0de35523bb
---
M util/git-hooks/install.sh
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/31/21831/1
diff --git a/util/git-hooks/install.sh b/util/git-hooks/install.sh
index bc90e37..d557c2f 100755
--- a/util/git-hooks/install.sh
+++ b/util/git-hooks/install.sh
@@ -14,6 +14,7 @@
if [ -e "${dst}$h" ]; then
mv "${dst}$h" "${dst}$h.local"
fi
- ln -s "$(git rev-parse --prefix $(git rev-parse --git-path hooks/) --show-cdup)${src}wrapper.sh" "${dst}$h"
+ ln -s "$(git rev-parse --prefix $(git rev-parse --git-path hooks/) --show-cdup)${src}wrapper.sh" \
+ "${dst}$h"
fi
done
--
To view, visit https://review.coreboot.org/21831
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: staging
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0e931fbb5902d2714d5399c1d1bfac0de35523bb
Gerrit-Change-Number: 21831
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Tauner <stefan.tauner(a)gmx.at>
Stefan Tauner has uploaded this change for review. ( https://review.coreboot.org/21830
Change subject: fixup! Convert flashrom to git
......................................................................
fixup! Convert flashrom to git
- exploit Make's -include statement to simplify execution flow
- expend and refine respective comment to better describe and
match the new behavior
- two other minor whitespace changes
Change-Id: I0c66f2508cc754cf9219211a06d6f305a32c422d
---
M Makefile
1 file changed, 5 insertions(+), 10 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/30/21830/1
diff --git a/Makefile b/Makefile
index b2db918..4484fc8 100644
--- a/Makefile
+++ b/Makefile
@@ -526,22 +526,17 @@
CLI_OBJS = cli_classic.o cli_output.o cli_common.o print.o
-# Makefile.VCS is used when packaging flashrom and is generated by the
-# export rule. If Makefile.VCS is not found, version info will be obtained
-# using util/getrevision.sh.
-ifeq ($(wildcard Makefile.VCS),)
+# Makefile.VCS stores metadata required by the build process when packaging flashrom. It is generated by the
+# export rule and imported below. If Makefile.VCS is not found and the variables are not defined by the user,
+# the info will be obtained using util/getrevision.sh, which is the common case during development.
+-include Makefile.VCS
VERSION ?= $(shell ./util/getrevision.sh --revision)
MAN_DATE ?= $(shell ./util/getrevision.sh --date $(PROGRAM).8.tmpl 2>/dev/null)
-else
-include Makefile.VCS
-endif
-# VERSION equals "offline" if online access is required but the respective git
-# config variable is not set yet.
+# VERSION equals "offline" if online access is required but the respective git config variable is not set yet.
ifeq ($(VERSION),offline)
$(error Aborting)
endif
-
SCMDEF := -D'FLASHROM_VERSION="$(VERSION)"'
# No spaces in release names unless set explicitly
--
To view, visit https://review.coreboot.org/21830
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: staging
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0c66f2508cc754cf9219211a06d6f305a32c422d
Gerrit-Change-Number: 21830
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Tauner <stefan.tauner(a)gmx.at>