From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1MXJbG-0002Hq-Qw for garchives@archives.gentoo.org; Sat, 01 Aug 2009 18:46:35 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BCC17E0423; Sat, 1 Aug 2009 18:46:33 +0000 (UTC) Received: from mail-fx0-f211.google.com (mail-fx0-f211.google.com [209.85.220.211]) by pigeon.gentoo.org (Postfix) with ESMTP id 4F4FDE0423; Sat, 1 Aug 2009 18:46:33 +0000 (UTC) Received: by fxm7 with SMTP id 7so1851006fxm.34 for ; Sat, 01 Aug 2009 11:46:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :in-reply-to:references:content-type:date:message-id:mime-version :x-mailer; bh=pjrQ5RWDsqnFRCWqEP3dNJg3a+anoelsiZCLGAxvQIM=; b=eOSjdQxBZOVijJ3xk+3TmgWV5BY0QGxF9cEJqnEcPgtyyrk4ytjmik9K+qiSOxvU3s SSUUD1kKvpdKFpghEnEjjW8xQKEUUYvwZUSLmz2nl5K/hr0HHdGDj9oryXTa+8SKiRXa 7WRyHhVWQo30juCv7k6u5kq6LGVtslDTAOCvs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer; b=Ce/lBPNjOh20t+dgwmUKomLkqZoaYa51LBoXt/XCKmLFd1EaNE4AqVX23eEq9ZCQ3e x7t5znSECKU8NnngbDOetB8IsttvBA137S/ergwzGLOiWZ5sZ7i2O1Cn2p5kB2GjU6cQ OF0WvIvHPpNweLorl0LPlXClCXCKzr1S4IlvY= Received: by 10.103.193.12 with SMTP id v12mr2337126mup.109.1249152392685; Sat, 01 Aug 2009 11:46:32 -0700 (PDT) Received: from ?77.54.191.86? (86.191.54.77.rev.vodafone.pt [77.54.191.86]) by mx.google.com with ESMTPS id t10sm27385359muh.0.2009.08.01.11.46.29 (version=SSLv3 cipher=RC4-MD5); Sat, 01 Aug 2009 11:46:31 -0700 (PDT) Subject: [gentoo-dev] Re: Progress on Universal Select Tool From: =?ISO-8859-1?Q?S=E9rgio?= Almeida To: Gentoo SoC Cc: Gentoo Dev In-Reply-To: <1245163715.14589.515.camel@thedude> References: <1245163715.14589.515.camel@thedude> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-cGG3EHGHBXYl7OTmhNYj" Date: Sat, 01 Aug 2009 19:46:23 +0100 Message-Id: <1249152383.18497.145.camel@thedude> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 X-Archives-Salt: f2c1fea3-384b-4565-b500-31e040b2bc76 X-Archives-Hash: b82bef18a03d299f8c10a5ac3294c2e3 --=-cGG3EHGHBXYl7OTmhNYj Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello all, Once again, another productive week. This week's work focused mostly on profiles. Uprofile's implementation exceeded my expectations and was much easier than what I thought it would be, the reason: uselect's simple api. What's working on uprofile: * uprofile when called with no arguments, finds current folder profile. If not present, it lists available profiles. ** Available profiles are profiles other than './uprofile/folder.json' * Profiles are written in json=20 ** Why json and not xml? Well, whoever said that xml is human-readable should reconsider the clause. In need of a markup language, easy bridge between python and markup, easily human-readable, I have chosen json. Example: {"profile": { "description": "Sample Profile", "author": "mephx.x@gmail.com", "version": "0.1", "modules": { "python": { "actions": { "bin": [ "/usr/bin/python2.6", "/usr/bin/python2.6-config" ] } } } }} In this profile, uprofile would call module python, action bin with args: python2.6 and python2.6-config.=20 uprofile when called: mephx - profiledfolder $ uprofile Setting Folder Profile... Setting /usr/bin/python2.6 success! Setting /usr/bin/python2.6-config success! Folder Profile Set! * Profiles read modules (from uselect's module dir), actions from modules, and call's Action.do_action() method with the specified args list. ** In order to profiles to work properly, arguments cannot be Integers as in uselect/eselect. All modules's actions which feature profiling capabilities, need to accept either indexed values, either absolute string values for specific selection. Why? Example: New python bin appears in /usr/bin, indexes change, profile gets broken. * Decided to keep a bin/ and a env.d/ in each .uprofile directory. These are updated as they normally would via uselect. * Automatic profile changing in bash can be done via a specially crafted PROMPT_COMMAND. I'm using this one now: PROMPT_COMMAND=3D"test -e $HOME/.uselect/env.d/ && PROFILE=3D'$HOME/.uselect' ; test -e .uprofile/env.d/ && PROFILE=3D'./.uprofile' ; source \$PROFILE/env.d/*" ** This actually changes the profile quite fast and reflects the changes on $PS1 with the folder name, neat =3D) mephx - ~/ $ cd profiledfolder [folder] mephx - profiledfolder $ ** To generate .uprofile/ directory, uprofile needs to be called by hand. Sourcing env.d/ automatically also updates the user's PATH to that bin DIR (this is still not implemented) therefore not needing to call uprofile every time you wish to activate the profile.=20 Next steps: * Finish implementing env actions. (It's now much funnier to test env actions using profiles) * Implement uprofile module for uselect as suggested. * Implement some more modules. What do you think? * json modules? * profile constraints (this is basically adding if's to profiles if we want profiles to behave differently on certain conditions (hostname, arch, etc...) During the next week, I will deploy a properly packed version for testing. I will also launch a call for modules to every *-eselect dev and *-config dev as I do not have the time to implement most of the modules just for testing purposes. Most modules are very easy to do (symlinking ones) and conversion of eselect to uselect can be done instantly, yet in an ugly way of still using all eselect's libs. Keep tuned for more. And stay in school =3D) Cheers, S=C3=A9rgio --=20 S=C3=A9rgio Almeida - mephx.x@gmail.com mephx @ freenode --=-cGG3EHGHBXYl7OTmhNYj Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEABECAAYFAkp0jXcACgkQQXumuXcKj04Q4QCdGD4M4hGcYy5yZs5gkRmLYACP lVkAoJS/3R0I01lredp5StSGG6BDAc9i =v2ey -----END PGP SIGNATURE----- --=-cGG3EHGHBXYl7OTmhNYj--