Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

File conflict callbacks #452

Merged
merged 2 commits into from Mar 29, 2016
Merged

File conflict callbacks #452

merged 2 commits into from Mar 29, 2016

Conversation

mvidner
Copy link
Member

@mvidner mvidner commented Mar 18, 2016

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. 馃槈

file_conflicts

NCurses UI

Again, the progress contains sleep() to make it visible.

file_conflicts_ncurses

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.

file_conflicts_cmdline

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.

file_conflicts_extra_pkgs2

@@ -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)"))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intreger -> integer

def FileConflictProgress(progress)
log.debug "File conflict progress: #{progress}%"

sleep(1)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIXME remove before merging

@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 59.428% when pulling f34d972 on file_conflict_callbacks into ea17f74 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 59.566% when pulling 135dbe6 on file_conflict_callbacks into ea17f74 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 59.559% when pulling 74013a3 on file_conflict_callbacks into ea17f74 on master.

@lslezak lslezak added the blog label Mar 29, 2016
@lslezak lslezak changed the title [WIP] File conflict callbacks File conflict callbacks Mar 29, 2016

module Packages
# Default file conflicts callbacks for package bindings. To register the
# callbacks in Yast::Pkg just call {Package::FileConflictCallbacks.register}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Packages::

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 59.559% when pulling 438f12e on file_conflict_callbacks into ea17f74 on master.

@mvidner
Copy link
Member Author

mvidner commented Mar 29, 2016

Looks good, only version + changelog missing.


- Display a confirmation dialog when a file conflict is detected
during package installation (bsc#923590)
- 3.1.180
Copy link
Member Author

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!

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 59.559% when pulling 4665d06 on file_conflict_callbacks into c567782 on master.

@mvidner
Copy link
Member Author

mvidner commented Mar 29, 2016

(I have removed an extra blank line in .changes)

LGTM, thank you!

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 59.559% when pulling 1fccb57 on file_conflict_callbacks into c567782 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 59.559% when pulling 22c9857 on file_conflict_callbacks into c567782 on master.

@lslezak
Copy link
Member

lslezak commented Mar 29, 2016

JFYI: I have squashed the commits to have a clean history.

@lslezak lslezak merged commit 62cf5d5 into master Mar 29, 2016
@lslezak lslezak deleted the file_conflict_callbacks branch March 29, 2016 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants