mirror of
https://github.com/openSUSE/osc.git
synced 2026-02-22 03:35:29 +01:00
Merge pull request #1852 from kenion/master
Fix 'osc-develproject' for opensuse:Factory packages in gitea
This commit is contained in:
18
osc/core.py
18
osc/core.py
@@ -100,6 +100,8 @@ DISTURL_RE = re.compile(r"^(?P<bs>.*)://(?P<apiurl>.*?)/(?P<project>.*?)/(?P<rep
|
||||
BUILDLOGURL_RE = re.compile(r"^(?P<apiurl>https?://.*?)/build/(?P<project>.*?)/(?P<repository>.*?)/(?P<arch>.*?)/(?P<package>.*?)/_log$")
|
||||
BUFSIZE = 1024 * 1024
|
||||
|
||||
DEVEL_PACKAGES_URL = "https://src.opensuse.org/openSUSE/Factory/raw/branch/main/pkgs/_meta/devel_packages"
|
||||
|
||||
new_project_templ = """\
|
||||
<project name="%(name)s">
|
||||
|
||||
@@ -1397,6 +1399,22 @@ def show_devel_project(apiurl, prj, pac):
|
||||
|
||||
package_obj = obs_api.Package.from_api(apiurl, prj, pac)
|
||||
if package_obj.devel is None:
|
||||
if prj == "openSUSE:Factory" or prj == "openSUSE.org:openSUSE:Factory":
|
||||
# If OBS api doesn't return a devel project, query the gitea devel_packages file
|
||||
try:
|
||||
response = http_request("GET", DEVEL_PACKAGES_URL)
|
||||
response.auto_close = False
|
||||
except:
|
||||
return None, None
|
||||
if response.status == 200:
|
||||
# locate pac in the devel_packages file
|
||||
for line in io.TextIOWrapper(response):
|
||||
devel_pkg, _, devel_prj = line.partition(" ")
|
||||
devel_prj = devel_prj.strip()
|
||||
if devel_pkg == pac:
|
||||
# found the package, return devel project and package
|
||||
if devel_pkg and devel_prj:
|
||||
return devel_prj, devel_pkg
|
||||
return None, None
|
||||
|
||||
# mute a false-positive: Instance of 'dict' has no 'project' member (no-member)
|
||||
|
||||
Reference in New Issue
Block a user