[csw-devel] [PATCH] checkpkg: allow collection of obsoletion info
Ben Walton
bwalton at opencsw.org
Sun Mar 27 15:19:15 CEST 2011
Excerpts from Maciej Bliziński's message of Sun Mar 27 04:18:42 -0400 2011:
> I've recently learned a Python idiom for opening files:
>
> with open(obsoleted_by_path, "r") as fd:
> indented block
> using fd
Ah! Very ruby-esque, I like it. The same thing in Ruby would be:
File.open("/path/to/file", "r") do |file|
file.each_line do |line|
...
end
end
(I'm one of the folks that likes the 'end' block markers as I find
they improve readability.)
> fd is unavailable outside that block
Exactly the way it works in ruby too. This is much nicer for many of
the typical file processing tasks that are common in code.
> I expect that some packages might contain a file with bad syntax, e.g.
> 3 fields or 1 field.
Yes, a good point. I'm only using the first two fields, but there is
a package description for the package that obsoletes the package too.
Not sure it's much use in the tests though. We could forseeably
change the description of a package in the future while not releasing
the updated _stub packages for example. Thus, of the line with
format:
CSWfoo foo - The foo package is great
We only care about the first two white space separated fields.
> if 2 != len(fields):
I prefer len(fields) != 2. Is there a reason you prefer the ordering
above? If it's the more common ordering throughout the code, I'll use
it for consistency.
> Or even better:
> return {
> "syntax": obsoleted_syntax_ok,
> "by": obsoleted_by,
> }
I like this better too.
> Next steps should be:
>
> - add a dict item around lib/python/package_stats.py line 500 (you
> could add a tuple, or transform it into a dictionary, or use
> whatever form that you think will be convenient to use later on; I
> like dictionaries because they tend to be self-descriptive)
I was looking at this last night but couldn't make the new info be
displayed in the output of checkpkg_inspect_stats.py -p...
> - since you're changing the data format, increment
> PACKAGE_STATS_VERSION in package_stats.py (line 25)
Ok, didn't catch that last night.
> - use the new data structure in a check
I think the first thing I'll do is ensure _stub when obsoleted by
syntax is ok and the list isn't empty. There are many other checks
that can focus on this new data. A list that isn't empty but fails
the syntax check would be one such test.
Updated patch attached.
Thanks
-Ben
--
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302
-------------- next part --------------
A non-text attachment was scrubbed...
Name: collect_obsoletion_info.patch
Type: application/octet-stream
Size: 1467 bytes
Desc: not available
URL: <http://lists.opencsw.org/pipermail/devel/attachments/20110327/aeeb61f5/attachment.obj>
More information about the devel
mailing list