Skip to content

Commit b4c4541

Browse files
committed
Add RPM spec files
These RPMs won't get distributed officially (yet?), but they may be useful for people who are not comfortable with python & pip installations, and would prefer a simple dnf installation. Signed-off-by: Stephen Brennan <[email protected]>
1 parent 94d8f33 commit b4c4541

File tree

4 files changed

+109
-2
lines changed

4 files changed

+109
-2
lines changed

Makefile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ _release_sanity_check:
8080
echo error: It looks like you have not bumped the version since last release.; \
8181
exit 1; \
8282
fi
83-
if [ -z "$$(grep -Pzo $(shell echo $(VERSION) | sed 's/\./\\./g')"[^\n]+\n-+\n" CHANGELOG.rst)" ]; then \
83+
@if [ -z "$$(grep -P "^Version:\s+$(shell echo $(VERSION) | sed 's/\./\\./g')" buildrpm/yo.spec)" ]; then \
84+
echo error: It looks like you have not updated buildrpm/yo.spec; \
85+
exit 1; \
86+
fi 2>/dev/null
87+
@if [ -z "$$(grep -Pzo $(shell echo $(VERSION) | sed 's/\./\\./g')"[^\n]+\n-+\n" CHANGELOG.rst)" ]; then \
8488
echo error: It looks like you have not documented this release in CHANGELOG.rst; \
8589
exit 1; \
8690
fi 2>/dev/null
@@ -95,8 +99,15 @@ _release_sanity_check:
9599
prerelease: _release_sanity_check test
96100
@echo "Safe to release $(VERSION)"
97101

102+
.PHONY: rpm
103+
rpm:
104+
git archive HEAD --format=tar.gz --prefix=yo-$(VERSION)/ -o buildrpm/v$(VERSION).tar.gz
105+
rpmbuild --define "_sourcedir $$(pwd)/buildrpm" \
106+
--define "_topdir $$(pwd)/buildrpm/tmp" \
107+
-ba buildrpm/yo.spec
108+
98109
.PHONY: release
99-
release: _release_sanity_check test
110+
release: _release_sanity_check test rpm
100111
@if [ ! $$(git symbolic-ref -q HEAD) = "refs/heads/main" ]; then \
101112
echo error: You must be on main to release a new version.; \
102113
exit 1; \

buildrpm/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
tmp/
2+
v*.tar.gz

buildrpm/yo.spec

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Copyright (c) 2025, Oracle and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
3+
Name: yo
4+
Version: 1.9.0
5+
Release: 0%{?dist}
6+
Summary: A fast and simple CLI client for managing OCI instances
7+
8+
License: UPL
9+
URL: https://github.com/oracle/yo
10+
Source: https://github.com/oracle/yo/archive/refs/tags/v%{version}.tar.gz
11+
12+
BuildArch: noarch
13+
BuildRequires: python3-devel
14+
BuildRequires: python3dist(sphinx)
15+
BuildRequires: python3dist(sphinx-argparse)
16+
BuildRequires: python3dist(pytest)
17+
18+
%global _description %{expand:
19+
yo is a command-line client for managing OCI instances. It makes launching OCI
20+
instances as simple as rudely telling your computer "yo, launch an instance".
21+
Its goals are speed, ease of use, and simplicity.
22+
...}
23+
24+
%description %_description
25+
26+
%prep
27+
%autosetup -p1 -n yo-%{version}
28+
echo -n "dnf" >yo/data/pkgman
29+
30+
31+
%build
32+
%pyproject_wheel
33+
34+
35+
%install
36+
%pyproject_install
37+
%pyproject_save_files yo
38+
sphinx-build --color -W -bhtml doc %{buildroot}/%{_docdir}/yo
39+
40+
41+
%check
42+
%pytest tests/
43+
44+
45+
%files -n yo -f %{pyproject_files}
46+
%doc %{_docdir}/yo
47+
%doc README.*
48+
%{_bindir}/yo
49+
50+
51+
%changelog
52+
* Wed Apr 9 2025 Stephen Brennan <[email protected]> - 1.9.0-0
53+
- Initial packaging of 1.9.0

doc/development.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,47 @@ Simply run the following command from the root of the git repo:
6565
on your whole system. If you'd prefer not to have this risk, then don't use
6666
this method!
6767

68+
Building an RPM
69+
---------------
70+
71+
Yo has an RPM spec file at ``buildrpm/yo.spec``, which can be used to build an
72+
RPM on Oracle Linux 9+, and likely Fedora as well. The RPMs themselves are not
73+
currently officially built or distributed, but they can be built easily. These
74+
instructions are for Oracle Linux 9. Similar instructions will likely work for
75+
Oracle Linux 10, but Oracle Linux 8 does not contain necessary dependencies.
76+
77+
First, install the build requirements:
78+
79+
.. code:: bash
80+
81+
sudo dnf install -y oracle-epel-release-el9 \
82+
oraclelinux-developer-release-el9 \
83+
pyproject-rpm-macros
84+
sudo dnf builddep -y buildrpm/yo.spec
85+
86+
87+
There are two ways to build the RPM. First is by using the current git tree to
88+
build, and the second is to fetch the latest release from Github and build from
89+
that source.
90+
91+
To use the current git tree, first ensure that all your changes are committed.
92+
The source distribution is built using ``git archive``, so only committed
93+
changes are included. You may also want to update the spec file to tweak the
94+
"Release" value, if you do not have a release tag checked out. Then:
95+
96+
.. code:: bash
97+
98+
make rpm
99+
100+
To download the source tarball from Github and then build:
101+
102+
.. code:: bash
103+
104+
cd buildrpm
105+
spectool -gS yo.spec
106+
rpmbuild --define "_sourcedir `pwd`" --define "_topdir `pwd`/tmp" -ba yo.spec
107+
108+
68109
Creating and Testing Changes
69110
----------------------------
70111

0 commit comments

Comments
 (0)