1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-06 06:46:14 +01:00

Merge pull request #1510 from dmach/fix-updatepacmetafromspec-incomplete-spec

Fix crash in 'updatepacmetafromspec' command when working with an incomplete spec
This commit is contained in:
Daniel Mach 2024-03-11 09:47:40 +01:00 committed by GitHub
commit aaae06c794
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4371,8 +4371,10 @@ def read_meta_from_spec(specfile, *args):
section_pat = r'^%s\s*?$' section_pat = r'^%s\s*?$'
for section in sections: for section in sections:
m = re.compile(section_pat % section, re.I | re.M).search(''.join(lines)) m = re.compile(section_pat % section, re.I | re.M).search(''.join(lines))
if m: if m is None:
start = lines.index(m.group() + '\n') + 1 spec_data[section] = ""
continue
start = lines.index(m.group() + '\n') + 1
data = [] data = []
for line in lines[start:]: for line in lines[start:]:
if line.startswith('%'): if line.startswith('%'):