1 |
On Fri, 26 Jul 2002 22:50:41 +0200 |
2 |
Marko Mikulicic <marko@××××.org> wrote: |
3 |
|
4 |
> Gregg wrote: |
5 |
> > Also, as per my last email with the other script that was being worked on. |
6 |
> > Ive noticed that the find in that one is faster because of the min and |
7 |
> > max depth settings. These 2 seem to be perfect for merging together then |
8 |
> > having exactly what we want, with it being quick and easy. |
9 |
> |
10 |
> Ok. I'm merging the two. I've already implemented the "remove" feture. |
11 |
> It outputs in red, for consistency, but I don't know if it makes sense. |
12 |
> |
13 |
> For the -maxdepth -mindepth: |
14 |
> I'm working to implement the |
15 |
> EXCLUDE="distfiles:files:eclass:licenses:profiles:scripts:metadata:packages" |
16 |
> feature, but if -maxdepth 2-mindepth 2 is used it is useless because |
17 |
> at this directory level all we have is *.ebuild directories. |
18 |
> But if the portage system will be extended to have more than two levels |
19 |
> of directories (instead of the "-" trik, like in "x11-libs") we'll |
20 |
> have to switch back. |
21 |
> Ok. so I drop the EXCLUDE feature. |
22 |
> |
23 |
> However the performance gain is ridiculous 0.3 seconds with recursive |
24 |
> vs 0.03 sec with maxdepth 2, given that rsync often takes much much longer. |
25 |
> |
26 |
> What about /var/cache for script output ? |
27 |
> Or should I leave /root as default ? |
28 |
> |
29 |
> I thought it could be called "emerge-rsync", at least until |
30 |
> we integrate it in emerge itself :-) ok? |
31 |
> |
32 |
> I've added command line passing to emerge rysnc (for --clean) |
33 |
> Tell me if you like it. |
34 |
> I will make an ebuild for it, but I cannot provide hosting. Where should |
35 |
> I put it? |
36 |
> |
37 |
> So here is the script: |
38 |
> <snip> |
39 |
> #!/bin/sh |
40 |
> BASE=/var/cache |
41 |
> USE_COLORS=yes |
42 |
> |
43 |
> # end user configuration section |
44 |
> . /etc/make.globals |
45 |
> BEFORE=$BASE/ebuild-rsync.before |
46 |
> AFTER=$BASE/ebuild-rsync.after |
47 |
> NEW=$BASE/ebuild-rsync.new |
48 |
> REMOVED=$BASE/ebuild-rsync.removed |
49 |
> |
50 |
> if [ "$USE_COLORS" == "yes" ]; then |
51 |
> RED="\033[;31m" |
52 |
> GREEN="\033[;32m" |
53 |
> NORMAL="\033[m" |
54 |
> fi |
55 |
> |
56 |
> function portagetree () { |
57 |
> find $PORTDIR -type d -mindepth 2 -maxdepth 2 |
58 |
> } |
59 |
> |
60 |
> # do it |
61 |
> portagetree >$BEFORE |
62 |
> emerge $@ rsync |
63 |
> portagetree >$AFTER |
64 |
> diff $BEFORE $AFTER | grep ">" | sed "s/> //g" > $NEW |
65 |
> diff $BEFORE $AFTER | grep "<" | sed "s/< //g" > $REMOVED |
66 |
> |
67 |
> # cleanup |
68 |
> rm $BEFORE $AFTER |
69 |
> |
70 |
> # display new ebuilds |
71 |
> if ! diff -q $NEW /dev/null >/dev/null; then |
72 |
> echo |
73 |
> echo New ebuilds: |
74 |
> for i in $(cat $NEW); do |
75 |
> . $(ls $i/*.ebuild --sort=time | head -n 1) |
76 |
> echo -e $GREEN${i##$PORTDIR/}$NORMAL: $DESCRIPTION |
77 |
> done |
78 |
> fi |
79 |
> |
80 |
> # display removed ebuilds |
81 |
> if ! diff -q $REMOVED /dev/null >/dev/null; then |
82 |
> echo |
83 |
> echo Removed ebuilds: |
84 |
> for i in $(cat $REMOVED); do |
85 |
> echo -e $RED${i##$PORTDIR/}$NORMAL |
86 |
> done |
87 |
> fi |
88 |
> </snip> |
89 |
|
90 |
Since /usr/portage/incoming/apmd/ does not have an ebuild file the script |
91 |
fails with: |
92 |
|
93 |
ls: /usr/portage/incoming/apmd/*.ebuild: No such file or directory |
94 |
./nuebuild: .: filename argument required |