adapt tag, build, giturl commands for local use and git

This commit is contained in:
Jean-Philippe Pialasse 2024-03-17 15:03:55 -04:00
parent 017e95327d
commit 9abc8dd9cb

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')
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,smecontrib)
BRANCHINFO = $(shell grep ^$(BRANCH): $(COMMON_DIR)/branches | cut -d: --output-delimiter=" " -f2-)
TARGET := $(word 1, $(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 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
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_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)
GIT_URL := https://src.koozali.org/$(GIT_ORG)/$(GIT_REPOSITORY)\#$(TAG)
## create a clean exported copy in $(TMPCVS)
export:: sources
@ -375,13 +383,20 @@ verrel:
# 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
tagcvs:: $(SPECFILE) $(COMMON_DIR)/branches
cvs tag $(TAG_OPTS) -c $(TAG)
@echo "Tagged with: $(TAG)"
@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
@$(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
@ -400,24 +415,32 @@ oldbuild: $(COMMON_DIR)/branches
cvs commit -m "request build of $(CVS_REPOSITORY) $(TAG) for $(TARGET)" tobuild ;\
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
@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
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
$(PLAGUE_CLIENT) build $(NAME) $(TAG) $(TARGET)
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
$(BUILD_CLIENT) $(SECONDARY_CONFIG) build $(BUILD_FLAGS) $(TARGET) '$(CVS_URL)'
ifneq (, $(filter devel, $(BRANCH)))
#ifneq (, $(filter devel, $(BRANCH)))
build: koji
else
build: plague
endif
#else
#build: plague
#endif
scratch-build: build-check
@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:
@echo '$(CVS_URL)'
giturl:
@echo '$(GIT_URL)'
chain-build: build-check
@if [ -z "$(CHAIN)" ]; then \
echo "Missing CHAIN variable, please specify the order of packages to" ; \
@ -552,11 +578,17 @@ rediff:
clog: $(SPECFILE)
@sed -n '/^%changelog/,/^$$/{/^%/d;/^$$/d;s/%%/%/g;p}' $(SPECFILE) | tee $@
commit: clog
commitcvs:
clog
@cvs commit -F $?
@rm -f clog
commit: clog
@git commit -m $?
@rm -f clog
push:
@git push
help:
@echo "Usage: make <target>"
@echo "Available targets are:"