Skip to content

Commit 1129f02

Browse files
blackboxswDarkPhily
authored andcommitted
chore: update developer specfile redhat/fedora and dependencies (canonical#6326)
1 parent 9fa41d8 commit 1129f02

File tree

3 files changed

+31
-79
lines changed

3 files changed

+31
-79
lines changed

packages/pkg-deps.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,25 @@
6969
"hostname"
7070
]
7171
},
72+
"fedora": {
73+
"build-requires" : [
74+
"bash-completion-devel",
75+
"meson",
76+
"pkgconf",
77+
"python3-devel",
78+
"systemd-devel"
79+
],
80+
"requires" : [
81+
"e2fsprogs",
82+
"iproute",
83+
"net-tools",
84+
"procps",
85+
"rsyslog",
86+
"shadow-utils",
87+
"sudo",
88+
"hostname"
89+
]
90+
},
7291
"suse" : {
7392
"renames" : {
7493
"jinja2" : "python3-Jinja2",

packages/redhat/cloud-init.spec.in

Lines changed: 9 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
## template: jinja
2-
%define use_systemd (0%{?fedora} && 0%{?fedora} >= 18) || (0%{?rhel} && 0%{?rhel} >= 7)
3-
4-
%if %{use_systemd}
5-
%define init_system systemd
6-
%else
7-
%define init_system sysvinit
8-
%endif
92

103
# See: http://www.zarb.org/~jasonc/macros.php
114
# Or: http://fedoraproject.org/wiki/Packaging:ScriptletSnippets
@@ -14,7 +7,7 @@
147
Name: cloud-init
158
Version: {{rpm_upstream_version}}
169
Release: 1{{subrelease}}%{?dist}
17-
Summary: Cloud instance initilization tool
10+
Summary: Cloud instance initialization tool
1811

1912
Group: System Environment/Base
2013
License: Dual-licesed GPLv3 or Apache 2.0
@@ -24,20 +17,10 @@ Source0: {{archive_name}}
2417
BuildArch: noarch
2518
BuildRoot: %{_tmppath}
2619

27-
%if "%{?el6}" == "1"
28-
BuildRequires: python-argparse
29-
%endif
30-
%if %{use_systemd}
31-
Requires: systemd
32-
BuildRequires: systemd
33-
Requires: systemd-units
34-
BuildRequires: systemd-units
35-
%else
36-
Requires: initscripts >= 8.36
37-
Requires(postun): initscripts
38-
Requires(post): chkconfig
39-
Requires(preun): chkconfig
40-
%endif
20+
Requires: systemd
21+
BuildRequires: pkgconfig(systemd)
22+
Requires: systemd-units
23+
BuildRequires: systemd-units
4124

4225
{% for r in buildrequires %}
4326
BuildRequires: {{r}}
@@ -61,16 +44,9 @@ Requires: {{r}}
6144
Patch{{loop.index0}}: {{p}}
6245
{% endfor %}
6346

64-
%if "%{init_system}" == "systemd"
6547
Requires(post): systemd
6648
Requires(preun): systemd
6749
Requires(postun): systemd
68-
%else
69-
Requires(post): chkconfig
70-
Requires(postun): initscripts
71-
Requires(preun): chkconfig
72-
Requires(preun): initscripts
73-
%endif
7450

7551
%description
7652
Cloud-init is a set of init scripts for cloud instances. Cloud instances
@@ -86,7 +62,7 @@ ssh keys and to let the user run various scripts.
8662
{% endfor %}
8763

8864
%build
89-
%meson -Dinit_system=systemd
65+
%meson -Dinit_system=systemd -Ddistro_templates=chef_client.rb.tmpl,chrony.conf.rhel.tmpl,hosts.redhat.tmpl,ntp.conf.rhel.tmpl,resolv.conf.tmpl,timesyncd.conf.tmpl
9066
%meson_build
9167

9268
%install
@@ -113,68 +89,23 @@ version_pys=$(cd "$RPM_BUILD_ROOT" && find . -name version.py -type f)
11389
rm -rf $RPM_BUILD_ROOT
11490

11591
%post
92+
%systemd_post cloud-init-main.service cloud-config.service cloud-config.target cloud-final.service cloud-init-network.service cloud-init.target cloud-init-local.service
11693

117-
%if "%{init_system}" == "systemd"
118-
if [ $1 -eq 1 ]
119-
then
120-
/bin/systemctl enable cloud-init-main.service >/dev/null 2>&1 || :
121-
/bin/systemctl enable cloud-init-local.service >/dev/null 2>&1 || :
122-
/bin/systemctl enable cloud-init-network.service >/dev/null 2>&1 || :
123-
/bin/systemctl enable cloud-config.service >/dev/null 2>&1 || :
124-
/bin/systemctl enable cloud-final.service >/dev/null 2>&1 || :
125-
fi
126-
%else
127-
/sbin/chkconfig --add %{_initrddir}/cloud-init-local
128-
/sbin/chkconfig --add %{_initrddir}/cloud-init
129-
/sbin/chkconfig --add %{_initrddir}/cloud-config
130-
/sbin/chkconfig --add %{_initrddir}/cloud-final
131-
%endif
13294

13395
%preun
96+
%systemd_preun cloud-init-main.service cloud-config.service cloud-config.target cloud-final.service cloud-init-network.service cloud-init.target cloud-init-local.service
13497

135-
%if "%{init_system}" == "systemd"
136-
if [ $1 -eq 0 ]
137-
then
138-
/bin/systemctl --no-reload disable cloud-init-main.service >/dev/null 2>&1 || :
139-
/bin/systemctl --no-reload disable cloud-init-local.service >/dev/null 2>&1 || :
140-
/bin/systemctl --no-reload disable cloud-init-network.service >/dev/null 2>&1 || :
141-
/bin/systemctl --no-reload disable cloud-config.service >/dev/null 2>&1 || :
142-
/bin/systemctl --no-reload disable cloud-final.service >/dev/null 2>&1 || :
143-
fi
144-
%else
145-
if [ $1 -eq 0 ]
146-
then
147-
/sbin/service cloud-init stop >/dev/null 2>&1 || :
148-
/sbin/chkconfig --del cloud-init || :
149-
/sbin/service cloud-init-local stop >/dev/null 2>&1 || :
150-
/sbin/chkconfig --del cloud-init-local || :
151-
/sbin/service cloud-config stop >/dev/null 2>&1 || :
152-
/sbin/chkconfig --del cloud-config || :
153-
/sbin/service cloud-final stop >/dev/null 2>&1 || :
154-
/sbin/chkconfig --del cloud-final || :
155-
fi
156-
%endif
15798

15899
%postun
159-
160-
%if "%{init_system}" == "systemd"
161-
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
162-
%endif
100+
%systemd_postun cloud-init-main.service cloud-config.service cloud-config.target cloud-final.service cloud-init-network.service cloud-init.target cloud-init-local.service
163101

164102
%files
165103

166104
%{_udevrulesdir}/66-azure-ephemeral.rules
167105

168-
%if "%{init_system}" == "systemd"
169106
/usr/lib/systemd/system-generators/cloud-init-generator
170107
/usr/lib/systemd/system/[email protected]/disable-sshd-keygen-if-cloud-init-active.conf
171108
%{_unitdir}/cloud-*
172-
%else
173-
%attr(0755, root, root) %{_initddir}/cloud-config
174-
%attr(0755, root, root) %{_initddir}/cloud-final
175-
%attr(0755, root, root) %{_initddir}/cloud-init-local
176-
%attr(0755, root, root) %{_initddir}/cloud-init
177-
%endif
178109

179110
# Program binaries
180111
%{_bindir}/cloud-init*

tools/read-dependencies

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ DISTRO_PKG_TYPE_MAP = {
2626
"centos": "redhat",
2727
"eurolinux": "redhat",
2828
"miraclelinux": "redhat",
29-
"fedora": "redhat",
29+
"fedora": "fedora",
3030
"rocky": "redhat",
3131
"redhat": "redhat",
3232
"debian": "debian",
@@ -107,10 +107,12 @@ ZYPPER_INSTALL = [
107107

108108
DRYRUN_DISTRO_INSTALL_PKG_CMD = {
109109
"redhat": ["yum", "install", "--assumeyes"],
110+
"fedora": ["yum", "install", "--assumeyes"],
110111
}
111112

112113
DISTRO_INSTALL_PKG_CMD = {
113114
"redhat": MAYBE_RELIABLE_YUM_INSTALL,
115+
"fedora": MAYBE_RELIABLE_YUM_INSTALL,
114116
"debian": ["apt", "install", "-y"],
115117
"suse": ZYPPER_INSTALL,
116118
}

0 commit comments

Comments
 (0)