1 |
Hello list, |
2 |
|
3 |
I have a couple of questions related to the modules that handle the "databases" |
4 |
in /usr/portage/metadata/cache and /var/cache/edb/dep at the moment. |
5 |
|
6 |
First I'd like to know what the purpose of the following code in |
7 |
/usr/bin/emerge is: |
8 |
|
9 |
if os.path.exists(myportdir+"/metadata/cache") and updatecache_flg: |
10 |
print "\n>>> Updating Portage cache... ", |
11 |
os.umask(0002) |
12 |
cachedir = os.path.normpath(portage.settings["PORTAGE_CACHEDIR"]) |
13 |
if cachedir in ["/", "/bin", "/dev", "/etc", "/home", |
14 |
"/lib", "/opt", "/proc", "/root", "/sbin", |
15 |
"/sys", "/tmp", "/usr", "/var"]: |
16 |
print "!!! PORTAGE_CACHEDIR IS SET TO A PRIMARY ROOT DIRECTORY ON YOUR SYSTEM." |
17 |
print "!!! This is ALMOST CERTAINLY NOT what you want: "+str(cachedir) |
18 |
sys.exit(73) |
19 |
if os.path.exists(cachedir): |
20 |
portage.spawn("rm -Rf "+cachedir+"/*",portage.settings,free=1) |
21 |
else: |
22 |
os.mkdir(cachedir) |
23 |
|
24 |
|
25 |
I am talking about the last four lines. Searching for "-Rf" in /usr/bin/emerge |
26 |
finds it right away. Is this really necessary? |
27 |
|
28 |
Another question. Why has there been no talk about the database modules |
29 |
anywhere? Turns out one can use db databases (or some other format if they |
30 |
don't have db) by doing: |
31 |
|
32 |
# echo 'portdbapi.auxdbmodule="portage_db_anydbm.database"' >> /etc/portage/modules |
33 |
|
34 |
I couldn't find anything in the forums by searching for anydbm, or anywhere |
35 |
else for that matter. Isn't the code stable? It sure looks good enough. The |
36 |
only problem is that "emerge metadata" takes forever to convert the flat |
37 |
database from /usr/portage/metadata/cache/ to anydbm format in |
38 |
/var/cache/edb/dep/. However, if rsync distributes not only the flat database, |
39 |
but also the .anydbm files, it would be pretty easy to simply copy the files |
40 |
that are in the same format as what the user decides to use on their system, and |
41 |
not to do the time-consuming database-by-database, key-by-key copy. For |
42 |
bandwidth and space concerns, the irrelevant databases can be excluded from the |
43 |
rsync process. Something like: |
44 |
|
45 |
# if we want the anydbm files |
46 |
rsync --exclude=/metdata/cache/*/ |
47 |
|
48 |
# if we want the flat database |
49 |
rsync --exclude=/metdata/cache/*.anydbm |
50 |
|
51 |
Using db database files in /var/cache/edb/dep/ really speeds up things. |
52 |
|
53 |
Another concern I have is that there is no easy way to set the locations for |
54 |
the databases. Currently the paths $PORTDIR/metadata/cache and |
55 |
/var/cache/edb/dep/ are hard-coded. I decided to get a faster database and |
56 |
coded a mysql module, but the configuration currently is like this: |
57 |
|
58 |
# cat /etc/portage/modules.mysql |
59 |
/usr/portage/metadata/cache = "modules.mysql.meta" |
60 |
/var/cache/edb/dep/ = "modules.mysql.aux" |
61 |
|
62 |
# cat /etc/portage/modules.myslq.meta |
63 |
host = 'localhost' |
64 |
user = 'portage' |
65 |
password= '' |
66 |
db = 'portage' |
67 |
table = 'metadata' |
68 |
|
69 |
# cat /etc/portage/modules.myslq.aux |
70 |
host = 'localhost' |
71 |
user = 'portage' |
72 |
password= '' |
73 |
db = 'portage' |
74 |
table = 'auxdb:ols-dell' |
75 |
table = 'metadir' |
76 |
|
77 |
Using the mysql module is faster than the anydbm databases. Plus, it is not |
78 |
necessary to have the auxdb on localhost. Would there be interest in this |
79 |
thing? Should I attach it to bugzilla? |
80 |
|
81 |
-- |
82 |
\ Georgi Georgiev \ The Golden Rule is of no use to you whatever \ |
83 |
/ chutz@×××.net / unless you realize it is your move. -- Frank / |
84 |
\ +81(90)6266-1163 \ Crane \ |