Permalink
Browse files

Add copr build integration

Builds can be found here:
https://copr.fedoraproject.org/coprs/purpleidea/oh-my-vagrant/

API setup per user can be found here:
https://copr.fedoraproject.org/api/
  • Loading branch information...
1 parent 5000589 commit 6a6d1f2be89ac0ef932f98368fcf672c7a0d95cc @purpleidea committed Jul 7, 2015
Showing with 35 additions and 2 deletions.
  1. +10 −2 Makefile
  2. +25 −0 extras/copr-build.py
View
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-.PHONY: all docs rpm srpm spec tar upload upload-sources upload-srpms upload-rpms
+.PHONY: all docs rpm srpm spec tar upload upload-sources upload-srpms upload-rpms copr
.SILENT:
# version of the program
@@ -24,9 +24,11 @@ RELEASE = 1
SPEC = rpmbuild/SPECS/oh-my-vagrant.spec
SOURCE = rpmbuild/SOURCES/oh-my-vagrant-$(VERSION).tar.bz2
SRPM = rpmbuild/SRPMS/oh-my-vagrant-$(VERSION)-$(RELEASE).src.rpm
+SRPM_BASE = oh-my-vagrant-$(VERSION)-$(RELEASE).src.rpm
RPM = rpmbuild/RPMS/oh-my-vagrant-$(VERSION)-$(RELEASE).rpm
+USERNAME := $(shell cat ~/.config/copr | grep username | awk -F '=' '{print $$2}' | tr -d ' ')
SERVER = 'dl.fedoraproject.org'
-REMOTE_PATH = 'pub/oh-my-vagrant'
+REMOTE_PATH = 'pub/alt/$(USERNAME)/oh-my-vagrant'
all: docs rpm
@@ -157,4 +159,10 @@ upload-rpms: rpmbuild/RPMS/ rpmbuild/RPMS/SHA256SUMS rpmbuild/RPMS/SHA256SUMS.as
rsync -avz --prune-empty-dirs rpmbuild/RPMS/ $(SERVER):$(REMOTE_PATH)/RPMS/; \
fi
+#
+# copr build
+#
+copr: upload-srpms
+ ./extras/copr-build.py https://$(SERVER)/$(REMOTE_PATH)/SRPMS/$(SRPM_BASE)
+
# vim: ts=8
View
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+
+# README:
+# for initial setup, browse to: https://copr.fedoraproject.org/api/
+# and it will have a ~/.config/copr config that you can download.
+# happy hacking!
+
+import os
+import sys
+import copr
+
+COPR = 'oh-my-vagrant'
+if len(sys.argv) != 2:
+ print("Usage: %s <srpm url>" % sys.argv[0])
+ sys.exit(1)
+
+url = sys.argv[1]
+
+client = copr.CoprClient.create_from_file_config(os.path.expanduser("~/.config/copr"))
+
+result = client.create_new_build(COPR, [url])
+if result.output != "ok":
+ print(result.error)
+ sys.exit(1)
+print(result.message)

0 comments on commit 6a6d1f2

Please sign in to comment.