Skip to content

Instantly share code, notes, and snippets.

@bwann
Created February 11, 2016 05:25
Show Gist options
  • Save bwann/d1038a80ea2fbc3958b4 to your computer and use it in GitHub Desktop.
Save bwann/d1038a80ea2fbc3958b4 to your computer and use it in GitHub Desktop.

Revisions

  1. bwann created this gist Feb 11, 2016.
    128 changes: 128 additions & 0 deletions scribe.spec
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,128 @@
    %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}

    Name: scribe
    Version: 2.02
    Release: 2%{?dist}
    Summary: A server for aggregating log data streamed in real time

    Group: Development/Libraries
    License: ASL 2.0
    URL: http://developers.facebook.com/scribe
    Source0: https://github.com/facebookarchive/scribe/archive/master.zip
    Source1: scribed.service
    Source2: scribed.sysconfig
    BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

    BuildRequires: automake
    BuildRequires: boost
    BuildRequires: boost-devel >= 1.33
    BuildRequires: fb303-devel
    BuildRequires: libevent-devel
    BuildRequires: thrift
    BuildRequires: thrift-devel
    BuildRequires: gcc-c++
    BuildRequires: systemd

    Requires: %{name}-python
    Requires: fb303
    Requires(post): systemd
    Requires(preun): systemd
    Requires(postun): systemd

    %description
    Scribe is a server for aggregating log data streamed in real time from a large
    number of servers. It is designed to be scalable, extensible without
    client-side modification, and robust to failure of the network or any specific
    machine.

    %package python
    Summary: Python bindings for %{name}
    Group: Development/Libraries
    BuildRequires: python-devel
    Requires: python-fb303

    %description python
    Python bindings for %{name}.

    %prep
    %setup -q -n %{name}-master

    # Remove subversion directories
    find . -type d -name .svn | xargs rm -fr

    %build
    %define configoptions --disable-static --with-thriftpath=%{_prefix} --with-fb303path=%{_prefix} --with-boost-system=boost_system --with-boost-filesystem=boost_filesystem
    ./bootstrap.sh %{configoptions}
    %configure %{configoptions}
    %{__make} %{?_smp_mflags}

    %install
    rm -rf %{buildroot}

    %{__make} DESTDIR=%{buildroot} install

    mkdir -p %{buildroot}%{_unitdir}

    # Install manually
    install -D -m 755 ./src/libscribe.so %{buildroot}%{_libdir}/libscribe.so
    install -D -m 755 ./src/libdynamicbucketupdater.so %{buildroot}%{_libdir}/libdynamicbucketupdater.so
    install -D -m 755 ./examples/scribe_cat %{buildroot}%{_bindir}/scribe_cat
    install -D -m 755 ./examples/scribe_ctrl %{buildroot}%{_sbindir}/scribe_ctrl
    install -D -m 644 ./examples/example1.conf %{buildroot}%{_sysconfdir}/scribed/default.conf
    install -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/scribed
    install -p -m 644 $RPM_SOURCE_DIR/scribed.service \
    %{buildroot}%{_unitdir}/scribed.service

    # Clean and fixes
    rm ./examples/scribe_*
    mv %{buildroot}%{_bindir}/scribed %{buildroot}%{_sbindir}/scribed
    find %{buildroot} -depth -type d -exec rmdir {} 2>/dev/null \;

    # We only want lib64 versions of this?
    rm %{buildroot}%{_prefix}/lib/libscribe.so
    rm %{buildroot}%{_prefix}/lib/libdynamicbucketupdater.so

    %clean
    rm -rf %{buildroot}

    %files
    %defattr(-,root,root,-)
    %doc LICENSE examples/
    %config(noreplace) %{_sysconfdir}/scribed/default.conf
    %config(noreplace) %{_sysconfdir}/sysconfig/scribed
    %{_unitdir}/*.service
    %{_sbindir}/scribed
    %{_sbindir}/scribe_ctrl

    %{_libdir}/libdynamicbucketupdater.so
    %{_libdir}/libscribe.so

    %files python
    %defattr(-,root,root,-)
    %doc LICENSE
    %{python_sitelib}/%{name}
    %{python_sitelib}/scribe-2.0-py2.7.egg-info
    %{_bindir}/scribe_cat

    %post
    %systemd_post scribed.service

    %preun
    %systemd_preun scribed.service

    %postun
    %systemd_postun_with_restart scribed.service

    %changelog
    * Tue Feb 09 2016 Bryan Wann <[email protected] - 2.02-2
    - Add systemd service entry

    * Tue Feb 09 2016 Bryan Wann <[email protected] - 2.02-1
    - Build for CentOS 7, based on final scribe version on
    github.com/facebookarchive/scribe

    * Wed May 06 2009 Silas Sewell <[email protected]> - 2.01-2
    - Build for EL5

    * Fri May 01 2009 Silas Sewell <[email protected]> - 2.01-1
    - Initial build
    9 changes: 9 additions & 0 deletions scribed.service
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    [Unit]
    Description=scribed

    [Service]
    Type=simple
    ExecStart=/bin/nohup /usr/sbin/scribed -c /etc/scribed/default.conf

    [Install]
    WantedBy=multi-user.target
    3 changes: 3 additions & 0 deletions scribed.sysconfig
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    # Configuration file for the scribe service.

    SCRIBED_CONFIG=/etc/scribed/default.conf
    36 changes: 36 additions & 0 deletions thrift.spec.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    --- thrift.spec 2014-05-05 02:47:16.000000000 -0700
    +++ thrift.spec.fix 2016-02-10 21:24:09.984735607 -0800
    @@ -1,6 +1,6 @@
    %global pkg_version 0.9.1
    %global fb303_version 1.0.0_dev
    -%global pkg_rel 12
    +%global pkg_rel 12_fix1

    %global py_version 2.7

    @@ -386,7 +386,7 @@
    sh ./bootstrap.sh

    # use unversioned doc dirs where appropriate (via _pkgdocdir macro)
    -%configure --disable-dependency-tracking --disable-static --without-libevent --with-boost=/usr %{ruby_configure} %{erlang_configure} %{golang_configure} %{php_configure} --docdir=%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}}
    +%configure --disable-dependency-tracking --disable-static --with-libevent=/usr --with-boost=/usr %{ruby_configure} %{erlang_configure} %{golang_configure} %{php_configure} --docdir=%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}}

    # eliminate unused direct shlib dependencies
    sed -i -e 's/ -shared / -Wl,--as-needed\0/g' libtool
    @@ -487,6 +487,7 @@
    %{_libdir}/pkgconfig/thrift-qt.pc
    %{_libdir}/pkgconfig/thrift.pc
    %{_libdir}/pkgconfig/thrift_c_glib.pc
    +%{_libdir}/pkgconfig/thrift-nb.pc
    %doc LICENSE NOTICE

    %files -n perl-%{name}
    @@ -547,6 +548,9 @@


    %changelog
    +* Mon Feb 08 2016 Bryan Wann <[email protected]> - 0.9.1-12_fix1
    +- Build with libevent support for scribe
    +
    * Mon May 05 2014 Lubomir Rintel <[email protected]> - 0.9.1-12
    - Fix EPEL build