[PATCH] Makefile.common: bodhi update target

Luke Macken lmacken at redhat.com
Wed Nov 14 20:57:35 UTC 2007


Attached is my first attempt at a patch that should hopefully address all of the
concerns that were mentioned.  This Makefile target now can handle:

    - auto-populating all bugs listed in the last changelog entry.
    - aborting if the template (excluding comments) does not differ from
      the original

I also noticed that Till's Makefile grabs only 1 bugzilla # per line, even if
multiple are listed.  The attached patch can handle multiple bugs per line.

luke
-------------- next part --------------
--- Makefile.common	13 Nov 2007 16:34:28 -0000	1.81
+++ Makefile.common	14 Nov 2007 20:55:28 -0000
@@ -133,6 +133,7 @@ WGET	?= $(shell if test -f /usr/bin/wget
 CLIENT	?= $(if $(CURL),$(CURL),$(if $(WGET),$(WGET)))
 PLAGUE_CLIENT ?= $(shell which plague-client 2>/dev/null)
 BUILD_CLIENT ?= $(shell which koji 2>/dev/null)
+BODHI_CLIENT ?= $(shell which bodhi 2>/dev/null)
 
 # RPM with all the overrides in place; you can override this in your
 # .cvspkgsrc also, to use a default rpm setup
@@ -428,6 +429,21 @@ else
 build: plague
 endif
 
+
+bodhi: build-check $(COMMON_DIR)/branches clog
+	@if [ ! -x "$(BODHI_CLIENT)" ]; then echo "Must have bodhi-client installed"; exit 1; fi
+	@echo -e "# [ $(NAME)-$(VERSION)-$(RELEASE) ]\n# type=[S|B|E] (S=security, B=bugfix, E=enhancement)\n# request=[T|S] (T=testing, S=stable)\n# bug=123,456\n# all other text will be considered to be part of the update notes\ntype=" > bodhi.template
+	@grep '#' clog | xargs -n1 | sed -n -e 's,^#\([0-9]*\)$$,\1,p' | xargs | tr ' ' ',' > $(NAME).bugs
+	@if [ `cat $(NAME).bugs` ]; then echo "bug=`cat $(NAME).bugs`" >> bodhi.template; fi
+	@sed -e '/^#/d' < bodhi.template > bodhi.template.orig
+	@if [ -z "$$EDITOR" ]; then vi bodhi.template; else $$EDITOR bodhi.template; fi
+	@if [ -n "`sed -e '/^#/d' < bodhi.template | diff bodhi.template.orig -`" ]; then $(BODHI_CLIENT) --new --release $(subst -,,$(BRANCH)) --file bodhi.template $(NAME)-$(VERSION)-$(RELEASE); else echo "Bodhi update aborted!"; fi
+	@rm -f bodhi.template{,.orig} $(NAME).bugs clog
+
+ifneq (, $(filter F-8 F-7, $(BRANCH)))
+update: bodhi
+endif
+
 cvsurl:
 	@echo '$(CVS_URL)'
 


More information about the fedora-devel-list mailing list