Gitea 1.20 introduced RPM package repository support. We can use this feature to publish the *dch-selinux* RPM, instead of manually creating the repository and publishing it to the file server. This will ultimately enable Jenkins to publish the package as well.
85 lines
1.6 KiB
Makefile
85 lines
1.6 KiB
Makefile
NAME ?= targeted
|
|
REPO ?= repo
|
|
|
|
RPMBUILDFLAGS = \
|
|
-D "_topdir ${PWD}" \
|
|
-D "_srcrpmdir ${PWD}" \
|
|
-D "_sourcedir ${PWD}" \
|
|
-D "_specdir ${PWD}" \
|
|
-D "_rpmdir ${PWD}"
|
|
|
|
ARCH = noarch
|
|
VERSION = $(shell rpm -q --qf '%{VERSION}' --specfile dch-selinux.spec)
|
|
RELEASE = $(shell rpm -q --qf '%{RELEASE}' --specfile dch-selinux.spec)
|
|
TAR = dch-selinux-$(VERSION).tar.xz
|
|
SPEC = dch-selinux.spec
|
|
RPM = dch-selinux-$(VERSION)-$(RELEASE).$(ARCH).rpm
|
|
SRPM = dch-selinux-$(VERSION)-$(RELEASE).src.rpm
|
|
|
|
GITEA_URL = https://git.pyrocufflink.net
|
|
GITEA_ORG = infra
|
|
|
|
define buildpp
|
|
$(MAKE) NAME=$(NAME) -f /usr/share/selinux/devel/Makefile
|
|
endef
|
|
|
|
.PHONY: \
|
|
clean \
|
|
default \
|
|
dist \
|
|
mockbuild \
|
|
pp \
|
|
publish \
|
|
repo \
|
|
rpm \
|
|
srpm
|
|
|
|
default: pp
|
|
|
|
dch-samba.pp: dch-samba.fc dch-samba.if dch-samba.te
|
|
$(call buildpp)
|
|
|
|
$(TAR): \
|
|
$(wildcard *.fc) \
|
|
$(wildcard *.if) \
|
|
$(wildcard *.te)
|
|
tar -cJf $@ --transform 's/^/dch-selinux-$(VERSION)\//' $^
|
|
|
|
$(RPM): $(SPEC) $(TAR)
|
|
rpmbuild $(RPMBUILDFLAGS) -bb -v $<
|
|
mv $(ARCH)/$@ $@
|
|
rmdir $(ARCH)
|
|
|
|
$(SRPM): $(SPEC) $(TAR)
|
|
rpmbuild $(RPMBUILDFLAGS) -bs -v $<
|
|
|
|
dist: $(TAR)
|
|
|
|
clean:
|
|
rm -f *.pp *.rpm *.srpm *.tar.xz
|
|
rm -rf BUILD BUILDROOT
|
|
rm -rf repo
|
|
rm -rf tmp
|
|
|
|
mockbuild: $(SRPM)
|
|
ifeq ($(MOCKTARGET),)
|
|
$(error MOCKTARGET is required, e.g. make MOCKTARGET=fedora-37-x86_64 mockbuild)
|
|
endif
|
|
mock -r '$(MOCKTARGET)' $(SRPM)
|
|
cp -a /var/lib/mock/$(MOCKTARGET)/result/*.noarch.rpm .
|
|
|
|
publish: $(RPM)
|
|
ifeq ($(GITEA_USERNAME),)
|
|
$(error GITEA_USERNAME and GITEA_PASSWORD are required)
|
|
endif
|
|
curl -f \
|
|
'$(GITEA_URL)/api/packages/$(GITEA_ORG)/rpm/upload' \
|
|
-u '$(GITEA_USERNAME):$(GITEA_PASSWORD)' \
|
|
-T $<
|
|
|
|
rpm: $(RPM)
|
|
|
|
srpm: $(SRPM)
|
|
|
|
pp: dch-samba.pp
|