mirror of
https://git.launchpad.net/~ubuntu-qt-code/+git/calamares-settings-ubuntu
synced 2025-03-03 15:21:08 +00:00
Fix installation of apt packages more consistently (LP: #2089494).
This commit is contained in:
parent
bffde9297a
commit
0fea5bd853
@ -2,15 +2,20 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
|
|||||||
|
|
||||||
include(FeatureSummary)
|
include(FeatureSummary)
|
||||||
|
|
||||||
set( CMAKE_CXX_STANDARD 20 )
|
set( CMAKE_CXX_STANDARD 23 )
|
||||||
set( CMAKE_CXX_STANDARD_REQUIRED ON )
|
set( CMAKE_CXX_STANDARD_REQUIRED ON )
|
||||||
|
|
||||||
set( CALAMARES_VERSION_REQUIRED 3.3.9 )
|
find_library(APT_PKG_LIB apt-pkg)
|
||||||
|
if (NOT APT_PKG_LIB)
|
||||||
|
message(FATAL_ERROR "Could not find libapt-pkg")
|
||||||
|
endif()
|
||||||
|
|
||||||
find_package(ECM "6.0.0" NO_MODULE)
|
find_package(ECM "6.0.0" NO_MODULE)
|
||||||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
|
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
|
||||||
include(KDEInstallDirs)
|
|
||||||
find_package(KF6 REQUIRED COMPONENTS CoreAddons)
|
find_package(KF6 REQUIRED COMPONENTS CoreAddons)
|
||||||
|
include(KDEInstallDirs)
|
||||||
|
|
||||||
|
set( CALAMARES_VERSION_REQUIRED 3.3.9 )
|
||||||
find_package(Calamares ${CALAMARES_VERSION_REQUIRED} NO_CMAKE_PACKAGE_REGISTRY)
|
find_package(Calamares ${CALAMARES_VERSION_REQUIRED} NO_CMAKE_PACKAGE_REGISTRY)
|
||||||
if (NOT TARGET Calamares::calamares OR NOT TARGET Calamares::calamaresui)
|
if (NOT TARGET Calamares::calamares OR NOT TARGET Calamares::calamaresui)
|
||||||
find_package(Calamares ${CALAMARES_VERSION_REQUIRED} REQUIRED)
|
find_package(Calamares ${CALAMARES_VERSION_REQUIRED} REQUIRED)
|
||||||
@ -28,3 +33,5 @@ calamares_add_plugin( pkgselectprocess
|
|||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
NO_CONFIG
|
NO_CONFIG
|
||||||
)
|
)
|
||||||
|
add_executable(check_package checkpackage-backend.cpp)
|
||||||
|
target_link_libraries(check_package PRIVATE ${APT_PKG_LIB})
|
||||||
|
@ -360,29 +360,16 @@ Calamares::JobResult PackageSelectProcess::exec()
|
|||||||
|
|
||||||
if (!debPackages.isEmpty()) {
|
if (!debPackages.isEmpty()) {
|
||||||
const QString packageList = debPackages.join(" ");
|
const QString packageList = debPackages.join(" ");
|
||||||
const QString installCommand = QString(
|
const QString installCommand = QString("DEBIAN_FRONTEND=noninteractive apt-get -y install $(/usr/libexec/checkpackage-backend %1);").arg(packageList);
|
||||||
"packages_to_install=$(for pkg in %1; do "
|
|
||||||
"if ! dpkg -s \"$pkg\" &>/dev/null && apt-cache show \"$pkg\" &>/dev/null; then "
|
|
||||||
"printf \"%s \" \"$pkg\"; "
|
|
||||||
"fi; "
|
|
||||||
"done); "
|
|
||||||
"if [ -n \"$packages_to_install\" ]; then "
|
|
||||||
"DEBIAN_FRONTEND=noninteractive apt-get -y install $packages_to_install; "
|
|
||||||
"fi"
|
|
||||||
).arg(packageList);
|
|
||||||
|
|
||||||
Calamares::JobResult installResult = runAptCommand(installCommand,
|
Calamares::JobResult installResult = runAptCommand(installCommand,
|
||||||
rootMountPoint,
|
rootMountPoint,
|
||||||
installStart,
|
installStart,
|
||||||
installEnd,
|
installEnd,
|
||||||
true);
|
true);
|
||||||
if (!installResult) { // Using operator bool() to check for errors
|
if (!installResult) return std::move(installResult);
|
||||||
return std::move(installResult); // Move to avoid copy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
qDebug() << "No packages to install.";
|
|
||||||
}
|
}
|
||||||
|
else qDebug() << "No packages to install.";
|
||||||
|
|
||||||
QStringList removeDebPackages;
|
QStringList removeDebPackages;
|
||||||
for (const QVariant& var : packagesToRemove) {
|
for (const QVariant& var : packagesToRemove) {
|
||||||
|
39
common/modules/pkgselectprocess/checkpackage-backend.cpp
Normal file
39
common/modules/pkgselectprocess/checkpackage-backend.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <apt-pkg/algorithms.h>
|
||||||
|
#include <apt-pkg/cacheiterators.h>
|
||||||
|
#include <apt-pkg/init.h>
|
||||||
|
#include <apt-pkg/cachefile.h>
|
||||||
|
#include <apt-pkg/pkgcache.h>
|
||||||
|
#include <apt-pkg/pkgsystem.h>
|
||||||
|
#include <apt-pkg/progress.h>
|
||||||
|
|
||||||
|
int main(int argc, char* argv[]) {
|
||||||
|
pkgInitConfig(*_config);
|
||||||
|
pkgInitSystem(*_config, _system);
|
||||||
|
if (_system == 0) {
|
||||||
|
std::cerr << "apt-pkg not initialized\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Open the package cache.
|
||||||
|
pkgCacheFile *cache = new pkgCacheFile();
|
||||||
|
OpProgress progress;
|
||||||
|
if (!cache || cache->Open(&progress, false) == false) {
|
||||||
|
std::cerr << "Error: could not open APT cache.\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
pkgApplyStatus(*cache);
|
||||||
|
|
||||||
|
std::vector<std::string> package_names(argv + 1, argv + argc);
|
||||||
|
if (package_names.empty()) return 0;
|
||||||
|
|
||||||
|
for (std::string package_name : package_names) {
|
||||||
|
pkgCache::PkgIterator it = cache->GetPkgCache()->FindPkg(package_name);
|
||||||
|
if (!it.end()) std::cout << package_name << " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "\n";
|
||||||
|
cache->Close();
|
||||||
|
return 0;
|
||||||
|
}
|
1
debian/calamares-settings-ubuntu-common.links
vendored
Normal file
1
debian/calamares-settings-ubuntu-common.links
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
usr/lib/calamares/modules/automirror usr/lib/${DEB_HOST_MULTIARCH}/calamares/modules/automirror
|
@ -1,4 +0,0 @@
|
|||||||
# this is an internal implementation detail, no manpage needed
|
|
||||||
calamares-settings-ubuntu-common: no-manual-page [usr/bin/calamares_snap_install]
|
|
||||||
# this is normal and not a problem
|
|
||||||
calamares-settings-ubuntu-common: executable-in-usr-lib [usr/lib/x86_64-linux-gnu/calamares/modules/automirror/main.py]
|
|
6
debian/changelog
vendored
6
debian/changelog
vendored
@ -1,3 +1,9 @@
|
|||||||
|
calamares-settings-ubuntu (1:25.04.16) plucky; urgency=medium
|
||||||
|
|
||||||
|
* Fix installation of apt packages more consistently (LP: #2089494).
|
||||||
|
|
||||||
|
-- Simon Quigley <tsimonq2@ubuntu.com> Mon, 24 Feb 2025 03:53:14 -0600
|
||||||
|
|
||||||
calamares-settings-ubuntu (1:25.04.15) plucky; urgency=medium
|
calamares-settings-ubuntu (1:25.04.15) plucky; urgency=medium
|
||||||
|
|
||||||
* Move calamares -> libcalamares-dev for build dependencies.
|
* Move calamares -> libcalamares-dev for build dependencies.
|
||||||
|
21
debian/control
vendored
21
debian/control
vendored
@ -8,6 +8,7 @@ Build-Depends: debhelper-compat (= 13),
|
|||||||
cmake,
|
cmake,
|
||||||
extra-cmake-modules,
|
extra-cmake-modules,
|
||||||
intltool,
|
intltool,
|
||||||
|
libapt-pkg-dev,
|
||||||
libcalamares-dev (>= 3.3.13-0ubuntu4),
|
libcalamares-dev (>= 3.3.13-0ubuntu4),
|
||||||
libkf6coreaddons-dev,
|
libkf6coreaddons-dev,
|
||||||
libqt6svg6-dev,
|
libqt6svg6-dev,
|
||||||
@ -68,19 +69,33 @@ Description: Ubuntu Unity Calamares Settings and Branding
|
|||||||
Package: calamares-settings-ubuntu-common
|
Package: calamares-settings-ubuntu-common
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Depends: calamares (>= 3.3.13-0ubuntu4),
|
Depends: calamares (>= 3.3.13-0ubuntu4),
|
||||||
|
calamares-settings-ubuntu-common-data (= ${binary:Version}),
|
||||||
cryptsetup,
|
cryptsetup,
|
||||||
dracut-core,
|
dracut-core,
|
||||||
kdialog,
|
kdialog,
|
||||||
keyutils,
|
keyutils,
|
||||||
python3,
|
|
||||||
python3-distro,
|
|
||||||
snapd-seed-glue,
|
snapd-seed-glue,
|
||||||
squashfs-tools,
|
squashfs-tools,
|
||||||
sudo,
|
sudo,
|
||||||
${misc:Depends},
|
${misc:Depends},
|
||||||
${qml6:Depends},
|
|
||||||
${shlibs:Depends}
|
${shlibs:Depends}
|
||||||
Description: Common Calamares Settings
|
Description: Common Calamares Settings
|
||||||
This package contains the common Calamares settings for all flavors.
|
This package contains the common Calamares settings for all flavors.
|
||||||
There is also a automirror Python script to set sources based on
|
There is also a automirror Python script to set sources based on
|
||||||
geolocation.
|
geolocation.
|
||||||
|
.
|
||||||
|
Common settings for all Ubuntu flavors.
|
||||||
|
|
||||||
|
Package: calamares-settings-ubuntu-common-data
|
||||||
|
Architecture: all
|
||||||
|
Depends: ${misc:Depends},
|
||||||
|
python3,
|
||||||
|
python3-distro,
|
||||||
|
Conflicts: calamares-settings-ubuntu-common (<< 1:25.04.16)
|
||||||
|
Replaces: calamares-settings-ubuntu-common (<< 1:25.04.16)
|
||||||
|
Description: Data for Common Calamares Settings
|
||||||
|
This package contains the common Calamares settings for all flavors.
|
||||||
|
There is also a automirror Python script to set sources based on
|
||||||
|
geolocation.
|
||||||
|
.
|
||||||
|
Architecture-independent data for the common Calamares settings.
|
||||||
|
27
debian/rules
vendored
27
debian/rules
vendored
@ -7,7 +7,10 @@ export GO111MODULE=off
|
|||||||
export GOCACHE=$(CURDIR)/.gocache
|
export GOCACHE=$(CURDIR)/.gocache
|
||||||
export PKGSELECT = "common/modules/pkgselect"
|
export PKGSELECT = "common/modules/pkgselect"
|
||||||
export PKGSELECTPROCESS = "common/modules/pkgselectprocess"
|
export PKGSELECTPROCESS = "common/modules/pkgselectprocess"
|
||||||
|
export USRDIR = "debian/calamares-settings-ubuntu-common/usr"
|
||||||
|
export DATA_USRDIR = "debian/calamares-settings-ubuntu-common-data/usr"
|
||||||
export MODULES_DIR = "debian/calamares-settings-ubuntu-common/usr/lib/$(DEB_HOST_MULTIARCH)/calamares/modules"
|
export MODULES_DIR = "debian/calamares-settings-ubuntu-common/usr/lib/$(DEB_HOST_MULTIARCH)/calamares/modules"
|
||||||
|
export DATA_MODULES_DIR = "debian/calamares-settings-ubuntu-common-data/usr/lib/calamares/modules"
|
||||||
|
|
||||||
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
|
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
|
||||||
|
|
||||||
@ -29,22 +32,22 @@ override_dh_auto_clean:
|
|||||||
|
|
||||||
override_dh_auto_install:
|
override_dh_auto_install:
|
||||||
(cd $(PKGSELECT)/build && $(MAKE) DESTDIR=$(CURDIR)/debian/calamares-settings-ubuntu-common/ install)
|
(cd $(PKGSELECT)/build && $(MAKE) DESTDIR=$(CURDIR)/debian/calamares-settings-ubuntu-common/ install)
|
||||||
(cd $(PKGSELECTPROCESS)/build && $(MAKE) DESTDIR=$(CURDIR)/debian/calamares-settings-ubuntu-common/ install)
|
|
||||||
|
|
||||||
override_dh_missing:
|
override_dh_missing:
|
||||||
dh_missing
|
dh_missing
|
||||||
mkdir -pv $(MODULES_DIR)
|
mkdir -pv $(MODULES_DIR) $(DATA_MODULES_DIR)
|
||||||
cp -vr common/modules/automirror $(MODULES_DIR)
|
cp -vr common/modules/automirror $(DATA_MODULES_DIR)
|
||||||
mkdir -pv debian/calamares-settings-ubuntu-common/etc/calamares/modules
|
mkdir -pv debian/calamares-settings-ubuntu-common-data/etc/calamares/modules
|
||||||
cp -vr common/modules/*.conf debian/calamares-settings-ubuntu-common/etc/calamares/modules
|
cp -vr common/modules/*.conf debian/calamares-settings-ubuntu-common-data/etc/calamares/modules
|
||||||
chmod -R 755 debian/calamares-settings-ubuntu-common/usr/lib/
|
chmod 644 $(DATA_MODULES_DIR)/automirror/automirror.conf
|
||||||
chmod 644 $(MODULES_DIR)/automirror/automirror.conf
|
chmod 644 $(DATA_MODULES_DIR)/automirror/module.desc
|
||||||
chmod 644 $(MODULES_DIR)/automirror/module.desc
|
|
||||||
chmod 644 $(MODULES_DIR)/pkgselect/libcalamares_viewmodule_pkgselect.so
|
chmod 644 $(MODULES_DIR)/pkgselect/libcalamares_viewmodule_pkgselect.so
|
||||||
chmod 644 $(MODULES_DIR)/pkgselect/module.desc
|
chmod 644 $(MODULES_DIR)/pkgselect/module.desc
|
||||||
|
mkdir -pv $(MODULES_DIR)/pkgselectprocess
|
||||||
|
cp -v $(PKGSELECTPROCESS)/build/*.so $(PKGSELECTPROCESS)/build/*.desc $(MODULES_DIR)/pkgselectprocess
|
||||||
chmod 644 $(MODULES_DIR)/pkgselectprocess/libcalamares_job_pkgselectprocess.so
|
chmod 644 $(MODULES_DIR)/pkgselectprocess/libcalamares_job_pkgselectprocess.so
|
||||||
chmod 644 $(MODULES_DIR)/pkgselectprocess/module.desc
|
chmod 644 $(MODULES_DIR)/pkgselectprocess/module.desc
|
||||||
mkdir -pv debian/calamares-settings-ubuntu-common/usr/bin/
|
mkdir -pv $(USRDIR)/libexec/ $(DATA_USRDIR)/libexec/
|
||||||
mkdir -pv debian/calamares-settings-ubuntu-common/usr/libexec/
|
cp -v common/fixconkeys-part1 $(DATA_USRDIR)/libexec/fixconkeys-part1
|
||||||
cp -v common/fixconkeys-part1 debian/calamares-settings-ubuntu-common/usr/libexec/fixconkeys-part1
|
cp -v common/fixconkeys-part2 $(DATA_USRDIR)/libexec/fixconkeys-part2
|
||||||
cp -v common/fixconkeys-part2 debian/calamares-settings-ubuntu-common/usr/libexec/fixconkeys-part2
|
cp -v $(PKGSELECTPROCESS)/build/check_package $(USRDIR)/libexec/checkpackage-backend
|
||||||
|
Loading…
x
Reference in New Issue
Block a user