[Pkg-privacy-commits] [tails-installer] 08/34: Move business logic to the backend class.
anonym
anonym-tails-guest at moszumanska.debian.org
Mon Jan 22 14:05:31 UTC 2018
This is an automated email from the git hooks/post-receive script.
anonym-tails-guest pushed a commit to branch tails/master
in repository tails-installer.
commit 432fcb3ef663e7d4553e59cdf1cc5684430903dd
Author: intrigeri <intrigeri at boum.org>
Date: Sat Jan 20 10:46:34 2018 +0000
Move business logic to the backend class.
It has nothing to do in gui.py.
---
tails_installer/creator.py | 14 ++++++++++++++
tails_installer/gui.py | 12 +-----------
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/tails_installer/creator.py b/tails_installer/creator.py
index 6fe333c..858930c 100755
--- a/tails_installer/creator.py
+++ b/tails_installer/creator.py
@@ -670,6 +670,20 @@ class LinuxTailsInstallerCreator(TailsInstallerCreator):
% data['device'])
data['is_device_big_enough_for_installation'] = False
+ # To be more accurate we would need to either mount the candidate
+ # device (which causes UX problems down the road) or to recursively
+ # parse the output of fatcat.
+ # We add a 5% margin to account for filesystem structures.
+ if partition \
+ and self.device_can_be_upgraded(data) \
+ and hasattr(self, 'source') \
+ and self.source is not None \
+ and data['size'] < self.source.size * 1.05:
+ self.log.warning(
+ 'Device is too small for upgrade: %s'
+ % data['device'])
+ data['is_device_big_enough_for_upgrade'] = False
+
mount = data['mount']
if mount:
if len(mount) > 1:
diff --git a/tails_installer/gui.py b/tails_installer/gui.py
index b0ca32a..4a86204 100755
--- a/tails_installer/gui.py
+++ b/tails_installer/gui.py
@@ -573,18 +573,8 @@ class TailsInstallerWindow(Gtk.ApplicationWindow):
self.status(message)
continue
# Skip devices too small for cloning, but inform the user
- # Note: we add a 5% margin because info['size']
- # is the block device size, which does not take into account
- # space used by filesystem structures, reserved space etc.
- # To be more accurate we would need to mount the candidate
- # device, which causes UX problems down the road.
- # XXX: move business logic to creator.py and set
- # info['is_device_big_enough_for_upgrade'] there
if self.opts.clone \
- and self.source_available \
- and hasattr(self.live, 'source') \
- and self.live.source is not None \
- and info['size'] < self.live.source.size * 1.05:
+ and not info['is_device_big_enough_for_upgrade']:
message = _('To upgrade device "%(pretty_name)s"'
' from this Tails, you need to use '
' a downloaded Tails ISO image:'
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/tails-installer.git
More information about the Pkg-privacy-commits
mailing list