-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
repos: improved parsing of the 'series' file #98
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -316,10 +316,21 @@ async def apply_patches_async(self): | |
elif os.path.isdir(path) \ | ||
and os.path.isfile(os.path.join(path, 'series')): | ||
with open(os.path.join(path, 'series')) as f: | ||
ln = 0 | ||
for line in f: | ||
if line.startswith('#'): | ||
ln += 1 | ||
if not line.rstrip('\n') or line.startswith('#'): | ||
continue | ||
p = os.path.join(path, line.split(' #')[0].rstrip()) | ||
pn = line.split(' #')[0].rstrip() | ||
if not pn: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. handle error if patch name |
||
logging.error('Could not parse patch file name from a \'series\' file. ' | ||
'(file: %s, line: %d, repo: %s, patch entry: %s)', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure if the error message is clear enough, or should it be rephrased? |
||
os.path.join(path, 'series'), | ||
ln, | ||
self.name, | ||
patch['id']) | ||
return 1 | ||
p = os.path.join(path, pn) | ||
if os.path.isfile(p): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this line behaves strange on my linux with python ver. 3.10.7, if |
||
my_patches.append((p, patch['id'])) | ||
else: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# test comment | ||
|
||
# this is a revert of the other 001 we applied without quilt | ||
001.patch # first patch | ||
002.patch | ||
003.patch # introduce an executable | ||
003.patch # introduce an executable |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# test comment | ||
|
||
# this is a revert of the other 001 we applied without quilt | ||
001.patch # first patch | ||
002.patch | ||
003.patch # introduce an executable | ||
003.patch # introduce an executable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
condition with
rstrip('\n')
accepts empty lines\n
, but not any whitespace on the line, e.g.\n