This commit is contained in:
Jean-Philippe Pialasse 2024-03-17 16:20:25 -04:00
parent 9abc8dd9cb
commit 9eb3ba514a

View File

@ -31,10 +31,6 @@ VERG = $(shell [ `sed -r 's/\[branch "(.*)"\]/\1/;t;d' .git/config` == 'master'
PREF = $(shell [ `grep url -r .git/config | cut -d/ -f4` == "smecontrib" ] && echo 'contrib' || echo 'sme') PREF = $(shell [ `grep url -r .git/config | cut -d/ -f4` == "smecontrib" ] && echo 'contrib' || echo 'sme')
BRANCH := $(PREF)$(VERG) BRANCH := $(PREF)$(VERG)
$(info $$BRANCH is $(BRANCH); $$VERG is $(VERG); $$PREF is $(PREF) ) $(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,smecontrib)
BRANCHINFO = $(shell grep ^$(BRANCH): $(COMMON_DIR)/branches | cut -d: --output-delimiter=" " -f2-) BRANCHINFO = $(shell grep ^$(BRANCH): $(COMMON_DIR)/branches | cut -d: --output-delimiter=" " -f2-)
TARGET := $(word 1, $(BRANCHINFO)) TARGET := $(word 1, $(BRANCHINFO))
DIST = $(word 2, $(BRANCHINFO)) DIST = $(word 2, $(BRANCHINFO))
@ -151,9 +147,7 @@ TAG_VERSION := $(shell echo $(VERSION) | sed s/\\\./_/g)
TAG_RELEASE := $(shell echo $(RELEASE) | sed s/\\\./_/g) TAG_RELEASE := $(shell echo $(RELEASE) | sed s/\\\./_/g)
# tag to export, defaulting to current tag in the spec file # tag to export, defaulting to current tag in the spec file
#TAG?=$(TAG_NAME)-$(TAG_VERSION)-$(TAG_RELEASE) TAG?=$(TAG_NAME)-$(TAG_VERSION)-$(TAG_RELEASE)
# simpler tagging using GIT
TAG?=$(TAG_VERSION)-$(TAG_RELEASE)
# where to cvs export temporarily # where to cvs export temporarily
TMPCVS := $(WORKDIR)/cvs-$(TAG) TMPCVS := $(WORKDIR)/cvs-$(TAG)
@ -322,9 +316,7 @@ install-short: sources $(TARGETS)
CVS_ROOT := $(shell if [ -f CVS/Root ] ; then cat CVS/Root ; fi) CVS_ROOT := $(shell if [ -f CVS/Root ] ; then cat CVS/Root ; fi)
CVS_REPOSITORY := $(shell if [ -f CVS/Repository ] ; then cat CVS/Repository ; fi) CVS_REPOSITORY := $(shell if [ -f CVS/Repository ] ; then cat CVS/Repository ; fi)
GIT_REPOSITORY := $(shell basename `git rev-parse --show-toplevel`)
CVS_URL := cvs://shell.koozali.org/cvs/smecontribs?$(CVS_REPOSITORY)\#$(TAG) CVS_URL := cvs://shell.koozali.org/cvs/smecontribs?$(CVS_REPOSITORY)\#$(TAG)
GIT_URL := https://src.koozali.org/$(GIT_ORG)/$(GIT_REPOSITORY)\#$(TAG)
## create a clean exported copy in $(TMPCVS) ## create a clean exported copy in $(TMPCVS)
export:: sources export:: sources
@ -383,20 +375,13 @@ verrel:
# If you build a new version into the tree, first do "make tag", # If you build a new version into the tree, first do "make tag",
# then "make srpm", then build the package. # then "make srpm", then build the package.
tagcvs:: $(SPECFILE) $(COMMON_DIR)/branches
cvs tag $(TAG_OPTS) -c $(TAG)
@echo "Tagged with: $(TAG)"
@echo
tag:: $(SPECFILE) $(COMMON_DIR)/branches tag:: $(SPECFILE) $(COMMON_DIR)/branches
git tag $(TAG_OPTS) -a $(TAG) -m $(TAG) cvs tag $(TAG_OPTS) -c $(TAG)
git push --tag
@echo "Tagged with: $(TAG)" @echo "Tagged with: $(TAG)"
@echo @echo
force-tag: $(SPECFILE) $(COMMON_DIR)/branches force-tag: $(SPECFILE) $(COMMON_DIR)/branches
@$(MAKE) tag TAG_OPTS="-F $(TAG_OPTS)" @$(MAKE) tag TAG_OPTS="-F $(TAG_OPTS)"
define find-user 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 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 endef
@ -415,32 +400,24 @@ oldbuild: $(COMMON_DIR)/branches
cvs commit -m "request build of $(CVS_REPOSITORY) $(TAG) for $(TARGET)" tobuild ;\ cvs commit -m "request build of $(CVS_REPOSITORY) $(TAG) for $(TARGET)" tobuild ;\
popd >/dev/null) popd >/dev/null)
build-checkcvs: $(SPECFILE) build-check: $(SPECFILE)
@if [ -z "$(TARGET)" -o ! -d CVS ]; then echo "Must be in a branch subdirectory"; exit 1; fi @if [ -z "$(TARGET)" -o ! -d CVS ]; then echo "Must be in a branch subdirectory"; exit 1; fi
@cvs -f status -v $(SPECFILE) 2>/dev/null | grep -q $(TAG); ret=$$? ;\ @cvs -f status -v $(SPECFILE) 2>/dev/null | grep -q $(TAG); ret=$$? ;\
if [ $$ret -ne 0 ]; then echo "$(SPECFILE) not tagged with tag $(TAG)"; exit 1; fi if [ $$ret -ne 0 ]; then echo "$(SPECFILE) not tagged with tag $(TAG)"; exit 1; fi
build-check: $(SPECFILE) plague: build-check $(COMMON_DIR)/branches
@git tag 2>/dev/null | grep -q $(TAG); ret=$$? ;\
if [ $$ret -ne 0 ]; then echo "$(SPECFILE) not tagged with tag $(TAG)"; exit 1; fi
plague: build-checkcvs $(COMMON_DIR)/branches
@if [ ! -x "$(PLAGUE_CLIENT)" ]; then echo "Must have plague-client installed - see http://fedoraproject.org/wiki/Extras/BuildSystemClientSetup"; exit 1; fi @if [ ! -x "$(PLAGUE_CLIENT)" ]; then echo "Must have plague-client installed - see http://fedoraproject.org/wiki/Extras/BuildSystemClientSetup"; exit 1; fi
$(PLAGUE_CLIENT) build $(NAME) $(TAG) $(TARGET) $(PLAGUE_CLIENT) build $(NAME) $(TAG) $(TARGET)
koji: build-check $(COMMON_DIR)/branches 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
$(info $(BUILD_CLIENT) $(SECONDARY_CONFIG) build $(BUILD_FLAGS) dist-$(TARGET)-$(KOJI_BUILD) '$(GIT_URL)')
kojicvs: build-check $(COMMON_DIR)/branches
@if [ ! -x "$(BUILD_CLIENT)" ]; then echo "Must have koji installed - see http://fedoraproject.org/wiki/BuildSystemClientSetup"; exit 1; fi @if [ ! -x "$(BUILD_CLIENT)" ]; then echo "Must have koji installed - see http://fedoraproject.org/wiki/BuildSystemClientSetup"; exit 1; fi
$(BUILD_CLIENT) $(SECONDARY_CONFIG) build $(BUILD_FLAGS) $(TARGET) '$(CVS_URL)' $(BUILD_CLIENT) $(SECONDARY_CONFIG) build $(BUILD_FLAGS) $(TARGET) '$(CVS_URL)'
#ifneq (, $(filter devel, $(BRANCH))) ifneq (, $(filter devel, $(BRANCH)))
build: koji build: koji
#else else
#build: plague build: plague
#endif endif
scratch-build: build-check scratch-build: build-check
@if [ ! -x "$(BUILD_CLIENT)" ]; then echo "Must have koji installed - see http://fedoraproject.org/wiki/BuildSystemClientSetup"; exit 1; fi @if [ ! -x "$(BUILD_CLIENT)" ]; then echo "Must have koji installed - see http://fedoraproject.org/wiki/BuildSystemClientSetup"; exit 1; fi
@ -484,9 +461,6 @@ endif
cvsurl: cvsurl:
@echo '$(CVS_URL)' @echo '$(CVS_URL)'
giturl:
@echo '$(GIT_URL)'
chain-build: build-check chain-build: build-check
@if [ -z "$(CHAIN)" ]; then \ @if [ -z "$(CHAIN)" ]; then \
echo "Missing CHAIN variable, please specify the order of packages to" ; \ echo "Missing CHAIN variable, please specify the order of packages to" ; \
@ -578,16 +552,10 @@ rediff:
clog: $(SPECFILE) clog: $(SPECFILE)
@sed -n '/^%changelog/,/^$$/{/^%/d;/^$$/d;s/%%/%/g;p}' $(SPECFILE) | tee $@ @sed -n '/^%changelog/,/^$$/{/^%/d;/^$$/d;s/%%/%/g;p}' $(SPECFILE) | tee $@
commitcvs:
clog
@cvs commit -F $?
@rm -f clog
commit: clog commit: clog
@git commit -m $? @cvs commit -F $?
@rm -f clog @rm -f clog
push:
@git push
help: help:
@echo "Usage: make <target>" @echo "Usage: make <target>"