# Makefile.common-addons.gmk # Addons for Fedora CVS Makefile # Author: Till Maas 2007 2008 2009 # # Version : 0.0.121+ # Release Date : 2009-02-15 ### Requirements ### # sed # wget ### SETUP ### # ## Edit your ~/.cvspkgsrc to include the following # # FAS_USERNAME= # -include /path/to/Makefile.common-addons.gmk ### Configuration ### # currently none ### Usage ### # type make help-addons after setup in a Fedora CVS rpm branch ### TODO ### # - publish updates to updates-testing after creation # - allow editing clog in make commit # - sync with devel target # - target to output the version of this makefile # - add checks for the branch it is running on # - add short alias targets for long targets # - add rebuild target # - add "add koji notification" target # - add echo cvslookaheadcache url show target ### Files ### # currently none used .DEFAULT_GOAL=sources EDITOR?=vim HELP_ADDONS=\nAddon-targets:\n HELP_MISSING=\nOfficial targets missing in help:\n # call strings help=$(shell /usr/bin/printf '%-30s %s\\n' "$(strip $1)" "$(strip $2)") koji-build=$(BUILD_CLIENT) $(SECONDARY_CONFIG) build $(1) $(BUILD_FLAGS) $(TARGET) '$2' # variables, that should be in Makefile.commong SRPMFILE=$(NAME)-$(VERSION)-$(RELEASE).src.rpm # Workaround variables comma = , , = , ## How to add someting to the help menu: # +=$(call help, , ) # Restrictions for helptext: # must not contain commas, use $(comma) instead # must only contain matching parenthesis or braces # leading, trailing whitespace will be stripped # multiple spaces will be merged into one #HELP_MISSING+=$(call help, <++>, <++>) HELP_MISSING+=$(call help, cvsurl, echo '$(CVS_URL)') HELP_MISSING+=$(call help, force-tag, Forces tag as '$(TAG)') HELP_MISSING+=$(call help, prep-, Run prep only for ) HELP_MISSING+=$(call help, upload, Upload the FILES$, adding to the ./sources manifest) #### USER TARGETS #### ## commit changes .PHONY:: commit HELP_ADDONS+=$(call help, commit, Commit changes to cvs with entries from spec changelog) commit: clog @cvs commit -F clog @rm clog ## show cvsurl of HEAD CVS_HEAD_URL=$(shell echo $(CVS_URL) | sed 's/\#.*/\#HEAD/') .PHONY:: cvsurl-head HELP_ADDONS+=$(call help, cvsurl-head, Show head cvsurl) cvsurl-head: @echo $(CVS_HEAD_URL) ## Help .PHONY:: help-addons HELP_ADDONS+=$(call help, help-addons, Shows the normal and the addon help text) help-addons: help @echo -ne "$(HELP_ADDONS)" @echo -e "Footnotes:\n¹ - there is a detailed help available with make help-topic TOPIC=''" @echo -ne "$(HELP_MISSING)" help-topic: @echo $(HELP_TOPIC_$(TOPIC)) ## Download koji buildlogs # Directory to store logs in KOJI_LOGS_DIR?=koji-logs-$(VERSION)-$(RELEASE) .PHONY:: koji-logs HELP_ADDONS+=$(call help, koji-logs, Download koji buildlogs) koji-logs: @wget --no-verbose --no-host-directories --cut-dirs 6 --directory-prefix=$(KOJI_LOGS_DIR) --continue --recursive $(KOJI_LOGS_URL)/{ppc,i386,x86_64,ppc64,noarch}/{root,build,mockconfig}.log || : ## show path to buildlogs # URL to koji logs KOJI_LOGS_URL=http://koji.fedoraproject.org/packages/$(NAME)/$(VERSION)/$(RELEASE)/data/logs/ .PHONY:: koji-logs-url HELP_ADDONS+=$(call help, koji-logs-url, Show URL to koji buildlogs) koji-logs-url: @echo $(KOJI_LOGS_URL) ## Show unreleased builds # seems to be a bad idea, because it takes very long (03:30 min) .PHONY:: koji-unreleased-builds HELP_ADDONS+=$(call help, koji-unreleased-builds, Shows which builds of yours need to be released) koji-unreleased-builds: $(BUILD_CLIENT) list-tagged --latest dist-fc7-updates-candidate | grep $(FAS_USERNAME) ## Scratch head build .PHONY:: scratch-head-build HELP_ADDONS+=$(call help, scratch-head-build, Creates a scratch build for all archs from cvs HEAD) scratch-head-build: koji-check $(call koji-build,--scratch,$(CVS_HEAD_URL)) ## Scratch head build with archlist # :TODO: make .PHONY work with scratch-build_% HELP_ADDONS+=$(call help, scratch-head-build_, Creates a scratch build for selected arches (comma separated) from cvs HEAD) scratch-head-build_%: koji-check FORCE $(call koji-build,--scratch --arch-override=$*,$(CVS_HEAD_URL)) # Used by make (patch, rediff), originally to remove timestamps, but here it removes the diff header for unused files, too. FILTERDIFF := filterdiff ## Create a backupf of all files using SUFFIX, unless such a backup does alread exist # :TODO: do not use $(NAME)-$(VERSION), but the new variable that exists for this case HELP_ADDONS+=$(call help, prepare-patch, creates a copy of every file with suffix .SUFFIX unless such a backup already exists) prepare-patch: @if test -z "$(SUFFIX)"; then echo "Must specify SUFFIX=whatever" ; exit 1; fi find $(NAME)-$(VERSION) -type f \! -regex ".*\\.$(SUFFIX)$$" -exec bash -c 'test -f {}."$(SUFFIX)" && echo skipping {}."$(SUFFIX)" || cp -a {} "{}.$(SUFFIX)"' \; ### HELPER TARGETS ### .PHONY:: koji-check koji-check: $(COMMON_DIR)/branches @if [ ! -x "$(BUILD_CLIENT)" ]; then echo "Please setup Koji, see: http://fedoraproject.org/wiki/Koji/UsingKoji"; exit 1; fi