summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Strawn2022-03-28 09:22:22 -0700
committerKenny Strawn2022-03-28 09:22:22 -0700
commit8a17fff7ddecc121176358228702b56929b1f464 (patch)
tree4a2e11bba55310d047918dcc310d2181ef41fac0
downloadaur-8a17fff7ddecc121176358228702b56929b1f464.tar.gz
Add calamares to the AUR directly
-rw-r--r--.SRCINFO44
-rw-r--r--.gitignore4
-rw-r--r--PKGBUILD78
-rw-r--r--yay-support.patch165
4 files changed, 291 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..b1c3423dda12
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,44 @@
+pkgbase = calamares-git
+ pkgdesc = Distribution-independent installer framework (development version)
+ pkgver = 3.2.55.r9918.9b769f0ae
+ pkgrel = 1
+ url = https://github.com/calamares/calamares
+ arch = i686
+ arch = x86_64
+ license = LGPL
+ makedepends = extra-cmake-modules
+ makedepends = qt5-tools
+ makedepends = qt5-translations
+ makedepends = git
+ makedepends = boost
+ depends = kconfig
+ depends = kcoreaddons
+ depends = kiconthemes
+ depends = ki18n
+ depends = kio
+ depends = solid
+ depends = yaml-cpp
+ depends = kpmcore>=4.1.0
+ depends = mkinitcpio-openswap
+ depends = boost-libs
+ depends = ckbcomp
+ depends = hwinfo
+ depends = qt5-svg
+ depends = polkit-qt5
+ depends = gtk-update-icon-cache
+ depends = plasma-framework
+ depends = qt5-xmlpatterns
+ depends = squashfs-tools
+ depends = libpwquality
+ depends = appstream-qt
+ provides = calamares
+ provides = calamares-dev
+ conflicts = calamares
+ conflicts = calamares-dev
+ replaces = calamares-dev
+ source = git+https://github.com/calamares/calamares.git
+ source = yay-support.patch
+ sha256sums = SKIP
+ sha256sums = SKIP
+
+pkgname = calamares-git
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..9887399073b3
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+calamares
+pkg
+src
+*.pkg.tar.*
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..ab07782b4be9
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,78 @@
+# Maintainer: Philip Müller <philm[at]manjaro[dog]org>
+
+pkgname=calamares-git
+pkgver=3.2.55.r9918.9b769f0ae
+pkgrel=1
+pkgdesc='Distribution-independent installer framework (development version)'
+arch=('i686' 'x86_64')
+license=(GPL)
+url="https://github.com/calamares/calamares"
+license=('LGPL')
+conflicts=('calamares' 'calamares-dev')
+provides=('calamares' 'calamares-dev')
+replaces=('calamares-dev')
+depends=('kconfig' 'kcoreaddons' 'kiconthemes' 'ki18n' 'kio' 'solid' 'yaml-cpp' 'kpmcore>=4.1.0' 'mkinitcpio-openswap'
+ 'boost-libs' 'ckbcomp' 'hwinfo' 'qt5-svg' 'polkit-qt5' 'gtk-update-icon-cache' 'plasma-framework'
+ 'qt5-xmlpatterns' 'squashfs-tools' 'libpwquality' 'appstream-qt') # 'pythonqt>=3.2')
+makedepends=('extra-cmake-modules' 'qt5-tools' 'qt5-translations' 'git' 'boost')
+# backup=('usr/share/calamares/modules/bootloader.conf'
+# 'usr/share/calamares/modules/displaymanager.conf'
+# 'usr/share/calamares/modules/initcpio.conf'
+# 'usr/share/calamares/modules/unpackfs.conf')
+
+source=(
+ "git+https://github.com/calamares/calamares.git"
+ "yay-support.patch"
+)
+sha256sums=(
+ 'SKIP'
+ 'SKIP'
+)
+
+pkgver() {
+ cd ${srcdir}/calamares
+ _ver="$(cat CMakeLists.txt | grep -m3 -e " VERSION" | grep -o "[[:digit:]]*" | xargs | sed s'/ /./g')"
+ _git=".r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
+ printf '%s%s' "${_ver}" "${_git}"
+ sed -i -e "s|\${CALAMARES_VERSION_MAJOR}.\${CALAMARES_VERSION_MINOR}.\${CALAMARES_VERSION_PATCH}|${_ver}${_git}|g" CMakeLists.txt
+ sed -i -e "s|CALAMARES_VERSION_RC 1|CALAMARES_VERSION_RC 0|g" CMakeLists.txt
+# sed -i -e "s|default|manjaro|g" src/branding/CMakeLists.txt
+ rm -rf ${srcdir}/calamares/.git
+}
+
+prepare() {
+ cd ${srcdir}/calamares
+ sed -i -e 's/"Install configuration files" OFF/"Install configuration files" ON/' CMakeLists.txt
+
+ git apply ../yay-support.patch
+}
+
+
+build() {
+ cd ${srcdir}/calamares
+
+ mkdir -p build
+ cd build
+ cmake .. \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_INSTALL_LIBDIR=lib \
+ -DWITH_PYTHONQT:BOOL=ON \
+ -DBoost_NO_BOOST_CMAKE=ON \
+ -DSKIP_MODULES="webview interactiveterminal initramfs \
+ initramfscfg dracut dracutlukscfg \
+ dummyprocess dummypython dummycpp \
+ dummypythonqt services-openrc"
+ make
+}
+
+package() {
+ cd ${srcdir}/calamares/build
+ make DESTDIR="$pkgdir" install
+
+ # rename services-systemd back to services
+ mv "$pkgdir/usr/lib/calamares/modules/services-systemd" "$pkgdir/usr/lib/calamares/modules/services"
+ mv "$pkgdir/usr/share/calamares/modules/services-systemd.conf" "$pkgdir/usr/share/calamares/modules/services.conf"
+ sed -i -e 's/-systemd//' "$pkgdir/usr/lib/calamares/modules/services/module.desc"
+ sed -i -e 's/-systemd//' "$pkgdir/usr/share/calamares/settings.conf"
+}
diff --git a/yay-support.patch b/yay-support.patch
new file mode 100644
index 000000000000..59fb4256f6e9
--- /dev/null
+++ b/yay-support.patch
@@ -0,0 +1,165 @@
+From e348a5424317b62dfa95bd88c85cb2da0f95571c Mon Sep 17 00:00:00 2001
+From: Kenny Strawn <Kenny.Strawn@gmail.com>
+Date: Fri, 25 Mar 2022 16:14:13 -0700
+Subject: [PATCH] Patch calamares instead of forking
+
+---
+ src/modules/packages/main.py | 129 +++++++++++++++++++++++++++++
+ src/modules/packages/packages.conf | 1 +
+ 2 files changed, 130 insertions(+)
+
+diff --git a/src/modules/packages/main.py b/src/modules/packages/main.py
+index e373a3443..05c8d22d3 100644
+--- a/src/modules/packages/main.py
++++ b/src/modules/packages/main.py
+@@ -475,6 +475,135 @@ class PMPacman(PackageManager):
+
+ self.run_pacman(command)
+
++class PMYay(PackageManager):
++ backend = "yay"
++
++ def __init__(self):
++ import re
++ import shutil
++
++ progress_match = re.compile("^\\((\\d+)/(\\d+)\\)")
++
++ # Note that this writes to /etc/sudoers.d, NOT /etc/sudoers!
++ sudoers_entry = open("/etc/sudoers.d/autoupdate", "w")
++ sudoers_entry.write("nobody ALL = NOPASSWD: " + shutil.which("pacman"))
++ sudoers_entry.close()
++
++ def line_cb(line):
++ if line.startswith(":: "):
++ self.in_package_changes = "package" in line or "hooks" in line
++ else:
++ if self.in_package_changes and line.endswith("...\n"):
++ # Update the message, untranslated; do not change the
++ # progress percentage, since there may be more "installing..."
++ # lines in the output for the group, than packages listed
++ # explicitly. We don't know how to calculate proper progress.
++ global custom_status_message
++ custom_status_message = "yay: " + line.strip()
++ libcalamares.job.setprogress(self.progress_fraction)
++ libcalamares.utils.debug(line)
++
++ self.in_package_changes = False
++ self.line_cb = line_cb
++
++ yay = libcalamares.job.configuration.get("yay", None)
++ if yay is None:
++ yay = dict()
++ if type(yay) is not dict:
++ libcalamares.utils.warning("Job configuration *yay* will be ignored.")
++ yay = dict()
++ self.yay_num_retries = yay.get("num_retries", 0)
++ self.yay_disable_timeout = yay.get("disable_download_timeout", False)
++ self.yay_needed_only = yay.get("needed_only", False)
++
++ def reset_progress(self):
++ self.in_package_changes = False
++ # These are globals
++ self.progress_fraction = (completed_packages * 1.0 / total_packages)
++
++ def run_yay(self, command, callback=False):
++ """
++ Call yay in a loop until it is successful or the number of retries is exceeded
++ :param command: The yay command to run
++ :param callback: An optional boolean that indicates if this yay run should use the callback
++ :return:
++ """
++
++ yay_count = 0
++ while yay_count <= self.yay_num_retries:
++ yay_count += 1
++ try:
++ if False: # callback:
++ libcalamares.utils.target_env_process_output(command, self.line_cb)
++ else:
++ libcalamares.utils.target_env_process_output(command)
++
++ return
++ except subprocess.CalledProcessError:
++ if yay_count <= self.yay_num_retries:
++ pass
++ else:
++ raise
++
++ def install(self, pkgs, from_local=False):
++ import os
++
++ os.environ["PWD"] = "/var/cache"
++ os.environ["XDG_CACHE_HOME"] = "/var/cache"
++
++ command = ["sudo", "-E", "-u", "nobody", "yay"]
++
++ if from_local:
++ command.append("-U")
++ else:
++ command.append("-S")
++
++ # Don't ask for user intervention, take the default action
++ command.append("--noconfirm")
++
++ # Don't report download progress for each file
++ command.append("--noprogressbar")
++
++ if self.yay_needed_only is True:
++ command.append("--needed")
++
++ if self.yay_disable_timeout is True:
++ command.append("--disable-download-timeout")
++
++ command += pkgs
++
++ self.reset_progress()
++ self.run_yay(command, True)
++
++ def remove(self, pkgs):
++ import os
++
++ os.environ["PWD"] = "/var/cache"
++ os.environ["XDG_CACHE_HOME"] = "/var/cache"
++
++ self.reset_progress()
++ self.run_yay(["sudo", "-E", "-u", "nobody", "yay", "-Rs", "--noconfirm"] + pkgs, True)
++
++ def update_db(self):
++ import os
++
++ os.environ["PWD"] = "/var/cache"
++ os.environ["XDG_CACHE_HOME"] = "/var/cache"
++
++ self.run_yay(["sudo", "-E", "-u", "nobody", "yay", "-Sy"])
++
++ def update_system(self):
++ import os
++
++ os.environ["PWD"] = "/var/cache"
++ os.environ["XDG_CACHE_HOME"] = "/var/cache"
++
++ command = ["sudo", "-E", "-u", "nobody", "yay", "-Su", "--noconfirm"]
++ if self.yay_disable_timeout is True:
++ command.append("--disable-download-timeout")
++
++ self.run_yay(command)
++
+
+ class PMPamac(PackageManager):
+ backend = "pamac"
+diff --git a/src/modules/packages/packages.conf b/src/modules/packages/packages.conf
+index 6e62f4b5f..74ab8d3cb 100644
+--- a/src/modules/packages/packages.conf
++++ b/src/modules/packages/packages.conf
+@@ -29,6 +29,7 @@
+ # - pacman - Pacman
+ # - pamac - Manjaro package manager
+ # - portage - Gentoo package manager
++# - yay - AUR package manager
+ # - yum - Yum RPM frontend
+ # - zypp - Zypp RPM frontend
+ #
+--
+2.35.1
+