use satisfier for AUR and mirrors support

This commit is contained in:
guinux 2015-08-23 13:00:55 +02:00
parent 6522072b34
commit 69f4b4368e
4 changed files with 19 additions and 4 deletions

View File

@ -396,6 +396,10 @@ namespace Pamac {
return Pamac.Package (alpm_config.handle.localdb.get_pkg (pkgname), null); return Pamac.Package (alpm_config.handle.localdb.get_pkg (pkgname), null);
} }
public Pamac.Package find_local_satisfier (string pkgname) {
return Pamac.Package (Alpm.find_satisfier (alpm_config.handle.localdb.pkgcache, pkgname), null);
}
private unowned Alpm.Package? get_syncpkg (string name) { private unowned Alpm.Package? get_syncpkg (string name) {
unowned Alpm.Package? pkg = null; unowned Alpm.Package? pkg = null;
foreach (var db in alpm_config.handle.syncdbs) { foreach (var db in alpm_config.handle.syncdbs) {
@ -514,7 +518,7 @@ namespace Pamac {
} }
if (alpm_pkg != null) { if (alpm_pkg != null) {
foreach (unowned Depend optdep in alpm_pkg.optdepends) { foreach (unowned Depend optdep in alpm_pkg.optdepends) {
if (find_satisfier (alpm_config.handle.localdb.pkgcache, optdep.name) == null) { if (Alpm.find_satisfier (alpm_config.handle.localdb.pkgcache, optdep.name) == null) {
optdeps += optdep.compute_string (); optdeps += optdep.compute_string ();
} }
} }

View File

@ -180,7 +180,7 @@ namespace Pamac {
if (pamac_config.recurse) { if (pamac_config.recurse) {
transaction.flags |= Alpm.TransFlag.RECURSE; transaction.flags |= Alpm.TransFlag.RECURSE;
} }
Pamac.Package pkg = transaction.find_local_pkg ("yaourt"); Pamac.Package pkg = transaction.find_local_satisfier ("yaourt");
if (pkg.name == "") { if (pkg.name == "") {
enable_aur (false); enable_aur (false);
} else { } else {

View File

@ -96,7 +96,7 @@ namespace Pamac {
no_update_hide_icon_checkbutton.toggled.connect (on_no_update_hide_icon_checkbutton_toggled); no_update_hide_icon_checkbutton.toggled.connect (on_no_update_hide_icon_checkbutton_toggled);
transaction.daemon.write_pamac_config_finished.connect (on_write_pamac_config_finished); transaction.daemon.write_pamac_config_finished.connect (on_write_pamac_config_finished);
Pamac.Package pkg = this.transaction.find_local_pkg ("pacman-mirrorlist"); Pamac.Package pkg = this.transaction.find_local_satisfier ("pacman-mirrorlist");
if (pkg.name == "") { if (pkg.name == "") {
mirrors_config_box.visible = false; mirrors_config_box.visible = false;
} else { } else {
@ -124,7 +124,7 @@ namespace Pamac {
transaction.daemon.write_mirrors_config_finished.connect (on_write_mirrors_config_finished); transaction.daemon.write_mirrors_config_finished.connect (on_write_mirrors_config_finished);
} }
pkg = this.transaction.find_local_pkg ("yaourt"); pkg = this.transaction.find_local_satisfier ("yaourt");
if (pkg.name == "") { if (pkg.name == "") {
aur_config_box.visible = false; aur_config_box.visible = false;
} else { } else {

View File

@ -37,6 +37,7 @@ namespace Pamac {
public abstract async Pamac.Package[] get_local_pkgs () throws IOError; public abstract async Pamac.Package[] get_local_pkgs () throws IOError;
public abstract async Pamac.Package[] get_orphans () throws IOError; public abstract async Pamac.Package[] get_orphans () throws IOError;
public abstract Pamac.Package find_local_pkg (string pkgname) throws IOError; public abstract Pamac.Package find_local_pkg (string pkgname) throws IOError;
public abstract Pamac.Package find_local_satisfier (string pkgname) throws IOError;
public abstract Pamac.Package find_sync_pkg (string pkgname) throws IOError; public abstract Pamac.Package find_sync_pkg (string pkgname) throws IOError;
public abstract async Pamac.Package[] search_pkgs (string search_string, bool search_from_aur) throws IOError; public abstract async Pamac.Package[] search_pkgs (string search_string, bool search_from_aur) throws IOError;
public abstract string[] get_repos_names () throws IOError; public abstract string[] get_repos_names () throws IOError;
@ -328,6 +329,16 @@ namespace Pamac {
return pkg; return pkg;
} }
public Pamac.Package find_local_satisfier (string pkgname) {
var pkg = Pamac.Package (null, null);
try {
pkg = daemon.find_local_satisfier (pkgname);
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
}
return pkg;
}
public Pamac.Package find_sync_pkg (string pkgname) { public Pamac.Package find_sync_pkg (string pkgname) {
var pkg = Pamac.Package (null, null); var pkg = Pamac.Package (null, null);
try { try {