From 1bd149c14e98277ae40f5d41503e5ace9a046274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20M=C3=BCller?= Date: Sun, 17 Jun 2018 12:53:31 +0200 Subject: [PATCH 1/3] [packages] add initial support for update target system --- src/modules/packages/main.py | 48 ++++++++++++++++++++++++++++-- src/modules/packages/packages.conf | 4 ++- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/modules/packages/main.py b/src/modules/packages/main.py index d9741287b..0190d474f 100644 --- a/src/modules/packages/main.py +++ b/src/modules/packages/main.py @@ -8,6 +8,7 @@ # Copyright 2016-2017, Kyle Robbertze # Copyright 2017, Alf Gaida # Copyright 2018, Adriaan de Groot +# Copyright 2018, Philip Müller # # Calamares is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -153,6 +154,9 @@ class PMPackageKit(PackageManager): def update_db(self): check_target_env_call(["pkcon", "refresh"]) + def update_system(self): + # Doesn't need to update the system explicitly + pass class PMZypp(PackageManager): backend = "zypp" @@ -170,6 +174,9 @@ class PMZypp(PackageManager): def update_db(self): check_target_env_call(["zypper", "--non-interactive", "update"]) + def update_system(self): + # Doesn't need to update the system explicitly + pass class PMYum(PackageManager): backend = "yum" @@ -185,6 +192,9 @@ class PMYum(PackageManager): # Doesn't need updates pass + def update_system(self): + # Doesn't need to update the system explicitly + pass class PMDnf(PackageManager): backend = "dnf" @@ -199,7 +209,11 @@ class PMDnf(PackageManager): "remove"] + pkgs) def update_db(self): - # Doesn't need to update explicitly + # Doesn't need updates + pass + + def update_system(self): + # Doesn't need to update the system explicitly pass @@ -218,6 +232,10 @@ class PMUrpmi(PackageManager): def update_db(self): check_target_env_call(["urpmi.update", "-a"]) + def update_system(self): + # Doesn't need to update the system explicitly + pass + class PMApt(PackageManager): backend = "apt" @@ -234,6 +252,10 @@ class PMApt(PackageManager): def update_db(self): check_target_env_call(["apt-get", "update"]) + def update_system(self): + # Doesn't need to update the system explicitly + pass + class PMPacman(PackageManager): backend = "pacman" @@ -242,7 +264,7 @@ class PMPacman(PackageManager): if from_local: pacman_flags = "-U" else: - pacman_flags = "-Sy" + pacman_flags = "-S" check_target_env_call(["pacman", pacman_flags, "--noconfirm"] + pkgs) @@ -253,6 +275,9 @@ class PMPacman(PackageManager): def update_db(self): check_target_env_call(["pacman", "-Sy"]) + def update_system(self): + check_target_env_call(["pacman", "-Su"]) + class PMPortage(PackageManager): backend = "portage" @@ -267,6 +292,10 @@ class PMPortage(PackageManager): def update_db(self): check_target_env_call(["emerge", "--sync"]) + def update_system(self): + # Doesn't need to update the system explicitly + pass + class PMEntropy(PackageManager): backend = "entropy" @@ -280,6 +309,10 @@ class PMEntropy(PackageManager): def update_db(self): check_target_env_call(["equo", "update"]) + def update_system(self): + # Doesn't need to update the system explicitly + pass + class PMDummy(PackageManager): backend = "dummy" @@ -293,6 +326,9 @@ class PMDummy(PackageManager): def update_db(self): libcalamares.utils.debug("Updating DB") + def update_system(self): + libcalamares.utils.debug("Updating System") + def run(self, script): libcalamares.utils.debug("Running script '" + str(script) + "'") @@ -309,6 +345,10 @@ class PMPisi(PackageManager): def update_db(self): check_target_env_call(["pisi", "update-repo"]) + def update_system(self): + # Doesn't need to update the system explicitly + pass + # Collect all the subclasses of PackageManager defined above, # and index them based on the backend property of each class. @@ -452,6 +492,10 @@ def run(): if update_db and libcalamares.globalstorage.value("hasInternet"): pkgman.update_db() + update_system = libcalamares.job.configuration.get("update_system", False) + if update_system and libcalamares.globalstorage.value("hasInternet"): + pkgman.update_system() + operations = libcalamares.job.configuration.get("operations", []) if libcalamares.globalstorage.contains("packageOperations"): operations += libcalamares.globalstorage.value("packageOperations") diff --git a/src/modules/packages/packages.conf b/src/modules/packages/packages.conf index ae141ee3a..84446257e 100644 --- a/src/modules/packages/packages.conf +++ b/src/modules/packages/packages.conf @@ -26,9 +26,11 @@ backend: dummy # You can run a package-manager specific update procedure # before installing packages (for instance, to update the # list of packages and dependencies); this is done only if there -# is an internet connection. Set *update_db* to true to do so. +# is an internet connection. Set *update_db* and/or *update_system* +# to true to do so. skip_if_no_internet: false update_db: true +update_system: false # # List of maps with package operations such as install or remove. From c600c3eccaa20b56f2f86396ad6c80e18fc8a949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20M=C3=BCller?= Date: Sun, 17 Jun 2018 13:10:59 +0200 Subject: [PATCH 2/3] [packages] update documentation to reflect 'update_db' and 'update_system' differences --- src/modules/packages/packages.conf | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/modules/packages/packages.conf b/src/modules/packages/packages.conf index 84446257e..2b1942ea3 100644 --- a/src/modules/packages/packages.conf +++ b/src/modules/packages/packages.conf @@ -16,18 +16,25 @@ backend: dummy # Often package installation needs an internet connection. # Since you may allow system installation without a connection -# and want to offer **optional** package installation, it's +# and want to offer OPTIONAL package installation, it's # possible to have no internet, yet have this packages module # enabled in settings. # # You can skip the whole module when there is no internet -# by setting *skip_if_no_internet* to true. +# by setting "skip_if_no_internet" to true. # # You can run a package-manager specific update procedure # before installing packages (for instance, to update the # list of packages and dependencies); this is done only if there -# is an internet connection. Set *update_db* and/or *update_system* -# to true to do so. +# is an internet connection. +# +# Set "update_db" to 'true' for refreshing the database on the +# target system. +# +# On target installations, which got installed by unsquashing +# a full system update is may be needed, to be able to post-install +# additional packages. Therefore set also "update_system" to 'true'. +# skip_if_no_internet: false update_db: true update_system: false @@ -88,14 +95,14 @@ update_system: false # # - if the system locale is English (any variety), then the package is not # installed at all, -# - otherwise $LOCALE or ${LOCALE} is replaced by the **lower-cased** BCP47 -# name of the **language** part of the selected system locale (not the -# country/region/dialect part), e.g. selecting *nl_BE* will use *nl* +# - otherwise $LOCALE or ${LOCALE} is replaced by the 'lower-cased' BCP47 +# name of the 'language' part of the selected system locale (not the +# country/region/dialect part), e.g. selecting "nl_BE" will use "nl" # here. # # Take care that just plain LOCALE will not be replaced, so foo-LOCALE will # be left unchanged, while foo-$LOCALE will be changed. However, foo-LOCALE -# **will** be removed from the list of packages, if English is selected. +# 'will' be removed from the list of packages, if English is selected. # # The following installs localizations for vi, if they are relevant; if # there is no localization, installation continues normally. From 3a3a4ec36387cf5a763f93ccf97f2514544c242e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20M=C3=BCller?= Date: Sun, 17 Jun 2018 13:15:55 +0200 Subject: [PATCH 3/3] [packages] update documentation --- src/modules/packages/packages.conf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/packages/packages.conf b/src/modules/packages/packages.conf index 2b1942ea3..974ba07a7 100644 --- a/src/modules/packages/packages.conf +++ b/src/modules/packages/packages.conf @@ -14,6 +14,7 @@ # backend: dummy +# # Often package installation needs an internet connection. # Since you may allow system installation without a connection # and want to offer OPTIONAL package installation, it's @@ -29,11 +30,10 @@ backend: dummy # is an internet connection. # # Set "update_db" to 'true' for refreshing the database on the -# target system. -# -# On target installations, which got installed by unsquashing -# a full system update is may be needed, to be able to post-install -# additional packages. Therefore set also "update_system" to 'true'. +# target system. On target installations, which got installed by +# unsquashing, a full system update may be needed. Otherwise +# post-installing additional packages may result in conflicts. +# Therefore set also "update_system" to 'true'. # skip_if_no_internet: false update_db: true