From 8c1eaf1bac12dc9c167afed5a2ae204c4e7aa637 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Thu, 26 Oct 2023 09:19:47 -0500 Subject: [PATCH] meta: Publish to Gitea 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. --- Makefile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index d6c68e7..bdc9cbe 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,9 @@ 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 @@ -65,16 +68,14 @@ endif mock -r '$(MOCKTARGET)' $(SRPM) cp -a /var/lib/mock/$(MOCKTARGET)/result/*.noarch.rpm . -publish: repo -ifeq ($(PUBLISH_HOST),) - $(error PUBLISH_HOST and PUBLISH_PATH are required) +publish: $(RPM) +ifeq ($(GITEA_USERNAME),) + $(error GITEA_USERNAME and GITEA_PASSWORD are required) endif - rsync -rtiO --delete $(REPO)/ $(PUBLISH_HOST):$(PUBLISH_PATH) - -repo: - mkdir -p '$(REPO)' - cp *.rpm '$(REPO)'/ - createrepo '$(REPO)' + curl -f \ + '$(GITEA_URL)/api/packages/$(GITEA_ORG)/rpm/upload' \ + -u '$(GITEA_USERNAME):$(GITEA_PASSWORD)' \ + -T $< rpm: $(RPM)