Gentoo Archives: gentoo-commits

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/cfengine/, net-misc/cfengine/files/
Date: Tue, 07 Jan 2020 02:03:52
Message-Id: 1578362625.4edd04b727e428dbe617c8a56d304ca23e00cf79.robbat2@gentoo
1 commit: 4edd04b727e428dbe617c8a56d304ca23e00cf79
2 Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 7 02:03:21 2020 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 7 02:03:45 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4edd04b7
7
8 net-misc/cfengine: string parsing fix for infra
9
10 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
11
12 net-misc/cfengine/cfengine-2.2.10-r6.ebuild | 116 +++++++++++++++++++++
13 .../files/cfengine-2.2.10-lsbrelease.patch | 24 +++++
14 2 files changed, 140 insertions(+)
15
16 diff --git a/net-misc/cfengine/cfengine-2.2.10-r6.ebuild b/net-misc/cfengine/cfengine-2.2.10-r6.ebuild
17 new file mode 100644
18 index 00000000000..87d5fa9341e
19 --- /dev/null
20 +++ b/net-misc/cfengine/cfengine-2.2.10-r6.ebuild
21 @@ -0,0 +1,116 @@
22 +# Copyright 1999-2019 Gentoo Authors
23 +# Distributed under the terms of the GNU General Public License v2
24 +
25 +EAPI=7
26 +
27 +DESCRIPTION="An automated suite of programs for configuring and maintaining
28 +Unix-like computers"
29 +HOMEPAGE="http://www.cfengine.org/"
30 +SRC_URI="http://cfengine.com/source_code/download?file=${P}.tar.gz -> ${P}.tar.gz"
31 +
32 +LICENSE="GPL-2"
33 +SLOT="0"
34 +KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~s390 ~sparc ~x86"
35 +IUSE="vim-syntax"
36 +
37 +RDEPEND=">=sys-libs/db-4:=
38 + <dev-libs/openssl-1.1:=
39 + app-portage/portage-utils
40 + net-libs/libnsl:="
41 +DEPEND="${RDEPEND}
42 + virtual/yacc
43 + sys-devel/flex"
44 +PDEPEND="vim-syntax? ( app-vim/cfengine-syntax )"
45 +
46 +src_prepare() {
47 + eapply_user
48 +
49 + # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=520696
50 + # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=511666
51 + # https://bugs.gentoo.org/339808
52 + eapply "${FILESDIR}/admit-noclass-520696.patch" \
53 + "${FILESDIR}/511666-segfault.patch" \
54 + "${FILESDIR}/${P}-snprintf_buffer_overflow.patch" \
55 + "${FILESDIR}/${PN}-2.2.10-lsbrelease.patch"
56 +
57 + # 2048 causes crashes on some 32-bit hardened kernels, and the warning
58 + # messages say to turn it back down.
59 + if use x86; then
60 + sed -i -e "s:CF_IFREQ 2048:CF_IFREQ 1024:g" src/cf.defs.h || die
61 + fi
62 +}
63 +
64 +src_configure() {
65 + # Enforce /var/cfengine for historical compatibility
66 + econf \
67 + --disable-static \
68 + --with-workdir=/var/cfengine \
69 + --with-berkeleydb=/usr
70 +
71 + # Fix Makefile to skip doc,inputs, & contrib install to wrong locations
72 + sed -i -e 's/\(DIST_SUBDIRS.*\) contrib inputs doc/\1/' \
73 + -e 's/\(SUBDIRS.*\) contrib inputs/\1/' \
74 + -e 's/\(install-data-am.*\) install-docDATA/\1/' Makefile || die
75 +
76 + # Fix man pages
77 + sed -i -e 's@/usr/local@/usr@' doc/*.8 || die
78 +}
79 +
80 +src_install() {
81 + newinitd "${FILESDIR}"/cfservd.rc6 cfservd
82 + newinitd "${FILESDIR}"/cfenvd.rc6 cfenvd
83 + newinitd "${FILESDIR}"/cfexecd.rc6 cfexecd
84 +
85 + emake DESTDIR="${D}" install
86 +
87 + # Remove static library and libtool file as they are not needed
88 + rm "${ED}"/usr/$(get_libdir)/*.la || die
89 +
90 + dodoc AUTHORS ChangeLog README TODO INSTALL
91 +
92 + # Manually install doc and inputs
93 + doman doc/*.8
94 + doinfo doc/*.info*
95 + docinto examples
96 + dodoc inputs/*.example
97 +
98 + # Create cfengine working directory
99 + dodir /var/cfengine
100 + fperms 700 /var/cfengine
101 + keepdir /var/cfengine/bin
102 + keepdir /var/cfengine/inputs
103 + keepdir /var/cfengine/modules
104 +}
105 +
106 +pkg_postinst() {
107 + # Copy cfagent into the cfengine tree otherwise cfexecd won't
108 + # find it. Most hosts cache their copy of the cfengine
109 + # binaries here. This is the default search location for the
110 + # binaries.
111 +
112 + cp -f /usr/sbin/cf{agent,servd,execd} "${ROOT}"/var/cfengine/bin/
113 +
114 + einfo
115 + einfo "NOTE: The cfportage module has been deprecated in favor of the"
116 + einfo " upstream 'packages' action."
117 + einfo
118 + einfo "Init scripts for cfservd, cfenvd, and cfexecd are now provided."
119 + einfo
120 + einfo "To run cfengine out of cron every half hour modify your crontab:"
121 + einfo "0,30 * * * * /usr/sbin/cfexecd -F"
122 + einfo
123 +
124 + elog "You MUST generate the keys for cfengine by running:"
125 + elog "emerge --config ${CATEGORY}/${PN}"
126 +}
127 +
128 +pkg_config() {
129 + if [[ -z ${ROOT} ]]; then
130 + if [[ ! -f ${EPREFIX}/var/cfengine/ppkeys/localhost.priv ]]; then
131 + einfo "Generating keys for localhost."
132 + "${EPREFIX}"/usr/sbin/cfkey
133 + fi
134 + else
135 + die "cfengine cfkey does not support any value of ROOT other than /."
136 + fi
137 +}
138
139 diff --git a/net-misc/cfengine/files/cfengine-2.2.10-lsbrelease.patch b/net-misc/cfengine/files/cfengine-2.2.10-lsbrelease.patch
140 new file mode 100644
141 index 00000000000..6f8dfa04d8f
142 --- /dev/null
143 +++ b/net-misc/cfengine/files/cfengine-2.2.10-lsbrelease.patch
144 @@ -0,0 +1,24 @@
145 +Newer GCC mis-compiles the lsb_release reader function.
146 +
147 +Signed-off-by: Robin H. Johnson <robbat2@g.o>
148 +
149 +--- cfengine-2.2.10/src/misc.c 2009-02-10 21:55:36.000000000 -0800
150 ++++ cfengine-2.2.10/src/misc.c 2020-01-06 17:58:07.049226386 -0800
151 +@@ -1187,6 +1187,7 @@ if ((fp = cfpopen(VBUFF, "r")) == NULL)
152 +
153 + if (ReadLine(VBUFF, CF_BUFSIZE, fp))
154 + {
155 ++ Debug4("(%s)",VBUFF);
156 + char * buffer = VBUFF;
157 + strsep(&buffer, ":");
158 +
159 +@@ -1198,7 +1199,8 @@ if (ReadLine(VBUFF, CF_BUFSIZE, fp))
160 + info = buffer;
161 + while((*buffer != '\0') && !isspace(*buffer))
162 + {
163 +- *buffer = tolower(*buffer++);
164 ++ *buffer = tolower(*buffer);
165 ++ buffer++;
166 + }
167 +
168 + *buffer = '\0';