diff --git a/.travis.yml b/.travis.yml index 3a3e305..56a7002 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ before_install: - ./build.sh alpine - ./build.sh centos - ./build.sh centos_rpm + - ./build.sh fedora_rpm script: - ./runtests.sh diff --git a/build/build.sh b/build/build.sh index 3be9f11..e8aaa86 100755 --- a/build/build.sh +++ b/build/build.sh @@ -5,7 +5,7 @@ set -e . functions.sh function usage() { - echo "$0 " + echo "$0 " } case $1 in @@ -14,11 +14,12 @@ case $1 in build_builder build_package ;; - build_deb) build_package ;; + build_deb) build_package ;; surok_image) build_surok_base rebuild ;; surok_image_no_rebuild) build_surok_base ;; alpine) build_alpine ;; centos) build_centos ;; centos_rpm) build_centos_rpm ;; + fedora_rpm) build_fedora_rpm ;; *) usage ;; esac diff --git a/build/functions.sh b/build/functions.sh index bfa5ed8..110e99c 100644 --- a/build/functions.sh +++ b/build/functions.sh @@ -136,9 +136,6 @@ MAINTAINER Denis Zheleztsov RUN yum -y install rpm-build COPY surok /tmp/surok-${VERSION} -RUN find /tmp/surok-${VERSION} -name '*pyc' -delete -RUN find /tmp/surok-${VERSION} -name '*pyo' -delete -RUN rm -rf /tmp/surok-${VERSION}/surok/__pycache__ RUN mkdir -p /root/rpmbuild/SPECS RUN mkdir -p /root/rpmbuild/SOURCES RUN cd /tmp && tar -czvf /root/rpmbuild/SOURCES/surok.tar.gz surok-${VERSION} @@ -152,20 +149,33 @@ EOF } function fedora_builder() { - cat > Dockerfile.fedora_builder < Dockerfile.centos_builder < RUN dnf -y install rpm-build -COPY surok /root/rpmbuild/SOURCES/surok +COPY surok /tmp/surok-${VERSION} +RUN mkdir -p /root/rpmbuild/SPECS +RUN mkdir -p /root/rpmbuild/SOURCES +RUN cd /tmp && tar -czvf /root/rpmbuild/SOURCES/surok.tar.gz surok-${VERSION} +ADD surok/surok_fedora.spec /root/rpmbuild/SPECS/ RUN dnf clean all + +ENTRYPOINT cd /root/rpmbuild/SPECS && rpmbuild -bb surok_fedora.spec EOF - docker build -t surok_builder_fedora -f Dockerfile.fedora_builder . + docker build -t surok_builder_fedora -f Dockerfile.centos_builder . } function build_centos_rpm() { centos_builder docker run -v $(pwd)/out:/root/rpmbuild/RPMS -ti surok_builder_centos } + +function build_fedora_rpm() { + fedora_builder + docker run -v $(pwd)/out:/root/rpmbuild/RPMS -ti surok_builder_fedora +} diff --git a/surok_fedora.spec b/surok_fedora.spec new file mode 100644 index 0000000..70ab991 --- /dev/null +++ b/surok_fedora.spec @@ -0,0 +1,55 @@ +Summary: Simple service discovery for Apache Mesos clusters +Name: surok +Version: 0.7.4.1 +Release: 1.fc24 +License: BSD +Group: admin +URL: https://github.com/Difrex/surok +Source0: surok.tar.gz +BuildArch: noarch +Requires: python3-requests, python3-dns, python3-memcached, python3-jinja2 +# BuildRoot: %{_tmppath}/%{name}-%{release}-root + +%description +Simple service discovery for Apache Mesos clusters + +%prep +%setup -q + +%build + +%install +mkdir -p %{buildroot}/opt/surok/surok +install -p -m 644 /root/rpmbuild/BUILD/surok-%{version}/surok/__init__.py %{buildroot}/opt/surok/surok +install -p -m 644 /root/rpmbuild/BUILD/surok-%{version}/surok/logger.py %{buildroot}/opt/surok/surok +install -p -m 644 /root/rpmbuild/BUILD/surok-%{version}/surok/system.py %{buildroot}/opt/surok/surok +install -p -m 644 /root/rpmbuild/BUILD/surok-%{version}/surok/discovery.py %{buildroot}/opt/surok/surok +install -p -m 644 /root/rpmbuild/BUILD/surok-%{version}/surok/templates.py %{buildroot}/opt/surok/surok +install -p -m 644 /root/rpmbuild/BUILD/surok-%{version}/surok.py %{buildroot}/opt/surok +mkdir -p %{buildroot}/etc/surok/{conf,conf.d,templates} +install -p -m 644 /root/rpmbuild/BUILD/surok-%{version}/conf/surok.json %{buildroot}/etc/surok/conf +install -p -m 644 /root/rpmbuild/BUILD/surok-%{version}/conf.d/selfcheck.json %{buildroot}/etc/surok/conf.d +install -p -m 644 /root/rpmbuild/BUILD/surok-%{version}/templates/selfcheck.jj2 %{buildroot}/etc/surok/templates + + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +/opt/surok/surok/__init__.py +/opt/surok/surok/logger.py +/etc/surok/conf/surok.json +/opt/surok/surok.py +/opt/surok/surok/discovery.py +/opt/surok/surok/system.py +/opt/surok/surok/templates.py +/etc/surok/conf.d/selfcheck.json +/etc/surok/templates/selfcheck.jj2 +%defattr(-,root,root,-) +%doc + + +%changelog +* Mon Nov 14 2016 Denis Zheleztsov - +- Initial build. +