Skip to content

Commit 57ee2b9

Browse files
committed
Initial RPM packaging
1 parent ea82507 commit 57ee2b9

3 files changed

Lines changed: 85 additions & 9 deletions

File tree

.gitignore

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ __pycache__/
1818
# Distribution / packaging
1919
.Python
2020
build/
21+
rpm-build/
2122
develop-eggs/
2223
dist/
2324
downloads/
@@ -34,12 +35,6 @@ wheels/
3435
*.egg
3536
MANIFEST
3637

37-
# PyInstaller
38-
# Usually these files are written by a python script from a template
39-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
40-
*.manifest
41-
*.spec
42-
4338
# Installer logs
4439
pip-log.txt
4540
pip-delete-this-directory.txt

Makefile

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,37 @@ ifeq ($(OFFICIAL),yes)
1313
RELEASE ?= 1
1414
else
1515
ifeq ($(origin RELEASE), undefined)
16-
RELEASE := 0.git$(shell date -u +%Y%m%d%H%M).$(shell git rev-parse --short HEAD)
16+
RELEASE := 0.git_$(shell git rev-parse --short HEAD)
1717
endif
1818
endif
19+
DIST ?= el7
20+
ARCH ?= x86_64
1921

20-
.PHONY: dist sdist test
22+
NVR_RELEASE = $(RELEASE).$(DIST)
23+
EPEL_DIST = $(subst el,epel-,$(DIST))
24+
NVR = $(NAME)-$(VERSION)-$(NVR_RELEASE)
25+
RESULTDIR = rpm-build/results-$(DIST)-$(ARCH)
26+
27+
.PHONY: clean version release dist sdist image dev shell test \
28+
mock-rpm mock-srpm image
2129

2230
clean:
2331
rm -rf dist
2432
rm -rf receptor.egg-info
33+
rm -rf rpm-build
34+
35+
version:
36+
@echo $(VERSION)
37+
38+
release:
39+
@echo $(RELEASE)
2540

2641
dist:
2742
$(DIST_PYTHON) setup.py bdist_wheel --universal
2843

2944
sdist: dist/$(NAME)-$(VERSION).tar.gz
3045

31-
dist/$(NAME)-$(VERSION).tar.gz:
46+
dist/$(NAME)-$(VERSION).tar.gz: $(shell find receptor -type f -name '*.py')
3247
$(DIST_PYTHON) setup.py sdist
3348

3449
image: dist
@@ -42,3 +57,25 @@ shell:
4257

4358
test:
4459
tox
60+
61+
dist/$(VERSION).tar.gz: dist/$(NAME)-$(VERSION).tar.gz
62+
cp dist/$(NAME)-$(VERSION).tar.gz dist/$(VERSION).tar.gz
63+
64+
rpm-build/$(NVR).spec: packaging/rpm/$(NAME).spec.j2
65+
mkdir -p rpm-build
66+
ansible -i localhost, -c local all -m template \
67+
-a "src=packaging/rpm/$(NAME).spec.j2 dest=rpm-build/$(NVR).spec" \
68+
-e version=$(VERSION) \
69+
-e release=$(NVR_RELEASE)
70+
71+
$(RESULTDIR)/$(NVR).src.rpm: dist/$(VERSION).tar.gz rpm-build/$(NVR).spec
72+
mock --buildsrpm --no-clean -r $(EPEL_DIST)-$(ARCH) --spec rpm-build/$(NVR).spec --sources dist/$(VERSION).tar.gz --resultdir $(RESULTDIR)
73+
74+
$(RESULTDIR)/$(NVR).rpm: $(RESULTDIR)/$(NVR).src.rpm
75+
mock --rebuild --no-clean -r $(EPEL_DIST)-$(ARCH) $(RESULTDIR)/$(NVR).src.rpm --resultdir $(RESULTDIR)
76+
@touch $@
77+
78+
mock-srpm: $(RESULTDIR)/$(NVR).src.rpm
79+
80+
mock-rpm: $(RESULTDIR)/$(NVR).rpm
81+

packaging/rpm/receptor.spec.j2

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
%define name receptor
2+
%define version {{ version }}
3+
%define release {{ release }}
4+
5+
Summary: UNKNOWN
6+
Name: %{name}
7+
Version: %{version}
8+
Release: %{release}
9+
Source0: https://github.com/project-receptor/%{name}/archive/%{version}.tar.gz
10+
11+
License: Apache
12+
Group: Development/Libraries
13+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
14+
Prefix: %{_prefix}
15+
BuildArch: noarch
16+
Vendor: Red Hat <UNKNOWN>
17+
Url: https://github.com/project-receptor/receptor
18+
19+
BuildRequires: python3
20+
BuildRequires: python3-setuptools
21+
Requires: python3
22+
Requires: python3-setuptools
23+
Requires: python3-aiohttp
24+
Requires: python3-prometheus_client
25+
26+
%description
27+
Receptor
28+
==============
29+
Project Receptor is a flexible multi-service relayer with remote execution and orchestration capabilities linking controllers with executors across a mesh of nodes. For the latest documentation see: [https://receptor.readthedocs.io](https://receptor.readthedocs.io/en/latest/)
30+
31+
%prep
32+
%setup -n %{name}-%{version} -n %{name}-%{version}
33+
34+
%build
35+
python3 setup.py build
36+
37+
%install
38+
python3 setup.py install --single-version-externally-managed -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
39+
40+
%clean
41+
rm -rf $RPM_BUILD_ROOT
42+
43+
%files -f INSTALLED_FILES
44+
%defattr(-,root,root)

0 commit comments

Comments
 (0)