1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-09 22:36:14 +01:00

Merge pull request #1629 from dmach/fix-resolved-subdir

Fix 'resolved' command to skip subdirectories in package checkouts
This commit is contained in:
Daniel Mach 2024-09-17 10:14:19 +02:00 committed by GitHub
commit 50a203fedb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -5990,7 +5990,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
self.argparse_error("Incorrect number of arguments.")
args = parseargs(args)
pacs = Package.from_paths(args)
pacs = Package.from_paths(args, skip_dirs=True)
for p in pacs:
for filename in p.todo:

View File

@ -89,12 +89,15 @@ class Package:
return (self.name, self.prjname, self.apiurl) < (other.name, other.prjname, other.apiurl)
@classmethod
def from_paths(cls, paths, progress_obj=None):
def from_paths(cls, paths, progress_obj=None, *, skip_dirs=False):
"""
Return a list of Package objects from working copies in given paths.
"""
packages = []
for path in paths:
if skip_dirs and os.path.isdir(path):
continue
package = cls(path, progress_obj)
seen_package = None
try:
@ -116,7 +119,7 @@ class Package:
return packages
@classmethod
def from_paths_nofail(cls, paths, progress_obj=None):
def from_paths_nofail(cls, paths, progress_obj=None, *, skip_dirs=False):
"""
Return a list of Package objects from working copies in given paths
and a list of strings with paths that do not contain Package working copies.
@ -124,6 +127,9 @@ class Package:
packages = []
failed_to_load = []
for path in paths:
if skip_dirs and os.path.isdir(path):
continue
try:
package = cls(path, progress_obj)
except oscerr.NoWorkingCopy: