From 74cffab0516897e2056c753f5cd39d696962328c Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Sun, 30 Jan 2011 14:26:13 -0700 Subject: If we don't have a remote branch, query koji (#619979) This looks to see what tag 'dist-rawhide' will build into, which will tell us good info about the dist values. --- src/pyfedpkg/__init__.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index 90c4582..7577823 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -1044,11 +1044,18 @@ class PackageModule: if branchre.match(branch): # Add it to the fedoras fedoras.append(branch) - - # Sort the list - fedoras.sort() - # Start with the last item, strip the f, add 1, return it. - return(int(fedoras[-1].strip('f')) + 1) + if fedoras: + # Sort the list + fedoras.sort() + # Start with the last item, strip the f, add 1, return it. + return(int(fedoras[-1].strip('f')) + 1) + else: + if not self.anonkojisession: + self.init_koji() + # We may not have Fedoras. Find out what rawhide target does. + rawhidetarget = self.kojisession.getBuildTarget('dist-rawhide') + desttag = rawhidetarget['dest_tag_name'] + return desttag.strip('dist-f') def _getlocalarch(self): """Get the local arch as defined by rpm""" -- cgit