#575 Print SpecFile parsing debug info
Merged by onosek. Opened by onosek.
onosek/rpkg print_rpmspec  into  master

Download 575.patch

The recently added class SpecFile parses a specfile with tool rpmspec.
It provides error messages when parsing failed. This change will show
these messages to user using rhpkg verbose (-v) switch. Without the
switch rhpkg only fails with exception and simple message.

Resolves: rhbz#2000556

Signed-off-by: Ondrej Nosek onosek@redhat.com

No need to have this line here, stderr is emitted in the next line

@oturpe Yes, it is not a final version. There are two possible approaches:
1) Print the debug only after rhpkg -v.
2) leave just the print without other functionality. Clean and simple :).

rebased onto 166aaedb9fc92590f5e9364c1cb6f607eaf28876

I would go with option 2.
It is an error after all, it is good to display it when it happens.

Other parts bother with using log.error(...)instead of simple print,
does the logger need to be used here as well?

log.error requires passing a cli object into SpecFile class. The print should be OK. It is already used in other places in a similar situation.

Thank you for explaining this.
I am :thumbsup: for this change,
the specfile parsing feature I wrote was problematic
because the printout in case of error was always just return code 1,
this change helps a lot to understand what is going wrong
when parsing fails.

@oturpe no problem, most releases are not flawless.

Pull-Request has been merged by onosek

Metadata