Merge lp:~james-w/linaro-image-tools/extra-text-in-packages-files into lp:linaro-image-tools/11.11
Proposed by
James Westby
Status: | Merged |
---|---|
Merged at revision: | 83 |
Proposed branch: | lp:~james-w/linaro-image-tools/extra-text-in-packages-files |
Merge into: | lp:linaro-image-tools/11.11 |
Prerequisite: | lp:~james-w/linaro-image-tools/set-content-mtime |
Diff against target: |
54 lines (+22/-1) 2 files modified
hwpack/packages.py (+6/-1) hwpack/tests/test_packages.py (+16/-0) |
To merge this branch: | bzr merge lp:~james-w/linaro-image-tools/extra-text-in-packages-files |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Zygmunt Krynicki (community) | Approve | ||
Review via email: mp+35335@code.launchpad.net |
Description of the change
Hi,
Another small change to allow specifying extra text for the Packages file.
The motivation for this is that the /var/lib/
installed packages uses this format with an extra line per-stanza.
I'm not particularly keen on the implementation, but I'm also wary of
adding lots of attributes to the Package class to accomodate this sort
of thing.
If someone thinks we should do this in a different way then I will be
happy to do so.
Thanks,
James
To post a comment you must log in.
14 + :param extra_text: extra text to insert in to each stanza.
15 + Should not end with a newline.
rstrip() will simplify it for your users.
Other than that I agree. I had similar issues in that past (class growing too many attributes) and such solutions tend to look not very pretty but are effective in practice. If you start abusing this argument you can always revisit this problem and add an extra attribute.
One other method that you might consider would be a callback that is called with each package to return this text. This would allow you do have one "hook" that decides on the extra bits on the caller side.