diff --git a/.gitignore b/.gitignore index 7f4feda..c38bc5f 100644 --- a/.gitignore +++ b/.gitignore @@ -209,7 +209,6 @@ MANIFEST # 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. *.manifest -*.spec # Installer logs pip-log.txt @@ -387,3 +386,4 @@ $RECYCLE.BIN/ # Custom changelogs/.plugin-cache.yaml # 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 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7dbdd9a --- /dev/null +++ b/Makefile @@ -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 diff --git a/ansible-collection-containers-podman.spec b/ansible-collection-containers-podman.spec new file mode 100644 index 0000000..36bbf7a --- /dev/null +++ b/ansible-collection-containers-podman.spec @@ -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 - 1.4.1-1 +- Initial package diff --git a/contrib/build_rpm.sh b/contrib/build_rpm.sh new file mode 100755 index 0000000..681f871 --- /dev/null +++ b/contrib/build_rpm.sh @@ -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