mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-26 18:06:13 +01:00
Fix build.get_repo() to return only directory that contains 'repodata/repomd.xml'
This commit is contained in:
parent
6d5493130e
commit
2cdf0520f3
27
osc/build.py
27
osc/build.py
@ -456,30 +456,21 @@ def get_built_files(pacdir, buildtype):
|
|||||||
|
|
||||||
|
|
||||||
def get_repo(path):
|
def get_repo(path):
|
||||||
"""Walks up path looking for any repodata directories.
|
"""
|
||||||
|
Walks up path looking for any repodata directories.
|
||||||
|
|
||||||
:param path: path to a directory
|
:param path: path to a directory
|
||||||
:return: path to repository directory containing repodata directory
|
:return: path to repository directory containing repodata directory with repomd.xml file
|
||||||
:rtype: str
|
:rtype: str
|
||||||
"""
|
"""
|
||||||
oldDirectory = None
|
|
||||||
currentDirectory = os.path.abspath(path)
|
|
||||||
repositoryDirectory = None
|
|
||||||
|
|
||||||
# while there are still parent directories
|
for root, dirs, files in os.walk(path):
|
||||||
while currentDirectory != oldDirectory:
|
if not "repodata" in dirs:
|
||||||
children = os.listdir(currentDirectory)
|
continue
|
||||||
|
if "repomd.xml" in os.listdir(os.path.join(root, "repodata")):
|
||||||
|
return root
|
||||||
|
return None
|
||||||
|
|
||||||
if "repodata" in children:
|
|
||||||
repositoryDirectory = currentDirectory
|
|
||||||
break
|
|
||||||
|
|
||||||
# ascend
|
|
||||||
oldDirectory = currentDirectory
|
|
||||||
currentDirectory = os.path.abspath(os.path.join(oldDirectory,
|
|
||||||
os.pardir))
|
|
||||||
|
|
||||||
return repositoryDirectory
|
|
||||||
|
|
||||||
|
|
||||||
def get_prefer_pkgs(dirs, wanted_arch, type, cpio):
|
def get_prefer_pkgs(dirs, wanted_arch, type, cpio):
|
||||||
|
Loading…
Reference in New Issue
Block a user