-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Framework] Add error detection to python pip calls #5927
[Framework] Add error detection to python pip calls #5927
Conversation
if ! python3 -m pip install --upgrade pip; then | ||
echo "Error: Python upgrade failed" 1>&2 | ||
exit 1 | ||
fi |
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.
we should only log, but not exit on error.
the following set_unix_permissions is mandatory for DSM 6.
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.
but the error is already logged now as shown in the referenced issue. the challenge is that it results in a package being installed that is incomplete (see #5926).
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.
Suggesting we always refer back to python packaged pip version... such as:
read -r -a PIP_VERSION 2>/dev/null <<< $(python3 -m pip --version)
[ "${PIP_VERSION[1]}" ] && PIP="pip==${PIP_VERSION[1]}" || PIP="pip"
if ! python3 -m pip install --upgrade ${PIP}; then
echo "Error: Python upgrade failed" 1>&2
fi
This way when ever we update pip in python3x, module installation will also follow.
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.
but the error is already logged now as shown in the referenced issue. the challenge is that it results in a package being installed that is incomplete (see #5926).
And I am also tempted to agree, to do exit 1
to confirm package did not installed correctly.
We should add an error detection in validate_preinst (when ever possible) to prevent the installation in such situations. If the validate_preinst succeeds but the later installation fails, we must handle such error ("exit 1" ?) in a way, that the DSM Package Center "repair" button (introduced with DSM 7) works as expected. I.e. the package repair will retry the download and if it succeeds the package should be correctly installed. Since the DSM Developer Guide is not very useful, we need some investigations to make this work. |
Agreed but that's outside the scope of this pr. I believe that what was the intent in here is now captured and could be merged. Additional optimizations you propose should be done in a separate pr. |
@th0ma7, is this good to merge now? |
I believe so. @hgy59 are you fine with comments above and merging? |
Catching-up... @hgy59 any issues with merging this? (see comments above) |
I would drop the whole pip check/update/downgrade stuff in and add |
forgot, good call, done |
I've been re-reading the code and indeed it's useless: its been using default Now only printing it out. (untested yet but change is trivial) - feel free to test in the meantime. |
dfce23a
to
2d20333
Compare
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.
Tested this morning and working well. It actually expedite the installation a bit.
Description
This proposed framework update aims to rectify issues associated with Python-based package installations. Specifically, it addresses a situation where, in the presence of installation errors, the system erroneously reports a successful installation to the user.
Fixes #5926
Checklist
all-supported
completed successfullyType of change