[gentoo-portage-dev] PATCH: parallel-fetch

2005-11-15 Thread Brian Harring
Yo.

Continuing the pillaging of ebd, attached is an integration of 
parallel-fetch.

The modification is pretty straight forward offhand; the notable 
difference this time around is rather then extending portage_exec to 
have the capability to 'spawn' python funcs (something I always found 
ugly), this handles the fork itself.

Debatable on that one, so feedback welcome.
~harring
Index: bin/emerge
===
--- bin/emerge  (revision 2309)
+++ bin/emerge  (working copy)
@@ -1821,6 +1824,42 @@
 
self.pkgsettings[FEATURES]=string.join(myfeat)
 
+   if parallel-fetch in myfeat and not (--ask in myopts or 
--pretend in myopts or --fetchonly in myopts):
+   if distlocks not in myfeat:
+   print red(!!!)
+   print red(!!!)+ parallel-fetching requires 
the distlocks feature enabled
+   print red(!!!)+ you have it disabled, thus 
parallel-fetching is being disabled
+   print red(!!!)
+   elif len(mymergelist)  1:
+   print  parallel-fetching is in the hizzay
+   pid = os.fork()
+   if not pid:
+   sys.stdin.close()
+   sys.stdout.close()
+   sys.stderr.close()
+   sys.stdout = open(/dev/null,w)
+   sys.stderr = open(/dev/null,w)
+   os.dup2(sys.stdout.fileno(), 1)
+   os.dup2(sys.stdout.fileno(), 2)
+   for x in (autoaddcvs, cvs):
+   try:myfeat.remove(x)
+   except ValueError: pass
+   self.pkgsettings[FEATURES] =  
.join(myfeat)
+   print child
+   ret = 0
+   for x in mymergelist:
+   if x[0] != ebuild:
+   continue
+   try:
+   ret = 
portage.doebuild(portage.portdb.findname(x[2]), fetch, x[1], self.pkgsettings,
+   cleanup=0, 
fetchonly=True, tree=porttree)
+   except SystemExit:
+   raise
+   except Exception:
+   ret = 1
+   sys.exit(0)
+   portage.portage_exec.spawned_pids.append(pid)
+
mergecount=0
for x in mymergelist:
mergecount+=1


pgp7U7HSghoAe.pgp
Description: PGP signature


Re: [gentoo-portage-dev] going to need a 2.0.53-rc8

2005-11-15 Thread Marius Mauch
On Mon, 14 Nov 2005 09:42:56 -0600
Brian Harring [EMAIL PROTECTED] wrote:

 On Mon, Nov 14, 2005 at 04:32:35PM +0100, Marius Mauch wrote:
   On Monday 14 November 2005 00:46, Jason Stubbs wrote:
  Replace 2.1.0 with 2.2.0 and I'll agree.
 Skipping 2.1 accomplishes what?

Avoid any possible confusion about what 2.1 is.

 People asking, whoah there, it's a later version then 2.1, where's 
 the 2.1 functionality? will still occur.

I don't think so.

 *cough* this is why alpha/feature releases should be date tagged 
 against the branch point instead of the potential version. :)

sorry, I don't understand this sentence. How would you have named the
alpha snapshot?

Marius

-- 
Public Key at http://www.genone.de/info/gpg-key.pub

In the beginning, there was nothing. And God said, 'Let there be
Light.' And there was still nothing, but you could see a bit better.


signature.asc
Description: PGP signature


[gentoo-portage-dev] Savior Plugins Backport

2005-11-15 Thread Alec Warner
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

This patch should cover the backport of 3.0's plugin framework.  Mostly
needed to backport a few utils, which were stuck in portage_util.py.  A
few extra files ( portage_plugins and portage_modules ) were taken
wholesale.  Also a small addition to portage_data and portage_const was
needed.  After applying the patch, register_plugins.py needs an execute
bit to run ;)

Please test these as well.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iQIVAwUBQ3q8DWzglR5RwbyYAQK1Hw/+Lod7ufd+TdSvTlFz2ehhUEewfW3uvJ11
5MVFS0scOfgmKpZOlCd8UzkJS6/Stiuyr3dC+EEw1YnGDbr2Luvv2y7l1JUVrm0M
ogBBDb0MtFvurDg/S0fAAS91L3U5xHyC3R52MslTzwhsasjXq7oHWSxZVgN+nAvW
zmOGHj5+GMtDTvd34RgdXZbM7Ja6slvBZwYYYLWKcqC3pTKpIMIUUNZ7OUuol1Wa
6RCpHklvVMUA4ooGJHJkM/E9BvMLp0p1VufHyznoX1bo2yvQSR6lEYeSlnFIEm/X
ZirjieZPSbSxDZsz6SwJLa/YOOXou0lYZAn4ZRjTJ2HwrUewUdxirGKbyFriNGXe
VF1ZKvTIBNvu17CmwxGDi2esdllW3pha4ioStIYfrvp9ZR5R74R6tUSNPSIIV0CZ
XxleA4RRjAo5OyXHfoOr9N2dlEHVQ3F+BOWZwAlAkd3R3EdVcFhIeCTv8Wi6xuhp
sl5++d+Cj8YnX/bqZlHbWm8loSjZ2gJlXvBcdjGTsvwXQbZw48l31B++HqTUIfTP
NpZvS35QGvB0hVvTiHE7BkcRaZum/gFnSEnqUC6qMUWfffAJROmlaiUrvmjiT0Yc
IUDloJzmwUeUGm2w0JwQ8RqezMSe4jFEq3k7LNw4vDoE43UDdrdniD84tY/zCWPg
04Ssv5ecSbU=
=vXbb
-END PGP SIGNATURE-
diff -Nru --exclude portage-plugins-backport.patch --exclude '*.pyc' --exclude 
'*.pyo' /usr/lib/portage/bin/register_plugin.py ./bin/register_plugin.py
--- /usr/lib/portage/bin/register_plugin.py 1969-12-31 19:00:00.0 
-0500
+++ ./bin/register_plugin.py2005-11-15 23:13:04.961017280 -0500
@@ -0,0 +1,81 @@
+#!/usr/bin/python
+# Copyright: 2005 Gentoo Foundation
+# Author(s): Brian Harring ([EMAIL PROTECTED])
+# License: GPL2
+# $Id:$
+
+import portage_plugins
+from portage_modules import load_attribute
+import sys
+
+def set(ptype, magic, version, namespace):
+   load_attribute(namespace)
+   # loaded.
+   portage.plugins.register(ptype, magic, version, namespace, replace=True)
+
+def cleanse(ptype, magic, version):
+   portage.plugins.deregister(ptype, magic, version)
+   
+def get_list(ptype=None):
+   return portage.plugins.query_plugins(ptype)
+
+if __name__ == __main__:
+   args = sys.argv[1:]
+   ret = 0
+   if -l in args:
+   args.pop(args.index(-l))
+   if len(args) == 0:
+   args = [None]
+   for x in args:
+   print querying %s % str(x)
+   try:
+   i = get_list(x).items()
+   if x is not None:
+   i = [(x, dict(i))]
+   for k,v in i:
+   print
+   try:
+   l = max(map(lambda y: len(y), 
v.keys())) + 4
+   print %s =  % k
+   for y in v.keys():
+   print %s:%s, %s % 
(y.rjust(l), v[y][namespace], v[y][version])
+   except ValueError:
+   print %s = no plugins found 
% k
+   print
+   except Exception, e:
+   print caught exception %s querying % e
+   ret = 1
+   elif -s in args:
+   args.pop(args.index(-s))
+   if len(args) != 4:
+   print need 4 args- ptype magic version namespace
+   sys.exit(1)
+   print registering namespace(%s) as type(%s) constant(%s), 
ver(%s) % (args[3], args[0], args[1], args[2])
+   set(*args)
+   elif -r in args:
+   args.pop(args.index(-r))
+   if len(args) != 3:
+   print need 3 args- ptype magic version
+   sys.exit(1)
+   print deregistering type(%s) constant(%s) ver(%s) % (args[0], 
args[1], args[2])
+   cleanse(*args)
+   elif -p in args:
+   args.pop(args.index(-p))
+   if len(args) != 0:
+   print no args allowed currently
+   sys.exit(1)
+   for ptype, v in get_list(None).iteritems():
+   for magic, vals in v.iteritems():
+   print %s -s %s %s %s %s % (sys.argv[0], 
ptype, magic, vals[version], vals[namespace])
+   else:
+   if --help not in args:
+   print command required
+   print
+   print options available: -s, -r, -l
+   print -s ptype magic ver namespace
+   print -r ptype magic ver
+   print -l [ptype]
+   print
+   if 

[gentoo-portage-dev] Plugin backport PATCH (1/2)/(2/2)

2005-11-15 Thread Alec Warner
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Brian asked me to split this up, and the first patch had some
cruft...and I broke things, both from old messing around.  So I started
with a clean installed of rc7, hopefully these are a bit better.

One patch is for the backend stuff, portage_modules, portage_plugins,
portage_file additions, portage_lock additions, portage_const additions
and portage_data additions.

The second patch is the addition of register_plugin.py.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iQIVAwUBQ3rcxWzglR5RwbyYAQIZMRAAjOwrr3oRl2JPwTKOd6bYySmlPlaIjY9P
fnKSVX0sndQYvlybKqbXlPqCsBz4ZiNdnuqKBNAQMPcP0MtViy0/CsXn6FzUt2n8
zih8wtQ78/JrcWbMfmCIKakok0LT1+htsnBdb4SY5sKZF5unlGJsoFENxre88lBY
mblJ3qAF5fU8QuMYQFPv3HkcHxZ+ncLUODGmFnxcM9miAa324URvAN5l+96cFW6I
e8FXMCvIgkqmtLfGPQvJcBhwQa3DovO7WsW+ya2UvMC3+mC0V5XbMqWmzOuvBgw7
C1SBJRmIYfxwnItDK0wq9ai2VFSPcZNVBoF3hYO7MY4LrN0UPwP13PazkdP8DhUi
0jub4aWHyHvvS3uNPW5XfdYDdFb/vdDLyyidpmlJHNpTbMVJCU5jFMUHxzVqKsFJ
RiNEu79l2F379pBGT8vli6uwyGwC2giyu9OPqPXC5n6qrF4MFAsgZdDG+FmNovrp
3zs/dH/4gLLB23Rg+Mprn/d7QR/VvVgT9EaS25RebDhxqJFRrIuzj12VLTEDymKs
h3FbWwzJJpZh6jjjatuIaZl+1Nz7rNEpO6k1GjieBEl5HrZE2NJxG0sz9fWeyTdy
XzJdkzjvzLCP/js+/loGl8cUYNAzxIsXvW/XayuwSCROjskbmvH5XVDOHXXDLGGH
B1hxUM7Jg+w=
=p6CR
-END PGP SIGNATURE-
diff -Nru --exclude '*.patch' --exclude '*.pyc' --exclude '*.pyo' 
/usr/lib/portage/pym/portage_const.py ./pym/portage_const.py
--- /usr/lib/portage/pym/portage_const.py   2005-11-15 23:42:27.0 
-0500
+++ ./pym/portage_const.py  2005-11-16 01:56:54.353722456 -0500
@@ -44,6 +44,7 @@
 
STICKIES=[KEYWORDS_ACCEPT,USE,CFLAGS,CXXFLAGS,MAKEOPTS,EXTRA_ECONF,EXTRA_EINSTALL,EXTRA_EMAKE]
 
 EAPI = 0
+PLUGINS_DIR= /var/lib/portage/plugins
 
 # ===
 # END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANT
diff -Nru --exclude '*.patch' --exclude '*.pyc' --exclude '*.pyo' 
/usr/lib/portage/pym/portage_data.py ./pym/portage_data.py
--- /usr/lib/portage/pym/portage_data.py2005-11-15 23:42:27.0 
-0500
+++ ./pym/portage_data.py   2005-11-16 01:57:03.153384704 -0500
@@ -43,6 +43,7 @@
 
 uid=os.getuid()
 wheelgid=0
+root_uid=0
 
 if uid==0:
secpass=2
diff -Nru --exclude '*.patch' --exclude '*.pyc' --exclude '*.pyo' 
/usr/lib/portage/pym/portage_file.py ./pym/portage_file.py
--- /usr/lib/portage/pym/portage_file.py2005-11-15 23:42:27.0 
-0500
+++ ./pym/portage_file.py   2005-11-16 01:56:19.157073160 -0500
@@ -8,6 +8,7 @@
 import portage_data
 import portage_exception
 from portage_localization import _
+import stat
 
 def normpath(mypath):
newpath = os.path.normpath(mypath)
@@ -48,15 +49,78 @@
os.umask(old_umask)
raise
portage_util.writemsg(_(Failed to chown: 
%(path)s to %(uid)s:%(gid)s\n) % {path:mypath,uid:uid,gid:gid})
-
os.umask(old_umask)
-   
-   
-   
-   
-   
-   
-   
-   
-   
-   
+
+def ensure_dirs(path, gid=-1, uid=-1, mode=0777, minimal=False):
+   ensure dirs exist, creating as needed with (optional) gid, uid, and 
mode
+   be forewarned- if mode is specified to a mode that blocks the euid from 
accessing the dir, this 
+   code *will* try to create the dir
+
+   try:
+   st = os.stat(path)
+   except OSError:
+   base = os.path.sep
+   try:
+   um = os.umask(0)
+   # if the dir perms would lack +wx, we have to force it
+   force_temp_perms = ((mode  0300) != 0300)
+   resets = []
+   apath = normpath(os.path.abspath(path))
+   sticky_parent = False
+   creating = False
+   
+   for dir in apath.split(os.path.sep):
+   base = os.path.join(base,dir)
+   try:
+   st = os.stat(base)
+   # something exists.  why are we doing 
isdir?
+   if not stat.S_ISDIR(st.st_mode):
+   return False
+   
+   # if it's a subdir, we need +wx at least
+   if apath != base:
+   if ((st.st_mode  0300) != 
0300):
+   try:
os.chmod(base, (st.st_mode | 0300))
+   except OSError: return 
False
+