Maintenance will be performed on git.ligo.org, chat.ligo.org, containers.ligo.org, and docs.ligo.org on the morning of Tuesday 11th August 2020, starting at approximately 9am PDT. It is expected to take around 20 minutes and there will be a short period of downtime (less than five minutes) towards the end of the maintenance window. Please direct any comments, questions, or concerns to computing-help@ligo.org.

Commit 32728bba authored by Daniel Brown's avatar Daniel Brown

rpm packaging script

parent 45e94d6f
......@@ -6,6 +6,4 @@ RUN yum -y update
RUN yum -y install git rpm-build gcc gsl-devel make gcc-c++
RUN git clone https://git.ligo.org/finesse/finesse.git
ADD . /host
ENTRYPOINT "python /root/finesse/packaging/rpm/build.py"
\ No newline at end of file
CMD ["python", "/host/build.py"]
\ No newline at end of file
......@@ -3,3 +3,5 @@ Builds an RPM package for the Finesse binary
Build docker image first:
docker build -t finesse/sl7 .
To create the rpm package:
docker run -it --volume=${PWD}:/host finesse/sl7
\ No newline at end of file
import os
from subprocess import call
import textwrap
from subprocess import call, check_output
from collections import defaultdict
import string
class SafeDict(dict):
def __missing__(self, key):
return '{' + key + '}'
os.chdir("/root/finesse")
call("git pull".split())
git_describe = str(check_output('git describe --tags'.split())).split("-")
call("./finesse.sh --build".split())
os.chdir("/root/finesse/packaging/rpm")
call("mkdir -p rpmbuild/{RPMS,SRPMS,BUILD,SOURCES,SPECS,tmp}".split())
for d in "RPMS,SRPMS,BUILD,SOURCES,SPECS,tmp".split(","):
call("mkdir -p rpmbuild/{d}".format(d=d).split())
with open(".rpmmacros") as file:
file.write("""
%_topdir %(echo $HOME)/rpmbuild
%_tmppath %{_topdir}/tmp
""")
with open("/root/.rpmmacros", "w") as f:
f.write("%_topdir /root/finesse/packaging/rpm/rpmbuild\n")
f.write("%_tmppath %{_topdir}/tmp\n")
os.chdir("/root/finesse/packaging/rpm/rpmbuild")
# mkdir finesse-{version}
# mkdir -p finesse-{version}/usr/bin
# mkdir -p finesse-{version}/etc/finesse
# install -m 755 toybinprog toybinprog-1.0/usr/bin
# install -m 644 toybinprog.conf toybinprog-1.0/etc/toybinprog/
# tar -zcvf toybinprog-1.0.tar.gz toybinprog-1.0/
\ No newline at end of file
vals = {
"version": git_describe[0],
"release": git_describe[1],
}
call('mkdir -p finesse-{version}'.format(**vals).split())
call('mkdir -p finesse-{version}/usr/bin'.format(**vals).split())
call('mkdir -p finesse-{version}/etc/finesse'.format(**vals).split())
call('cp /root/finesse/kat /root/finesse/packaging/rpm/rpmbuild/finesse-{version}/usr/bin'.format(**vals).split())
call('cp /root/finesse/kat.ini /root/finesse/packaging/rpm/rpmbuild/finesse-{version}/etc/finesse'.format(**vals).split())
call('tar -zcvf ./SOURCES/finesse-{version}-{release}.tar.gz finesse-{version}/'.format(**vals).split())
with open("/root/finesse/packaging/rpm/rpmbuild/SPECS/finesse.spec", "w") as f:
s = string.Formatter().vformat(textwrap.dedent("""
%define __spec_install_post %{nil}
%define debug_package %{nil}
%define __os_install_post %{_dbpath}/brp-compress
Summary: FINESSE: Frequency domain INterfErometer Simulation SoftwarE
Name: finesse
Version: {version}
Release: {release}
License: GPL
Group: Development/Tools
SOURCE0 : %{name}-%{{version}}-%{{release}}.tar.gz
URL: http://gwoptics.org/finesse
BuildRoot: %{_tmppath}/%{name}-%{{version}}-%{{release}}-root
%description
%{summary}
%prep
%setup -q
%build
# Empty section.
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}
# in builddir
cp -a * %{buildroot}
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%{_sysconfdir}/%{name}/kat.ini
%{_bindir}/*
%changelog
"""), (), SafeDict(**vals))
f.write(s)
call("rpmbuild -bb SPECS/finesse.spec".split())
call("cp RPMS/x86_64/finesse-2.2-16.x86_64.rpm /host".split())
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment