Skip to content

Commit 8f1f8b3

Browse files
committed
new: dev: add hexdump spec with matching workflow, update readme
Signed-off-by: Stephen L Arnold <sarnold@vctlabs.com>
1 parent 3d22037 commit 8f1f8b3

File tree

3 files changed

+221
-0
lines changed

3 files changed

+221
-0
lines changed

.github/workflows/hexdump.yml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: hexdump RPMs
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
get_version:
12+
name: Get version info
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
defaults:
17+
run:
18+
shell: bash
19+
outputs:
20+
version: ${{ steps.spec_ver.outputs.version }}
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Get package version
28+
id: spec_ver
29+
run: |
30+
version=$(make version)
31+
echo "version=${version}" >> $GITHUB_OUTPUT
32+
echo Version from spec: $version
33+
env:
34+
NAME: python-hexdump
35+
36+
build_rpms:
37+
name: hexdump-rpms
38+
timeout-minutes: 30
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
name: [rocky9]
43+
include:
44+
- name: rocky9
45+
spec: python-hexdump
46+
image: quay.io/rockylinux/rockylinux:9
47+
48+
runs-on: ubuntu-latest
49+
needs: [get_version]
50+
container:
51+
image: ${{ matrix.image }}
52+
permissions:
53+
contents: read
54+
defaults:
55+
run:
56+
shell: bash
57+
env:
58+
PYTHONIOENCODING: utf-8
59+
60+
steps:
61+
- uses: actions/checkout@v4
62+
with:
63+
fetch-depth: 0
64+
65+
# Work-around for https://github.com/actions/runner-images/issues/6775
66+
- name: Change Owner of Container Working Directory
67+
if: matrix.image
68+
run: chown root.root .
69+
70+
- name: Check version and update spec
71+
env:
72+
VERSION: ${{ needs.get_version.outputs.version }}
73+
run: |
74+
echo Dev version from get_version step: $VERSION
75+
76+
- name: Install deps for rpm builds (centos/rocky)
77+
run: |
78+
bash scripts/install_deps_el9.sh
79+
dnf install -y https://github.com/VCTLabs/el9-rpm-toolbox/releases/download/honcho-2.0.0.1/python3-honcho-2.0.0.1-1.el9.noarch.rpm
80+
81+
- name: Build bdist_rpm pkgs
82+
run: |
83+
NAME="${{ matrix.spec }}" make packages
84+
85+
- name: Upload rpm files
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: packages
89+
path: |
90+
tmp/RPMS/*/*.rpm
91+
tmp/SRPMS/*.rpm
92+
93+
create-release:
94+
name: Create hexdump Release
95+
runs-on: ubuntu-latest
96+
needs: [get_version, build_rpms]
97+
permissions:
98+
contents: write
99+
steps:
100+
- name: Checkout
101+
uses: actions/checkout@v4
102+
103+
- name: Download Artifacts
104+
uses: actions/download-artifact@v4
105+
106+
- name: List Artifacts
107+
run: ls -laR packages
108+
109+
- name: Fetch tags
110+
run: git fetch --tags --prune --quiet
111+
112+
- name: Tag Release
113+
id: tag_release
114+
if: ${{ github.event_name != 'pull_request' }}
115+
run: |
116+
set +e
117+
if git rev-list "hexdump-${{ needs.get_version.outputs.version }}" >/dev/null 2>&1 ; then
118+
echo "Tag for hexdump-${{ needs.get_version.outputs.version }} already exists. Skipping release creation."
119+
echo "NEW_RELEASE=false" >> $GITHUB_OUTPUT
120+
else
121+
git tag "hexdump-${{ needs.get_version.outputs.version }}"
122+
git push origin "hexdump-${{ needs.get_version.outputs.version }}"
123+
echo "NEW_RELEASE=true" >> $GITHUB_OUTPUT
124+
fi
125+
126+
- name: Create draft release
127+
id: create_release
128+
if: ${{ github.event_name != 'pull_request' && steps.tag_release.outputs.NEW_RELEASE == 'true' }}
129+
uses: softprops/action-gh-release@v2
130+
env:
131+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132+
with:
133+
tag_name: hexdump-${{ needs.get_version.outputs.version }}
134+
name: RPM Release hexdump-${{ needs.get_version.outputs.version }}
135+
body: Latest RPMs for hexdump-${{ needs.get_version.outputs.version }}
136+
draft: false
137+
prerelease: false
138+
files: |
139+
packages/RPMS/*/*.rpm
140+
packages/SRPMS/*.rpm

README.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ following table.
3636
============= ===============
3737
daemonizer |daemonizer|
3838
diskcache |diskcache|
39+
hexdump |hexdump|
3940
honcho |honcho|
4041
picotui |picotui|
4142
procman |procman|
@@ -57,6 +58,10 @@ following table.
5758
:target: http://www.grantjenks.com/docs/diskcache/
5859
:alt: diskcache RPM status
5960

61+
.. |hexdump| image:: https://github.com/VCTLabs/el9-rpm-toolbox/actions/workflows/hexdump.yml/badge.svg
62+
:target: https://sarnold.github.io/hexdump/
63+
:alt: hexdump RPM status
64+
6065
.. |honcho| image:: https://github.com/VCTLabs/el9-rpm-toolbox/actions/workflows/honcho.yml/badge.svg
6166
:target: https://honcho.readthedocs.io/
6267
:alt: honcho RPM status

specs/python-hexdump.spec

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Tests are disabled in RHEL 9 because really old tox
2+
# Specify --with tests to enable them.
3+
%bcond_with tests
4+
5+
%global pypi_name hexdump
6+
7+
Name: python-%{pypi_name}
8+
Version: 3.5.2
9+
Release: 1%{?dist}
10+
Summary: view/edit your binary with any text editor.
11+
12+
License: LGPL-2.1-or-later
13+
URL: http://github.com/sarnold/hexdump
14+
Source0: %{url}/releases/download/%{version}/%{pypi_name}-%{version}.tar.gz
15+
BuildArch: noarch
16+
17+
%description
18+
Hexdump is both a library and command line tool, and can dump your binary
19+
to hex and restore it back. Hexdump can run on all major platforms, eg,
20+
Linux, Windows, MacOS, using any non-ancient Python 3 release.
21+
22+
%package -n python%{python3_pkgversion}-%{pypi_name}
23+
Summary: %{summary}
24+
25+
BuildRequires: python%{python3_pkgversion}-devel
26+
BuildRequires: pyproject-rpm-macros
27+
BuildRequires: python%{python3_pkgversion}dist(tomli)
28+
BuildRequires: python%{python3_pkgversion}dist(wheel)
29+
BuildRequires: python%{python3_pkgversion}dist(setuptools)
30+
BuildRequires: python%{python3_pkgversion}dist(setuptools-scm[toml])
31+
BuildRequires: python%{python3_pkgversion}dist(importlib-resources)
32+
%if %{with tests}
33+
BuildRequires: python%{python3_pkgversion}dist(pytest)
34+
%endif
35+
36+
%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}
37+
38+
%description -n python%{python3_pkgversion}-%{pypi_name}
39+
Hexdump is both a library and command line tool, and can dump your binary
40+
to hex and restore it back. Hexdump can run on all major platforms, eg,
41+
Linux, Windows, MacOS, using any non-ancient Python 3 release.
42+
43+
%prep
44+
%autosetup -p1 -n %{pypi_name}-%{version}
45+
46+
# using pyproject macros
47+
%generate_buildrequires
48+
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
49+
%pyproject_buildrequires
50+
51+
%build
52+
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
53+
%pyproject_wheel
54+
55+
%install
56+
%pyproject_install
57+
58+
# Use -l to assert a %%license file is found (PEP 639).
59+
# note the last argument is the top-level module directory name
60+
%pyproject_save_files -l hexdump
61+
62+
# Use -t to only import top-level module
63+
%check
64+
%pyproject_check_import
65+
%if %{with tests}
66+
%pytest -vv test/
67+
%endif
68+
69+
%files -n python%{python3_pkgversion}-hexdump -f %{pyproject_files}
70+
%doc README.rst CHANGELOG.rst
71+
%license LICENSE REUSE.toml
72+
%{_bindir}/hexdump
73+
74+
%changelog
75+
* Mon Jul 21 2025 Stephen Arnold <nerdboy@gentoo.org> - 3.5.2
76+
- New package

0 commit comments

Comments
 (0)