back on track

This commit is contained in:
Jean-Philippe Pialasse 2024-03-17 16:41:35 -04:00
parent 9eb3ba514a
commit 593bd2f568

View File

@ -31,6 +31,10 @@ 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))
@ -147,7 +151,9 @@ 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)
@ -316,7 +322,9 @@ 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 := git+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
@ -375,13 +383,20 @@ 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.
tag:: $(SPECFILE) $(COMMON_DIR)/branches tagcvs:: $(SPECFILE) $(COMMON_DIR)/branches
cvs tag $(TAG_OPTS) -c $(TAG) cvs tag $(TAG_OPTS) -c $(TAG)
@echo "Tagged with: $(TAG)" @echo "Tagged with: $(TAG)"
@echo @echo
tag:: $(SPECFILE) $(COMMON_DIR)/branches
git tag $(TAG_OPTS) -a $(TAG) -m $(TAG)
git push --tag
@echo "Tagged with: $(TAG)"
@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
@ -400,24 +415,32 @@ 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-check: $(SPECFILE) build-checkcvs: $(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
plague: build-check $(COMMON_DIR)/branches 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
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
@ -461,6 +484,9 @@ 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" ; \
@ -552,11 +578,23 @@ 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:
commit: clog clog
@cvs commit -F $? @cvs commit -F $?
@rm -f clog @rm -f clog
commit: clog
@git commit -m $?
@rm -f clog
@git push
commitonly: clog
@git commit -m $?
@rm -f clog
push:
@git push
help: help:
@echo "Usage: make <target>" @echo "Usage: make <target>"
@echo "Available targets are:" @echo "Available targets are:"