Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

packaging: rpms: Add systemd support for openSUSE #31

Merged
merged 1 commit into from
Jul 3, 2017

Conversation

hwoarang
Copy link
Contributor

Recent openSUSE releases have been migrated to systemd so use the
%{suse_version} macro to detect if we are building on openSUSE
so we can include the necessary systemd files and also perform the
needed systemd steps. This also defines the 'suse_version' to 1315
which is what openSUSE Leap 42.x use.

@michaelklishin
Copy link
Member

Thank you. Looks like we'll need to produce two separate packages for SUSE like we do for CentOS.

@michaelklishin
Copy link
Member

@hwoarang how recent is recent? We can't drop support for versions below 42 in 3.6.x but we probably can for 3.7.0. So, should we do that or put in effort to produce two SUSE packages?
The latter would affect our release timeline but we can do it if it's the right thing to do.

@hwoarang
Copy link
Contributor Author

@michaelklishin Well I was mostly referring to 42.X indeed. The rest of the openSUSE versions have reached EOL. In fact, 42.1 has also reached EOL.

https://en.opensuse.org/Lifetime

So it's up to you I suppose. If you need to build two variants for pre- and post- 42.X then I can modify this commit to use 0%{?suse_version} >= 1315 instead

@Gsantomaggio
Copy link
Member

@michaelklishin @dumbbell
In my opinion we should support both also with 3.7.0.
There are lot of users with old Centos versions, and I suppose it is the same with OpenSuse.

@hwoarang Thank you for your PR.

I tried the setup and it raised this error:

RPM build errors:
    File not found: /pk/packaging/RPMS/Fedora/BUILDROOT/rabbitmq-server-3.7.0.milestone15+8.g4db0752-1.suse.x86_64/etc/init.d/rabbitmq-server
Makefile:91: recipe for target 'package' failed
make[2]: *** [package] Error 1
make[2]: Leaving directory '/pk/packaging/RPMS/Fedora'
Makefile:90: recipe for target 'package-rpm-opensuse' failed
make[1]: *** [package-rpm-opensuse] Error 2
make[1]: Leaving directory '/pk/packaging'
Makefile:221: recipe for target 'package-rpm' failed
make: *** [package-rpm] Error 2
root@7e171201763f:/pk# ls /pk/packaging/RPMS/Fedora/BUILDROOT/rabbitmq-server-3.7.0.milestone15+8.g4db0752-1.suse.x86_64/
etc  usr  var
root@7e171201763f:/pk# ls /pk/packaging/RPMS/Fedora/BUILDROOT/rabbitmq-server-3.7.0.milestone15+8.g4db0752-1.suse.x86_64/etc/
logrotate.d  profile.d  rabbitmq
root@7e171201763f:/pk# ls -la PACKAGES/
total 41288
drwxr-xr-x  9 root root      306 Jun 29 08:23 .
drwxr-xr-x 18 root root      612 Jun 29 08:07 ..
drwxr-xr-x 28 root root      952 Jun 29 08:08 rabbitmq-server-3.7.0.milestone15+8.g4db0752
-rw-r--r--  1 root root 11227039 Jun 29 08:16 rabbitmq-server-3.7.0.milestone15+8.g4db0752-1.el6.noarch.rpm
-rw-r--r--  1 root root  6565126 Jun 29 08:16 rabbitmq-server-3.7.0.milestone15+8.g4db0752-1.el6.src.rpm
-rw-r--r--  1 root root 11227215 Jun 29 08:23 rabbitmq-server-3.7.0.milestone15+8.g4db0752-1.el7.noarch.rpm
-rw-r--r--  1 root root  6565138 Jun 29 08:23 rabbitmq-server-3.7.0.milestone15+8.g4db0752-1.el7.src.rpm
-rw-r--r--  1 root root   132317 Jun 29 08:08 rabbitmq-server-3.7.0.milestone15+8.g4db0752.manifest
-rw-r--r--  1 root root  6552280 Jun 29 08:09 rabbitmq-server-3.7.0.milestone15+8.g4db0752.tar.xz
root@7e171201763f:/pk#

(master branch works correctly )

@hwoarang
Copy link
Contributor Author

@Gsantomaggio

Thank you for the report. I believe the updated PR fixes that.

@Gsantomaggio
Copy link
Member

thanks @hwoarang but there are still problems:

commit 8f8633c09af61f75edb68c74aea37af517ae8b2d

RPM build errors:
    File not found: /pk/packaging/RPMS/Fedora/BUILDROOT/rabbitmq-server-3.7.0.milestone15+8.g8f8633c-1.el6.x86_64/pk/packaging/RPMS/Fedora/BUILDROOT/rabbitmq-server-3.7.0.milestone15+8.g8f8633c-1.el6.x86_64/etc/rc.d/init.d/rabbitmq-server
Makefile:91: recipe for target 'package' failed
make[2]: *** [package] Error 1
make[2]: Leaving directory '/pk/packaging/RPMS/Fedora'
Makefile:84: recipe for target 'package-rpm-rhel6' failed
make[1]: *** [package-rpm-rhel6] Error 2
make[1]: Leaving directory '/pk/packaging'
Makefile:221: recipe for target 'package-rpm' failed
make: *** [package-rpm] Error 2

I created this docker image to test the build, you could use it to test your script:

docker build -t rabbitmq_package .

Then:

(improve-opensuse-spec) ✗ docker run -it -v$(pwd):/pk/  --cpuset-cpus="0-3" rabbitmq_package /bin/bash

root@0c4d751537d6:/# cd /pk/
root@0c4d751537d6:/pk# make package-rpm

Recent openSUSE releases have been migrated to systemd so use the
%{suse_version} macro to detect if we are building on openSUSE
so we can include the necessary systemd files and also perform the
needed systemd steps. This also defines the 'suse_version' to 1315
which is what openSUSE Leap 42.x use. This also drops the buggy rhel7
conditional for the sysvinit script and use another 'find' command
instead. The previous condition was wrong since it would also try
to include the sysvinit file on openSUSE and Fedora which do not
define the %rhel macro and as such the 0 < 7 conditional was always
true.
@hwoarang
Copy link
Contributor Author

@Gsantomaggio thank you that was very helpful. I fixed the problems and it should be OK now.

@Gsantomaggio
Copy link
Member

@hwoarang ok now the builds work correctly ! :)!

Tested the package on opensuse-leap-42:

vagrant@opensuse-leap-42:/tmp> sudo systemctl start rabbitmq-server
vagrant@opensuse-leap-42:/tmp> sudo systemctl status rabbitmq-server
● rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2017-07-03 12:38:00 UTC; 7s ago
 Main PID: 8363 (beam)
   Status: "Initialized"
    Tasks: 68 (limit: 512)
   CGroup: /system.slice/rabbitmq-server.service
           ├─8363 /usr/lib64/erlang/erts-7.3.1.3/bin/beam -W w -A 64 -P 1048576 -t 5000000 -stbt db -zdbbl 32000 -K true -- -root ...

and:

vagrant@vagrant-openSUSE-Harlequin:/vagrant> cat /etc/os-release
NAME=openSUSE
VERSION="13.2 (Harlequin)"
..
vagrant@vagrant-openSUSE-Harlequin:/vagrant> sudo systemctl start rabbitmq-server
vagrant@vagrant-openSUSE-Harlequin:/vagrant> sudo systemctl status rabbitmq-server
rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled)
   Active: active (running) since Mon 2017-07-03 15:42:10 CEST; 2min 48s ago
 Main PID: 1265 (beam)
   Status: "Initialized"
   CGroup: /system.slice/rabbitmq-server.service
           ├─1265 /usr/lib64/erlang/erts-8.3.5/bin/beam -W w -A 64 -P 1048576 -t 5000000 -stbt db -zdbbl 32000 -K true -- -root /usr...

@michaelklishin
Copy link
Member

@hwoarang @Gsantomaggio @dumbbell @gerhard @hairyhum @kjnilsson @dcorbacho @lukebakken I'm still not 100% sure where we are with the number of packages we should support for OpenSUSE. Can we have just one or there are reasonable arguments for supporting two (like we do for CentOS: 6 and 7)?

@michaelklishin michaelklishin added this to the 3.7.0 milestone Jul 3, 2017
@michaelklishin
Copy link
Member

We decided to not create a separate package for 42.1 and older releases. This will be in 3.7.0, which should go RC later this month.

Thank you, @hwoarang!

@michaelklishin michaelklishin merged commit edc2573 into rabbitmq:master Jul 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants