-
Notifications
You must be signed in to change notification settings - Fork 158
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?
Conversation
When kas applies patches and the 'series' file contains an empty line or whitespaces before comment, it fails on error FileNotFoundError, which has nothing to do with a file operation, it's only a parsing issue. This patch fixes issue with parsing the 'series' file. Moreover, test files were updated to cover such case. siemens#96 Signed-off-by: Viliam Lejcik <[email protected]>
for line in f: | ||
if line.startswith('#'): | ||
ln += 1 | ||
if not line.rstrip('\n') or line.startswith('#'): |
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
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 comment
The reason will be displayed to describe this comment to others. Learn more.
handle error if patch name pn
is parsed as empty string
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 comment
The 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 pn
contains space at the beginning (e.g. 001.patch
), isfile()
says that such path p
exists, and error appears later when patch is about to be applied,
pn = line.split(' #')[0].rstrip() | ||
if not pn: | ||
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 comment
The 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?
MRs are not systematically reviewed by the community. I would recommend to follow up with a "v2" of your patch on the mailing list. |
What's the status of this proposal? |
fixes #96