-
Notifications
You must be signed in to change notification settings - Fork 44
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
File conflict callbacks #452
Conversation
@@ -2759,6 +2854,13 @@ def SetProgressReportCallbacks | |||
nil | |||
end | |||
|
|||
def SetFileConflictsCallbacks | |||
Pkg.CallbackFileConflictStart(fun_ref(method(:FileConflictStart), "void ()")) | |||
Pkg.CallbackFileConflictProgress(fun_ref(method(:FileConflictProgress), "boolean (intreger)")) |
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.
intreger -> integer
0ba80c5
to
2c82b7d
Compare
def FileConflictProgress(progress) | ||
log.debug "File conflict progress: #{progress}%" | ||
|
||
sleep(1) |
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.
FIXME remove before merging
|
||
module Packages | ||
# Default file conflicts callbacks for package bindings. To register the | ||
# callbacks in Yast::Pkg just call {Package::FileConflictCallbacks.register} |
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.
Packages::
Looks good, only version + changelog missing. |
|
||
- Display a confirmation dialog when a file conflict is detected | ||
during package installation (bsc#923590) | ||
- 3.1.180 |
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.
Conflict in a conflict PR!!1!
(I have removed an extra blank line in .changes) LGTM, thank you! |
1fccb57
to
22c9857
Compare
JFYI: I have squashed the commits to have a clean history. |
Handle File Conflicts in Packages
A sample repository with testing packages that have file conflicts is obs://YaST:testing.
Note: The new added file has 100% test code coverage 😉
Background (for the Blog)
Until now the package installation in YaST ignored possible file conflicts in the installed packages. In contrast
zypper
already supports that check for some time.File conflicts happen when two packages attempt to install files with the same name but different contents. If such conflicting packages are installed the conflicting files will be replaced losing the previous content. The final file content will also depend on the installation order so some issues might look "random". The package which file has been overwritten is actually broken.
YaST now displays a confirmation dialog which asks whether to continue with installation despite the conflicts or abort. Previously YaST silently continued with the package installation which could cause serious troubles later.
File conflicts should normally not happen, at least when you use the original distribution repositories. The OBS build checks for some file conflicts during package build and if there really is a file conflict that it should be marked on the RPM level (so you should not be allowed to select the conflicting packages for installation at first place).
It is up to the user to decide whether it is OK to ignore the conflict or not. If the conflict is for example in a documentation file then ignoring the conflict is usually no problem, but if the conflict is in a binary file or in a system library then it is potentially risky. If you are not sure "Abort" is the safe choice here.
Screencasts
(Click an image to display it in full size.)
Qt GUI
In this demo there is a
sleep()
call used in the progress dialog to make the progress visible, in real installation it will be much faster. The Packman packages were added just to have more progress steps. The "Actions performed" log is empty as the packages were cached locally from the previous attempts. 😉NCurses UI
Again, the progress contains
sleep()
to make it visible.Command Line Mode
The yast2-dhcp-server package has been manually modified to install the conflicting packages beside the usual
dhcp-server
package. In the command line mode the conflicts are ignored and the packages are installed without asking.Installing Extra Packages at Runtime
Some modules install missing packages when the module is started. In this case I patched the
dhcp-server
module to additionally install the conflicting packages.