1 |
commit: 97f0d18a976f63155e49686779c9eb75d539fa8a |
2 |
Author: Tony Vroon <chainsaw <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Feb 28 12:03:28 2019 +0000 |
4 |
Commit: Tony Vroon <chainsaw <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Feb 28 12:03:28 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=97f0d18a |
7 |
|
8 |
net-proxy/http-replicator: Revert 3.0 branch removal |
9 |
|
10 |
This reverts commit 3b8b8f6ec45e0220e5b841c96f89f52c6c5e02a5. |
11 |
The 4.0 branch does not implement --alias which means it is not a |
12 |
drop-in replacement to 3.0 in all cases. |
13 |
Please speak to me or file me a bug if you have any change requirements |
14 |
for the 3.x branch ebuilds. I will action them. |
15 |
|
16 |
Requested-By: Matthew Ogilvie |
17 |
Signed-Off-By: Tony Vroon <chainsaw <AT> gentoo.org> |
18 |
Closes: https://bugs.gentoo.org/676758 |
19 |
|
20 |
net-proxy/http-replicator/Manifest | 1 + |
21 |
.../http-replicator-3-missing-directory.patch | 51 ++++++++++++ |
22 |
.../http-replicator-3-unique-cache-name.patch | 31 ++++++++ |
23 |
.../files/http-replicator-3.0-sighup.patch | 20 +++++ |
24 |
.../http-replicator/files/http-replicator-3.0.conf | 46 +++++++++++ |
25 |
.../http-replicator/files/http-replicator-3.0.init | 20 +++++ |
26 |
.../http-replicator/http-replicator-3.0-r7.ebuild | 93 ++++++++++++++++++++++ |
27 |
7 files changed, 262 insertions(+) |
28 |
|
29 |
diff --git a/net-proxy/http-replicator/Manifest b/net-proxy/http-replicator/Manifest |
30 |
index 8c075058ba4..460a0f3b65b 100644 |
31 |
--- a/net-proxy/http-replicator/Manifest |
32 |
+++ b/net-proxy/http-replicator/Manifest |
33 |
@@ -1 +1,2 @@ |
34 |
+DIST http-replicator_3.0.tar.gz 39291 BLAKE2B a97d8b6b32f5d4ca4feefa9abaa7da7cb6570f76566c79d7371134c0edd74b2333a02480deff02fa1bf5b6cd6f2bfbfe4aaa649633d70bd2efbdd22701422651 SHA512 d98a608c38201db6f2d8ba809a4777ab5588f5ed395882bdf542c2788df1770c61a2de160604c09297d847f2c73463ba0530d7f2c2e482467f8e8f35be068d57 |
35 |
DIST http-replicator_4.0alpha2.tgz 27575 BLAKE2B 48138bc8fa9695ddb31ce89c4638adda4a1d1b58c904cd98d0ee1dbab006f79ef7d19495db8eb4de0113f8e45da425950524c48ec9e3e864d8595ccdef9f7cfa SHA512 437e0cc881af0cb8f84bfd1366bb6edeee4f76112c4b2ac2af4bcb8809462852b96e9c99e04c8f370492c9e1eb33ddc68a85c4f09b073694242cd6c05b4d3a6c |
36 |
|
37 |
diff --git a/net-proxy/http-replicator/files/http-replicator-3-missing-directory.patch b/net-proxy/http-replicator/files/http-replicator-3-missing-directory.patch |
38 |
new file mode 100644 |
39 |
index 00000000000..37c2ce2361f |
40 |
--- /dev/null |
41 |
+++ b/net-proxy/http-replicator/files/http-replicator-3-missing-directory.patch |
42 |
@@ -0,0 +1,51 @@ |
43 |
+Author: Matthew Ogilvie |
44 |
+Date: Sat Jan 17 09:24:34 2015 -0700 |
45 |
+ |
46 |
+ add some suggestions to the missing-directory error message |
47 |
+ |
48 |
+ Also wait until directory confirmed before forking. |
49 |
+ |
50 |
+ See gentoo bug 502574 and bug 442874 |
51 |
+ |
52 |
+diff --git a/http-replicator b/http-replicator |
53 |
+index bbc163c..81e254d 100755 |
54 |
+--- a/http-replicator |
55 |
++++ b/http-replicator |
56 |
+@@ -636,13 +636,6 @@ def main (): |
57 |
+ parser.error('user %r does not exist' % options.user) |
58 |
+ except OSError: |
59 |
+ parser.error('no permission for changing to user %r' % options.user) |
60 |
+- pid = os.fork() # fork process |
61 |
+- if pid: # parent process |
62 |
+- pidfile.write(str(pid)) # store child's pid |
63 |
+- pidfile.close() |
64 |
+- return |
65 |
+- else: |
66 |
+- signal.signal(signal.SIGHUP, signal.SIG_IGN) |
67 |
+ else: |
68 |
+ handler = logging.StreamHandler(sys.stdout) # log to stdout |
69 |
+ handler.setFormatter(logging.Formatter('%(levelname)s: %(name)s %(message)s')) |
70 |
+@@ -651,10 +644,22 @@ def main (): |
71 |
+ try: |
72 |
+ os.chdir(options.dir) # change to cache directory |
73 |
+ except OSError: |
74 |
+- parser.error('invalid directory %r' % options.dir) |
75 |
++ parser.error('invalid directory %r\n' \ |
76 |
++ 'Try running repcacheman, and/or see\n' \ |
77 |
++ 'http://forums.gentoo.org/viewtopic-t-173226.html' \ |
78 |
++ % options.dir) |
79 |
+ if not os.access(os.curdir, os.R_OK | os.W_OK): # check permissions for cache directory |
80 |
+ parser.error('no read/write permission for directory %r' % options.dir) |
81 |
+ |
82 |
++ if options.daemon: |
83 |
++ pid = os.fork() # fork process |
84 |
++ if pid: # parent process |
85 |
++ pidfile.write(str(pid)) # store child's pid |
86 |
++ pidfile.close() |
87 |
++ return |
88 |
++ else: |
89 |
++ signal.signal(signal.SIGHUP, signal.SIG_IGN) |
90 |
++ |
91 |
+ sys.stdout = sys.stderr = open('/dev/null', 'w') # redirect all output to bit bucket |
92 |
+ logging.root.name = 'HttpReplicator' |
93 |
+ try: |
94 |
|
95 |
diff --git a/net-proxy/http-replicator/files/http-replicator-3-unique-cache-name.patch b/net-proxy/http-replicator/files/http-replicator-3-unique-cache-name.patch |
96 |
new file mode 100644 |
97 |
index 00000000000..3ad0529ed16 |
98 |
--- /dev/null |
99 |
+++ b/net-proxy/http-replicator/files/http-replicator-3-unique-cache-name.patch |
100 |
@@ -0,0 +1,31 @@ |
101 |
+Author: Matthew Ogilvie |
102 |
+Date: Sun Dec 28 20:14:15 2014 -0700 |
103 |
+ |
104 |
+ honor x-unique-cache-name header in flat mode, if present |
105 |
+ |
106 |
+ This allows things like different versions of the adobe-flash |
107 |
+ downloader that are given different names in a flat download |
108 |
+ directory (like in gentoo) to work in an http-replicator cache |
109 |
+ as well. As long as the fetcher passes the custom name through |
110 |
+ the experimental header... |
111 |
+ |
112 |
+ See gentoo bug # 442874 |
113 |
+ |
114 |
+diff --git a/http-replicator b/http-replicator |
115 |
+index 19ae427..befe9f2 100755 |
116 |
+--- a/http-replicator |
117 |
++++ b/http-replicator |
118 |
+@@ -311,7 +311,12 @@ class HttpClient (Http): |
119 |
+ self.log.info('requested range: bytes %s to %s' % self.range) # log request |
120 |
+ |
121 |
+ head = '' |
122 |
+- for tail in self.path.split('/'): # iterate over items in path |
123 |
++ adjUrlPath = self.path |
124 |
++ if not self.direct and self.flat: |
125 |
++ uniqueCacheName = body.get('x-unique-cache-name') |
126 |
++ if uniqueCacheName: |
127 |
++ adjUrlPath = uniqueCacheName |
128 |
++ for tail in adjUrlPath.split('/'): # iterate over items in path |
129 |
+ head = os.path.join(head, tail) # build target path |
130 |
+ if head in self.alias: # path up till now hos an alias |
131 |
+ head = self.alias[head] # replace by alias |
132 |
|
133 |
diff --git a/net-proxy/http-replicator/files/http-replicator-3.0-sighup.patch b/net-proxy/http-replicator/files/http-replicator-3.0-sighup.patch |
134 |
new file mode 100644 |
135 |
index 00000000000..969bbc91f9d |
136 |
--- /dev/null |
137 |
+++ b/net-proxy/http-replicator/files/http-replicator-3.0-sighup.patch |
138 |
@@ -0,0 +1,20 @@ |
139 |
+--- a/http-replicator 2007-07-09 20:09:44.000000000 +0200 |
140 |
++++ b/http-replicator 2007-07-09 20:11:48.433913445 +0200 |
141 |
+@@ -5,7 +5,7 @@ |
142 |
+ # Because of this the server runs as a single process, multiplexing I/O with its various client and server connections within a single process/thread. |
143 |
+ # According to the readme <http://www.nightmare.com/medusa/README.html> this means it is capable of smoother and higher performance than most other servers, while placing a dramatically reduced load on the server machine. |
144 |
+ |
145 |
+-import asyncore, socket, os, time, calendar, sys, re, optparse, logging |
146 |
++import asyncore, socket, os, time, calendar, sys, re, optparse, logging, signal |
147 |
+ |
148 |
+ # LISTENER |
149 |
+ # |
150 |
+@@ -636,6 +636,8 @@ |
151 |
+ pidfile.write(str(pid)) # store child's pid |
152 |
+ pidfile.close() |
153 |
+ return |
154 |
++ else: |
155 |
++ signal.signal(signal.SIGHUP, signal.SIG_IGN) |
156 |
+ else: |
157 |
+ handler = logging.StreamHandler(sys.stdout) # log to stdout |
158 |
+ handler.setFormatter(logging.Formatter('%(levelname)s: %(name)s %(message)s')) |
159 |
|
160 |
diff --git a/net-proxy/http-replicator/files/http-replicator-3.0.conf b/net-proxy/http-replicator/files/http-replicator-3.0.conf |
161 |
new file mode 100644 |
162 |
index 00000000000..35671fd262c |
163 |
--- /dev/null |
164 |
+++ b/net-proxy/http-replicator/files/http-replicator-3.0.conf |
165 |
@@ -0,0 +1,46 @@ |
166 |
+## Config file for http-replicator |
167 |
+## sourced by init scripts automatically |
168 |
+## GENERAL_OPTS used by repcacheman |
169 |
+## DAEMON_OPTS used by http-replicator |
170 |
+ |
171 |
+ |
172 |
+## Set the cache dir |
173 |
+GENERAL_OPTS="--dir /var/cache/http-replicator" |
174 |
+ |
175 |
+## Change UID/GID to user after opening the log and pid file. |
176 |
+## 'user' must have read/write access to cache dir: |
177 |
+GENERAL_OPTS="$GENERAL_OPTS --user portage" |
178 |
+ |
179 |
+## Don't change or comment this out: |
180 |
+DAEMON_OPTS="$GENERAL_OPTS" |
181 |
+ |
182 |
+## Do you need a proxy to reach the internet? |
183 |
+## This will forward requests to an external proxy server: |
184 |
+## Use one of the following, not both: |
185 |
+#DAEMON_OPTS="$DAEMON_OPTS --external somehost:1234" |
186 |
+#DAEMON_OPTS="$DAEMON_OPTS --external username:password@host:port" |
187 |
+ |
188 |
+## Local dir to serve clients. Great for serving binary packages |
189 |
+## See PKDIR and PORTAGE_BINHOST settings in 'man make.conf' |
190 |
+## --alias /path/to/serve:location will make /path/to/serve |
191 |
+## browsable at http://http-replicator.com:port/location |
192 |
+DAEMON_OPTS="$DAEMON_OPTS --alias /usr/portage/packages:packages" |
193 |
+ |
194 |
+## Dir to hold the log file: |
195 |
+DAEMON_OPTS="$DAEMON_OPTS --log /var/log/http-replicator.log" |
196 |
+ |
197 |
+## Make the log messages less and less verbose. |
198 |
+## Up to four times to make it extremely quiet. |
199 |
+#DAEMON_OPTS="$DAEMON_OPTS --quiet" |
200 |
+#DAEMON_OPTS="$DAEMON_OPTS --quiet" |
201 |
+ |
202 |
+## Make the log messages extra verbose for debugging. |
203 |
+#DAEMON_OPTS="$DAEMON_OPTS --debug" |
204 |
+ |
205 |
+## The ip addresses from which access is allowed. Can be used as many times |
206 |
+## as necessary. Access from localhost is allowed by default. |
207 |
+DAEMON_OPTS="$DAEMON_OPTS --ip 192.168.*.*" |
208 |
+DAEMON_OPTS="$DAEMON_OPTS --ip 10.*.*.*" |
209 |
+ |
210 |
+## The proxy port on which the server listens for http requests: |
211 |
+DAEMON_OPTS="$DAEMON_OPTS --port 8080" |
212 |
|
213 |
diff --git a/net-proxy/http-replicator/files/http-replicator-3.0.init b/net-proxy/http-replicator/files/http-replicator-3.0.init |
214 |
new file mode 100644 |
215 |
index 00000000000..7fc3d5e108d |
216 |
--- /dev/null |
217 |
+++ b/net-proxy/http-replicator/files/http-replicator-3.0.init |
218 |
@@ -0,0 +1,20 @@ |
219 |
+#!/sbin/openrc-run |
220 |
+# Copyright 1999-2016 Gentoo Foundation |
221 |
+# Distributed under the terms of the GNU General Public License v2 |
222 |
+ |
223 |
+depend() { |
224 |
+ need net |
225 |
+} |
226 |
+ |
227 |
+start() { |
228 |
+ ebegin "Starting Http-Replicator" |
229 |
+ start-stop-daemon --start --pidfile /var/run/http-replicator.pid --name http-replicator \ |
230 |
+ --exec /usr/bin/http-replicator -- -s -f --pid /var/run/http-replicator.pid --daemon $DAEMON_OPTS |
231 |
+ eend $? "Failed to start Http-Replicator" |
232 |
+} |
233 |
+ |
234 |
+stop() { |
235 |
+ ebegin "Stopping Http-Replicator" |
236 |
+ start-stop-daemon --stop --pidfile /var/run/http-replicator.pid --name http-replicator --signal 2 |
237 |
+ eend $? "Failed to stop Http-Replicator" |
238 |
+} |
239 |
|
240 |
diff --git a/net-proxy/http-replicator/http-replicator-3.0-r7.ebuild b/net-proxy/http-replicator/http-replicator-3.0-r7.ebuild |
241 |
new file mode 100644 |
242 |
index 00000000000..68405a1f8c1 |
243 |
--- /dev/null |
244 |
+++ b/net-proxy/http-replicator/http-replicator-3.0-r7.ebuild |
245 |
@@ -0,0 +1,93 @@ |
246 |
+# Copyright 1999-2017 Gentoo Foundation |
247 |
+# Distributed under the terms of the GNU General Public License v2 |
248 |
+ |
249 |
+EAPI=6 |
250 |
+ |
251 |
+PYTHON_COMPAT=( python2_7 ) # not 2.6 bug #33907, not 3.0 bug #411083 |
252 |
+ |
253 |
+inherit eutils python-single-r1 systemd |
254 |
+ |
255 |
+MY_P="${PN}_${PV}" |
256 |
+ |
257 |
+DESCRIPTION="Proxy cache for Gentoo packages" |
258 |
+HOMEPAGE="https://sourceforge.net/projects/http-replicator" |
259 |
+SRC_URI="mirror://sourceforge/http-replicator/${MY_P}.tar.gz" |
260 |
+ |
261 |
+LICENSE="GPL-2" |
262 |
+SLOT="0" |
263 |
+KEYWORDS="~alpha amd64 hppa ppc ~sparc x86" |
264 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE}" |
265 |
+ |
266 |
+RDEPEND="${PYTHON_DEPS}" |
267 |
+DEPEND="${RDEPEND}" |
268 |
+ |
269 |
+S="${WORKDIR}/${MY_P}" |
270 |
+ |
271 |
+PATCHES=( |
272 |
+ "${FILESDIR}/http-replicator-3.0-sighup.patch" |
273 |
+ "${FILESDIR}/http-replicator-3-unique-cache-name.patch" |
274 |
+ "${FILESDIR}/http-replicator-3-missing-directory.patch" |
275 |
+) |
276 |
+ |
277 |
+pkg_setup() { |
278 |
+ python-single-r1_pkg_setup |
279 |
+} |
280 |
+ |
281 |
+src_install() { |
282 |
+ # Daemon and repcacheman into /usr/bin |
283 |
+ python_scriptinto /usr/bin |
284 |
+ python_doscript http-replicator |
285 |
+ python_newscript "${FILESDIR}/http-replicator-3.0-repcacheman-0.44-r2" repcacheman.py |
286 |
+ |
287 |
+ exeinto /usr/bin |
288 |
+ newexe "${FILESDIR}/http-replicator-3.0-callrepcacheman-0.1" repcacheman |
289 |
+ |
290 |
+ # init.d scripts |
291 |
+ newinitd "${FILESDIR}/http-replicator-3.0.init" http-replicator |
292 |
+ newconfd "${FILESDIR}/http-replicator-3.0.conf" http-replicator |
293 |
+ |
294 |
+ systemd_dounit "${FILESDIR}"/http-replicator.service |
295 |
+ systemd_install_serviced "${FILESDIR}"/http-replicator.service.conf |
296 |
+ |
297 |
+ # Docs |
298 |
+ dodoc README debian/changelog |
299 |
+ |
300 |
+ # Man Page - Not Gentooified yet |
301 |
+ doman http-replicator.1 |
302 |
+ |
303 |
+ insinto /etc/logrotate.d |
304 |
+ newins debian/logrotate http-replicator |
305 |
+} |
306 |
+ |
307 |
+pkg_postinst() { |
308 |
+ elog |
309 |
+ ewarn "Before starting http-replicator, please follow the next few steps:" |
310 |
+ elog "- Modify /etc/conf.d/http-replicator if required." |
311 |
+ ewarn "- Run /usr/bin/repcacheman to set up the cache." |
312 |
+ elog "- Add http_proxy=\"http://serveraddress:8080\" to make.conf on" |
313 |
+ elog " the server as well as on the client machines." |
314 |
+ elog "- Make sure FETCHCOMMAND adds the X-unique-cache-name header to" |
315 |
+ elog " HTTP requests in make.conf (or maybe portage will add it to" |
316 |
+ elog " the default make.globals someday). Example:" |
317 |
+ elog ' FETCHCOMMAND="wget -t 3 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" --header=\"X-unique-cache-name: \${FILE}\" \"\${URI}\""' |
318 |
+ elog ' RESUMECOMMAND="wget -c -t 3 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" --header=\"X-unique-cache-name: \${FILE}\" \"\${URI}\""' |
319 |
+ elog "- Arrange to periodically run repcacheman on this server," |
320 |
+ elog " to clean up the local /usr/portage/distfiles directory." |
321 |
+ elog "- Arrange to periodically run something like the following" |
322 |
+ elog " on this server. 'eclean' is in app-portage/gentoolkit." |
323 |
+ elog " ( export DISTDIR=/var/cache/http-replicator/" |
324 |
+ elog " eclean -i distfiles )" |
325 |
+ elog "- Even with FETCHCOMMAND fixing most cases, occasionally" |
326 |
+ elog " an older invalid version of a file may end up in the cache," |
327 |
+ elog " causing checksum failures when portage tries to fetch" |
328 |
+ elog " it. To recover, either use eclean (above), manually delete" |
329 |
+ elog " the relevant file from the cache, or temporarily comment" |
330 |
+ elog " out the http_proxy setting. Commenting only requires" |
331 |
+ elog " access to client config, not server cache." |
332 |
+ elog "- Make sure GENTOO_MIRRORS in /etc/portage/make.conf starts" |
333 |
+ elog " with several good http mirrors." |
334 |
+ elog |
335 |
+ elog "For more information please refer to the following forum thread:" |
336 |
+ elog " http://forums.gentoo.org/viewtopic-t-173226.html" |
337 |
+ elog |
338 |
+} |