Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 129054 - hardcoded /var/db/pkg, rootpath
Summary: hardcoded /var/db/pkg, rootpath
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 137867 136244
  Show dependency tree
 
Reported: 2006-04-06 12:04 UTC by Eldad Zack (RETIRED)
Modified: 2006-06-26 16:23 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eldad Zack (RETIRED) gentoo-dev 2006-04-06 12:04:19 UTC
there are 3 places that have "/var/db/pkg" hardcoded instead of using VDB_PATH:

/usr/lib/portage/pym/portage_contents.py:153:   for x in os.listdir("/var/db/pkg"):
/usr/lib/portage/pym/portage_contents.py:154:           for y in os.listdir("/var/db/pkg/"+x):
/usr/lib/portage/pym/portage_contents.py:155:                   c_path = "/var/db/pkg/"+x+"/"+y+"/CONTENTS"

I'd like that fixed so I can store remote dbs on a local machine and test against it for security updates.

on other note, what are the chances of getting VDB_PATH an enviornment setting?
Comment 1 SpanKY gentoo-dev 2006-04-07 16:45:43 UTC
you cant simply change it to VDB_PATH ... it has to contain the root logic as well

besides, that code is only found in the test() function ... it isnt actually used when doing an `emerge` or something ...
Comment 2 solar (RETIRED) gentoo-dev 2006-04-07 17:31:47 UTC
(In reply to comment #0)

> I'd like that fixed so I can store remote dbs on a local machine and test
> against it for security updates.

That is a very sweet idea.

 
> on other note, what are the chances of getting VDB_PATH an enviornment setting?

You could try todo something like this which is probably painfully quite slow.
Index: pym/portage_const.py
===================================================================
--- pym/portage_const.py	(revision 3055)
+++ pym/portage_const.py	(working copy)
@@ -7,8 +7,11 @@
 # ===========================================================================
 # START OF CONSTANTS -- START OF CONSTANTS -- START OF CONSTANTS -- START OF
 # ===========================================================================
+import os
+VDB_PATH                = os.getenv("VDB_PATH")
+if VDB_PATH == None:
+	VDB_PATH        = "var/db/pkg"
 
-VDB_PATH                = "var/db/pkg"
 PRIVATE_PATH            = "var/lib/portage"
 CACHE_PATH              = "/var/cache/edb"
 DEPCACHE_PATH           = CACHE_PATH+"/dep"

---------
Or allow the name var/db/pkg to be used and just use
ROOT=/somepath/REMOTE_HOST glsa-check -v -l affected
where the vdb is $ROOT/var/db/pkg
Comment 3 Eldad Zack (RETIRED) gentoo-dev 2006-04-08 08:33:19 UTC
ok, my bad for not checking what it was used for - but sure, I'm all for adding the ROOT as well.

and, there are two occurances which use VDB_PATH without root:
(those are for the counter)

/usr/lib/portage/pym/portage.py:4452:                                   counter=long(commands.getoutput("for FILE in $(find /"+VDB_PATH+" -type f -name COUNTER); do echo $(<${FILE}); done | sort -n | tail -n1 | tr -d '\n'"))

/usr/lib/portage/pym/portage.py:4463:                           counter=long(commands.getoutput("for FILE in $(find /"+VDB_PATH+" -type f -name COUNTER); do echo $(<${FILE}); done | sort -n | tail -n1 | tr -d '\n'"))
Comment 4 Eldad Zack (RETIRED) gentoo-dev 2006-04-08 13:21:35 UTC
solar,thanks for the guidance I got the pesky little bug that prevented:

  ROOT=/somepath/REMOTE_HOST glsa-check -v -l affected

from working.
below it is the patch that fixes it.

I can't connect to freenode now for some reason, but here's what I got.

I don't know what's the overall meaning of it, and if it can screw things up under certain conditions, but it made ROOT=/remote emerge -va world work as well. 

comments please?

--- portage.py.orig     2006-04-08 23:10:08.000000000 +0300
+++ portage.py  2006-04-08 23:11:15.000000000 +0300
@@ -7210,7 +7210,7 @@
                        vkeysplit=x.split("/")
                        if not virts_p.has_key(vkeysplit[1]):
                                virts_p[vkeysplit[1]]=virts[x]
-       db["/"]={"virtuals":virts,"vartree":vartree("/",virts)}
+       db["/"]={"virtuals":virts,"vartree":vartree(root,virts)}
        if root!="/":
                virts=mysettings.getvirtuals(root)
                db[root]={"virtuals":virts,"vartree":vartree(root,virts)}

Comment 5 Eldad Zack (RETIRED) gentoo-dev 2006-04-08 13:24:46 UTC
oh, there's another ref to /var/db/pkg, line 1111 in portage 2.0.54:

  self.loadVirtuals('/')

and it should be self.loadVirtuals(root).

still there's something that hardcodes '/' as root, fetching "PROVIDE" from /var/db/pkg.
I'll try to nail that one as well.

Comment 6 Eldad Zack (RETIRED) gentoo-dev 2006-04-09 07:31:28 UTC
as far as /etc/* goes there's already bug 40302
Comment 7 Zac Medico gentoo-dev 2006-06-24 13:47:04 UTC
(In reply to comment #5)
> still there's something that hardcodes '/' as root, fetching "PROVIDE" from
> /var/db/pkg.

That sounds like bug 129054.

The only VDB_PATH I could find wasn't yet relative to $ROOT was in the COUNTER rengeneration logic and that is fixed in svn r3644.
Comment 8 Zac Medico gentoo-dev 2006-06-24 13:48:10 UTC
(In reply to comment #7)
> That sounds like bug 129054.

Pardon, I meant to say bug 131319 of course.
Comment 9 Zac Medico gentoo-dev 2006-06-26 16:23:25 UTC
This has been released in 2.1.1_pre1-r3.