Merge ~raharper/cloud-init:redhat-fix-spec-systemd into cloud-init:master

Proposed by Ryan Harper
Status: Merged
Merged at revision: b9cd8a82ee41e235df66801a02b2244226bee5ee
Proposed branch: ~raharper/cloud-init:redhat-fix-spec-systemd
Merge into: cloud-init:master
Diff against target: 51 lines (+20/-5)
1 file modified
packages/redhat/cloud-init.spec.in (+20/-5)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Scott Moser Approve
Review via email: mp+325402@code.launchpad.net

Description of the change

Update redhat spec to use distro release version to determine if we use systemd

The typical rpm build process will examine the spec file to determine
which packages should be installed in the boot root. This requires
the specfile to declare that it needs system. Provide this information
by checking which version in which the rpm is being built and exporting
requirements for systemd.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Scott Moser (smoser) wrote :

This looks fine. Go ahead and commit and push
But please make subject line of commit to be 74 chars or less.

(It might be the mobile view that makes me think it is. I did not count)

review: Approve
7e919ae... by Ryan Harper

Merge branch 'redhat-fix-spec-systemd' of git.launchpad.net:~raharper/cloud-init into redhat-fix-spec-systemd

Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/packages/redhat/cloud-init.spec.in b/packages/redhat/cloud-init.spec.in
2index 1939ca8..3e92c98 100644
3--- a/packages/redhat/cloud-init.spec.in
4+++ b/packages/redhat/cloud-init.spec.in
5@@ -1,10 +1,12 @@
6 ## template: cheetah
7 %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
8
9-%if %{undefined systemd_requires}
10-%define init_system sysvinit
11-%else
12+%define use_systemd (0%{?fedora} && 0%{?fedora} >= 18) || (0%{?rhel} && 0%{?rhel} >= 7)
13+
14+%if %{use_systemd}
15 %define init_system systemd
16+%else
17+%define init_system sysvinit
18 %endif
19
20 # See: http://www.zarb.org/~jasonc/macros.php
21@@ -29,6 +31,18 @@ BuildRequires: python-setuptools
22 %if "%{?el6}" == "1"
23 BuildRequires: python-argparse
24 %endif
25+%if %{use_systemd}
26+Requires: systemd
27+BuildRequires: systemd
28+Requires: systemd-units
29+BuildRequires: systemd-units
30+%else
31+Requires: initscripts >= 8.36
32+Requires(postun): initscripts
33+Requires(post): chkconfig
34+Requires(preun): chkconfig
35+%endif
36+
37 # These are runtime dependencies, but declared as BuildRequires so that
38 # - tests can be run here.
39 # - parts of cloud-init such (setup.py) use these dependencies.
40@@ -68,8 +82,9 @@ Patch${size}: $p
41 #end for
42
43 %if "%{init_system}" == "systemd"
44-BuildRequires: systemd-units
45-%{systemd_requires}
46+Requires(post): systemd
47+Requires(preun): systemd
48+Requires(postun): systemd
49 %else
50 Requires(post): chkconfig
51 Requires(postun): initscripts

Subscribers

People subscribed via source and target branches