mirror of
https://src.koozali.org/smeserver/common.git
synced 2024-11-21 20:17:27 +01:00
506 lines
20 KiB
Makefile
506 lines
20 KiB
Makefile
# -*- Makefile -*-
|
|
#
|
|
# Common Makefile for building RPMs
|
|
# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php)
|
|
# Copyright (C) 2004-2005 Red Hat, Inc.
|
|
# Copyright (C) 2005 Fedora Foundation
|
|
#
|
|
# $Id: Makefile.common,v 1.14 2022/06/08 18:44:49 jpp Exp $
|
|
|
|
# Define the common dir.
|
|
# This needs to happen first.
|
|
define find-common-dir
|
|
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then echo "$$d"; break ; fi ; done
|
|
endef
|
|
COMMON_DIR := $(shell $(find-common-dir))
|
|
|
|
# Branch and disttag definitions
|
|
# These need to happen second.
|
|
ifndef HEAD_BRANCH
|
|
HEAD_BRANCH := devel
|
|
endif
|
|
BASEDIR := $(shell basename `pwd`)
|
|
# using git
|
|
#VERG = $(shell [ `/usr/bin/git branch|awk '{print $$2}'` == 'master' ] && echo 11 || echo `/usr/bin/git branch | /usr/bin/awk '{print $$2}'`)
|
|
#PREF = $(shell [ `/usr/bin/git config --get remote.origin.url| cut -d/ -f4` == "smecontrib" ] && echo 'contrib' || echo 'sme')
|
|
# without git installed eg in chroot
|
|
# TODO change strategy for SME12 and above branch SME11 branch SME12 instead of master
|
|
VERG = $(shell [ `sed -r 's/\[branch "(.*)"\]/\1/;t;d' .git/config` == 'master' ] && echo 11 || echo `sed -r 's/\[branch "(.*)"\]/\1/;t;d' .git/config` )
|
|
PREF = $(shell [ `grep url -r .git/config | cut -d/ -f4` == "smecontribs" ] && echo 'contribs' || echo 'sme')
|
|
BRANCH := $(PREF)$(VERG)
|
|
$(info $$BRANCH is $(BRANCH); $$VERG is $(VERG); $$PREF is $(PREF) )
|
|
# gitea=>koji specific : smeserver=>os smecontrib=>smecontrib
|
|
KOJI_BUILD := $(if $(filter sme,$(PREF)),os,contribs)
|
|
GIT_ORG := $(if $(filter sme,$(PREF)),smeserver,smecontribs)
|
|
|
|
BRANCHINFO = $(shell grep ^$(BRANCH): $(COMMON_DIR)/branches | cut -d: --output-delimiter=" " -f2-)
|
|
TARGET := $(word 1, $(BRANCHINFO))
|
|
DIST = $(word 2, $(BRANCHINFO))
|
|
DISTVAR = $(word 3, $(BRANCHINFO))
|
|
DISTVAL = $(word 4, $(BRANCHINFO))
|
|
DISTDEF = $(shell echo $(DIST) | sed -e s/^\\\.//| sed -e s/\\\./_/ )
|
|
SMEVAL = $(word 5, $(BRANCHINFO))
|
|
DIST_DEFINES = --define "dist $(DIST)" --define "$(DISTVAR) $(DISTVAL)" --define "$(DISTDEF) 1" --define "sme $(SMEVAL)"
|
|
|
|
BUILD_FLAGS ?= $(KOJI_FLAGS)
|
|
|
|
LOCALARCH := $(if $(shell grep -i '^BuildArch:.*noarch' $(SPECFILE)), noarch, $(shell uname -m))
|
|
|
|
## a base directory where we'll put as much temporary working stuff as we can
|
|
ifndef WORKDIR
|
|
WORKDIR := $(shell pwd)
|
|
endif
|
|
## of course all this can also be overridden in your RPM macros file,
|
|
## but this way you can separate your normal RPM setup from your CVS
|
|
## setup. Override RPM_WITH_DIRS in ~/.cvspkgsrc to avoid the usage of
|
|
## these variables.
|
|
SRCRPMDIR ?= $(WORKDIR)
|
|
BUILDDIR ?= $(WORKDIR)
|
|
RPMDIR ?= $(WORKDIR)
|
|
MOCKDIR ?= $(WORKDIR)
|
|
MOCKCFG ?= smeserver-$(SMEVAL)-$(BUILDARCH)-base
|
|
## SOURCEDIR is special; it has to match the CVS checkout directory,
|
|
## because the CVS checkout directory contains the patch files. So it basically
|
|
## can't be overridden without breaking things. But we leave it a variable
|
|
## for consistency, and in hopes of convincing it to work sometime.
|
|
ifndef SOURCEDIR
|
|
SOURCEDIR := $(shell pwd)
|
|
endif
|
|
ifndef SPECDIR
|
|
SPECDIR := $(shell pwd)
|
|
endif
|
|
|
|
ifndef RPM_DEFINES
|
|
RPM_DEFINES := --define "_sourcedir $(SOURCEDIR)" \
|
|
--define "_specdir $(SPECDIR)" \
|
|
--define "_builddir $(BUILDDIR)" \
|
|
--define "_srcrpmdir $(SRCRPMDIR)" \
|
|
--define "_rpmdir $(RPMDIR)" \
|
|
$(DIST_DEFINES)
|
|
endif
|
|
|
|
# Initialize the variables that we need, but are not defined
|
|
# the version of the package
|
|
VER_REL := $(shell rpm $(RPM_DEFINES) $(DIST_DEFINES) -q --qf "%{VERSION} %{RELEASE}\n" --specfile $(SPECFILE)| head -1)
|
|
ifndef NAME
|
|
$(error "You can not run this Makefile without having NAME defined")
|
|
endif
|
|
ifndef VERSION
|
|
VERSION := $(word 1, $(VER_REL))
|
|
endif
|
|
# the release of the package
|
|
ifndef RELEASE
|
|
RELEASE := $(word 2, $(VER_REL))
|
|
endif
|
|
# this is used in make patch, maybe make clean eventually.
|
|
# would be nicer to autodetermine from the spec file...
|
|
RPM_BUILD_DIR ?= $(BUILDDIR)/$(NAME)-$(VERSION)
|
|
|
|
#needed for archivefile rule
|
|
TREEPATH := $(NAME)-$(VERSION)
|
|
CODEDIR := "root"
|
|
TEMPDIR := $(shell mktemp -d)
|
|
EXT := $(shell cat $(NAME).spec | grep -e '^[S|s]ource' | head -n 1 | sed 's/Source: //' | sed -E 's/^([^.]*\.)(.*)$/\2//')
|
|
#ARCHIVEFILE=$(cat ${NAME}.spec | grep -e '^[S|s]ource' | sed -r 's/^[S|s]ource[0-9]?:\s?//' | xargs basename)
|
|
#ARCHIVEFILE=$(rpm --queryformat "${ARCHIVEFILE}\n" --specfile ${NAME}.spec | head -n 1)
|
|
#ifeq (,$(wildcard archivefilename))
|
|
#ARCHIVEFILE := "$(NAME)-$(VERSION).tar.gz"
|
|
#else
|
|
#ARCHIVEFILE := $(shell cat archivefilename)
|
|
#endif
|
|
ARCHIVEFILE := $(shell cat $(NAME).spec | grep -e '^[S|s]ource' | sed -r 's/^[S|s]ource[0-9]?:\s?//' | sed -e 's/{//g' -e 's/}//g' -e "s/%name/$(NAME)/g" -e "s/%version/$(VERSION)/g" | xargs basename)
|
|
|
|
# default target:
|
|
all:
|
|
|
|
# The repository and the clients we use for the files
|
|
REPOSITORY ?= http://buildsys.contribs.org/source
|
|
UPLOAD_REPOSITORY ?= /build/builds/source
|
|
|
|
# We define CURL and WGET in a way that makes if possible to have them
|
|
# overwritten from the module's Makefiles. Then CLIENT picks CURL, otherwise WGET
|
|
CURL ?= $(shell if test -f /usr/bin/curl ; then echo "curl -H Pragma: -O -R -S --fail --show-error" ; fi)
|
|
WGET ?= $(shell if test -f /usr/bin/wget ; then echo "wget -nd -m" ; fi)
|
|
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
|
|
# the rpm build command line
|
|
ifndef RPM
|
|
RPM := rpmbuild
|
|
endif
|
|
ifndef RPM_WITH_DIRS
|
|
RPM_WITH_DIRS = $(RPM) $(RPM_DEFINES)
|
|
endif
|
|
|
|
# CVS-safe version/release -- a package name like 4Suite screws things
|
|
# up, so we have to remove the leaving digits from the name
|
|
TAG_NAME := $(shell echo $(NAME) | sed -e s/\\\./_/g -e s/^[0-9]\\\+//g)
|
|
TAG_VERSION := $(shell echo $(VERSION) | sed s/\\\./_/g)
|
|
TAG_RELEASE := $(shell echo $(RELEASE) | sed s/\\\./_/g)
|
|
|
|
# tag to export, defaulting to current tag in the spec file
|
|
#TAG?=$(TAG_NAME)-$(TAG_VERSION)-$(TAG_RELEASE)
|
|
# simpler tagging using GIT
|
|
TAG?=$(TAG_VERSION)-$(TAG_RELEASE)
|
|
|
|
#TODO remove was CVS specific # retrieve the stored md5 sum for a source download
|
|
define get_sources_md5
|
|
$(shell cat sources 2>/dev/null | while read m f ; do if test "$$f" = "$@" ; then echo $$m ; break ; fi ; done)
|
|
endef
|
|
|
|
# list the possible targets for valid arches
|
|
ARCHES = noarch i386 i586 i686 x86_64 aarch64 # ia64 s390 s390x ppc ppc64 pseries ppc64pseries iseries ppc64iseries athlon alpha alphaev6 sparc sparc64 sparcv9 sparcv9v sparc64v i164 mac sh mips geode
|
|
|
|
# for the modules that do different "make prep" depending on what arch we build for
|
|
PREP_ARCHES = $(addprefix prep-,$(ARCHES))
|
|
|
|
## list all our bogus targets
|
|
.PHONY :: $(ARCHES) $(ARCHIVEFILE) clog commit sources uploadsource upload check build build-check plague koji build chain-build test-srpm srpm tag tagbuild force-tag verrel new clean patch prep compile install install-short compile-short FORCE local scratch-build scratch-build-%
|
|
|
|
# The TARGETS define is meant for local module targets that should be
|
|
# made in addition to the SOURCEFILES whenever needed
|
|
TARGETS ?= $(ARCHIVEFILE)
|
|
#TARGETS ?=
|
|
|
|
# default target - retrieve/rebuild the sources and make the module specific targets
|
|
sources: $(TARGETS)
|
|
|
|
# allow overriding buildarch so you can do, say, an i386 build on x86_64
|
|
ifndef BUILDARCH
|
|
BUILDARCH := $(shell rpm --eval "%{_arch}")
|
|
endif
|
|
|
|
# test build in mock
|
|
mockbuild : srpm
|
|
mock $(MOCKARGS) -r $(MOCKCFG) --resultdir=$(MOCKDIR)/$(TAG) rebuild $(SRCRPMDIR)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm
|
|
|
|
# check the build with rpmlint
|
|
lint:
|
|
@test -e $(NAME)-$(VERSION)-$(RELEASE).src.rpm || (echo "run 'make local' first" ; exit 1 )
|
|
rpmlint $(NAME)-$(VERSION)-$(RELEASE).src.rpm $(LOCALARCH)/*-$(VERSION)-$(RELEASE).$(LOCALARCH).rpm
|
|
|
|
# build for a particular arch
|
|
$(ARCHES) : sources $(TARGETS)
|
|
$(RPM_WITH_DIRS) --target $@ -ba $(SPECFILE) 2>&1 | tee .build-$(VERSION)-$(RELEASE).log ; exit $${PIPESTATUS[0]}
|
|
|
|
# empty target to force checking
|
|
FORCE:
|
|
|
|
# build whatever's appropriate for the local architecture
|
|
local: $(LOCALARCH)
|
|
|
|
# attempt to apply all the patches, optionally only for a particular arch
|
|
ifdef PREPARCH
|
|
prep: sources $(TARGETS)
|
|
$(RPM_WITH_DIRS) --nodeps -bp --target $(PREPARCH) $(SPECFILE)
|
|
else
|
|
prep: sources $(TARGETS)
|
|
$(RPM_WITH_DIRS) --nodeps -bp $(SPECFILE)
|
|
endif
|
|
|
|
# this allows for make prep-i686, make prep-ppc64, etc
|
|
prep-% : Makefile
|
|
$(MAKE) prep PREPARCH=$*
|
|
|
|
compile: sources $(TARGETS)
|
|
$(RPM_WITH_DIRS) -bc $(SPECFILE)
|
|
|
|
install: sources $(TARGETS)
|
|
$(RPM_WITH_DIRS) -bi $(SPECFILE)
|
|
|
|
compile-short: sources $(TARGETS)
|
|
$(RPM_WITH_DIRS) --nodeps --short-circuit -bc $(SPECFILE)
|
|
|
|
install-short: sources $(TARGETS)
|
|
$(RPM_WITH_DIRS) --nodeps --short-circuit -bi $(SPECFILE)
|
|
|
|
#TODO remove was CVS specific
|
|
CVS_ROOT := $(shell if [ -f CVS/Root ] ; then cat CVS/Root ; fi)
|
|
GIT_REPOSITORY := $(shell basename `git rev-parse --show-toplevel`)
|
|
GIT_URL := git+https://src.koozali.org/$(GIT_ORG)/$(GIT_REPOSITORY)\#$(TAG)
|
|
|
|
## build a test-srpm and see if it will -bp on all arches
|
|
# XXX: I am not sure exactly what this is supposed to really do, since the
|
|
# query format returns (none) most of the time, and that is not
|
|
# handled --gafton
|
|
check: test-srpm
|
|
@archs=`rpm -qp $(SRCRPMDIR)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm --qf "[%{EXCLUSIVEARCH}\n]" | egrep -v "(i586)|(i686)|(athlon)"` ;\
|
|
if test -z "$$archs"; then archs=noarch; fi ; \
|
|
echo "Checking arches: $$archs" ; \
|
|
for arch in $$archs; do \
|
|
echo "Checking $$arch..."; \
|
|
if ! $(RPM_WITH_DIRS) -bp --target $$arch $(SPECFILE); then \
|
|
echo "*** make prep failed for $$arch"; \
|
|
exit 1; \
|
|
fi; \
|
|
done;
|
|
|
|
## use this to build an srpm locally
|
|
ifneq (, $(filter contribs7 contribs8 contribs9, $(BRANCH)))
|
|
srpm: sources $(TARGETS)
|
|
$(RPM_WITH_DIRS) $(DIST_DEFINES) --define _source_filedigest_algorithm=md5 --nodeps -bs $(SPECFILE)
|
|
else
|
|
srpm: sources $(TARGETS)
|
|
$(RPM_WITH_DIRS) $(DIST_DEFINES) --nodeps -bs $(SPECFILE)
|
|
endif
|
|
|
|
# Create the .tar.gz or whatever file
|
|
$(ARCHIVEFILE):
|
|
$(info create or update ${ARCHIVEFILE} archive)
|
|
@mkdir -p "${TEMPDIR}/${TREEPATH}" ;\
|
|
if [ -d ${CODEDIR} ] ; then cp -R "${CODEDIR}" "${TEMPDIR}/${TREEPATH}" ; fi ; \
|
|
if [ -e createlinks ] ; then cp createlinks "${TEMPDIR}/${TREEPATH}/." ; fi ; \
|
|
if [ -d additional ] ; then cp -r additional/* "${TEMPDIR}/${TREEPATH}/." ; fi ; \
|
|
find "${TEMPDIR}/${TREEPATH}/." -type f -name ".gitignore" -delete ; \
|
|
rm -f ${ARCHIVEFILE} ;\
|
|
tar -caf "${ARCHIVEFILE}" -C "${TEMPDIR}" "${TREEPATH}" ;\
|
|
ls -l ${ARCHIVEFILE} ;\
|
|
rm -Rf "${TEMPDIR}/${TREEPATH}/"
|
|
|
|
test-srpm: srpm
|
|
|
|
verrel:
|
|
@echo $(NAME)-$(VERSION)-$(RELEASE)
|
|
|
|
# If you build a new version into the tree, first do "make tag",
|
|
# then "make srpm", then build the package.
|
|
tag:: $(SPECFILE) $(COMMON_DIR)/branches
|
|
git tag $(TAG_OPTS) -a $(TAG) -m $(TAG)
|
|
git push --tag
|
|
@echo "Tagged with: $(TAG)"
|
|
@echo
|
|
|
|
tagbuild: tag build clog
|
|
@rm -f clog
|
|
|
|
force-tag: $(SPECFILE) $(COMMON_DIR)/branches
|
|
@$(MAKE) tag TAG_OPTS="-F $(TAG_OPTS)"
|
|
|
|
define find-user
|
|
if [ -f CVS/Root ] ; then if [ `cat CVS/Root |grep -c [^:]@` -ne 0 ]; then cat CVS/Root |cut -d @ -f 1 | sed 's/:.*://' ; else echo $(USER); fi ; else echo $(USER);fi
|
|
endef
|
|
USER := $(shell $(find-user))
|
|
|
|
build-check: $(SPECFILE)
|
|
@git tag 2>/dev/null | grep -q $(TAG); ret=$$? ;\
|
|
if [ $$ret -ne 0 ]; then echo "$(SPECFILE) not tagged with tag $(TAG)"; exit 1; fi
|
|
|
|
koji: build-check $(COMMON_DIR)/branches
|
|
@if [ ! -x "$(BUILD_CLIENT)" ]; then echo "Must have koji installed - see http://fedoraproject.org/wiki/BuildSystemClientSetup"; exit 1; fi
|
|
$(BUILD_CLIENT) $(SECONDARY_CONFIG) build --nowait $(BUILD_FLAGS) $(TARGET)-$(KOJI_BUILD) '$(GIT_URL)'
|
|
|
|
#ifneq (, $(filter devel, $(BRANCH)))
|
|
build:: koji
|
|
#else
|
|
#build: plague
|
|
#endif
|
|
|
|
# TODO rework or remove
|
|
scratch-build: build-check
|
|
@if [ ! -x "$(BUILD_CLIENT)" ]; then echo "Must have koji installed - see http://fedoraproject.org/wiki/BuildSystemClientSetup"; exit 1; fi
|
|
$(BUILD_CLIENT) $(SECONDARY_CONFIG) build --scratch $(BUILD_FLAGS) $(TARGET) '$(GIT_URL)'
|
|
|
|
# TODO rework or remove
|
|
scratch-build-%: build-check
|
|
@if [ ! -x "$(BUILD_CLIENT)" ]; then echo "Must have koji installed - see http://fedoraproject.org/wiki/BuildSystemClientSetup"; exit 1; fi
|
|
$(BUILD_CLIENT) $(SECONDARY_CONFIG) build --scratch --arch-override=$* $(BUILD_FLAGS) $(TARGET) '$(GIT_URL)'
|
|
|
|
# TODO rework or remove
|
|
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) (required)\n\
|
|
# request=[T|S] (T=testing, S=stable) (default: testing)\n\
|
|
# bug=123,456\n\
|
|
# all other text will be considered to be part of the update notes\n\
|
|
type=" > bodhi.template
|
|
@grep -iZ '\[SME' clog | xargs -0n1 | sed -n -e 's,[^]]*\[SME[: ]*\([0-9]*\)\],\1 ,igp' | 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) -v --new --release $(subst -,,$(BRANCH)) \
|
|
--file bodhi.template $(NAME)-$(VERSION)-$(RELEASE) -u $(BODHI_USER); \
|
|
else \
|
|
echo "Bodhi update aborted!"; \
|
|
fi
|
|
@rm -f bodhi.template{,.orig} $(NAME).bugs clog
|
|
|
|
ifndef $(BODHI_USER)
|
|
BODHI_USER=$(USER)
|
|
endif
|
|
|
|
ifneq (, $(filter contribs7 contribs8 contribs9, $(BRANCH)))
|
|
update: bodhi
|
|
endif
|
|
|
|
giturl:
|
|
@echo '$(GIT_URL)'
|
|
|
|
# TODO rework or remove
|
|
chain-build: build-check
|
|
@if [ -z "$(CHAIN)" ]; then \
|
|
echo "Missing CHAIN variable, please specify the order of packages to" ; \
|
|
echo "chain build. For example: make chain-build CHAIN='foo bar'" ; \
|
|
exit 1 ; \
|
|
fi ; \
|
|
set -e ; \
|
|
subdir=`basename $$(pwd)` ; \
|
|
urls="" ; \
|
|
for component in $(CHAIN) ; do \
|
|
if [ "$$component" = "$(NAME)" ]; then \
|
|
echo "$(NAME) must not appear in CHAIN" ; \
|
|
exit 1 ; \
|
|
fi ; \
|
|
if [ "$$component" = ":" ]; then \
|
|
urls="$$urls :" ; \
|
|
continue ; \
|
|
elif [ -n "$$urls" -a -z "$(findstring :,$(CHAIN))" ]; then \
|
|
urls="$$urls :" ; \
|
|
fi ; \
|
|
rm -rf .tmp-$$$$ ; \
|
|
mkdir -p .tmp-$$$$ ; \
|
|
pushd .tmp-$$$$ > /dev/null ; \
|
|
cvs -f -Q -z 3 -d $(CVS_ROOT) co $$component ; \
|
|
urls="$$urls `make -s -C $$component/$$subdir giturl`" ; \
|
|
popd > /dev/null ; \
|
|
rm -rf .tmp-$$$$ ; \
|
|
done ; \
|
|
if [ -z "$(findstring :,$(CHAIN))" ]; then \
|
|
urls="$$urls :" ; \
|
|
fi ; \
|
|
urls="$$urls `make -s giturl`" ; \
|
|
$(BUILD_CLIENT) chain-build $(BUILD_FLAGS) $(TARGET) $$urls
|
|
|
|
# TODO rework or remove
|
|
# "make new | less" to see what has changed since the last tag was assigned
|
|
new:
|
|
-@cvs diff -u -r$$(cvs log Makefile 2>/dev/null | awk '/^symbolic names:$$/ {getline; sub(/^[ \t]*/, "") ; sub (/:.*$$/, ""); print; exit 0}')
|
|
|
|
# TODO rework or remove
|
|
# mop up, printing out exactly what was mopped.
|
|
clean ::
|
|
@echo "Running the %clean script of the rpmbuild..."
|
|
-@$(RPM_WITH_DIRS) --clean --nodeps $(SPECFILE)
|
|
#@for F in $(FULLSOURCEFILES); do \
|
|
# if test -e $$F ; then \
|
|
# echo "Deleting $$F" ; /bin/rm -f $$F ; \
|
|
# fi; \
|
|
# done
|
|
#@if test -d $(TMPCVS); then \
|
|
# echo "Deleting CVS dir $(TMPCVS)" ; \
|
|
# /bin/rm -rf $(TMPCVS); \
|
|
#fi
|
|
@if test -e $(SRCRPMDIR)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm ; then \
|
|
echo "Deleting $(SRCRPMDIR)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm" ; \
|
|
/bin/rm -f $(SRCRPMDIR)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm ; \
|
|
fi
|
|
@rm -fv *~ clog
|
|
@echo "Fully clean!"
|
|
|
|
# To prevent CVS noise due to changing file timestamps, upgrade
|
|
# to patchutils-0.2.23-3 or later, and add to ~/.cvspkgsrc:
|
|
# FILTERDIFF := filterdiff --remove-timestamps
|
|
ifndef FILTERDIFF
|
|
FILTERDIFF := cat
|
|
endif
|
|
|
|
ifdef CVE
|
|
PATCHFILE := $(NAME)-$(VERSION)-CVE-$(CVE).patch
|
|
SUFFIX := cve$(shell echo $(CVE) | sed s/.*-//)
|
|
else
|
|
PATCHFILE := $(NAME)-$(VERSION)-$(SUFFIX).patch
|
|
endif
|
|
|
|
patch:
|
|
@if test -z "$(SUFFIX)"; then echo "Must specify SUFFIX=whatever" ; exit 1; fi
|
|
(cd $(RPM_BUILD_DIR)/.. && gendiff $(NAME)-$(VERSION) .$(SUFFIX) | $(FILTERDIFF)) > $(PATCHFILE) || true
|
|
@if ! test -s $(PATCHFILE); then echo "Patch is empty!"; exit 1; fi
|
|
@echo "Created $(PATCHFILE)"
|
|
#@grep "$(PATCHFILE)" CVS/Entries >&/dev/null || cvs add -ko $(PATCHFILE) || true
|
|
|
|
# Recreates the patch file of specified suffix from the current working sources
|
|
# but keeping any comments at the top of file intact, and backing up the old copy
|
|
# with a '~' suffix.
|
|
rediff:
|
|
@if test -z "$(SUFFIX)"; then echo "Must specify SUFFIX=whatever" ; exit 1; fi
|
|
@if ! test -f "$(PATCHFILE)"; then echo "$(PATCHFILE) not found"; exit 1; fi
|
|
@mv -f $(PATCHFILE) $(PATCHFILE)\~
|
|
@sed '/^--- /,$$d' < $(PATCHFILE)\~ > $(PATCHFILE)
|
|
@(cd $(RPM_BUILD_DIR)/.. && gendiff $(NAME)-$(VERSION) .$(SUFFIX) | $(FILTERDIFF)) >> $(PATCHFILE) || true
|
|
|
|
clog: $(SPECFILE)
|
|
@sed -n '/^%changelog/,/^$$/{/^%/d;/^$$/d;s/%%/%/g;p}' $(SPECFILE) | tee $@
|
|
|
|
commit: clog
|
|
@git commit -F clog
|
|
@rm -f clog
|
|
@git push
|
|
|
|
commitonly: clog
|
|
@git commit -F clog
|
|
@rm -f clog
|
|
|
|
push:
|
|
@git push
|
|
|
|
help:
|
|
@echo "Usage: make <target>"
|
|
@echo "Available targets are:"
|
|
@echo " help Show this text"
|
|
@echo " sources Download/build source files"
|
|
@echo " <arch> Local test rpmbuild binary"
|
|
@echo " local Local test rpmbuild binary"
|
|
@echo " prep Local test rpmbuild prep"
|
|
@echo " compile Local test rpmbuild compile"
|
|
@echo " install Local test rpmbuild install"
|
|
@echo " compile-short Local test rpmbuild short-circuit compile"
|
|
@echo " install-short Local test rpmbuild short-circuit install"
|
|
@echo " lint Run rpmlint against local build output"
|
|
@echo " check Check test srpm preps on all archs"
|
|
@echo " srpm Create a srpm"
|
|
@echo " tag Tag sources as \"$(TAG)\""
|
|
@echo " tagbuild Tag sources as \"$(TAG)\" and then build"
|
|
@echo " build Request build of \"$(TAG)\" for $(TARGET)"
|
|
@echo " chain-build Build current package in order with other packages"
|
|
@echo " example: make chain-build CHAIN='libwidget libgizmo'"
|
|
@echo " The current package is added to the end of the CHAIN list."
|
|
@echo " Colons (:) can be used in the CHAIN parameter to define dependency groups."
|
|
@echo " Packages in a single group will be built in parallel, and all packages"
|
|
@echo " in a group must build successfully and populate the repository before"
|
|
@echo " the next group will begin building."
|
|
@echo " If no groups are defined, packages will be built sequentially."
|
|
@echo " scratch-build Request scratch build of \"$(TAG)\" for $(TARGET)"
|
|
@echo " scratch-build-<archs> Request scratch build of \"$(TAG)\" for $(TARGET) and archs <archs>"
|
|
@echo " examples: make scratch-build-i386,ppc64"
|
|
@echo " make scratch-build-x86_64"
|
|
@echo " mockbuild Local test build using mock"
|
|
@echo " verrel Echo \"$(NAME)-$(VERSION)-$(RELEASE)\""
|
|
@echo " new Diff against last tag"
|
|
@echo " clog Make a clog file containing top changelog entry"
|
|
@echo " commit Commit and push to GIT using the clog file as the log message"
|
|
@echo " commitonly Commit to GIT using the clog file as the log message"
|
|
@echo " push Push to GIT after a git commit or make commitonly"
|
|
@echo " clean Remove srcs and srpm ($(NAME)-$(VERSION)-$(RELEASE).src.rpm)"
|
|
@echo " patch SUFFIX=<suff> Create and add a gendiff patch file"
|
|
@echo " rediff SUFFIX=<suff> Recreates a gendiff patch file, retaining comments"
|
|
@echo " unused-patches Print list of patches not referenced by name in specfile"
|
|
@echo " unused-fedora-patches Print Fedora patches not used by Patch and/or ApplyPatch directives"
|
|
@echo " gimmespec Print the name of the specfile"
|
|
@echo " update Submit $(NAME)-$(VERSION)-$(RELEASE) as an update for $(BRANCH)"
|
|
|
|
gimmespec:
|
|
@echo "$(SPECFILE)"
|
|
|
|
unused-patches:
|
|
@for f in *.patch; do if [ -e $$f ]; then grep -q $$f $(SPECFILE) || echo $$f; fi; done
|
|
|
|
unused-fedora-patches:
|
|
@for f in *.patch; do if [ -e $$f ]; then (egrep -q "^Patch[[:digit:]]+:[[:space:]]+$$f" $(SPECFILE) || echo "Unused: $$f") && egrep -q "^ApplyPatch[[:space:]]+$$f" $(SPECFILE) || echo "Unapplied: $$f"; fi; done
|
|
|