Browse Source

use satisfier for AUR and mirrors support

tags/v5.1.2
guinux 4 years ago
parent
commit
69f4b4368e
4 changed files with 19 additions and 4 deletions
  1. +5
    -1
      src/daemon.vala
  2. +1
    -1
      src/manager_window.vala
  3. +2
    -2
      src/preferences_dialog.vala
  4. +11
    -0
      src/transaction.vala

+ 5
- 1
src/daemon.vala View File

@@ -396,6 +396,10 @@ namespace Pamac {
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) {
unowned Alpm.Package? pkg = null;
foreach (var db in alpm_config.handle.syncdbs) {
@@ -514,7 +518,7 @@ namespace Pamac {
}
if (alpm_pkg != null) {
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 ();
}
}


+ 1
- 1
src/manager_window.vala View File

@@ -180,7 +180,7 @@ namespace Pamac {
if (pamac_config.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 == "") {
enable_aur (false);
} else {


+ 2
- 2
src/preferences_dialog.vala View File

@@ -96,7 +96,7 @@ namespace Pamac {
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);

Pamac.Package pkg = this.transaction.find_local_pkg ("pacman-mirrorlist");
Pamac.Package pkg = this.transaction.find_local_satisfier ("pacman-mirrorlist");
if (pkg.name == "") {
mirrors_config_box.visible = false;
} else {
@@ -124,7 +124,7 @@ namespace Pamac {
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 == "") {
aur_config_box.visible = false;
} else {


+ 11
- 0
src/transaction.vala View File

@@ -37,6 +37,7 @@ namespace Pamac {
public abstract async Pamac.Package[] get_local_pkgs () 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_satisfier (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 string[] get_repos_names () throws IOError;
@@ -328,6 +329,16 @@ namespace Pamac {
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) {
var pkg = Pamac.Package (null, null);
try {


Loading…
Cancel
Save