diff --git a/.github/workflows/packing.yml b/.github/workflows/packing.yml index 69203871..4609e036 100644 --- a/.github/workflows/packing.yml +++ b/.github/workflows/packing.yml @@ -206,3 +206,68 @@ jobs: env: PYPI_REPO: pypi PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + + pack_rpm: + # We want to run on external PRs, but not on our own internal + # PRs as they'll be run by the push to the branch. + # + # The main trick is described here: + # https://github.com/Dart-Code/Dart-Code/pull/2375 + if: (github.event_name == 'push') || + (github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name != github.repository) + runs-on: ubuntu-latest + + container: + image: ${{ matrix.target.os }}:${{ matrix.target.dist }} + + strategy: + fail-fast: false + + matrix: + target: + - os: fedora + dist: '34' + - os: fedora + dist: '35' + - os: fedora + dist: '36' + + steps: + - name: Bump git version + # Fails to compute package version inside docker otherwise: + # https://github.com/actions/runner/issues/2033 + run: dnf install -y git + + - name: Clone the connector repo + uses: actions/checkout@v3 + # Checkout all tags for correct version computation. + with: + fetch-depth: 0 + + - name: Set ownership + # Fails to compute package version inside docker otherwise: + # https://github.com/actions/runner/issues/2033 + run: chown -R $(id -u):$(id -g) $PWD + + - name: Setup Python and various packing tools + run: dnf install -y python3 python3-libs python3-pip python3-setuptools python3-wheel + + - name: Install RPM packing tools + run: | + dnf install -y gcc make coreutils diffutils patch + dnf install -y rpm-build rpm-devel rpmlint rpmdevtools + + - name: Pack source and binary RPM + run: make rpm-dist + + - name: Verify the package + run: make rpm-dist-check + + - name: Archive RPM artifacts + uses: actions/upload-artifact@v3 + with: + name: rpm_dist_${{ matrix.target.os }}_${{ matrix.target.dist }} + path: rpm_dist + retention-days: 1 + if-no-files-found: error diff --git a/.gitignore b/.gitignore index 51b36f6d..3392efa8 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,13 @@ venv/* tarantool/version.py pip_dist + +# Cannot ignore a directory and negate a single file +# https://www.atlassian.com/git/tutorials/saving-changes/gitignore +rpm/SOURCES +rpm/SRPMS +rpm/BUILDROOT +rpm/BUILD +rpm/RPMS + +rpm_dist diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fd6e94a..bc960947 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -187,6 +187,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Support iproto feature push (#201). - Pack pip package with GitHub Actions (#198). - Publish pip package with GitHub Actions (#198). +- Pack RPM package with GitHub Actions (#164, #198). ### Changed - Bump msgpack requirement to 1.0.4 (PR #223). diff --git a/Makefile b/Makefile index 94bb8d8a..58752456 100644 --- a/Makefile +++ b/Makefile @@ -47,3 +47,16 @@ pip-dist: pip-sdist pip-bdist .PHONY: pip-dist-check pip-dist-check: twine check pip_dist/* + + +.PHONY: rpm-dist +rpm-dist: + python3 setup.py sdist --dist-dir=rpm/SOURCES + rpmbuild -ba --define "_topdir `pwd`/rpm" rpm/SPECS/python-tarantool.spec + mkdir -p rpm_dist + mv rpm/SRPMS/*.rpm -t rpm_dist + mv rpm/RPMS/noarch/*.rpm -t rpm_dist + +.PHONY: rpm-dist-check +rpm-dist-check: + rpm -K --nosignature rpm_dist/*.rpm diff --git a/rpm/SPECS/python-tarantool.spec b/rpm/SPECS/python-tarantool.spec new file mode 100644 index 00000000..b1dae43d --- /dev/null +++ b/rpm/SPECS/python-tarantool.spec @@ -0,0 +1,61 @@ +# Based on https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/installing_and_using_dynamic_programming_languages/assembly_packaging-python-3-rpms_installing-and-using-dynamic-programming-languages +# merged with python3 setup.py bdist_rpm --spec-only result. + +%define srcname tarantool +%define version %(python3 setup.py --version) + +Name: python-%{srcname} +Version: %{version} +Release: 1%{?dist} +Summary: Python client library for Tarantool + +License: BSD +Group: Development/Libraries +URL: https://github.com/tarantool/tarantool-python + +BuildArch: noarch +Source: %{srcname}-%{version}.tar.gz +Vendor: tarantool-python AUTHORS + +BuildRequires: python3-setuptools +BuildRequires: python3-wheel + +%global _description %{expand: +Python client library for Tarantool.} + +%description %_description + + +%package -n python3-%{srcname} + +Requires: python3-msgpack +Requires: python3-pandas +Requires: python3-pytz + +Summary: %{summary} + +Obsoletes: tarantool-python <= 0.9.0 + +%description -n python3-%{srcname} %_description + + +%prep +%setup -n %{srcname}-%{version} + + +%build +python3 setup.py build + + +%install +python3 setup.py install --single-version-externally-managed -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES + + +%clean +rm -rf $RPM_BUILD_ROOT + + +%files -n python3-%{srcname} -f INSTALLED_FILES + + +%defattr(-,root,root) diff --git a/rpm/tarantool-python.spec b/rpm/tarantool-python.spec deleted file mode 100644 index 2b9e6431..00000000 --- a/rpm/tarantool-python.spec +++ /dev/null @@ -1,117 +0,0 @@ -Summary: Python client library for Tarantool Database -Name: tarantool-python -Version: 0.9.0 -Release: 1%{?dist} -Source0: tarantool-python-%{version}.tar.gz -License: BSD -Group: Development/Libraries -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot -Prefix: %{_prefix} -BuildArch: noarch -Vendor: Konstantin Cherkasoff -Requires: python-msgpack -Url: https://github.com/tarantool/tarantool-python -BuildRequires: python-setuptools -%description -Python driver for Tarantool 1.6 -=============================== - -This package is a pure-python client library for `Tarantool`_. - -`Documentation`_ | `Downloads`_ | `PyPI`_ | `GitHub`_ | `Issue tracker`_ - -.. _`Documentation`: http://tarantool-python.readthedocs.org/en/latest/ -.. _`Downloads`: http://pypi.python.org/pypi/tarantool#downloads -.. _`PyPI`: http://pypi.python.org/pypi/tarantool -.. _`GitHub`: https://github.com/tarantool/tarantool-python -.. _`Issue tracker`: https://github.com/tarantool/tarantool-python/issues - -.. image:: https://travis-ci.org/tarantool/tarantool-python.svg?branch=master - :target: https://travis-ci.org/tarantool/tarantool-python - -Download and Install --------------------- - -The recommended way to install ``tarantool`` package is using PIP -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -For Tarantool version < 1.6.0 you must get ``0.3.*`` connector version:: - - $ pip install tarantool\<0.4 - -For later Tarantool use version ``0.5.*`` connector version:: - - $ pip install tarantool\>0.4 - -You can also download zip archive, unpack it and run -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -:: - - $ python setup.py install - -To install development version of the package using pip -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -For Tarantool version < 1.6.0 you must get ``stable`` branch:: - - $ pip install git+https://github.com/tarantool/tarantool-python.git@stable - -For later Tarantool use ``master`` branch:: - - $ pip install git+https://github.com/tarantool/tarantool-python.git@master - --------------------------------------------------------------------------------- - -What is Tarantool? ------------------- - -`Tarantool`_ is a NoSQL database running inside a Lua program. It combines the network programming power of Node.JS with data persistency capabilities of Redis. It's open source, `BSD licensed`_. - -Features --------- - - * Lua packages for non-blocking I/O, fibers and HTTP - * MsgPack data format and MsgPack based client-server protocol - * Two data engines: - * 100% in-memory with optional persistence - * 2-level disk-based B-tree, to use with large data sets (powered by `Sophia`_) - * secondary key and index iterators support (can be non-unique and composite) - * multiple index types: HASH, BITSET, TREE - * asynchronous master-master replication - * authentication and access control - - -See More -^^^^^^^^ - - * `Tarantool Homepage`_ - * `Tarantool at Github`_ - * `Tarantool User Guide`_ - * `Client-server Protocol Specification`_ - - -.. _`Tarantool`: -.. _`Tarantool Database`: -.. _`Tarantool Homepage`: http://tarantool.org -.. _`Tarantool at Github`: https://github.com/tarantool/tarantool -.. _`Tarantool User Guide`: http://tarantool.org/doc/user_guide.html -.. _`Client-server protocol specification`: http://tarantool.org/doc/dev_guide/box-protocol.html -.. _`Sophia`: http://sphia.org -.. _`BSD licensed`: http://www.gnu.org/licenses/license-list.html#ModifiedBSD - - -%prep -%setup -q -n %{name}-%{version} - -%build -python setup.py build - -%install -python setup.py install --single-version-externally-managed -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES - -%clean -rm -rf $RPM_BUILD_ROOT - -%files -f INSTALLED_FILES -%defattr(-,root,root)