1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-02-04 07:11:49 +00:00

Add RPM building scripts (#255)

This commit is contained in:
Sergey 2021-05-13 14:09:16 +03:00 committed by GitHub
parent 1c0a167a1d
commit 6f7c1f340f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 72 additions and 1 deletions

2
.gitignore vendored
View file

@ -209,7 +209,6 @@ MANIFEST
# Usually these files are written by a python script from a template # Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it. # before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest *.manifest
*.spec
# Installer logs # Installer logs
pip-log.txt pip-log.txt
@ -387,3 +386,4 @@ $RECYCLE.BIN/
# Custom # Custom
changelogs/.plugin-cache.yaml changelogs/.plugin-cache.yaml
# End of https://www.gitignore.io/api/git,linux,pydev,python,windows,pycharm+all,jupyternotebook,vim,webstorm,emacs,dotenv # End of https://www.gitignore.io/api/git,linux,pydev,python,windows,pycharm+all,jupyternotebook,vim,webstorm,emacs,dotenv
ansible-collection-containers-podman-build.spec

15
Makefile Normal file
View file

@ -0,0 +1,15 @@
PKG_NAME=ansible-podman-collections
TMPINSTALLDIR=/tmp/$(PKG_NAME)-fpm-install
VERSION ?= $(shell python3 setup.py --version 2>/dev/null | sed "s/\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/g")
rpm:
rm -rf $(TMPINSTALLDIR)
mkdir -p ~/rpmbuild/SOURCES/
mkdir -p $(TMPINSTALLDIR)/$(PKG_NAME)-$(VERSION)
cp -r * $(TMPINSTALLDIR)/$(PKG_NAME)-$(VERSION)/
tar -zcvf ~/rpmbuild/SOURCES/$(VERSION).tar.gz -C $(TMPINSTALLDIR) $(PKG_NAME)-$(VERSION)
cp ansible-collection-containers-podman.spec ansible-collection-containers-podman-build.spec
sed -i "s/Version:.*/Version: $(VERSION)/g" ansible-collection-containers-podman-build.spec
sed -i "s/Release:.*/Release: 999%{?dist}/g" ansible-collection-containers-podman-build.spec
sed -i "s/^version: .*/version: $(VERSION)/" $(TMPINSTALLDIR)/$(PKG_NAME)-$(VERSION)/galaxy.yml
rpmbuild -bb ansible-collection-containers-podman-build.spec

View file

@ -0,0 +1,40 @@
%global collection_namespace containers
%global collection_name podman
Name: ansible-collection-%{collection_namespace}-%{collection_name}
Version: XXX
Release: 1%{?dist}
Summary: Podman Ansible collection for Podman containers
License: GPLv3+
URL: %{ansible_collection_url}
Source: https://github.com/containers/ansible-podman-collections/archive/%{version}.tar.gz
BuildRequires: ansible >= 2.9.10
BuildArch: noarch
%description
%{summary}.
%prep
%autosetup -n ansible-podman-collections-%{version}
sed -i -e 's/version:.*/version: %{version}/' galaxy.yml
find -type f ! -executable -name '*.py' -print -exec sed -i -e '1{\@^#!.*@d}' '{}' +
rm -fvr changelogs/ ci/ contrib/ tests/ ./galaxy.yml.in .github/ .gitignore
%build
%ansible_collection_build
%install
%ansible_collection_install
%files
%license COPYING
%doc README.md
%{ansible_collection_files}
%changelog
* Tue Feb 09 2021 Sagi Shnaidman <sshnaidm@redhat.com> - 1.4.1-1
- Initial package

16
contrib/build_rpm.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
export PKG_NAME=ansible-podman-collections
export TMPINSTALLDIR=/tmp/${PKG_NAME}-fpm-install
export VERSION=$(python3 setup.py --version 2>/dev/null | sed "s/\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/g")
rm -rf "${TMPINSTALLDIR}"
mkdir -p ~/rpmbuild/SOURCES/
mkdir -p "${TMPINSTALLDIR}/${PKG_NAME}-${VERSION}"
cp -r * ${TMPINSTALLDIR}/${PKG_NAME}-${VERSION}/
tar -zcvf ~/rpmbuild/SOURCES/${VERSION}.tar.gz -C ${TMPINSTALLDIR} ${PKG_NAME}-${VERSION}
cp ansible-collection-containers-podman.spec ansible-collection-containers-podman-build.spec
sed -i "s/Version:.*/Version: ${VERSION}/g" ansible-collection-containers-podman-build.spec
sed -i "s/Release:.*/Release: 999%{?dist}/g" ansible-collection-containers-podman-build.spec
sed -i "s/^version: .*/version: ${VERSION}/" ${TMPINSTALLDIR}/${PKG_NAME}-${VERSION}/galaxy.yml
rpmbuild -bb ansible-collection-containers-podman-build.spec