#295 Grab the correct line in case of rpm output
Merged by cqi. Opened by eclipseo.
Unknown source master

Download 295.patch

Signed-off-by: Robert-André Mauchin zebob.m@gmail.com

If the rpm build process output some text (like with rpm.expand("%{echo:Some text}") notably used in the new Go packaging), the following code in load_nameverrel grabs the RPM output before %{NAME} %{EPOCH} %{VERSION} %{RELEASE}??:

        # Get just the output, then split it by ??, grab the first and split
        # again to get ver and rel
        first_line_output = output.split('??')[0]
        parts = first_line_output.split()
        if len(parts) != 4:
            raise rpkgError('Could not get n-v-r-e from %r'
                            % first_line_output)
        (self._module_name_spec,
         self._epoch,
         self._ver,
         self._rel) = parts

output.split('??')[0] does not then contain the 4 parts variables and thus fails.
This patch simply add a split point ?? before %{NAME} %{EPOCH} %{VERSION} %{RELEASE} to separate the RPM output from the rest and then grab the second split instead of the first.

Hi @eclipseo

Can you give a specific example? Which go package can be used to test and verify this change?

Can you also write a test for the issue this change to solve? There is a test case LoadNameVerRelTest in test_commands.py and you can write the new test inside that test case class.

Sorry for the delay.

Any Golang package making use of "gometa -i", for example https://src.fedoraproject.org/rpms/golang-github-agl-ed25519, https://src.fedoraproject.org/rpms/golang-github-google-btree and many other.

pretty please pagure-ci rebuild

I'm going to merge this solution. The failure test is relative to a different issue and I'll make a patch to propose a fix. Thank you very much.

Commit 6900c2ef fixes this pull-request

Pull-Request has been merged by cqi

Pull-Request has been merged by cqi

Metadata