Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/prefix:master commit in: scripts/
Date: Sat, 02 Jan 2021 19:17:44
Message-Id: 1609614991.c0ff0e5d25b78f612b26b63d0da31c69f6a034d4.grobian@gentoo
1 commit: c0ff0e5d25b78f612b26b63d0da31c69f6a034d4
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jan 2 19:16:31 2021 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Sat Jan 2 19:16:31 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=c0ff0e5d
7
8 scripts: remove old/obsolete scripts
9
10 - eupdate: dead the moment gx86 was migrated to git
11 - keyword-check: I frankly don't recall what it is/was for
12
13 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
14
15 scripts/eupdate.in | 831 -----------------------------------------------
16 scripts/keyword-check.rb | 51 ---
17 2 files changed, 882 deletions(-)
18
19 diff --git a/scripts/eupdate.in b/scripts/eupdate.in
20 deleted file mode 100755
21 index 1726cbec7d..0000000000
22 --- a/scripts/eupdate.in
23 +++ /dev/null
24 @@ -1,831 +0,0 @@
25 -#!/usr/bin/env bash
26 -# Copyright 2006-2014 Gentoo Foundation; Distributed under the GPL v2
27 -
28 -# <haubi@g.o> -- 2014-08-04
29 -# do numeric comparison on calculated rev-diff, as [[ 0 < -9 ]] is true
30 -# <grobian@g.o> -- 2010-10-16
31 -# treat ChangeLogs special, such that newer repoman that update the
32 -# ChangeLog can just do so -- we try to 'prepend only' avoiding
33 -# conflicts
34 -# <abcd@g.o> -- 2010-01-14
35 -# allow eclasses to be found in MTREEDIR if not in PTREEDIR
36 -# <zuxez@××××××××××××.de> -- 2009-08-11
37 -# allow to use web-based viewcvs instead of anonymous CVS access
38 -# <grobian@g.o> -- 2008-06-17
39 -# switch to fully sourcing ebuilds (and their eclasses) in fetch_files
40 -# such that we catch more cases in which patches can be referenced
41 -# <grobian@g.o> -- 2007-11-27
42 -# ignore live CVS ebuilds (version 9999)
43 -# <grobian@g.o> -- 2007-11-11
44 -# add some dummy implementations of often used functions to silence bash
45 -# some more
46 -# <grobian@g.o> -- 2007-11-09
47 -# also take notion of local variables for expansion in fetch_files
48 -# <grobian@g.o> -- 2007-10-08
49 -# added support for _p in versions after _rc, _pre, etc.
50 -# sourcing the versionator eclass when being used now for better
51 -# expansion of variables in fetch_files
52 -# <grobian@g.o> -- 2007-09-24
53 -# added support for all P* variables in fetch_files expansion, avoided
54 -# getting bash errors due to unterminated quotes
55 -# <grobian@g.o> -- 2007-09-12
56 -# performance improvements by avoiding comparing ebuilds to non-ebuilds
57 -# when looking for updates, and by avoiding fork/execs for cut and echo
58 -# in the version comparator function
59 -# <grobian@g.o> -- 2007-03-20
60 -# also update alpha, beta, pre, p, etc. instead of only revisions.
61 -# Basically everything which is on top of the 'base' version number
62 -# should be upgraded always.
63 -# <grobian@g.o> -- 2007-02-08
64 -# when adding a new version, also try and copy all extra files from
65 -# FILESDIR. Also when invoked from an empty directory properly deal
66 -# with "missing" files, so new files are copied.
67 -# <grobian@g.o> -- 2006-12-24
68 -# support for inter-revisions (-r01.1), which are also ignored when
69 -# comparing to the main tree
70 -# <grobian@g.o> -- 2006-11-03
71 -# let eapify figure out what should be done to a file. This requires
72 -# the extension of the file to be retained in the temp location, but
73 -# afterwards it works nicely for eclasses and ebuilds, as well as
74 -# ChangeLogs.
75 -# <grobian@g.o> -- 2006-09-22
76 -# eupdate: a not yet fully complete bucket of voodoo to sync a the
77 -# prefix tree with the mainline tree. Strategies followed are largerly
78 -# based on cvs revision numbers and diffs between those revisions. For
79 -# the real internals, please look at the comments below in the code. In
80 -# general, this script checks if an ebuild contains the most recent
81 -# changes to it, and if there is a newer ebuild available. In both
82 -# cases (cross) diffing techniques are used to maintain the manually
83 -# made changes.
84 -#
85 -# This script doesn't run out of the box, you have to feed it some paths
86 -# so it can do it's magic stuff. Also, you have to be a gentoo
87 -# developer with cvs access. (Or when anoncvs is available, every user
88 -# can do it.) For your convenience it is intended that you rename this
89 -# file to something without the .in and change the paths below.
90 -
91 -# Main Tree Directory, an rsynced portage tree is fine
92 -[[ -z $MTREEDIR ]] && MTREEDIR='/path/to/rsync-gentoo-x86'
93 -# Prefix offset
94 -[[ -z $EPREFIX ]] && EPREFIX=$(portageq envvar EPREFIX)
95 -# Prefix Tree Directory
96 -[[ -z $PTREEDIR ]] && PTREEDIR="`cd ${EPREFIX}/usr/portage && pwd -P`"
97 -# How to reach the CVS server for retrieving revision diffs, devs can
98 -# use their ssh access for the most up-to-date tree. You can use the
99 -# anonymous CVS (:pserver:anonymous@××××××××××××××.org:/var/cvsroot) or
100 -# HTTP-based webcvs (http://sources.gentoo.org/viewcvs.py). We default
101 -# to the first since it should be less stressful for the server.
102 -[[ -z $CVSROOT ]] && CVSROOT=':pserver:anonymous@××××××××××××××.org:/var/cvsroot'
103 -
104 -# Don't touch this. You really don't want to.
105 -CVSMODULE='gentoo-x86'
106 -# Voodoo to figure out what package you're currently messing with
107 -EPACKAGE="`pwd -P`"; EPACKAGE=${EPACKAGE#*${PTREEDIR}/}
108 -
109 -[[ -e "${EPREFIX}"/etc/init.d/functions.sh ]] \
110 - && source "${EPREFIX}"/etc/init.d/functions.sh \
111 - || echo "!!! cannot find functions.sh !!!"
112 -
113 -[[ -z $DO_INDENT ]] || RC_INDENTATION=$DO_INDENT
114 -
115 -# file used for subshell communication (in /tmp, so swap on Solaris)
116 -gf=/tmp/eupdate.subshell.$$
117 -
118 -# returns the CVS revision number from the $Header
119 -get_cvsversion() {
120 - if [[ -z $1 ]] ; then
121 - echo 0
122 - return
123 - fi
124 -
125 - ver=`egrep '(^|[^\\])\\\$(Header|Id):' "$1" | egrep -m1 -o "v [0-9.]+" | head -n1`
126 - if [[ $ver == "" ]] ; then
127 - echo 0
128 - return
129 - fi
130 - echo ${ver#v }
131 -}
132 -
133 -# Comparator for ebuild version strings. Returns 0 if both arguments
134 -# are equal, a number less then 0 if the first argument is smaller than
135 -# the second, and a number greater then 0 otherwise. Arguments may be
136 -# up to full paths to the bare version string only.
137 -# It is possible to deduce what the largest difference between the two
138 -# given versions is, by considering the following on the absolute return
139 -# value: 10000 < x < 0 -> main version, where 1 is a difference in
140 -# the major, 10 a difference in the minor, etc. 100000 < x < 10000 ->
141 -# suffix, 1000000 < x < 100000 -> revision.
142 -cmp_ebuild_ver() {
143 - # get the bare version, if not already
144 - local l=$(get_ebuildversion $1)
145 - local r=$(get_ebuildversion $2)
146 -
147 - if [[ -z $l ]] && [[ -z $r ]]; then
148 - echo 0
149 - return
150 - elif [[ ! -z $l ]] && [[ -z $r ]] ; then
151 - echo 1
152 - return
153 - fi
154 -
155 - local lver=${l%%-*}
156 - local lrev=${l#${lver}} ; lrev=${lrev#-}
157 - local t=$lver
158 - lver=${lver%%_*}
159 - local lsuf=${t#${lver}} ; lsuf=${lsuf#_}
160 -
161 - local rver=${r%%-*}
162 - local rrev=${r#${rver}} ; rrev=${rrev#-}
163 - t=$rver
164 - rver=${rver%%_*}
165 - local rsuf=${t#${rver}} ; rsuf=${rsuf#_}
166 -
167 - local cnt=1
168 - # start "eating" the version from the left, comparing the numbers,
169 - # following an exit-early approach
170 - while [[ $lver != "" ]] || [[ $rver != "" ]] ; do
171 - # get the "head" component
172 - local la=${lver%%.*}
173 - local ra=${rver%%.*}
174 - # unfortunately also characters next to numbers can appear in
175 - # the version number, 4a is considered to be smaller than 33
176 - local lan=${la%%[a-zA-Z]*}
177 - local ran=${ra%%[a-zA-Z]*}
178 -
179 - # deal with 1.0301 < 1.30
180 - while [[ ${lan} == 0* && ${ran} == 0* ]] ; do
181 - lan=${lan#0}
182 - ran=${ran#0}
183 - done
184 - if [[ ${lan} == 0* ]] ; then
185 - [[ -z ${ran} ]] && echo ${cnt} || echo -${cnt}
186 - return
187 - elif [[ ${ran} == 0* ]] ; then
188 - [[ -z ${lan} ]] && echo -${cnt} || echo ${cnt}
189 - return
190 - fi
191 -
192 - t=$((lan - ran))
193 - if (( ${t} != 0 )) ; then
194 - (( $t > 9 )) && t=9
195 - (( $t < -9 )) && t=-9
196 - echo $((t * cnt))
197 - return
198 - else
199 - # perform string equality... should work
200 - if [[ ${la} < ${ra} ]] ; then
201 - echo $((-1 * cnt))
202 - return
203 - elif [[ ${la} > ${ra} ]] ; then
204 - echo $cnt
205 - return
206 - fi
207 - fi
208 -
209 - # remove the part we processed (and was equal)
210 - lver=${lver#${la}}
211 - rver=${rver#${ra}}
212 - # strip leading dot (if any)
213 - lver=${lver#.}
214 - rver=${rver#.}
215 -
216 - (( $cnt < 1000 )) && cnt=$((cnt * 10))
217 - done
218 -
219 - # the main version components are equal, dive into the suffices
220 - # we need to treat _p special, as it can occur with the other suffices
221 -
222 - # suffix precedence rules:
223 - # alpha
224 - # beta
225 - # pre
226 - # rc
227 - # (none)
228 - # p
229 -
230 - cnt=10000
231 - local lan=0
232 - case $lsuf in
233 - alpha*)
234 - lan=-1
235 - lsuf=${lsuf#alpha}
236 - ;;
237 - beta*)
238 - lan=-2
239 - lsuf=${lsuf#beta}
240 - ;;
241 - pre*)
242 - lan=-3
243 - lsuf=${lsuf#pre}
244 - ;;
245 - rc*)
246 - lan=-4
247 - lsuf=${lsuf#rc}
248 - ;;
249 - p*)
250 - lan=-6
251 - lsuf=${lsuf#p}
252 - ;;
253 - *)
254 - lan=-5
255 - ;;
256 - esac
257 -
258 - local ran=0
259 - case $rsuf in
260 - alpha*)
261 - ran=-1
262 - rsuf=${rsuf#alpha}
263 - ;;
264 - beta*)
265 - ran=-2
266 - rsuf=${rsuf#beta}
267 - ;;
268 - pre*)
269 - ran=-3
270 - rsuf=${rsuf#pre}
271 - ;;
272 - rc*)
273 - ran=-4
274 - rsuf=${rsuf#rc}
275 - ;;
276 - p*)
277 - ran=-6
278 - rsuf=${rsuf#p}
279 - ;;
280 - *)
281 - ran=-5
282 - ;;
283 - esac
284 -
285 - t=$((lan - ran))
286 - if (( ${t} != 0 )) ; then
287 - echo $((-t * cnt))
288 - return
289 - fi
290 -
291 - # if lsuf or rsuf starts with a 0, bash thinks it's an octal number
292 - if [[ ${lsuf} == 0* || ${rsuf} == 0* ]] ; then
293 - lsuf="1${lsuf}"
294 - rsuf="1${rsuf}"
295 - fi
296 -
297 - lsuf=${lsuf:-0}
298 - rsuf=${rsuf:-0}
299 - t=$((${lsuf%_p*} - ${rsuf%_p*}))
300 - if (( ${t} != 0 )) ; then
301 - (( $t > 9 )) && t=9
302 - (( $t < -9 )) && t=-9
303 - echo $((t * cnt))
304 - return
305 - fi
306 - # we may have a _p in the suffices now, need to compare those
307 - case ${lsuf}:${rsuf} in
308 - *_p*:*_p*)
309 - t=$((${lsuf#*_p} - ${rsuf#*_p}))
310 - if (( ${t} != 0 )) ; then
311 - (( $t > 9 )) && t=9
312 - (( $t < -9 )) && t=-9
313 - echo $((t * cnt))
314 - return
315 - fi
316 - ;;
317 - *_p*:*)
318 - echo $cnt
319 - return
320 - ;;
321 - *:*_p*)
322 - echo -$cnt
323 - return
324 - ;;
325 - esac
326 -
327 - # suffices were equal too, now lets see the revision
328 -
329 - cnt=100000
330 - lrev=${lrev#r}
331 - rrev=${rrev#r}
332 - lsrev=0
333 - rsrev=0
334 -
335 - if [[ ${lrev:0:1} == "0" ]] ; then
336 - lsrev=${lrev/*./}
337 - lrev=${lrev:1}
338 - lrev=${lrev/.*/}
339 - fi
340 - if [[ ${rrev:0:1} == "0" ]] ; then
341 - rsrev=${rrev/*./}
342 - rrev=${rrev:1}
343 - rrev=${rrev/.*/}
344 - fi
345 -
346 - t=$((lrev - rrev))
347 - (( $t == 0 )) && t=$((lsrev - rsrev))
348 - (( $t > 9 )) && t=9
349 - (( $t < -9 )) && t=-9
350 - echo $((t * cnt))
351 -}
352 -
353 -get_ebuildversion() {
354 - if [[ -z $1 ]] ; then
355 - return
356 - fi
357 -
358 - # strip extension
359 - t=${1%.ebuild}
360 - # abort if this is not an ebuild
361 - if [[ $t == $1 ]] ; then
362 - return
363 - fi
364 - # strip package name
365 - t=${t#*-}
366 - # sometimes there are dashes in the package name
367 - while [[ ${t:0:1} < "0" || ${t:0:1} > "9" ]] ; do
368 - [[ $t != ${t#*-} ]] \
369 - && t=${t#*-} \
370 - || break
371 - done
372 -
373 - echo ${t}
374 -}
375 -
376 -cross_diff() {
377 - mver=$(get_ebuildversion $1)
378 - pver=$(get_ebuildversion $2)
379 - # $1 is just somewhere, $2 must be local, mte becomes local $1
380 - mte=${1##*/}
381 - pte=$2
382 - # get real main tree corresponding version
383 - if [[ ${pte/-r0/-r} == $pte ]] ; then
384 - mypte=$pte
385 - else
386 - # normalise version, so we compare against the original
387 - # version from the main tree
388 - mypte=${pte%.*.ebuild}.ebuild
389 - mypte=${mypte/-r0/-r}
390 - mypte=${mypte/-r.ebuild/.ebuild}
391 - mypte=${mypte/-r0.ebuild/.ebuild}
392 - fi
393 - mtecv=$(get_cvsversion $1)
394 - ptecv=$(get_cvsversion $2)
395 - ewarn "new version in main tree: ${mver} [${pver}] ... cross diff from $ptecv to $mtecv"
396 - # checkout both original versions and make the diffs,
397 - # ignoring keywords
398 - tmp="tmp.${package##*.}"
399 - if [[ ${CVSROOT} == "http://"* ]] ; then
400 - wget -q -O /var/tmp/$mypte-$ptecv.$tmp \
401 - "${CVSROOT}/${CVSMODULE}/${EPACKAGE}/$mypte?rev=$ptecv"
402 - wget -q -O /var/tmp/$mte-$mtecv.$tmp \
403 - "${CVSROOT}/${CVSMODULE}/${EPACKAGE}/$mte?rev=$mtecv"
404 - else
405 - cvs -Q -d"${CVSROOT}" \
406 - checkout -r$ptecv -p ${CVSMODULE}/${EPACKAGE}/$mypte \
407 - > /var/tmp/$mypte-$ptecv.$tmp
408 - cvs -Q -d"${CVSROOT}" \
409 - checkout -r$mtecv -p ${CVSMODULE}/${EPACKAGE}/$mte \
410 - > /var/tmp/$mte-$mtecv.$tmp
411 - fi
412 - # create the new file to patch against
413 - cp $pte $mte
414 - # Sanitise the $Header line, because it may differ being in the
415 - # Attic or something. Use version of main tree, to keep updates
416 - # working.
417 - sed -i \
418 - -e 's|^# \$Header:.*$|'"`egrep '^# \\\$Header: ' /var/tmp/$mte-$mtecv.$tmp`"'|' \
419 - $mte /var/tmp/$mypte-$ptecv.$tmp
420 - # make KEYWORDS void in the diff
421 - sed -i \
422 - -e 's|^KEYWORDS=.*$|'"$(egrep '^KEYWORDS=' $pte | head -n1)"'|' \
423 - /var/tmp/$mypte-$ptecv.$tmp /var/tmp/$mte-$mtecv.$tmp
424 - # destroy changes (hopefully) with the prefixed version by eapifying
425 - eapify -e /var/tmp/$mypte-$ptecv.$tmp /var/tmp/$mte-$mtecv.$tmp > /dev/null
426 - # (attempt to) do it!
427 - diff -u /var/tmp/$mypte-$ptecv.$tmp /var/tmp/$mte-$mtecv.$tmp \
428 - | patch --no-backup-if-mismatch $mte
429 - ret=$?
430 - rm /var/tmp/$mypte-$ptecv.$tmp /var/tmp/$mte-$mtecv.$tmp
431 - # try to get new patches and stuff
432 - fetch_files $mte
433 - return $ret
434 -}
435 -
436 -revision_diff() {
437 - local mtecv=$1
438 - local ptecv=$2
439 - local package=$3
440 - local pfile=$4
441 - # Gentoo never increments the major, and branches are not
442 - # allowed, so we can make things easy and only use the minor
443 - if [[ ${mtecv#1.} -eq ${ptecv#1.} ]] ; then
444 - return
445 - elif [[ ${mtecv#1.} -gt ${ptecv#1.} ]] ; then
446 - echo "out-of-date, applying diff -r$ptecv -r$mtecv"
447 - # checkout both original versions and make the diffs,
448 - # ignoring keywords
449 - local tmp="tmp.${package##*.}"
450 - if [[ ${CVSROOT} == "http://"* ]] ; then
451 - wget -q -O /var/tmp/$package-$ptecv.$tmp \
452 - "${CVSROOT}/${CVSMODULE}/${EPACKAGE}/$package?rev=$ptecv"
453 - wget -q -O /var/tmp/$package-$mtecv.$tmp \
454 - "${CVSROOT}/${CVSMODULE}/${EPACKAGE}/$package?rev=$mtecv"
455 - else
456 - cvs -Q -d"${CVSROOT}" \
457 - checkout -r$ptecv -p ${CVSMODULE}/${EPACKAGE}/$package \
458 - > /var/tmp/$package-$ptecv.$tmp
459 - cvs -Q -d"${CVSROOT}" \
460 - checkout -r$mtecv -p ${CVSMODULE}/${EPACKAGE}/$package \
461 - > /var/tmp/$package-$mtecv.$tmp
462 - fi
463 - # make KEYWORDS void in the diff
464 - [[ ${package##*.} == "ebuild" ]] && sed -i \
465 - -e 's|^KEYWORDS=.*$|'"$(egrep '^KEYWORDS=' $pfile | head -n1)"'|' \
466 - /var/tmp/$package-$mtecv.$tmp /var/tmp/$package-$ptecv.$tmp
467 - if [[ ${package} != "ChangeLog" ]] ; then
468 - # destroy changes (hopefully) with the prefixed version by eapifying
469 - eapify /var/tmp/$package-$ptecv.$tmp /var/tmp/$package-$mtecv.$tmp > /dev/null
470 - # if the file was checked out by ecopy from the web, correct the
471 - # header so we don't get conflicts because of that
472 - sed -i -e '/^# $Header:/s:/var/www/viewcvs.gentoo.org/raw_cvs:/var/cvsroot:' \
473 - $pfile
474 - # show what's going to change
475 - diff -U 1 /var/tmp/$package-$ptecv.$tmp /var/tmp/$package-$mtecv.$tmp
476 - local chng=$?
477 - # (attempt to) do it!
478 - diff -u /var/tmp/$package-$ptecv.$tmp /var/tmp/$package-$mtecv.$tmp \
479 - | patch --no-backup-if-mismatch $pfile
480 - local ret=$?
481 - # try to get new patches and stuff
482 - fetch_files $pfile
483 - else
484 - # treat ChangeLogs different, so we can have appends both in
485 - # gx86 and Prefix (repoman insists)
486 -
487 - # first zap the headers, so we don't get any changes there
488 - sed -i \
489 - -e '1c\# ChangeLog for '"${EPACKAGE}" \
490 - -e '2c\# Copyright 1999-'"$(date +%Y)"' Gentoo Foundation; Distributed under the GPL v2' \
491 - /var/tmp/$package-$mtecv.$tmp
492 - {
493 - echo "@@ -1,3 +1,3 @@"
494 - head -n3 /var/tmp/$package-$ptecv.$tmp | sed -e 's/^/-/'
495 - head -n3 $pfile | sed -e 's/^/+/'
496 - } | patch -r - --no-backup-if-mismatch /var/tmp/$package-$ptecv.$tmp
497 -
498 - # then just take the first hunk, nothing more
499 - diff -U 1 /var/tmp/$package-$ptecv.$tmp /var/tmp/$package-$mtecv.$tmp | sed -e '4,$s/^@@ .*$/REMOVEMEXXXXXX/' | sed -e '/REMOVEMEXXXXXX/,$d'
500 - local chng=$?
501 - diff -U 0 /var/tmp/$package-$ptecv.$tmp /var/tmp/$package-$mtecv.$tmp | \
502 - sed -e '4,$s/^@@ .*$/REMOVEMEXXXXXX/' | \
503 - sed -e '/REMOVEMEXXXXXX/,$d' | \
504 - patch --no-backup-if-mismatch $pfile
505 - local ret=$?
506 - fi
507 - [[ $ret == 0 ]] && ret=$chng
508 - rm /var/tmp/$package-$ptecv.$tmp /var/tmp/$package-$mtecv.$tmp
509 - return $ret
510 - fi
511 -}
512 -
513 -fetch_files() {
514 - local mver=$(get_ebuildversion $1)
515 - local pn=${EPACKAGE##*/}
516 - local pv=${mver%-r*}
517 - local pr=${mver#${pv}} ; pr=${pr#-} ; pr=${pr:-r0}
518 - local pf=${pn}-${mver}
519 - local p=$pn-$pv
520 - local t=""
521 -
522 - # ebuild.sh and friends provided often occurring funcs
523 - local funcs='
524 - EXPORT_FUNCTIONS() { :; }
525 - has() { :; }
526 - hasq() { :; }
527 - use() { :; }
528 - use_enable() { :; }
529 - use_with() { :; }
530 - addwrite() { :; }
531 - addpredict() { :; }
532 - debug-print-function() { :; }
533 - debug-print() { :; }
534 - inherit() {
535 - for p in $*; do
536 - if [[ -f '"${PTREEDIR}"'/eclass/${p}.eclass ]]; then
537 - source '"${PTREEDIR}"'/eclass/${p}.eclass
538 - else
539 - source '"${MTREEDIR}"'/eclass/${p}.eclass
540 - fi
541 - done
542 - }
543 - :'
544 -
545 - # Find all "referenced" files from/to FILESDIR. We keep ${FILESDIR}
546 - # in, to just use a bash eval on what we found to get the right
547 - # path.
548 - eindent
549 - sed \
550 - -e '/FILESDIR/!d' \
551 - -e 's/^.*[^"]\("\?\${FILESDIR}\)/\1/' \
552 - -e 's/#.*$//' \
553 - -e 's/\\$//' \
554 - $1 | \
555 - while read l ; do
556 - t=$(eval a='$l'; for i in $a ; do echo $i ; break ; done)
557 - t=$(env -i P=$p PN=$pn PV=$pv PR=$pr PVR=$mver PF=$pf FILESDIR=files $(type -P bash) -c "${funcs}; source $1; echo $t")
558 - # we can have file{1,2} stuff in the first t here, so iterate
559 - # over the result list...
560 - for u in $t ; do
561 - if [[ ! -e $u ]] ; then
562 - ewarn "copying $u"
563 - [[ ! -d $(dirname $u) ]] && mkdir -p $(dirname $u)
564 - cp -R "${MTREEDIR}/${EPACKAGE}"/$u $u
565 - fi
566 - done
567 - done
568 - eoutdent
569 -}
570 -
571 -diff_patch() {
572 - ( diff -u $2 "${MTREEDIR}/${EPACKAGE}"/$1 ; echo $? > $gf ) | patch $2
573 - local ret=$?
574 - [[ ${ret} == 0 ]] && ret=$(< $gf)
575 - rm $gf
576 - # try to get new patches and stuff
577 - fetch_files $2
578 - return $ret
579 -}
580 -
581 -update_file() {
582 - # on directories, recurse
583 - if [[ -d $1 ]] ; then
584 - eindent
585 - # recurse into this directory (don't update digests)
586 - f=$(ls -p $1 | egrep -v "^digest-")
587 - [[ ! -z $f ]] && ( cd $1 && DO_INDENT=$RC_INDENTATION eupdate $f ; ret=$? )
588 - eoutdent
589 - return $ret
590 - fi
591 -
592 - # check existence of files
593 - if [[ ! -f $2 ]] ; then
594 - echo "no such file: $2"
595 - return -1
596 - fi
597 - if [[ ! -f "${MTREEDIR}/${EPACKAGE}"/$1 ]] ; then
598 - echo "$1 not found in the main tree"
599 - return 0
600 - fi
601 -
602 - # see if the file has a CVS header
603 - local mtecv=$(get_cvsversion "${MTREEDIR}/${EPACKAGE}"/$1)
604 - local ptecv=$(get_cvsversion $2)
605 - if [[ $mtecv == 0 ]] && [[ $ptecv == 0 ]] ; then
606 - diff_patch $1 $2
607 - return $?
608 - else
609 - revision_diff $mtecv $ptecv $1 $2
610 - return $?
611 - fi
612 -}
613 -
614 -do_check_file() {
615 - local mfile=$1
616 - local pfile=$2
617 - local msg=""
618 - if [[ -z $3 ]] ; then
619 - [[ $pfile != $mfile ]] \
620 - && msg="checking $mfile/$pfile" \
621 - || msg="checking $mfile"
622 - else
623 - msg=$3
624 - fi
625 -
626 - if [[ -d $mfile ]] ; then
627 - einfo "$msg (a directory)"
628 - update_file $pfile
629 - return $?
630 - fi
631 -
632 - ebegin $msg
633 - local err=$(update_file $mfile $pfile ; echo $? > $gf)
634 - local ret=$(< $gf)
635 - rm $gf
636 - [[ $ret < 0 ]] && eend -1 || eend 0
637 - if [[ ! -z $err ]] ; then
638 - if [[ $mfile != $pfile ]] ; then
639 - [[ $ret < 0 ]] \
640 - && eerror "$mfile/$pfile: $err" \
641 - || ewarn "$mfile/$pfile: $err"
642 - else
643 - [[ $ret < 0 ]] \
644 - && eerror "$mfile: $err" \
645 - || ewarn "$mfile: $err"
646 - fi
647 - fi
648 -
649 - return $ret
650 -}
651 -
652 -# if the user gave some files on the command line, try to update those
653 -if [[ ${#*} > 0 ]] ; then
654 - while [[ ${#*} > 0 ]] ; do
655 - if [[ ${1/->/} != ${1} ]] ; then
656 - # if a a.1.ebuild->a.2.ebuild is given, we force a
657 - # cross-diff from a.1 to a.2
658 - cross_diff ${MTREEDIR}/${EPACKAGE}/${1#*->} ${1%->*}
659 - elif [[ ${1#=} != ${1} ]] ; then
660 - # try to fetch files for this ebuild
661 - fetch_files ${1#=}
662 - elif [[ -f $1 ]] ; then
663 - # $1 just exists, just update
664 - do_check_file $1 $1
665 - elif [[ ! -f ${MTREEDIR}/${EPACKAGE}/$1 ]] ; then
666 - # kind of lazy way of saying "file not found"
667 - do_check_file $1 $1
668 - else
669 - # move over the file
670 - ewarn "copying $1"
671 - cp "${MTREEDIR}/${EPACKAGE}"/$1 .
672 - eapify $1
673 - ecleankw $1
674 - fetch_files $1
675 - fi
676 - shift
677 - done
678 -
679 - # we're done
680 - exit 0
681 -fi
682 -
683 -if [[ ! -d ${MTREEDIR}/${EPACKAGE} ]] ; then
684 - eerror "no such package in main tree: ${EPACKAGE}"
685 - exit 2
686 -fi
687 -
688 -if [[ ${EPACKAGE} == "eclass" || ${EPACKAGE} == "licenses" || ${EPACKAGE} == "updates" || ${EPACKAGE} == "desc" ]] ; then
689 - einfo "Processing ${EPACKAGE} directory"
690 - excode=0
691 - mt=`cd "${MTREEDIR}"/${EPACKAGE}/ && ls -p`
692 - pt=`ls -p`
693 - # nested loop join
694 - for pte in $pt ; do
695 - had_match=0
696 - for mte in $mt ; do
697 - if [[ $pte == $mte ]] ; then
698 - do_check_file $mte $pte
699 - ret=$?
700 - if [[ $ret < 0 ]] || [[ $ret > 1 ]] ; then
701 - excode=-1
702 - elif [[ $excode == 0 ]] ; then
703 - excode=$ret
704 - fi
705 - had_match=1;
706 - # we don't need $pte/$mte any more
707 - pt=${pt/$pte/}
708 - mt=${mt/$mte/}
709 - break;
710 - fi
711 - done
712 - [[ $had_match == 0 ]] \
713 - && ewarn "warning: $pte no longer in the main tree"
714 - done
715 -
716 - # everything left in $mt now is what's not in $pt, let's make a
717 - # note about them and perform a copy
718 - for mte in $mt ; do
719 - ewarn "adding from main tree: $mte"
720 - cp "${MTREEDIR}"/${EPACKAGE}/$mte .
721 - done
722 -
723 - exit $excode
724 -fi
725 -
726 -einfo "Processing ${EPACKAGE}"
727 -excode=0
728 -mt=`cd "${MTREEDIR}"/${EPACKAGE}/ && ls -p | egrep -v "^Manifest$"`
729 -pt=`ls -p | egrep -v "^Manifest$"`
730 -# do a nested loop join, we don't assume any order
731 -for pte in $pt ; do
732 - had_match=0
733 - mypte=$pte
734 - for mte in $mt ; do
735 - # calculate the diffs between prefix and main
736 - if [[ ${pte} == *-r0* ]] ; then
737 - # normalise version, so we compare against the original
738 - # version from the main tree
739 - mypte=${pte%.*.ebuild}.ebuild
740 - mypte=${mypte/-r0/-r}
741 - mypte=${mypte/-r.ebuild/.ebuild}
742 - mypte=${mypte/-r0.ebuild/.ebuild}
743 - fi
744 - vdiff=$(cmp_ebuild_ver $mte $mypte)
745 - # if we have the same ebuild version... (or file)
746 - if [[ $vdiff == 0 ]] && [[ $mte == $mypte ]] ; then
747 - had_match=1
748 - # ... look inside the files to see if the file was updated or not
749 - do_check_file $mte $pte
750 - ret=$?
751 - if [[ $ret < 0 ]] || [[ $ret > 1 ]] ; then
752 - excode=-1
753 - elif [[ $excode == 0 ]] ; then
754 - excode=$ret
755 - fi
756 - # we found this version, so needless to look for it any more
757 - mt=${mt/$mte/}
758 - fi
759 - done
760 - # stale entry
761 - [[ $had_match == 0 ]] \
762 - && ewarn "warning: $pte (${mypte}) no longer in the main tree"
763 -done
764 -# what's left in $mt is everything which is not in $pt
765 -# find the latest revisions/alpha/beta/pre and see if there is a more
766 -# recent revision in the main tree
767 -last_pte=""
768 -for pte in $pt ; do
769 - # skip over non-ebuilds
770 - if [[ ${pte} != *.ebuild ]] ; then
771 - pt=${pt/${pte}/}
772 - continue
773 - fi
774 - for xpte in $pt ; do
775 - # check against the rest
776 - [[ $(cmp_ebuild_ver $pte $xpte) -ge 10000 ]] \
777 - && pt=${pt/$xpte/}
778 - done
779 - [[ $(cmp_ebuild_ver $pte $last_pte) > 0 ]] \
780 - && last_pte=$pte
781 -done
782 -# for all ebuilds (the latest revisions/alpha/beta/pre) we check if
783 -# there is a more recent revision in the main tree
784 -for pte in $pt ; do
785 - last_rev=""
786 - for mte in $mt ; do
787 - # kill live CVS ebuilds
788 - v=$(get_ebuildversion ${mte})
789 - if [[ ${v} == 9999 || ${v} == 99999999 ]] ; then
790 - mt=${mt/$mte/}
791 - continue
792 - fi
793 -
794 - if [[ $(cmp_ebuild_ver $mte $pte) -ge 10000 ]] ; then
795 - [[ $(cmp_ebuild_ver $mte $last_rev) > 0 ]] \
796 - && last_rev=$mte
797 - # we will deal with the (newer) revision later, so let's
798 - # avoid the final update check below finding this revision
799 - mt=${mt/$mte/}
800 - fi
801 - done
802 - if [[ $last_rev != "" ]] ; then
803 - cross_diff ${MTREEDIR}/${EPACKAGE}/$last_rev $pte
804 - ret=$?
805 - if [[ $ret < 0 ]] || [[ $ret > 1 ]] ; then
806 - excode=-1
807 - elif [[ $excode -ge 0 ]] ; then
808 - excode=1 # not 0, as we changed something (added a file)
809 - fi
810 - fi
811 -done
812 -# if there is anything left in mt that is bigger than last_pte we want
813 -# the biggest of that
814 -last_mte=""
815 -for mte in $mt ; do
816 - # skip over non-ebuilds
817 - [[ ${mte} != *.ebuild ]] && continue
818 - [[ $(cmp_ebuild_ver $mte $last_pte) > 0 ]] && \
819 - [[ $(cmp_ebuild_ver $mte $last_mte) > 0 ]] \
820 - && last_mte=$mte
821 -done
822 -if [[ $last_mte != "" ]] ; then
823 - if [[ $last_pte != "" ]] ; then
824 - # we have to apply an update from $last_pte to $last_mte
825 - cross_diff ${MTREEDIR}/${EPACKAGE}/$last_mte $last_pte
826 - ret=$?
827 - if [[ $ret < 0 ]] || [[ $ret > 1 ]] ; then
828 - excode=-1
829 - elif [[ $excode -ge 0 ]] ; then
830 - excode=1 # not 0, as we changed something (added a file)
831 - fi
832 - else
833 - # this is from an empty directory, get the last one and relevant
834 - # files
835 - if [[ -f ${MTREEDIR}/${EPACKAGE}/metadata.xml ]] ; then
836 - ewarn "copying metadata.xml"
837 - cp "${MTREEDIR}/${EPACKAGE}"/metadata.xml .
838 - fi
839 - if [[ -f ${MTREEDIR}/${EPACKAGE}/ChangeLog ]] ; then
840 - ewarn "copying ChangeLog"
841 - cp "${MTREEDIR}/${EPACKAGE}"/ChangeLog .
842 - fi
843 - if [[ -f ${MTREEDIR}/${EPACKAGE}/Manifest ]] ; then
844 - ewarn "copying Manifest"
845 - cp "${MTREEDIR}/${EPACKAGE}"/Manifest .
846 - fi
847 - ewarn "copying $last_mte"
848 - cp "${MTREEDIR}/${EPACKAGE}"/$last_mte .
849 - eapify $last_mte
850 - ecleankw $last_mte
851 - fetch_files $last_mte
852 - fi
853 -fi
854 -
855 -exit $excode
856
857 diff --git a/scripts/keyword-check.rb b/scripts/keyword-check.rb
858 deleted file mode 100755
859 index 71bb8695e1..0000000000
860 --- a/scripts/keyword-check.rb
861 +++ /dev/null
862 @@ -1,51 +0,0 @@
863 -#!/usr/bin/env ruby -w
864 -# Copyright 2008-2014 Gentoo Foundation; Distributed under the GPL v2
865 -
866 -%w{ pathname set }.each {|lib| require lib}
867 -
868 -lines = Pathname.new( 'profiles/arch.list' ).readlines
869 -allowed = lines.collect {|line| line.chomp }.reject {|line|
870 - line.slice( 0, 1 ) == '#' or line.empty?
871 -}
872 -
873 -kmods = Set.new %w{ ~ - }
874 -
875 -start = Time.now
876 -problemCnt = 0
877 -
878 -Pathname.new( '.' ).find {|file|
879 - next unless file.fnmatch? '*/*/*.ebuild'
880 - file.readlines.each {|line|
881 - unless line.slice( 0, 9 ) == 'KEYWORDS='
882 - next
883 - else
884 - kws = line.chomp.slice( 10..-2 )
885 - break if kws.empty?
886 - forbidden = Array.new
887 - stable = Array.new
888 - kws.split.each {|kw|
889 - # keywords are only allowed to start with a tilde for now but
890 - # keywords are only stable if there is no - in front of them
891 - stable << kw if is_stable = !kmods.include?( kw.slice( 0, 1 ) )
892 - forbidden << kw unless allowed.include?(
893 - is_stable ? kw : kw.slice( 1..-1 )
894 - )
895 - }
896 - if stable.any? or forbidden.any?
897 - puts 'EBUILD : %s' % [ file.dirname.dirname + file.basename ]
898 - puts 'stable : %s' % stable.join( " " ) if stable.any?
899 - puts 'forbidden : %s' % forbidden.join( " " ) if forbidden.any?
900 - puts
901 - problemCnt += 1
902 - end
903 - break
904 - end
905 - }
906 -}
907 -
908 -if problemCnt > 0
909 - puts 'found %d packages with problems in %.1fs' %
910 - [ problemCnt, (Time.new - start) ]
911 -end
912 -
913 -# vim: set ts=4 sw=4 noexpandtab: