Skip to content

Build RPMs for HPC UGent #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions bdist_rpm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

VERSION=$(grep "Version:.*[0-9]" pyslurm.spec | tr -s " " | awk '{print $2;}')
RELEASE=$(grep "%global.*rel.*[-1-9]" pyslurm.spec | tr -s " " | awk '{print $3}')

echo $VERSION
echo $RELEASE

if [ "${RELEASE}" -gt 1 ]; then
SUFFIX=${VERSION}-${RELEASE}
else
SUFFIX=${VERSION}
fi

GITTAG=$(git log --format=%ct.%h -1)

mkdir -p BUILD SOURCES SPECS RPMS BUILDROOT
git archive --format=tar.gz -o "SOURCES/pyslurm-${SUFFIX}.tar.gz" --prefix="pyslurm-${SUFFIX}/" HEAD
cp pyslurm.spec "SPECS"
rpmbuild --define "gittag ${GITTAG}" --define "_topdir $PWD" -ba SPECS/pyslurm.spec

47 changes: 47 additions & 0 deletions pyslurm.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# SPEC file taken from https://centos.pkgs.org/7/puias-computational-x86_64/python-pyslurm-17.02-1.gitab899c6.sdl7.x86_64.rpm.html
Name: pyslurm
Version: 17.11.5
%global rel 1
Release: %{rel}%{gittag}%{?dist}.ug
Summary: PySlurm: Slurm Interface for Python

Group: Development/Libraries
License: GPLv2
URL: https://github.com/PySlurm/pyslurm

# when the rel number is one, the directory name does not include it
%if "%{rel}" == "1"
%global pyslurm_source_dir %{name}-%{version}
%else
%global pyslurm_source_dir %{name}-%{version}-%{rel}
%endif

Source: %{pyslurm_source_dir}.tar.gz
#Source0: https://github.com/PySlurm/pyslurm/archive/%{pyslcommit}/archive/%{pkgname}.tar.gz#/%{pkgname}-%{pyslcommit}.tar.gz

BuildRequires: slurm-devel >= %{version}, Cython, python-devel
Requires: slurm

%description
This module provides a low-level Python wrapper around the Slurm C-API using Cython.

%prep
%setup -q -n %{pyslurm_source_dir}

%build
%{__python} setup.py build

%install
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT

%clean
rm -rf $RPM_BUILD_ROOT

%files
%doc CONTRIBUTORS.rst COPYING.txt README.rst THANKS.rst
%{python_sitearch}/*

%changelog
* Tue May 29 2018 Andy Georges <andy.georges@ugent.be> - Adjusted for HPC UGent
* Fri May 19 2017 Josko Plazonic <plazonic@princeton.edu> - 17.02-1
- initial build