[libvirt] [PATCH] Skip the 'copyright-check' on -maint branches

The maint branches will often have out of date copyright headers so we must skip the 'sc_copyright_check' rule there. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 11 +++++++++++ 1 file changed, 11 insertions(+) Perhaps there's a better way to detect -maint branches than the logic I tried. diff --git a/cfg.mk b/cfg.mk index 207dfeb..47c7798 100644 --- a/cfg.mk +++ b/cfg.mk @@ -88,6 +88,17 @@ else distdir: sc_vulnerable_makefile_CVE-2012-3386.z endif +GIT_BRANCH := $(shell if test -d $(srcdir)/.git; then \ + cd $(srcdir) && \ + (git status -s -b | grep '\#\#' | \ + sed -e 's/.*-maint/-maint/'); fi) + +# We fully expect -maint branches to have out of date +# copyright dates, so we must skip that check +ifeq ($(GIT_BRANCH),-maint) + local-checks-to-skip += sc_copyright_check +endif + # Files that should never cause syntax check failures. VC_LIST_ALWAYS_EXCLUDE_REGEX = \ (^(HACKING|docs/(news\.html\.in|.*\.patch))|\.po)$$ -- 1.8.5.3

On 02/04/2014 06:51 AM, Daniel P. Berrange wrote:
The maint branches will often have out of date copyright headers so we must skip the 'sc_copyright_check' rule there.
Is that the only rule, or are there others? But yeah, that's definitely the most annoying one.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 11 +++++++++++ 1 file changed, 11 insertions(+)
Perhaps there's a better way to detect -maint branches than the logic I tried.
diff --git a/cfg.mk b/cfg.mk index 207dfeb..47c7798 100644 --- a/cfg.mk +++ b/cfg.mk @@ -88,6 +88,17 @@ else distdir: sc_vulnerable_makefile_CVE-2012-3386.z endif
+GIT_BRANCH := $(shell if test -d $(srcdir)/.git; then \ + cd $(srcdir) && \ + (git status -s -b | grep '\#\#' | \ + sed -e 's/.*-maint/-maint/'); fi)
I'm still thinking about this one...
+ +# We fully expect -maint branches to have out of date +# copyright dates, so we must skip that check +ifeq ($(GIT_BRANCH),-maint) + local-checks-to-skip += sc_copyright_check +endif
But this part looks fine, once the GIT_BRANCH rule is optimized.
+ # Files that should never cause syntax check failures. VC_LIST_ALWAYS_EXCLUDE_REGEX = \ (^(HACKING|docs/(news\.html\.in|.*\.patch))|\.po)$$
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Thu, Feb 06, 2014 at 04:30:52PM -0700, Eric Blake wrote:
On 02/04/2014 06:51 AM, Daniel P. Berrange wrote:
The maint branches will often have out of date copyright headers so we must skip the 'sc_copyright_check' rule there.
Is that the only rule, or are there others? But yeah, that's definitely the most annoying one.
IMHO we should expect all syntax check rules to pass on -maint branches in general. Recent maint branches I've tried will pass if we just kill this date check. If we find more problems in the future we can just backlist them in the same way Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Thu, Feb 06, 2014 at 04:30:52PM -0700, Eric Blake wrote:
On 02/04/2014 06:51 AM, Daniel P. Berrange wrote:
The maint branches will often have out of date copyright headers so we must skip the 'sc_copyright_check' rule there.
Is that the only rule, or are there others? But yeah, that's definitely the most annoying one.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 11 +++++++++++ 1 file changed, 11 insertions(+)
Perhaps there's a better way to detect -maint branches than the logic I tried.
diff --git a/cfg.mk b/cfg.mk index 207dfeb..47c7798 100644 --- a/cfg.mk +++ b/cfg.mk @@ -88,6 +88,17 @@ else distdir: sc_vulnerable_makefile_CVE-2012-3386.z endif
+GIT_BRANCH := $(shell if test -d $(srcdir)/.git; then \ + cd $(srcdir) && \ + (git status -s -b | grep '\#\#' | \ + sed -e 's/.*-maint/-maint/'); fi)
I'm still thinking about this one...
I think the point is that we need to go to the root directory of the repository if we're in a submodule and this made me realize my root-searching one-liner in my rebuild script doesn't work for submodules, although it would be nicer to use it: TOPLEVEL=$(git rev-parse --show-toplevel 2>/dev/null || echo '.') Martin
+ +# We fully expect -maint branches to have out of date +# copyright dates, so we must skip that check +ifeq ($(GIT_BRANCH),-maint) + local-checks-to-skip += sc_copyright_check +endif
But this part looks fine, once the GIT_BRANCH rule is optimized.
+ # Files that should never cause syntax check failures. VC_LIST_ALWAYS_EXCLUDE_REGEX = \ (^(HACKING|docs/(news\.html\.in|.*\.patch))|\.po)$$
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 02/04/2014 06:51 AM, Daniel P. Berrange wrote:
The maint branches will often have out of date copyright headers so we must skip the 'sc_copyright_check' rule there.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 11 +++++++++++ 1 file changed, 11 insertions(+)
Perhaps there's a better way to detect -maint branches than the logic I tried.
Based on reading __git_ps1 (thanks, bash completion functions!) maybe you want to try: git describe --contains --all HEAD which directly gives you the current branch name that you are based off of, even when in the middle of a rebase on that branch.
diff --git a/cfg.mk b/cfg.mk index 207dfeb..47c7798 100644 --- a/cfg.mk +++ b/cfg.mk @@ -88,6 +88,17 @@ else distdir: sc_vulnerable_makefile_CVE-2012-3386.z endif
+GIT_BRANCH := $(shell if test -d $(srcdir)/.git; then \ + cd $(srcdir) && \ + (git status -s -b | grep '\#\#' | \ + sed -e 's/.*-maint/-maint/'); fi)
Even if we go with 'git status -s -b', you can shave a process by using sed -n '/##/ s/.*-maint/-maint/p' and skipping the grep (anyone using 'grep | sed' is almost always wasting a process).
+ +# We fully expect -maint branches to have out of date +# copyright dates, so we must skip that check +ifeq ($(GIT_BRANCH),-maint) + local-checks-to-skip += sc_copyright_check +endif + # Files that should never cause syntax check failures. VC_LIST_ALWAYS_EXCLUDE_REGEX = \ (^(HACKING|docs/(news\.html\.in|.*\.patch))|\.po)$$
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Daniel P. Berrange
-
Eric Blake
-
Martin Kletzander