#60 Fix the srcpkg endpoint
Merged 7 years ago by pingou. Opened 7 years ago by pingou.

file modified
+4 -2
@@ -111,13 +111,15 @@ 

          pkg = session.query(

              primary.Package

          ).filter(

-             primary.Package.basename == pkg_name

+             primary.Package.rpm_sourcerpm.like('{}%'.format(pkg_name))

          ).order_by(

              primary.Package.epoch.desc(),

              primary.Package.version.desc(),

              primary.Package.release.desc(),

          )

-         output = pkg.first()

+         for pkg in pkg.all():

+             if pkg.basename == pkg_name:

+                 return pkg

      except SQLAlchemyError as err:

          cnt += 1

          if cnt > RETRY_ATTEMPT:

This commit finished undoing the approach we once had to use a
hybrid_property to figure out the base name which turned out to not
be as reliable as first thought.

Fixes https://pagure.io/mdapi/issue/59

Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr

You already know I'm going to recommend unit tests :grinning:.

I have no idea if this is the "right" fix or not since there's no demonstration of it working, but if you're happy with it, merge on.

I've tested it locally and looking at the git history I realized that https://pagure.io/mdapi/pull-request/54 only reverted part of the changes

Thanks for the quick review :)

Thanks for the quick review :)

Pull-Request has been merged by pingou

7 years ago
Metadata