From: "W. Trevor King" <wking@tremily.us>
To: gentoo-catalyst@lists.gentoo.org
Subject: Re: [gentoo-catalyst] More proposed Catalyst changes
Date: Sun, 03 Feb 2013 07:44:36 -0500 [thread overview]
Message-ID: <20130203124436.GB27214@odin.tremily.us> (raw)
In-Reply-To: <1359837692.3997.132.camel@big_daddy.dol-sen.ca>
[-- Attachment #1: Type: text/plain, Size: 6056 bytes --]
On Sat, Feb 02, 2013 at 12:41:32PM -0800, Brian Dolbec wrote:
> On Thu, 2013-01-31 at 14:46 -0500, W. Trevor King wrote:
> > 968d818 Initial creation of a defaults file. Split out hash and
> > contents to their own classes, files
> >
> > After this, it's not clear to me what the difference is between
> > catalyst.support and catalyst.util. Perhaps they should be merged.
>
> I hadn't looked at util until now.
>
> hmm, I wonder if it would be better to move CatalystError there and
> rename it to error.py There is only a couple error traceback functions
> in it. I was thinking it might be good to define a few more specific
> error classes than just the general CatalystError(). But I am not yet
> familiar enough with the code to know for certain.
This sounds good to me too.
> > a4ef493 re-version to "git-rewrite branch"
> >
> > Why?
>
> Why not. It is not intended to be pushed into master. It also helps to
> confirm that you are running the correct code. I have fixed it so the
> code can be run from the git checkout. That way you can have a
> "Production" version installed on the same system. Now that I am
> testing/debugging, I am comparing catalyst operation and results to
> current -9999 code. I am not familiar with using catalyst, so that is
> helping me figure out what is wrong.
A fair enough. Again, it would be nice if there was a FIXME or
something in the commit message so I knew it wasn't destined for
master ;).
> > 9d752a7 move confdefaults out of main.py
> >
> > Looks good, except, I'm not sure why you changed from
> > `confdefaults.keys()` to `list(confdefaults)` in parse_config() (which
> > should probably be living in catalyst.config anyway).
>
> keeping a separate defaults file can be helpful in importing some info
> into different modules while keeping imports to a minimum. Sometimes it
> helps prevents circular import problems. At this point I opted for a
> separate file, to be determined later if a merge is warranted.
ok.
> As for list(confdefaults), py3 compatibility. dict.keys() isn't usable
> and 2to3 converts it to list(dict)... something about needing to specify
> the return type. So is a preemptive change. One less thing to change
> later.
Really?
$ python3.3 -c "a = {1:2, 3:4}; print([x for x in a.keys()])"
[1, 3]
On the other hand, it might be cleaner to just say:
for x in confdefaults:
But this should still go into a separate commit.
> > c303dae some options cleanup, unifying their use, reducing redundancy.
> >
> > While I like the general thrust of this, I'd be happier with explicit
> > boolean options instead of a set of boolean options. For example:
> >
> > confdefaults = {
> > 'autoresume': False,
> > 'ccache': False,
> > …
> > }
>
> Yeah, I removed those. They were capitalized versions of the values in
> options. So, I optimized them into options becoming a set which
> eliminates, the duplication and potential problems by changing the value
> of one and not the other. Believe me keeping 2 different lists in sync
> can be much more difficult than it seems. It also makes things much
> more difficult to debug. (the independent booleans like you suggest can
> be considered a list, the other is the options list, set,
> string...whatever form it is in)
I think I would do something like:
import collections as _collections
import ConfigParser as _configparser
CONFIG = _configparser.ConfigParser(dict_type=_collections.OrderedDict)
for setting,value in [
('ccache', str(False))]:
CONFIG.set('DEFAULT', setting, value)
although OrderedDict doesn't exist in 2.6, where we should probably
just fall back to dicts. Use it with:
if CONFIG.getboolean('DEFAULT', 'ccache'):
…
Then there's no duplication to worry about, and you get a
configuration object Python developers will be familiar with.
> also using member inclusion is faster and prefered compared to other
> methods like has_key(). In this case, it is just simpler to use
> "options" rather than to individualize them.
I don't think option lookup speed will have much impact on catalyst
execution speed ;). And with ConfigParser, individual options will
require no additional coding.
> > Can we use logging instead of print?
>
> YES!!!!, please :D
>
> that's been on my wish list too.
I can add this if you don't want to. Let me know if you want me to
base my patch against `master`, or against something in your branch.
> > I think keyword arguments are better, because changes to keywords
> > usually occur alongside changes to the argument semantics. A keyword
> > mismatch is an obvious fix, while changes due to a semantic shift can
> > be more subtle.
>
> yeah, I was a bit frustrated at that point, debugging code, so chose the
> easy way. /me fixes.
;). I've certainly been there too.
> > 923e8a2 remove trailing slash for consistency in variables and remove
> > extra slashes in paths
> >
> > os.path.join()
>
> Yes, for sure. But after I debug my current changes. But also most of
> those are for the bash side consistency which can not use os.path.join()
> and were adding the slashes again at times.
>
> I am not a bash programmer, so if someone good at the bash stuff wants
> to work on those... go for it. I'll try to keep my damage to a minimum.
I can look into this, but I think I need a better description of the
problem first. Can you give me an example breakage due to using
os.path.join?
> Also if releng want to recode them in python, that's ok with me ;)
I'd be ok with that too, although I don't feel a pressing need for it
;).
> Thank you for the review, it has been informative. And good to keep me
> from any blunders.
No problem :D
Trevor
--
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-02-03 12:44 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-08 8:32 [gentoo-catalyst] More proposed Catalyst changes Brian Dolbec
2013-01-08 18:08 ` Peter Stuge
2013-01-12 8:55 ` Brian Dolbec
2013-01-31 18:39 ` W. Trevor King
2013-01-31 19:46 ` W. Trevor King
2013-02-02 20:41 ` Brian Dolbec
2013-02-03 12:44 ` W. Trevor King [this message]
2013-04-11 2:06 ` [gentoo-catalyst] chmod +x all sh scripts so they can run from the git checkout W. Trevor King
2013-02-02 18:45 ` [gentoo-catalyst] More proposed Catalyst changes Brian Dolbec
2013-02-03 12:20 ` W. Trevor King
2013-02-26 18:04 ` [gentoo-catalyst] patch, fix broken seed stage update W. Trevor King
2013-02-27 1:30 ` Brian Dolbec
2013-02-27 1:40 ` W. Trevor King
2013-02-27 2:35 ` Brian Dolbec
2013-02-27 2:41 ` Matt Turner
-- strict thread matches above, loose matches on Subject: below --
2013-02-26 16:20 Brian Dolbec
2013-02-26 16:37 ` W. Trevor King
2013-02-26 16:47 ` Brian Dolbec
2013-02-26 16:48 ` Peter Stuge
2013-02-26 17:29 ` Rick "Zero_Chaos" Farina
2013-02-26 19:39 ` Matt Turner
2013-02-27 2:04 ` Brian Dolbec
2013-02-27 2:37 ` Matt Turner
2013-02-27 12:12 ` W. Trevor King
2013-02-27 2:37 ` Matt Turner
2013-02-27 3:03 ` Brian Dolbec
2013-02-27 3:22 ` Matt Turner
2013-02-27 3:49 ` Brian Dolbec
2013-03-08 17:27 ` [gentoo-catalyst] [PATCH v2] Remove update_seed_command and strengthen update_seed W. Trevor King
2013-03-08 18:34 ` Rick "Zero_Chaos" Farina
2013-03-08 18:47 ` [gentoo-catalyst] [PATCH v3] Strengthen update_seed to update @system and @world with dependencies W. Trevor King
2013-03-08 20:14 ` Matt Turner
2013-03-09 12:10 ` [gentoo-catalyst] " W. Trevor King
2013-04-11 17:09 ` [gentoo-catalyst] Binary package dependencies and update_seed W. Trevor King
2013-04-11 17:39 ` Rick "Zero_Chaos" Farina
2013-04-11 17:52 ` W. Trevor King
2013-04-12 15:12 ` [gentoo-catalyst] [PATCH] files/catalyst.conf: Document linking issues with binary packages W. Trevor King
2013-04-12 15:21 ` Rick "Zero_Chaos" Farina
2013-04-12 15:33 ` W. Trevor King
2013-04-12 16:11 ` Rick "Zero_Chaos" Farina
2013-04-12 18:21 ` [gentoo-catalyst] [PATCH v2 0/2] pkgcache warning in catalyst-config(5) W. Trevor King
2013-04-12 18:21 ` [gentoo-catalyst] [PATCH v2 1/2] doc/catalyst-config.5.txt: Add man page for catalyst.conf W. Trevor King
2013-04-12 18:27 ` [gentoo-catalyst] " W. Trevor King
2013-04-12 18:47 ` [gentoo-catalyst] " Rick "Zero_Chaos" Farina
2013-04-12 19:05 ` W. Trevor King
2013-04-12 19:30 ` Rick "Zero_Chaos" Farina
2013-04-16 1:33 ` [gentoo-catalyst] [PATCH v3 0/2] pkgcache warning in catalyst-config(5) W. Trevor King
2013-04-16 1:33 ` [gentoo-catalyst] [PATCH v3 1/2] doc/catalyst-config.5.txt: Add man page for catalyst.conf W. Trevor King
2013-04-16 1:33 ` [gentoo-catalyst] [PATCH v3 2/2] doc/catalyst-config.5.txt: Document linking issues with binary packages W. Trevor King
2013-12-14 5:41 ` [gentoo-catalyst] Re: [PATCH v3 0/2] pkgcache warning in catalyst-config(5) W. Trevor King
2013-04-12 18:21 ` [gentoo-catalyst] [PATCH v2 2/2] doc/catalyst-config.5.txt: Document linking issues with binary packages W. Trevor King
2013-04-11 18:20 ` [gentoo-catalyst] Binary package dependencies and update_seed Matt Turner
2013-04-11 18:22 ` Matt Turner
2013-04-11 18:53 ` Rick "Zero_Chaos" Farina
2013-04-11 19:00 ` W. Trevor King
2013-04-11 19:03 ` Matt Turner
2013-04-11 19:18 ` Rick "Zero_Chaos" Farina
2013-04-11 20:24 ` Matt Turner
2013-04-11 20:34 ` W. Trevor King
2013-04-12 1:11 ` W. Trevor King
2013-04-11 20:37 ` Rick "Zero_Chaos" Farina
2013-04-11 18:53 ` W. Trevor King
2013-04-12 6:57 ` Brian Dolbec
2013-04-16 19:42 ` [gentoo-catalyst] [PATCH 0/2] Blacklisting binary packages W. Trevor King
2013-04-16 19:42 ` [gentoo-catalyst] [PATCH 1/2] spec: Add binpkg_blacklist option for troublesome packages W. Trevor King
2013-04-16 19:42 ` [gentoo-catalyst] [PATCH 2/2] Revert "don't build packages during update_seed" W. Trevor King
2013-04-16 20:35 ` [gentoo-catalyst] [PATCH 0/2] Blacklisting binary packages Matt Turner
2013-04-16 20:59 ` W. Trevor King
[not found] ` <516DD074.3090906@gentoo.org>
2013-04-16 22:53 ` W. Trevor King
2013-04-17 4:18 ` Brian Dolbec
2013-04-17 11:30 ` W. Trevor King
2013-04-17 14:57 ` Matt Turner
2013-04-19 14:11 ` Rick "Zero_Chaos" Farina
2013-04-19 16:18 ` W. Trevor King
2013-04-19 16:32 ` Rick "Zero_Chaos" Farina
2013-04-19 16:36 ` W. Trevor King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130203124436.GB27214@odin.tremily.us \
--to=wking@tremily.us \
--cc=gentoo-catalyst@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox