From bdee058f7ede8cbfb962d72108514280ad1cecb6 Mon Sep 17 00:00:00 2001
From: SolveFinder <kwopleq@proton.me>
Date: Aug 07 2023 09:24:52 +0000
Subject: [PATCH 1/2] libre/discover, libre/packagekit, libre/parabola-appstream-data


---

diff --git a/libre/discover/PKGBUILD b/libre/discover/PKGBUILD
new file mode 100644
index 0000000..07962f8
--- /dev/null
+++ b/libre/discover/PKGBUILD
@@ -0,0 +1,50 @@
+# Maintainer: Antonio Rojas <arojas@archlinux.org> 
+
+pkgname=discoverless
+_pkgname=discover
+pkgver=5.27.7
+_dirver=$(echo $pkgver | cut -d. -f1-3)
+pkgrel=1
+pkgrel+=.parabola1
+pkgdesc='KDE and Plasma resources management GUI'
+pkgdesc+=', without non-free webview support and TPPM functionality'
+arch=(x86_64)
+arch+=(i686 armv7h)
+url='https://kde.org/plasma-desktop/'
+license=(LGPL)
+depends=(kidletime
+         qt5-graphicaleffects
+         appstream-qt
+         # parabola-appstream-data
+         kirigami2
+         discount
+         kuserfeedback
+         purpose)
+makedepends=(extra-cmake-modules plasma-framework packagekit-qt5)
+optdepends=('packagekit-qt5: to manage packages from Parabola repositories (not recommended, use at your own risk)')
+groups=(plasma)
+source=(https://download.kde.org/stable/plasma/$_dirver/$_pkgname-$pkgver.tar.xz{,.sig}
+        'libre.patch')
+sha256sums=('a9eca14bb4cf3094d5c4df7975f1a793fca8fb4018ca1252d1e1230c79784500'
+            'SKIP'
+            'ffe77a6f78d96d98a9228920372f97539be2b76ebedae066cf207a4436fcf65f')
+validpgpkeys=('E0A3EB202F8E57528E13E72FD7574483BB57B18D'  # Jonathan Esk-Riddell <jr@jriddell.org>
+              '0AAC775BB6437A8D9AF7A3ACFE0784117FBCE11D'  # Bhushan Shah <bshah@kde.org>
+              'D07BD8662C56CB291B316EB2F5675605C74E02CF'  # David Edmundson <davidedmundson@kde.org>
+              '1FA881591C26B276D7A5518EEAAF29B42A678C20') # Marco Martin <notmart@gmail.com>
+
+prepare() {
+  cd "$_pkgname-$pkgver"
+  patch -p1 -i ../libre.patch
+}
+
+build() {
+  cmake -B build -S $_pkgname-$pkgver \
+    -DCMAKE_INSTALL_LIBEXECDIR=lib \
+    -DBUILD_TESTING=OFF
+  cmake --build build
+}
+
+package() {
+  DESTDIR="$pkgdir" cmake --install build
+}
diff --git a/libre/discover/libre.patch b/libre/discover/libre.patch
new file mode 100644
index 0000000..5c04bf5
--- /dev/null
+++ b/libre/discover/libre.patch
@@ -0,0 +1,135 @@
+From f2c792dd45ae6208e2f0f391379aa205cdae9de9 Mon Sep 17 00:00:00 2001
+From: SolveFinder <kwopleq@proton.me>
+Date: Sat, 5 Aug 2023 23:54:43 +0300
+Subject: [PATCH] libre/discover without TPPM functionality; webview, flatpak,
+ snap, fwupd and rpm-ostree support
+
+---
+ CMakeLists.txt                                |  1 -
+ discover/CMakeLists.txt                       |  7 +---
+ libdiscover/backends/CMakeLists.txt           | 12 +++----
+ .../packagekit-backend-categories.xml         | 34 -------------------
+ 4 files changed, 5 insertions(+), 49 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 87bbe34..d5312ab 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -23,7 +23,6 @@ include(ECMQtDeclareLoggingCategory)
+ include(KDEClangFormat)
+ include(KDEGitCommitHooks)
+ find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED CONFIG COMPONENTS Widgets Test Network Concurrent DBus Quick)
+-find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG OPTIONAL_COMPONENTS WebView)
+ 
+ find_package(PkgConfig REQUIRED)
+ 
+diff --git a/discover/CMakeLists.txt b/discover/CMakeLists.txt
+index 17ac7f8..cbc2403 100644
+--- a/discover/CMakeLists.txt
++++ b/discover/CMakeLists.txt
+@@ -53,12 +53,7 @@ target_link_libraries(plasma-discover PUBLIC
+                                      Discover::Common
+ )
+ 
+-if (TARGET Qt::WebView)
+-    target_link_libraries(plasma-discover PUBLIC Qt::WebView)
+-    target_compile_definitions(plasma-discover PUBLIC -DWITH_QTWEBVIEW=1)
+-else()
+-    target_compile_definitions(plasma-discover PUBLIC -DWITH_QTWEBVIEW=0)
+-endif()
++target_compile_definitions(plasma-discover PUBLIC -DWITH_QTWEBVIEW=0)
+ 
+ if (TARGET KUserFeedbackCore)
+     target_link_libraries(plasma-discover PRIVATE KUserFeedbackCore)
+diff --git a/libdiscover/backends/CMakeLists.txt b/libdiscover/backends/CMakeLists.txt
+index bd3a032..149495e 100644
+--- a/libdiscover/backends/CMakeLists.txt
++++ b/libdiscover/backends/CMakeLists.txt
+@@ -8,10 +8,6 @@ function(add_unit_test name)
+         Qt::Test Qt::Core ${EXTRA_LIBS})
+ endfunction()
+ 
+-if(KF5Attica_FOUND AND KF5NewStuff_FOUND AND AppStreamQt_FOUND)
+-   add_subdirectory(KNSBackend)
+-endif()
+-
+ if(packagekitqt5_FOUND AND AppStreamQt_FOUND)
+     add_subdirectory(PackageKitBackend)
+ endif()
+@@ -21,7 +17,7 @@ if(BUILD_DummyBackend)
+     add_subdirectory(DummyBackend)
+ endif()
+ 
+-option(BUILD_FlatpakBackend "Build Flatpak support" "ON")
++option(BUILD_FlatpakBackend "Build Flatpak support" "OFF")
+ if(Flatpak_FOUND AND AppStreamQt_FOUND AND BUILD_FlatpakBackend)
+     add_subdirectory(FlatpakBackend)
+ elseif(BUILD_FlatpakBackend)
+@@ -40,17 +36,17 @@ if(BUILD_SteamOSBackend)
+     add_subdirectory(SteamOSBackend)
+ endif()
+ 
+-option(BUILD_SnapBackend "Build Snap support." "ON")
++option(BUILD_SnapBackend "Build Snap support." "OFF")
+ if(BUILD_SnapBackend AND AppStreamQt_FOUND AND Snapd_FOUND)
+     add_subdirectory(SnapBackend)
+ endif()
+ 
+-option(BUILD_FwupdBackend "Build Fwupd support." "ON")
++option(BUILD_FwupdBackend "Build Fwupd support." "OFF")
+ if(BUILD_FwupdBackend AND TARGET PkgConfig::Fwupd)
+     add_subdirectory(FwupdBackend)
+ endif()
+ 
+-option(BUILD_RpmOstreeBackend "Build rpm-ostree support." "ON")
++option(BUILD_RpmOstreeBackend "Build rpm-ostree support." "OFF")
+ if(BUILD_RpmOstreeBackend AND Ostree_FOUND AND RpmOstree_FOUND)
+     add_subdirectory(RpmOstreeBackend)
+ endif()
+diff --git a/libdiscover/backends/PackageKitBackend/packagekit-backend-categories.xml b/libdiscover/backends/PackageKitBackend/packagekit-backend-categories.xml
+index ff1a922..f6b5fe3 100644
+--- a/libdiscover/backends/PackageKitBackend/packagekit-backend-categories.xml
++++ b/libdiscover/backends/PackageKitBackend/packagekit-backend-categories.xml
+@@ -548,39 +548,5 @@
+       </Or>
+     </Include>
+   </Menu>
+-  <Menu>
+-    <Name>Plasma Addons</Name>
+-    <Icon>plasma</Icon>
+-    <Addons />
+-
+-    <Include>
+-        <Or>
+-            <AppstreamIdWildcard>org.kde.plasma.*</AppstreamIdWildcard>
+-        </Or>
+-    </Include>
+-
+-    <Menu>
+-      <Name>Plasma Widgets</Name>
+-      <Icon>plasma</Icon>
+-      <Addons />
+-      <Include>
+-        <Or>
+-            <AppstreamIdWildcard>org.kde.plasma.*</AppstreamIdWildcard>
+-        </Or>
+-      </Include>
+-    </Menu>
+-
+-<!--
+-    <Menu>
+-      <Name>Fonts</Name>
+-      <Icon>preferences-desktop-font</Icon>
+-      <Include>
+-        <And>
+-            <Category>Fonts</Category>
+-        </And>
+-      </Include>
+-    </Menu>
+--->
+-  </Menu>
+ 
+ </Menu>
+-- 
+2.41.0
+
diff --git a/libre/packagekit/0001-build-fix-overall-sysconfdir-handling-so-it-can-work.patch b/libre/packagekit/0001-build-fix-overall-sysconfdir-handling-so-it-can-work.patch
new file mode 100644
index 0000000..4320049
--- /dev/null
+++ b/libre/packagekit/0001-build-fix-overall-sysconfdir-handling-so-it-can-work.patch
@@ -0,0 +1,249 @@
+From 86379195b835eae2dee93bcbcad47028ba440560 Mon Sep 17 00:00:00 2001
+From: "Carsten Haitzler (Rasterman)" <raster@rasterman.com>
+Date: Sat, 22 May 2021 16:30:33 +0100
+Subject: [PATCH 1/1] build - fix overall sysconfdir handling so it can work
+ out of the box
+
+sysconfdir is "etc" by default in meson, this means paths are like
+"etc/PackageKit/xxxx" ... which is not a path. missing a / to begin
+with. not to mention packagekit installs its own etc files in prefix/etc
+(eg /usr/local/etc) by default. so differentiate files installed by
+pkgkit (pk_sysconfdir)) and other system files (sysconfdir) and use
+approplriately in the build. if the default etc is used then fix it to be
+/etc for system and prefix/etc for pk installed files. at least things can
+work out of the box then when you ninja install and dont provide a
+custom sysconfidr on the cmdline.
+---
+ backends/alpm/meson.build                        |  8 ++++----
+ backends/apt/meson.build                         |  2 +-
+ backends/slack/meson.build                       |  5 +++--
+ backends/slack/pk-backend-slack.cc               |  2 +-
+ backends/slack/tests/meson.build                 |  3 ++-
+ contrib/command-not-found/meson.build            |  7 ++++---
+ contrib/command-not-found/pk-command-not-found.c |  2 +-
+ contrib/cron/meson.build                         |  4 ++--
+ data/meson.build                                 |  2 +-
+ etc/meson.build                                  |  2 +-
+ meson.build                                      | 10 +++++++++-
+ src/meson.build                                  |  3 ++-
+ src/pk-shared.c                                  |  2 +-
+ 13 files changed, 32 insertions(+), 20 deletions(-)
+
+diff --git a/backends/alpm/meson.build b/backends/alpm/meson.build
+index eb4d5b373..fc7972128 100644
+--- a/backends/alpm/meson.build
++++ b/backends/alpm/meson.build
+@@ -34,9 +34,9 @@ shared_module(
+   c_args: [
+     '-DPK_LOG_PREFIX="PACKAGEKIT"',
+     '-DG_LOG_DOMAIN="PackageKit-alpm"',
+-    '-DPK_BACKEND_CONFIG_FILE="@0@"'.format(join_paths(get_option('sysconfdir'), 'PackageKit', 'alpm.d', 'pacman.conf')),
+-    '-DPK_BACKEND_GROUP_FILE="@0@"'.format(join_paths(get_option('sysconfdir'), 'PackageKit', 'alpm.d', 'groups.list')),
+-    '-DPK_BACKEND_REPO_FILE="@0@"'.format(join_paths(get_option('sysconfdir'), 'PackageKit', 'alpm.d', 'repos.list')),
++    '-DPK_BACKEND_CONFIG_FILE="@0@"'.format(join_paths(pk_sysconfdir, 'PackageKit', 'alpm.d', 'pacman.conf')),
++    '-DPK_BACKEND_GROUP_FILE="@0@"'.format(join_paths(pk_sysconfdir, 'PackageKit', 'alpm.d', 'groups.list')),
++    '-DPK_BACKEND_REPO_FILE="@0@"'.format(join_paths(pk_sysconfdir, 'PackageKit', 'alpm.d', 'repos.list')),
+     '-DPK_BACKEND_DEFAULT_PATH="/bin:/usr/bin:/sbin:/usr/sbin"',
+   ],
+   install: true,
+@@ -52,5 +52,5 @@ install_data(
+   'groups.list',
+   'pacman.conf',
+   'repos.list',
+-  install_dir: join_paths(get_option('sysconfdir'), 'PackageKit', 'alpm.d')
++  install_dir: join_paths(pk_sysconfdir, 'PackageKit', 'alpm.d')
+ )
+diff --git a/backends/apt/meson.build b/backends/apt/meson.build
+index 5df8f29e2..b29af882b 100644
+--- a/backends/apt/meson.build
++++ b/backends/apt/meson.build
+@@ -75,7 +75,7 @@ shared_module(
+ 
+ install_data(
+   '20packagekit',
+-  install_dir: join_paths(get_option('sysconfdir'), 'apt', 'apt.conf.d'),
++  install_dir: join_paths(sysconfdir, 'apt', 'apt.conf.d'),
+ )
+ 
+ install_data(
+diff --git a/backends/slack/meson.build b/backends/slack/meson.build
+index f44eea193..c6fdee49f 100644
+--- a/backends/slack/meson.build
++++ b/backends/slack/meson.build
+@@ -24,7 +24,8 @@ packagekit_backend_slack_module = shared_module(
+     '-DPK_COMPILATION=1',
+     '-DLOCALSTATEDIR="@0@"'.format(join_paths(get_option('prefix'), get_option('localstatedir'))),
+     '-DLIBDIR="@0@"'.format(join_paths(get_option('prefix'), get_option('libdir'))),
+-    '-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir')),
++    '-DSYSCONFDIR="@0@"'.format(sysconfdir),
++    '-DPK_SYSCONFDIR="@0@"'.format(pk_sysconfdir),
+   ],
+   override_options: ['c_std=c14', 'cpp_std=c++14'],
+   install: true,
+@@ -45,7 +46,7 @@ configure_file(
+   output: 'Slackware.conf',
+   configuration: slackware_config_data,
+   install: true,
+-  install_dir: join_paths(get_option('sysconfdir'), 'PackageKit'),
++  install_dir: join_paths(sysconfdir, 'PackageKit'),
+ )
+ 
+ install_data(
+diff --git a/backends/slack/pk-backend-slack.cc b/backends/slack/pk-backend-slack.cc
+index 46e233d9a..4dbce8a50 100644
+--- a/backends/slack/pk-backend-slack.cc
++++ b/backends/slack/pk-backend-slack.cc
+@@ -44,7 +44,7 @@ void pk_backend_initialize(GKeyFile *conf, PkBackend *backend)
+ 
+ 	/* Read the configuration file */
+ 	key_conf = g_key_file_new();
+-	path = g_build_filename(SYSCONFDIR, "PackageKit", "Slackware.conf", NULL);
++	path = g_build_filename(PK_SYSCONFDIR, "PackageKit", "Slackware.conf", NULL);
+ 	g_key_file_load_from_file(key_conf, path, G_KEY_FILE_NONE, &err);
+ 	if (err)
+ 	{
+diff --git a/backends/slack/tests/meson.build b/backends/slack/tests/meson.build
+index c5235227c..49e6161e1 100644
+--- a/backends/slack/tests/meson.build
++++ b/backends/slack/tests/meson.build
+@@ -13,7 +13,8 @@ pk_slack_test_cpp_args = [
+   '-DPK_COMPILATION=1',
+   '-DLOCALSTATEDIR="@0@"'.format(join_paths(get_option('prefix'), get_option('localstatedir'))),
+   '-DLIBDIR="@0@"'.format(join_paths(get_option('prefix'), get_option('libdir'))),
+-  '-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir')),
++  '-DSYSCONFDIR="@0@"'.format(sysconfdir),
++  '-DPK_SYSCONFDIR="@0@"'.format(pk_sysconfdir),
+   '-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()),
+   '-DLIBEXECDIR="@0@"'.format(join_paths(get_option('prefix'), get_option('libexecdir'))),
+   '-DPK_DB_DIR="."',
+diff --git a/contrib/command-not-found/meson.build b/contrib/command-not-found/meson.build
+index c1fba7a95..b1f0e88d8 100644
+--- a/contrib/command-not-found/meson.build
++++ b/contrib/command-not-found/meson.build
+@@ -8,7 +8,8 @@ executable(
+     '-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()),
+     '-DG_LOG_DOMAIN="PackageKit"',
+     '-DPACKAGE_LOCALE_DIR="@0@"'.format(join_paths(get_option('prefix'), get_option('localedir'))),
+-    '-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir')),
++    '-DSYSCONFDIR="@0@"'.format(sysconfdir),
++    '-DPK_SYSCONFDIR="@0@"'.format(pk_sysconfdir),
+   ]
+ )
+ 
+@@ -19,10 +20,10 @@ configure_file(
+   output: 'PackageKit.sh',
+   configuration: bashprofile_config_data,
+   install: true,
+-  install_dir: join_paths(get_option('sysconfdir'), 'profile.d'),
++  install_dir: join_paths(sysconfdir, 'profile.d'),
+ )
+ 
+ install_data(
+   'CommandNotFound.conf',
+-  install_dir: join_paths(get_option('sysconfdir'), 'PackageKit'),
++  install_dir: join_paths(pk_sysconfdir, 'PackageKit'),
+ )
+diff --git a/contrib/command-not-found/pk-command-not-found.c b/contrib/command-not-found/pk-command-not-found.c
+index 8bedb081c..f7c5005b7 100644
+--- a/contrib/command-not-found/pk-command-not-found.c
++++ b/contrib/command-not-found/pk-command-not-found.c
+@@ -591,7 +591,7 @@ pk_cnf_get_config (void)
+ 
+ 	/* load file */
+ 	file = g_key_file_new ();
+-	path = g_build_filename (SYSCONFDIR, "PackageKit", "CommandNotFound.conf", NULL);
++	path = g_build_filename (PK_SYSCONFDIR, "PackageKit", "CommandNotFound.conf", NULL);
+ 	ret = g_key_file_load_from_file (file, path, G_KEY_FILE_NONE, &error);
+ 	if (!ret) {
+ 		g_printerr ("failed to load config file: %s\n", error->message);
+diff --git a/contrib/cron/meson.build b/contrib/cron/meson.build
+index bff5eec27..5c1926e4b 100644
+--- a/contrib/cron/meson.build
++++ b/contrib/cron/meson.build
+@@ -1,9 +1,9 @@
+ install_data(
+   'packagekit-background.cron',
+-  install_dir: join_paths(get_option('sysconfdir'), 'cron.daily')
++  install_dir: join_paths(sysconfdir, 'cron.daily')
+ )
+ 
+ install_data(
+   'packagekit-background',
+-  install_dir: join_paths(get_option('sysconfdir'), 'sysconfig')
++  install_dir: join_paths(sysconfdir, 'sysconfig')
+ )
+diff --git a/data/meson.build b/data/meson.build
+index a953f6280..11d115204 100644
+--- a/data/meson.build
++++ b/data/meson.build
+@@ -9,7 +9,7 @@ dbus_config_data.set('libexecdir', join_paths(get_option('prefix'), get_option('
+ 
+ dbus_sys_dir = get_option('dbus_sys')
+ if dbus_sys_dir == ''
+-  dbus_sys_dir = join_paths(get_option('sysconfdir'), 'dbus-1', 'system.d')
++  dbus_sys_dir = join_paths(sysconfdir, 'dbus-1', 'system.d')
+ endif
+ 
+ configure_file(
+diff --git a/etc/meson.build b/etc/meson.build
+index d3687f820..5094d93b3 100644
+--- a/etc/meson.build
++++ b/etc/meson.build
+@@ -1,5 +1,5 @@
+ install_data(
+   'PackageKit.conf',
+   'Vendor.conf',
+-  install_dir: join_paths(get_option('sysconfdir'), 'PackageKit')
++  install_dir: join_paths(pk_sysconfdir, 'PackageKit')
+ )
+diff --git a/meson.build b/meson.build
+index 98587c6ec..8eba1544f 100644
+--- a/meson.build
++++ b/meson.build
+@@ -73,7 +73,15 @@ add_project_arguments ('-DPK_COMPILATION', language: 'c')
+ conf = configuration_data()
+ conf.set_quoted('DATADIR', join_paths(get_option('prefix'), get_option('datadir')))
+ conf.set_quoted('LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))
+-conf.set_quoted('SYSCONFDIR', get_option('sysconfdir'))
++if get_option('sysconfdir') == 'etc'
++  pk_sysconfdir = join_paths(get_option('prefix'), get_option('sysconfdir'))
++  sysconfdir = '/etc'
++else
++  pk_sysconfdir = get_option('sysconfdir')
++  sysconfdir = get_option('sysconfdir')
++endif
++conf.set_quoted('SYSCONFDIR', sysconfdir)
++conf.set_quoted('PK_SYSCONFDIR', pk_sysconfdir)
+ 
+ conf.set_quoted('PROJECT_NAME', meson.project_name())
+ conf.set_quoted('PROJECT_VERSION', meson.project_version())
+diff --git a/src/meson.build b/src/meson.build
+index cae73380e..505e9491d 100644
+--- a/src/meson.build
++++ b/src/meson.build
+@@ -54,7 +54,8 @@ packagekit_direct_exec = executable(
+   c_args: [
+     '-DG_LOG_DOMAIN="PackageKit"',
+     '-DLIBDIR="@0@"'.format(join_paths(get_option('prefix'), get_option('libdir'))),
+-    '-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir')),
++    '-DSYSCONFDIR="@0@"'.format(sysconfdir),
++    '-DPK_SYSCONFDIR="@0@"'.format(pk_sysconfdir),
+     '-DVERSION="@0@"'.format(meson.project_version()),
+     '-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()),
+     '-DPACKAGE_LOCALE_DIR="@0@"'.format(package_locale_dir),
+diff --git a/src/pk-shared.c b/src/pk-shared.c
+index ca825dee9..a9fc623f4 100644
+--- a/src/pk-shared.c
++++ b/src/pk-shared.c
+@@ -326,7 +326,7 @@ pk_util_get_config_filename (void)
+ 	g_free (path);
+ #endif
+ 	/* check the prefix path */
+-	path = g_build_filename (SYSCONFDIR, "PackageKit", "PackageKit.conf", NULL);
++	path = g_build_filename (PK_SYSCONFDIR, "PackageKit", "PackageKit.conf", NULL);
+ 	if (g_file_test (path, G_FILE_TEST_EXISTS))
+ 		goto out;
+ 
+-- 
+2.35.1
+
diff --git a/libre/packagekit/PKGBUILD b/libre/packagekit/PKGBUILD
new file mode 100644
index 0000000..0f2f0e8
--- /dev/null
+++ b/libre/packagekit/PKGBUILD
@@ -0,0 +1,73 @@
+# Maintainer: Christian Hesse <mail@eworm.de>
+# Contributor: Jonathan Conder <jonno.conder@gmail.com>
+
+pkgbase='packagekit'
+pkgname=('packagekit' 'libpackagekit-glib')
+pkgver=1.2.6
+pkgrel=2
+pkgrel+=.parabola1
+pkgdesc='A system designed to make installation and updates of packages easier'
+arch=('x86_64')
+arch+=('i686' 'armv7h')
+url='https://www.freedesktop.org/software/PackageKit/'
+license=('GPL')
+makedepends=('polkit' 'sqlite' 'gobject-introspection' 'intltool'
+             'bash-completion' 'vala' 'meson')
+options=('!emptydirs')
+validpgpkeys=('163EB50119225DB3DF8F49EA17ACBA8DFA970E17'        # Richard Hughes <richard@hughsie.com>
+              'EC60AABDF42AAE8FB062640480858FA38F62AF74')       # Kalev Lember <klember@redhat.com>
+source=("https://www.freedesktop.org/software/PackageKit/releases/PackageKit-${pkgver}.tar.xz"
+        '0001-build-fix-overall-sysconfdir-handling-so-it-can-work.patch'
+        'url.patch')
+sha256sums=('1a0cf173065ce9232c6d5fb044bf6b606147a8702dc6ff4753c2a08331c52e51'
+            '31bda312a0320bdf4b084a89cd6b13f1366b50d5c1cf7c9a77a1e1024eca30ea'
+            '4f0e6a4d8d3efcb75d8977afa0b1be8502b516f2500fc3a43207f27bb11bd051')
+
+prepare() {
+  for _patch in *.patch; do
+    patch -d PackageKit-$pkgver -p1 < $_patch
+  done
+}
+
+build() {
+        local _meson_options=(
+                -Dcron=false
+                -Ddbus_sys=/usr/share/dbus-1/system.d
+                -Dgstreamer_plugin=false
+                -Dgtk_doc=false
+                -Dgtk_module=false
+                -Dpackaging_backend=alpm
+                -Dsystemd=true
+        )
+
+        arch-meson "PackageKit-$pkgver" build "${_meson_options[@]}"
+
+        ninja -C build
+}
+
+package_packagekit() {
+        depends=('libpackagekit-glib' 'pacman>=6.0.0' 'polkit' 'sqlite')
+        optdepends=('bash-completion: command completion in bash')
+        backup=('var/lib/PackageKit/transactions.db'
+                'etc/PackageKit/alpm.d/pacman.conf'
+                'etc/PackageKit/alpm.d/repos.list')
+
+        # install directory with root owner, polkit group and
+        # correct permission
+        install -d -o root -g 102 -m 750 "${pkgdir}/usr/share/polkit-1/rules.d"
+
+        DESTDIR="$pkgdir" meson install -C build
+
+        # move away for libpackagekit-glib
+        mkdir -p libpackagekit/usr/{lib,share}
+        mv "$pkgdir"/usr/include/ libpackagekit/usr/
+        mv "$pkgdir"/usr/lib/{girepository-1.0,libpackagekit-glib2.so*,pkgconfig} libpackagekit/usr/lib/
+        mv "$pkgdir"/usr/share/{gir-1.0,vala}/ libpackagekit/usr/share/
+}
+
+package_libpackagekit-glib() {
+        pkgdesc='GLib library for accessing PackageKit'
+        depends=('glib2')
+
+        mv libpackagekit/usr/ "$pkgdir"/
+}
diff --git a/libre/packagekit/url.patch b/libre/packagekit/url.patch
new file mode 100644
index 0000000..8319309
--- /dev/null
+++ b/libre/packagekit/url.patch
@@ -0,0 +1,25 @@
+From f0116d72bc7a3fba872f8c757798002fbbc395b4 Mon Sep 17 00:00:00 2001
+From: SolveFinder <kwopleq@proton.me>
+Date: Sat, 5 Aug 2023 23:37:04 +0300
+Subject: [PATCH] Site url fix
+
+---
+ backends/alpm/pk-alpm-update.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/backends/alpm/pk-alpm-update.c b/backends/alpm/pk-alpm-update.c
+index 3695b3f..cf50611 100644
+--- a/backends/alpm/pk-alpm-update.c
++++ b/backends/alpm/pk-alpm-update.c
+@@ -71,7 +71,7 @@ static gchar **
+ pk_alpm_pkg_build_urls (alpm_pkg_t *pkg)
+ {
+ 	gchar **urls = g_new0 (gchar *, 2);
+-	urls[0] = g_strdup_printf ("https://archlinux.org/packages/%s/%s/%s/",
++	urls[0] = g_strdup_printf ("https://parabola.nu/packages/%s/%s/%s/",
+ 				   alpm_db_get_name (alpm_pkg_get_db (pkg)),
+ 				   alpm_pkg_get_arch (pkg),
+ 				   alpm_pkg_get_name (pkg));
+-- 
+2.41.0
+
diff --git a/libre/parabola-appstream-data/PKGBUILD b/libre/parabola-appstream-data/PKGBUILD
new file mode 100644
index 0000000..db274d6
--- /dev/null
+++ b/libre/parabola-appstream-data/PKGBUILD
@@ -0,0 +1,64 @@
+# Maintainer (arch): Antonio Rojas <arojas@archlinux.org>
+
+_pkgname=archlinux-appstream-data
+pkgname=parabola-appstream-data
+pkgver=20230715
+pkgrel=1
+pkgrel+=.parabola1
+pkgdesc='Parabola application database for AppStream-based software centers'
+arch=(any)
+url='https://www.parabola.nu'
+license=(GPL)
+depends=()
+makedepends=(python)
+source=(https://git.parabola.nu/blacklist.git/plain/blacklist.txt
+        appstream_fix.py
+        iceweasel_iceweasel.svg::https://git.parabola.nu/packages/iceweasel.git/plain/src/branding/iceweasel_icon.svg
+        icedove_icedove.svg::https://git.parabola.nu/packages/icedove.git/plain/src/logo/icedove_icon.svg)
+noextract=()
+# provides=(archlinux-appstream-data)
+for _repo in core extra multilib; do
+ source+=($_repo-$pkgver.xml.gz::https://sources.archlinux.org/other/packages/$_pkgname/$pkgver/$_repo/Components-x86_64.xml.gz
+          $_repo-icons-48x48-$pkgver.tar.gz::https://sources.archlinux.org/other/packages/$_pkgname/$pkgver/$_repo/icons-48x48.tar.gz
+          $_repo-icons-64x64-$pkgver.tar.gz::https://sources.archlinux.org/other/packages/$_pkgname/$pkgver/$_repo/icons-64x64.tar.gz
+          $_repo-icons-128x128-$pkgver.tar.gz::https://sources.archlinux.org/other/packages/$_pkgname/$pkgver/$_repo/icons-128x128.tar.gz
+          https://repo.parabola.nu/$_repo/os/x86_64/$_repo.db.tar.gz)
+ noextract+=($_repo.xml.gz-$pkgver $_repo-icons-{48x48,64x64,128x128}-$pkgver.tar.gz $_repo.db.tar.gz)
+done
+sha256sums=('SKIP'
+            '63d0d25e8980a97c3a122f050827bbf97bbe81bac550f9e300eda0d3b90abd09'
+            'SKIP'
+            'SKIP'
+            'f32770b001d90903d45ac0ee05898e2c57d99bde560eac9ae2357b311300e681'
+            '7989bb311baa38ef545250282aa065d23281c46dfb8faabe4c653487bdbded5c'
+            '198c7aec4989984166174defe7b7eafda54d1f4ab4f83097e2d11ac1a9193fcf'
+            '7989bb311baa38ef545250282aa065d23281c46dfb8faabe4c653487bdbded5c'
+            'SKIP'
+            'ae65e6fe2272545a91c04e3d59986ebe89cc984be19fc587d8e0afa1b1081cee'
+            '943b53894e561cc831d3e9b0ba323a56695befe1d0c2762be92953c54df6c2af'
+            '064f05c31e2eb7b2f5c54ee05a4701681860d35b5d376959775ff15382aca82a'
+            'c88cc504c99ddc31e34fe6af7a2c84a3ddf8d7573c6b8f4683e065b88c8621a4'
+            'SKIP'
+            '9e364b5afec4390bc6aaa8e3ac385e49130b7224340f5c8cc57def89b5b85fa1'
+            '2e6562ca40e3c8f8fcd22c6a6b3e3aab513d3fa9f45ad36c74aa16a4466b61b1'
+            '4369ccd47698a55da9cfa441322b8b8250955683de4e6d496a568df4162e3625'
+            '242bacebf03766e06f6683c509a2f31e7e96e6878f1b2e936d0d2e16441e43a9'
+            'SKIP')
+
+package() {
+  mkdir -p "$pkgdir"/usr/share/app-info/{icons/archlinux-arch-{core,extra,multilib}/{48x48,64x64,128x128},xmls}
+  for _repo in core extra multilib; do
+   tar -xzf $_repo-icons-48x48-$pkgver.tar.gz -C "$pkgdir"/usr/share/app-info/icons/archlinux-arch-$_repo/48x48
+   tar -xzf $_repo-icons-64x64-$pkgver.tar.gz -C "$pkgdir"/usr/share/app-info/icons/archlinux-arch-$_repo/64x64
+   tar -xzf $_repo-icons-128x128-$pkgver.tar.gz -C "$pkgdir"/usr/share/app-info/icons/archlinux-arch-$_repo/128x128
+   python appstream_fix.py $_repo-$pkgver.xml "$pkgdir"/usr/share/app-info/icons/archlinux-arch-$_repo $_repo
+   rm $_repo-$pkgver.xml.gz
+   gzip -k $_repo-$pkgver.xml
+   install -m644 $_repo-$pkgver.xml.gz "$pkgdir"/usr/share/app-info/xmls/$_repo.xml.gz
+   for _icon in iceweasel_iceweasel.svg icedove_icedove.svg; do
+    install -m644 "$srcdir"/$_icon "$pkgdir"/usr/share/app-info/icons/archlinux-arch-$_repo/48x48/$_icon
+    install -m644 "$srcdir"/$_icon "$pkgdir"/usr/share/app-info/icons/archlinux-arch-$_repo/64x64/$_icon
+    install -m644 "$srcdir"/$_icon "$pkgdir"/usr/share/app-info/icons/archlinux-arch-$_repo/128x128/$_icon
+    done
+  done
+}
diff --git a/libre/parabola-appstream-data/appstream_fix.py b/libre/parabola-appstream-data/appstream_fix.py
new file mode 100644
index 0000000..3ac59bc
--- /dev/null
+++ b/libre/parabola-appstream-data/appstream_fix.py
@@ -0,0 +1,92 @@
+from xml.etree import ElementTree
+from os import remove, listdir, mkdir, system, chdir
+from sys import argv
+from shutil import rmtree, copy
+from copy import deepcopy
+
+# With internet:
+# import requests
+# blacklist_url = 'https://git.parabola.nu/blacklist.git/plain/blacklist.txt'
+# blackdict = {i.split(':')[:2][0]: i.split(':')[:2][1] for i in requests.get(blacklist_url).text.split('\n') if len(i) > 1}
+################
+
+# Without internet:
+blackdict = {i.split(':')[:2][0]: i.split(':')[:2][1] for i in open('blacklist.txt', 'r').read().split('\n') if len(i) > 1}
+###################
+# blackdict: {'package': 'libre_replacement'}
+
+blacklist = [k for k, v in blackdict.items() if v == '']
+# blacklist: ['package_without_replacement1', ...]
+
+repo = argv[3]
+
+# Full list of packages from repository
+mkdir(repo)
+copy(f'{repo}.db.tar.gz', f'{repo}/{repo}.db')
+chdir(repo)
+system(f'tar -xf {repo}.db; rm {repo}.db')
+repo_pkgs = ['-'.join(i.split('-')[:-2]) for i in listdir()]
+chdir('..')
+rmtree(repo)
+
+
+def fix_specific(pkgname, xml_component):
+    if pkgname == 'firefox':
+        fixed_name = 'iceweasel'
+    elif pkgname == 'thunderbird':
+        fixed_name = 'icedove'
+    for i in xml_component.iter():
+        i.text = i.text.replace(f'{pkgname}.png', f'{fixed_name}.svg')\
+            .replace(pkgname, fixed_name)\
+            .replace(pkgname.title(), fixed_name.title())
+        if pkgname == 'firefox':
+            i.text = i.text.replace('Standalone web browser from mozilla.org',
+                                    'Standalone web browser derived from Mozilla Firefox')
+
+
+def fix(xml_path, icons_path, packages):
+    tree = ElementTree.parse(xml_path)
+    xml = tree.getroot()
+    to_remove = {
+        'xml': [],
+        'icons': {
+            '48': [],
+            '64': [],
+            '128': []
+                  }
+    }
+    for c in xml.iter('component'):
+        pkg = c.find('pkgname').text
+        if pkg in blacklist or pkg not in packages and pkg not in blackdict.keys():
+            for i in c.findall('icon'):
+                if i.get('type') == 'cached':
+                    to_remove['icons'][i.get('width')].append(i.text)
+            to_remove['xml'].append(c)
+            if pkg not in blacklist and pkg not in packages:
+                print(f'Missing "{pkg}"')
+        elif pkg in blackdict.keys():
+            if pkg in ['thunderbird', 'firefox']:
+                fix_specific(pkg, c)
+                print(f'Replaced "{pkg}" with "{blackdict[pkg]}" (fixed)')
+            elif pkg != blackdict[pkg]:
+                c.find('pkgname').text = blackdict[pkg]
+                print(f'Replaced "{pkg}" with "{blackdict[pkg]}"')
+        # else:
+        #     if c.find('project_license') is None:
+        #         print('Unknown license!', pkg)
+
+    for i in to_remove['xml']:
+        pkg = i.find('pkgname').text
+        xml.remove(i)
+        print(f'Removed blacklisted "{pkg}"')
+
+    for k, v in to_remove['icons'].items():
+        for i in set(v):
+            remove(f'{icons_path}/{k}x{k}/{i}')
+            print(f'Removed {k}x{k}/{i}')
+
+    # 'Unicode' reduces file size compared to default
+    tree.write(xml_path, encoding='Unicode')
+
+# Usage: python appstream_fix.py path_to_xml path_to_icon_dir repo_name
+fix(argv[1], argv[2], repo_pkgs)

From f62f55f17b386776b914287c89afb31ae6b79068 Mon Sep 17 00:00:00 2001
From: Solve Finder <kwopleq@proton.me>
Date: Aug 07 2023 09:34:04 +0000
Subject: [PATCH 2/2] Correct pkgname


---

diff --git a/libre/discover/PKGBUILD b/libre/discover/PKGBUILD
index 07962f8..91fb76d 100644
--- a/libre/discover/PKGBUILD
+++ b/libre/discover/PKGBUILD
@@ -1,7 +1,6 @@
-# Maintainer: Antonio Rojas <arojas@archlinux.org> 
+# Maintainer (arch): Antonio Rojas <arojas@archlinux.org> 
 
-pkgname=discoverless
-_pkgname=discover
+pkgname=discover
 pkgver=5.27.7
 _dirver=$(echo $pkgver | cut -d. -f1-3)
 pkgrel=1
@@ -15,7 +14,7 @@ license=(LGPL)
 depends=(kidletime
          qt5-graphicaleffects
          appstream-qt
-         # parabola-appstream-data
+         parabola-appstream-data
          kirigami2
          discount
          kuserfeedback
@@ -23,7 +22,7 @@ depends=(kidletime
 makedepends=(extra-cmake-modules plasma-framework packagekit-qt5)
 optdepends=('packagekit-qt5: to manage packages from Parabola repositories (not recommended, use at your own risk)')
 groups=(plasma)
-source=(https://download.kde.org/stable/plasma/$_dirver/$_pkgname-$pkgver.tar.xz{,.sig}
+source=(https://download.kde.org/stable/plasma/$_dirver/$pkgname-$pkgver.tar.xz{,.sig}
         'libre.patch')
 sha256sums=('a9eca14bb4cf3094d5c4df7975f1a793fca8fb4018ca1252d1e1230c79784500'
             'SKIP'
@@ -34,12 +33,12 @@ validpgpkeys=('E0A3EB202F8E57528E13E72FD7574483BB57B18D'  # Jonathan Esk-Riddell
               '1FA881591C26B276D7A5518EEAAF29B42A678C20') # Marco Martin <notmart@gmail.com>
 
 prepare() {
-  cd "$_pkgname-$pkgver"
+  cd "$pkgname-$pkgver"
   patch -p1 -i ../libre.patch
 }
 
 build() {
-  cmake -B build -S $_pkgname-$pkgver \
+  cmake -B build -S $pkgname-$pkgver \
     -DCMAKE_INSTALL_LIBEXECDIR=lib \
     -DBUILD_TESTING=OFF
   cmake --build build

