rolfn opened a new issue #16: Suggestion: rpm for openSUSE
URL: https://github.com/apache/couchdb-pkg/issues/16
 
 
   With the following patch against `Makefile` and `rpm/SPECS/couchdb.spec` 
it's possible to create a rpm file for openSUSE and after installing a working 
couchDB:
   ``` patch
   commit 29b6e6bd6ddb690eff921d45dee8d7e2556442a6
   Author: Rolf Niepraschk <[email protected]>
   Date:   Mon Dec 25 14:41:18 2017 +0100
   
       Changes for openSUSE rpm creation
   
   diff --git a/Makefile b/Makefile
   index b99c464..c20e149 100644
   --- a/Makefile
   +++ b/Makefile
   @@ -56,6 +56,8 @@ centos6: make-rpmbuild centos
    
    centos7: make-rpmbuild centos rm-js185-rpms
    
   +opensuse: centos7
   +
    # ######################################
    get-couch:
        mkdir -p $(COUCHDIR)
   diff --git a/rpm/SPECS/couchdb.spec b/rpm/SPECS/couchdb.spec
   index a2b11a9..608d0a7 100644
   --- a/rpm/SPECS/couchdb.spec
   +++ b/rpm/SPECS/couchdb.spec
   @@ -33,7 +33,19 @@ ExclusiveArch: x86_64
    Exclusiveos:   linux
    Packager:      CouchDB Developers <[email protected]>
    
   +%if 0%{?is_opensuse}
   +BuildRequires: erlang >= %{erlang_version}
   +BuildRequires: erlang-src
   +BuildRequires: erlang-rebar
   +BuildRequires: erlang-reltool
   +BuildRequires: erlang-epmd
   +BuildRequires: pkg-config
   +Requires(pre): shadow
   +%else
    BuildRequires: esl-erlang = %{erlang_version}
   +Requires(pre): shadow-utils
   +Requires(post): js = 1:1.8.5
   +%endif
    BuildRequires: gcc
    BuildRequires: git
    BuildRequires: help2man
   @@ -46,15 +58,16 @@ BuildRequires: python >= 2.6
    #BuildRequires: python-sphinx >= 1.5.3
    #BuildRequires: shunit2
    
   -Requires(pre): shadow-utils
   -
    Requires(post): curl
   -Requires(post): js = 1:1.8.5
    Requires(post): libicu >= 4.2.1
    Requires(post): procps
    Requires(post): python-progressbar
    Requires(post): python-requests
    
   +%if 0%{?is_opensuse}
   +BuildRequires: systemd-rpm-macros
   +%{?systemd_requires}
   +%else
    %if 0%{?fedora} || 0%{?rhel} >= 7
    BuildRequires:              xfsprogs-devel
    %{?systemd_requires}
   @@ -64,6 +77,7 @@ Requires(post):            chkconfig
    Requires(preun):    chkconfig, initscripts
    Requires(postun):   initscripts
    %endif
   +%endif
    
    %description
    Apache CouchDB is a distributed, fault-tolerant and schema-free
   @@ -103,7 +117,7 @@ if ! /usr/bin/getent passwd couchdb > /dev/null; then 
/usr/sbin/adduser \
    %{__install} -Dp -m0644 %{SOURCE5} %{buildroot}/etc/logrotate.d/%{name}
    /bin/find %{buildroot}/opt/%{name} -name *.ini -exec %{__chmod} 0640 {} \;
    
   -%if 0%{?fedora} || 0%{?rhel} >= 7
   +%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?is_opensuse}
    %{__install} -Dp -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
    %else
    %{__install} -Dp -m0755 %{SOURCE2} %{buildroot}%{_initrddir}/%{name}
   @@ -114,14 +128,14 @@ if ! /usr/bin/getent passwd couchdb > /dev/null; then 
/usr/sbin/adduser \
    %post
    %{__chown} -R couchdb:couchdb /opt/%{name}
    %{__chmod} a+x /opt/%{name}/bin/*
   -%if 0%{?fedora} || 0%{?rhel} >= 7
   +%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?is_opensuse}
    %systemd_post %{name}.service
    %else
    /sbin/chkconfig --add %{name} || :
    %endif
    
    %preun
   -%if 0%{?fedora} || 0%{?rhel} >= 7
   +%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?is_opensuse}
    %systemd_preun %{name}.service
    %else
    # stop couchdb only when uninstalling
   @@ -133,7 +147,7 @@ killall -u couchdb epmd
    %endif
    
    %postun
   -%if 0%{?fedora} || 0%{?rhel} >= 7
   +%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?is_opensuse}
    %systemd_postun_with_restart %{name}.service
    %else
    # restart couchdb only when upgrading
   @@ -148,7 +162,7 @@ fi
    %attr(0755, %{name}, %{name}) %dir /var/log/%{name}
    %config(noreplace) /opt/couchdb/etc/local.ini
    %config /etc/logrotate.d/%{name}
   -%if 0%{?fedora} || 0%{?rhel} >= 7
   +%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?is_opensuse}
    %{_unitdir}/%{name}.service
    %else
    %{_initrddir}/%{name}
   ```
   The detail to create the rpm file:
   ```
   
URL=https://www.apache.org/dist/couchdb/source/2.1.1/apache-couchdb-2.1.1.tar.gz
 \
     make download-couch opensuse
   ```
   After compiling:
   ```
   systemctl --system daemon-reload
   systemctl enable couchdb.service
   systemctl start couchdb.service
   ```
   I tested the couchDB installation on "Tumbleweed" (version "20171222"). 
After january 8 I will do more tests on "Leap 42.2 and "Leap 42.3".
   
   It would be nice if my patches can be included in the project. Provided 
rpm's for openSUSE would also be helpful.
   
   
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to