Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/iproute2/, sys-apps/iproute2/files/
Date: Tue, 09 Jan 2018 23:41:44
Message-Id: 1515541250.333b1e3a9086215ff466114e1762172ef3124ee3.vapier@gentoo
1 commit: 333b1e3a9086215ff466114e1762172ef3124ee3
2 Author: Mike Frysinger <vapier <AT> chromium <DOT> org>
3 AuthorDate: Tue Jan 9 23:40:41 2018 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 9 23:40:50 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=333b1e3a
7
8 sys-apps/iproute2: clean up scripts to use /bin/sh only
9
10 .../files/iproute2-4.14.1-posix-shell.patch | 65 +++++++++
11 sys-apps/iproute2/iproute2-4.14.1-r4.ebuild | 153 +++++++++++++++++++++
12 2 files changed, 218 insertions(+)
13
14 diff --git a/sys-apps/iproute2/files/iproute2-4.14.1-posix-shell.patch b/sys-apps/iproute2/files/iproute2-4.14.1-posix-shell.patch
15 new file mode 100644
16 index 00000000000..e5efc9068ce
17 --- /dev/null
18 +++ b/sys-apps/iproute2/files/iproute2-4.14.1-posix-shell.patch
19 @@ -0,0 +1,65 @@
20 +https://marc.info/?l=linux-netdev&m=151554000532498&w=2
21 +
22 +From aec69bbc285e5498add5384b6018564355594233 Mon Sep 17 00:00:00 2001
23 +From: Mike Frysinger <vapier@××××××××.org>
24 +Date: Tue, 9 Jan 2018 18:16:53 -0500
25 +Subject: [PATCH iproute2] ifcfg/rtpr: convert to POSIX shell
26 +
27 +These files are already mostly written in POSIX shell, so convert their
28 +shebangs to /bin/sh and tweak the few bashisms in here.
29 +
30 +URL: https://crbug.com/756559
31 +Reported-by: Pat Erley <perley@××××××××.org>
32 +Signed-off-by: Mike Frysinger <vapier@××××××××.org>
33 +---
34 + ip/ifcfg | 12 ++++++------
35 + ip/rtpr | 2 +-
36 + 2 files changed, 7 insertions(+), 7 deletions(-)
37 +
38 +diff --git a/ip/ifcfg b/ip/ifcfg
39 +index 851b9215ab63..5b34decd4480 100644
40 +--- a/ip/ifcfg
41 ++++ b/ip/ifcfg
42 +@@ -1,3 +1,3 @@
43 +-#! /bin/bash
44 ++#! /bin/sh
45 +
46 + CheckForwarding () {
47 +@@ -7,7 +7,7 @@ CheckForwarding () {
48 + fwd=0
49 + if [ -d $sbase ]; then
50 + for dir in $sbase/*/forwarding; do
51 +- fwd=$[$fwd + `cat $dir`]
52 ++ fwd=$(( fwd + $(cat "$dir") ))
53 + done
54 + else
55 + fwd=2
56 +@@ -128,12 +128,12 @@ fi
57 + arping -q -A -c 1 -I $dev $ipaddr
58 + noarp=$?
59 + ( sleep 2 ;
60 +- arping -q -U -c 1 -I $dev $ipaddr ) >& /dev/null </dev/null &
61 ++ arping -q -U -c 1 -I $dev $ipaddr ) >/dev/null 2>&1 </dev/null &
62 +
63 +-ip route add unreachable 224.0.0.0/24 >& /dev/null
64 +-ip route add unreachable 255.255.255.255 >& /dev/null
65 ++ip route add unreachable 224.0.0.0/24 >/dev/null 2>&1
66 ++ip route add unreachable 255.255.255.255 >/dev/null 2>&1
67 + if [ "`ip link ls $dev | grep -c MULTICAST`" -ge 1 ]; then
68 +- ip route add 224.0.0.0/4 dev $dev scope global >& /dev/null
69 ++ ip route add 224.0.0.0/4 dev $dev scope global >/dev/null 2>&1
70 + fi
71 +
72 + if [ $fwd -eq 0 ]; then
73 +diff --git a/ip/rtpr b/ip/rtpr
74 +index 192a476f817e..7e48674bcf53 100644
75 +--- a/ip/rtpr
76 ++++ b/ip/rtpr
77 +@@ -1,3 +1,3 @@
78 +-#! /bin/bash
79 ++#! /bin/sh
80 +
81 + exec tr "[\\\\]" "[
82 +--
83 +2.15.1
84 +
85
86 diff --git a/sys-apps/iproute2/iproute2-4.14.1-r4.ebuild b/sys-apps/iproute2/iproute2-4.14.1-r4.ebuild
87 new file mode 100644
88 index 00000000000..c9c21b326b4
89 --- /dev/null
90 +++ b/sys-apps/iproute2/iproute2-4.14.1-r4.ebuild
91 @@ -0,0 +1,153 @@
92 +# Copyright 1999-2018 Gentoo Foundation
93 +# Distributed under the terms of the GNU General Public License v2
94 +
95 +EAPI=6
96 +
97 +inherit toolchain-funcs flag-o-matic multilib
98 +
99 +if [[ ${PV} == "9999" ]] ; then
100 + EGIT_REPO_URI="git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git"
101 + inherit git-r3
102 +else
103 + SRC_URI="mirror://kernel/linux/utils/net/${PN}/${P}.tar.xz"
104 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
105 +fi
106 +
107 +DESCRIPTION="kernel routing and traffic control utilities"
108 +HOMEPAGE="https://wiki.linuxfoundation.org/networking/iproute2"
109 +
110 +LICENSE="GPL-2"
111 +SLOT="0"
112 +IUSE="atm berkdb +iptables ipv6 minimal selinux"
113 +
114 +# We could make libmnl optional, but it's tiny, so eh
115 +RDEPEND="
116 + !net-misc/arpd
117 + !minimal? ( net-libs/libmnl virtual/libelf )
118 + iptables? ( >=net-firewall/iptables-1.4.20:= )
119 + berkdb? ( sys-libs/db:= )
120 + atm? ( net-dialup/linux-atm )
121 + selinux? ( sys-libs/libselinux )
122 +"
123 +# We require newer linux-headers for ipset support #549948 and some defines #553876
124 +DEPEND="
125 + ${RDEPEND}
126 + app-arch/xz-utils
127 + iptables? ( virtual/pkgconfig )
128 + >=sys-devel/bison-2.4
129 + sys-devel/flex
130 + >=sys-kernel/linux-headers-3.16
131 + elibc_glibc? ( >=sys-libs/glibc-2.7 )
132 +"
133 +
134 +PATCHES=(
135 + "${FILESDIR}"/${PN}-3.1.0-mtu.patch #291907
136 + "${FILESDIR}"/${P}-fix-tc-actions.patch
137 + "${FILESDIR}"/${P}-configure-nomagic.patch # bug 643722
138 + "${FILESDIR}"/${P}-posix-shell.patch
139 +)
140 +
141 +src_prepare() {
142 + if ! use ipv6 ; then
143 + PATCHES+=(
144 + "${FILESDIR}"/${PN}-4.11.0-no-ipv6.patch #326849
145 + )
146 + fi
147 +
148 + default
149 +
150 + sed -i \
151 + -e '/^CC :\?=/d' \
152 + -e "/^LIBDIR/s:=.*:=/$(get_libdir):" \
153 + -e "s:-O2:${CFLAGS} ${CPPFLAGS}:" \
154 + -e "/^HOSTCC/s:=.*:= $(tc-getBUILD_CC):" \
155 + -e "/^WFLAGS/s:-Werror::" \
156 + -e "/^DBM_INCLUDE/s:=.*:=${T}:" \
157 + Makefile || die
158 +
159 + # Use /run instead of /var/run.
160 + sed -i \
161 + -e 's:/var/run:/run:g' \
162 + include/namespace.h \
163 + man/man8/ip-netns.8 || die
164 +
165 + # build against system headers
166 + rm -r include/netinet #include/linux include/ip{,6}tables{,_common}.h include/libiptc
167 + sed -i 's:TCPI_OPT_ECN_SEEN:16:' misc/ss.c || die
168 +
169 + use minimal && sed -i -e '/^SUBDIRS=/s:=.*:=lib tc ip:' Makefile
170 +}
171 +
172 +src_configure() {
173 + tc-export AR CC PKG_CONFIG
174 +
175 + # This sure is ugly. Should probably move into toolchain-funcs at some point.
176 + local setns
177 + pushd "${T}" >/dev/null
178 + printf '#include <sched.h>\nint main(){return setns(0, 0);}\n' > test.c
179 + ${CC} ${CFLAGS} ${CPPFLAGS} -D_GNU_SOURCE ${LDFLAGS} test.c >&/dev/null && setns=y || setns=n
180 + echo 'int main(){return 0;}' > test.c
181 + ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} test.c -lresolv >&/dev/null || sed -i '/^LDLIBS/s:-lresolv::' "${S}"/Makefile
182 + popd >/dev/null
183 +
184 + # run "configure" script first which will create "config.mk"...
185 + econf
186 +
187 + # ...now switch on/off requested features via USE flags
188 + # this is only useful if the test did not set other things, per bug #643722
189 + cat <<-EOF >> config.mk
190 + TC_CONFIG_ATM := $(usex atm y n)
191 + TC_CONFIG_XT := $(usex iptables y n)
192 + TC_CONFIG_NO_XT := $(usex iptables n y)
193 + # We've locked in recent enough kernel headers #549948
194 + TC_CONFIG_IPSET := y
195 + HAVE_BERKELEY_DB := $(usex berkdb y n)
196 + HAVE_MNL := $(usex minimal n y)
197 + HAVE_ELF := $(usex minimal n y)
198 + HAVE_SELINUX := $(usex selinux y n)
199 + IP_CONFIG_SETNS := ${setns}
200 + # Use correct iptables dir, #144265 #293709
201 + IPT_LIB_DIR := $(use iptables && ${PKG_CONFIG} xtables --variable=xtlibdir)
202 + EOF
203 +}
204 +
205 +src_compile() {
206 + emake V=1
207 +}
208 +
209 +src_install() {
210 + if use minimal ; then
211 + into /
212 + dosbin tc/tc
213 + dobin ip/ip
214 + return 0
215 + fi
216 +
217 + emake \
218 + DESTDIR="${D}" \
219 + LIBDIR="${EPREFIX%/}"/$(get_libdir) \
220 + SBINDIR="${EPREFIX%/}"/sbin \
221 + CONFDIR="${EPREFIX%/}"/etc/iproute2 \
222 + DOCDIR="${EPREFIX%/}"/usr/share/doc/${PF} \
223 + MANDIR="${EPREFIX%/}"/usr/share/man \
224 + ARPDDIR="${EPREFIX%/}"/var/lib/arpd \
225 + install
226 +
227 + dodir /bin
228 + mv "${ED%/}"/{s,}bin/ip || die #330115
229 +
230 + dolib.a lib/libnetlink.a
231 + insinto /usr/include
232 + doins include/libnetlink.h
233 + # This local header pulls in a lot of linux headers it
234 + # doesn't directly need. Delete this header that requires
235 + # linux-headers-3.8 until that goes stable. #467716
236 + sed -i '/linux\/netconf.h/d' "${ED%/}"/usr/include/libnetlink.h || die
237 +
238 + if use berkdb ; then
239 + dodir /var/lib/arpd
240 + # bug 47482, arpd doesn't need to be in /sbin
241 + dodir /usr/bin
242 + mv "${ED%/}"/sbin/arpd "${ED%/}"/usr/bin/ || die
243 + fi
244 +}