[Buildroot] [PATCH v4 5/5] support/scripts/pkgstats: add CPE reporting

Ricardo Martincoski ricardo.martincoski at gmail.com
Fri May 18 03:16:50 UTC 2018


Hello,

On Wed, May 16, 2018 at 10:42 PM, Matthew Weber wrote:
> On Wed, May 16, 2018 at 6:32 PM, Arnout Vandecappelle wrote:
>> On 16-05-18 05:43, Ricardo Martincoski wrote:

[snip]
>> >> +    cpe_dict = CPE()
>> >> +    cpe_dict.get_xml_dict()
>> >> +    if args.cpe_report:
>> >> +        print("Performing Target CPE Report Analysis...")
>> >> +        get_target_cpe_report(args.cpe_report, cpe_dict)
>> >> +    elif args.output:
>> >
>> > This is not common in other scripts in the tree. All checks between options are
>> > done at the start of __main__.
>> > But having two different code paths is not common either (in the scripts in the
>> > tree), so it seems to me it makes sense here.
>> > Maybe others disagree.
>>
>>  The way I see it, there is almost no commonality between the script with the -c
>> option and the normal pkg-stats, so it makes no sense to have them in the same
>> script. I would split off the CPE class into a separate module that would be
>> imported into this script and a new cpe_report script.
> 
> I debated this.  Ricardo/Arnout, what naming and directory scheme
> would you propose?

It seems you need a single shared module, so inspired by:

getdeveloperlib.py
get-developers -> import getdeveloperlib

you could have:

cpelib.py
pkg-stats -> import cpelib
cpe-report -> import cpelib

But cpe-report seems to be a user-facing script, so it would go to the utils/
directory. I am not sure what is the best way to solve the import for:

support/scripts/cpelib.py
support/scripts/pkg-stats -> import cpelib
utils/cpe-report -> import cpelib

Maybe a symlink utils/cpelib.py -> support/scripts/cpelib.py ? (not tested)
I never tried importing using relative paths without having __init__.py.


Regards,
Ricardo


More information about the buildroot mailing list