Gentoo Archives: gentoo-dev

From: Brian Harring <ferringb@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] why do different ebuilds have the same version number?
Date: Wed, 27 Apr 2005 20:25:03
Message-Id: 20050427202548.GP29554@exodus.wit.org
In Reply to: Re: [gentoo-dev] why do different ebuilds have the same version number? by Francesco Riosa
1 On Wed, Apr 27, 2005 at 10:02:27PM +0200, Francesco Riosa wrote:
2 > Brian Harring wrote:
3 >
4 > >>>[snip]
5 > >>>
6 > >>>
7 > >>Why you could not use ctime/mtime ? Isn't possible to make a check like
8 > >>you do now but only on a filtered by "mtime" list of ebuild ?
9 > >>A command like this
10 > >># find . -name "*.ebuild" -and -mtime "-7" -or -ctime "-7"
11 > >>
12 > >>
13 > >Actually... nope. :)
14 > >You're forgetting about eclass changes, which can adjust metadata
15 > >(deps) of an ebuild w/out the ebuild ever being modified...
16 > >~brian
17 > >
18 > >
19 > right was forgotting that :P , what about something like this ?
20 >
21 > HAS_MODIFIED_ECLASS=$( find /usr/portage/eclass/ -name "*.eclass" -and
22 > -ctime "-1" -mtime "-1" )
23 > if [[ -z $HAS_MODIFIED_ECLASS ]] ; then
24 > echo "Good, using faster method"
25 > find /usr/portage -name "*.ebuild" \
26 > -and -mtime "-1" \
27 > -or -ctime "-1" \
28 > -exec something_here.sh
29 > else
30 > find /usr/portage -name "*.ebuild" \
31 > -exec something_here.sh
32 > fi
33 >
34 > will save you often, eclasses are not so frequently updated ;-)
35 Actually... :)
36
37 bit easier, abusing portage's own functionality.
38
39 python -c $'
40 import portage, time
41 target=long(time.strftime("%s",time.gmtime())) - 24*60*60
42 pdb=portage.portdb
43 for cp in pdb.cp_all():
44 for cpv in pdb.cp_list(cp):
45 flagged=False
46 try: mtime, eclasses = pdb.aux_get(cpv,["_mtime_","INHERITED"])
47 except SystemExit: raise
48 except: continue
49 if mtime >= target: flagged=True
50 else:
51 try:
52 for e in eclasses.split():
53 if pdb.eclassdb.eclasses[e][1] >= target:
54 flagged=True
55 break
56 except KeyError: flagged=True
57 if flagged: print cpv
58 '
59
60 ~brian