Last active
April 13, 2023 12:46
-
-
Save class101/fa8e56b084f184ac653901aa7a646964 to your computer and use it in GitHub Desktop.
alpm_octopi_utils: Pacman 6.x support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 87de5068f5ad5b03b77c3e071e7f2213460a75f1 Mon Sep 17 00:00:00 2001 | |
From: Arnaud Dovi <[email protected]> | |
Date: Tue, 1 Jun 2021 15:00:24 +0200 | |
Subject: [PATCH 1/2] Added pacman 6.0 support. | |
--- | |
src/alpm_config.vala | 14 +++++++------- | |
src/alpm_octopi_utils.vala | 9 ++++++--- | |
vapi/libalpm.vapi | 8 ++++---- | |
3 files changed, 17 insertions(+), 14 deletions(-) | |
diff --git a/src/alpm_config.vala b/src/alpm_config.vala | |
index f6b3ad6..84d56f7 100644 | |
--- a/src/alpm_config.vala | |
+++ b/src/alpm_config.vala | |
@@ -49,7 +49,7 @@ class AlpmConfig { | |
public string? dbpath; | |
public string? logfile; | |
public string? gpgdir; | |
- public string? arch; | |
+ public Alpm.List<unowned string> architectures; | |
public int usesyslog; | |
public int checkspace; | |
public Alpm.List<unowned string> cachedirs; | |
@@ -120,8 +120,8 @@ class AlpmConfig { | |
// rootdir is defined because it contains configuration data. | |
gpgdir = "/etc/pacman.d/gnupg/"; | |
} | |
- if (arch == null) { | |
- arch = Posix.utsname().machine; | |
+ if (architectures.length () == 0) { | |
+ architectures.append (Posix.utsname().machine); | |
} | |
} | |
@@ -135,7 +135,7 @@ class AlpmConfig { | |
// define options | |
handle.logfile = logfile; | |
handle.gpgdir = gpgdir; | |
- handle.arch = arch; | |
+ handle.architectures = architectures; | |
handle.usesyslog = usesyslog; | |
handle.checkspace = checkspace; | |
handle.defaultsiglevel = siglevel; | |
@@ -160,7 +160,7 @@ class AlpmConfig { | |
repo.siglevel = merge_siglevel (siglevel, repo.siglevel, repo.siglevel_mask); | |
unowned Alpm.DB db = handle.register_syncdb (repo.name, repo.siglevel); | |
foreach (unowned string url in repo.urls) { | |
- db.add_server (url.replace ("$repo", repo.name).replace ("$arch", handle.arch)); | |
+ db.add_server (url.replace ("$repo", repo.name).replace ("$arch", handle.architectures.nth(0).data)); | |
} | |
if (repo.usage == 0) { | |
db.usage = Alpm.DB.Usage.ALL; | |
@@ -231,9 +231,9 @@ class AlpmConfig { | |
logfile = val; | |
} else if (key == "Architecture") { | |
if (val == "auto") { | |
- arch = Posix.utsname ().machine; | |
+ architectures.append (Posix.utsname().machine); | |
} else { | |
- arch = val; | |
+ architectures.append (val); | |
} | |
} else if (key == "UseSysLog") { | |
usesyslog = 1; | |
diff --git a/src/alpm_octopi_utils.vala b/src/alpm_octopi_utils.vala | |
index 1160ec2..8e3429d 100644 | |
--- a/src/alpm_octopi_utils.vala | |
+++ b/src/alpm_octopi_utils.vala | |
@@ -61,20 +61,23 @@ public class AlpmUtils { | |
public Alpm.List<unowned Alpm.Package> search_all_dbs (string search_string) { | |
Alpm.List<unowned Alpm.Package> syncpkgs = null; | |
+ Alpm.List<unowned Alpm.Package> results = null; | |
+ Alpm.List<unowned Alpm.Package> ret = null; | |
Alpm.List<unowned string> needles = null; | |
string[] splitted = search_string.split (" "); | |
foreach (unowned string part in splitted) { | |
needles.append (part); | |
} | |
- Alpm.List<unowned Alpm.Package> results = alpm_handle.localdb.search (needles); | |
+ alpm_handle.localdb.search (needles, results); | |
unowned Alpm.List<unowned Alpm.DB> list = alpm_handle.syncdbs; | |
while (list != null) { | |
unowned Alpm.DB db = list.data; | |
if (syncpkgs.length () == 0) { | |
- syncpkgs = db.search (needles); | |
+ db.search (needles, syncpkgs); | |
} else { | |
//syncpkgs.join (db.search (needles).diff (syncpkgs, (Alpm.List.CompareFunc) alpm_pkg_compare_name)); | |
- syncpkgs.join (db.search (needles)); | |
+ db.search (needles, ret); | |
+ syncpkgs.join (ret.copy()); | |
} | |
list = list.next; | |
} | |
diff --git a/vapi/libalpm.vapi b/vapi/libalpm.vapi | |
index 35abf77..19c5915 100644 | |
--- a/vapi/libalpm.vapi | |
+++ b/vapi/libalpm.vapi | |
@@ -64,9 +64,9 @@ namespace Alpm { | |
public unowned string dbpath { | |
[CCode (cname = "alpm_option_get_dbpath")] get; | |
} | |
- public unowned string arch { | |
- [CCode (cname = "alpm_option_get_arch")] get; | |
- [CCode (cname = "alpm_option_set_arch")] set; | |
+ public unowned Alpm.List<unowned string?> architectures { | |
+ [CCode (cname = "alpm_option_get_architectures")] get; | |
+ [CCode (cname = "alpm_option_set_architectures")] set; | |
} | |
public unowned Alpm.List<unowned string?> cachedirs { | |
[CCode (cname = "alpm_option_get_cachedirs")] get; | |
@@ -362,7 +362,7 @@ namespace Alpm { | |
public unowned Package? get_pkg(string name); | |
public unowned Group? get_group(string name); | |
- public Alpm.List<unowned Package?> search(Alpm.List<unowned string> needles); | |
+ public int search(Alpm.List<unowned string> needles, Alpm.List<unowned Package?> ret); | |
public int check_pgp_signature(out SigList siglist); | |
} | |
-- | |
2.31.1 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 789ba9acc52b7b0624fb08de9f4756b5d51c10f1 Mon Sep 17 00:00:00 2001 | |
From: Arnaud Dovi <[email protected]> | |
Date: Wed, 2 Jun 2021 22:30:11 +0200 | |
Subject: [PATCH 2/2] Fix missing out statement :s | |
--- | |
src/alpm_config.vala | 4 ++-- | |
src/alpm_octopi_utils.vala | 6 +++--- | |
vapi/libalpm.vapi | 2 +- | |
3 files changed, 6 insertions(+), 6 deletions(-) | |
diff --git a/src/alpm_config.vala b/src/alpm_config.vala | |
index 84d56f7..5625082 100644 | |
--- a/src/alpm_config.vala | |
+++ b/src/alpm_config.vala | |
@@ -231,9 +231,9 @@ class AlpmConfig { | |
logfile = val; | |
} else if (key == "Architecture") { | |
if (val == "auto") { | |
- architectures.append (Posix.utsname().machine); | |
+ architectures.append (Posix.utsname().machine); | |
} else { | |
- architectures.append (val); | |
+ architectures.append (val); | |
} | |
} else if (key == "UseSysLog") { | |
usesyslog = 1; | |
diff --git a/src/alpm_octopi_utils.vala b/src/alpm_octopi_utils.vala | |
index 8e3429d..60b6f33 100644 | |
--- a/src/alpm_octopi_utils.vala | |
+++ b/src/alpm_octopi_utils.vala | |
@@ -68,15 +68,15 @@ public class AlpmUtils { | |
foreach (unowned string part in splitted) { | |
needles.append (part); | |
} | |
- alpm_handle.localdb.search (needles, results); | |
+ alpm_handle.localdb.search (needles, out results); | |
unowned Alpm.List<unowned Alpm.DB> list = alpm_handle.syncdbs; | |
while (list != null) { | |
unowned Alpm.DB db = list.data; | |
if (syncpkgs.length () == 0) { | |
- db.search (needles, syncpkgs); | |
+ db.search (needles, out syncpkgs); | |
} else { | |
//syncpkgs.join (db.search (needles).diff (syncpkgs, (Alpm.List.CompareFunc) alpm_pkg_compare_name)); | |
- db.search (needles, ret); | |
+ db.search (needles, out ret); | |
syncpkgs.join (ret.copy()); | |
} | |
list = list.next; | |
diff --git a/vapi/libalpm.vapi b/vapi/libalpm.vapi | |
index 19c5915..4e1d59b 100644 | |
--- a/vapi/libalpm.vapi | |
+++ b/vapi/libalpm.vapi | |
@@ -362,7 +362,7 @@ namespace Alpm { | |
public unowned Package? get_pkg(string name); | |
public unowned Group? get_group(string name); | |
- public int search(Alpm.List<unowned string> needles, Alpm.List<unowned Package?> ret); | |
+ public int search(Alpm.List<unowned string> needles, out Alpm.List<unowned Package?> ret); | |
public int check_pgp_signature(out SigList siglist); | |
} | |
-- | |
2.31.1 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Maintainer: MatMoul <[email protected]> | |
pkgname=alpm_octopi_utils | |
pkgver=1.0.2 | |
_commit=2bb9349507f8155155c9b5f12b1f30e60e157d30 | |
pkgrel=2 | |
pkgdesc="Alpm utils for Octopi" | |
url="https://tintaescura.com/projects/octopi/" | |
arch=('i686' 'x86_64') | |
license=('GPL3') | |
depends=('pacman-contrib') | |
makedepends=('vala') | |
source=("https://github.com/aarnt/${pkgname}/archive/${_commit}.tar.gz" '0001-Added-pacman-6.0-support.patch' '0002-Fix-missing-out-statement-s.patch') | |
sha256sums=('7decbc613f65aafb5a4ef8f9fbe5b87893f535e8c6e5c9d9659051ee6ce0aef5' 'edd4bdc1972fd6dbefae6539a18b938b483a43347500ffb9f7e2830530994e90' '23d5bcf70e3c200c041041487e50c3c404428b6a11ab1d3d434cf04f2efe3939') | |
prepare() { | |
cd "$pkgname-$_commit" | |
# PATCH - PACMAN6 API UPDATE | |
echo -e " ==> [PATCH] - PACMAN6 API UPDATE" | |
patch --no-backup-if-mismatch --forward --strip=1 --input="${srcdir}/0001-Added-pacman-6.0-support.patch" | |
# PATCH - PACMAN6 API UPDATE - FIX MISSING OUT STATEMENT | |
echo -e " ==> [PATCH] - PACMAN6 API UPDATE - FIX MISSING OUT STATEMENT" | |
patch --no-backup-if-mismatch --forward --strip=1 --input="${srcdir}/0002-Fix-missing-out-statement-s.patch" | |
} | |
build() { | |
cd "$pkgname-$_commit" | |
make | |
} | |
package() { | |
cd "$pkgname-$_commit" | |
install -D -m755 src/libalpm_octopi_utils.so "$pkgdir"/usr/lib/libalpm_octopi_utils.so | |
install -D -m644 src/libalpm_octopi_utils.pc "$pkgdir"/usr/lib/pkgconfig/libalpm_octopi_utils.pc | |
install -D -m644 src/alpm_octopi_utils.h "$pkgdir"/usr/include/alpm_octopi_utils.h | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment