Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions data/config/pamac.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ RefreshPeriod = 6
## When check updates from AUR support is enabled check for vcs updates:
#CheckAURVCSUpdates

## Number of days to wait before showing AUR updates (0 to disable):
AURUpdateDelayDays = 0

## AUR build directory:
BuildDirectory = /var/tmp

Expand Down
15 changes: 13 additions & 2 deletions src/database.vala
Original file line number Diff line number Diff line change
Expand Up @@ -2234,10 +2234,16 @@ namespace Pamac {
return pkgnames_table;
}

void get_aur_updates_real (GenericArray<unowned AURInfos> aur_infos_list, GenericArray<string> vcs_local_pkgs, ref Updates updates) {
void get_aur_updates_real (GenericArray<unowned AURInfos> aur_infos_list, GenericArray<string> vcs_local_pkgs, ref Updates updates, bool apply_aur_delay = true) {
unowned GenericArray<AURPackage> aur_updates = updates.aur_updates;
unowned GenericArray<AURPackage> outofdate = updates.outofdate;
unowned GenericArray<AURPackage> ignored_aur_updates = updates.ignored_aur_updates;
DateTime? now = null;
TimeSpan delay_span = 0;
if (apply_aur_delay && config.aur_update_delay_days > 0) {
now = new DateTime.now_local ();
delay_span = TimeSpan.DAY * (int64) config.aur_update_delay_days;
}
HashTable<string, string> vcs_versions = null;
if (config.check_aur_vcs_updates) {
vcs_versions = get_vcs_last_version (vcs_local_pkgs);
Expand Down Expand Up @@ -2272,6 +2278,11 @@ namespace Pamac {
// set aur_pkg.version
aur_pkg.version = new_version;
}
if (now != null && aur_infos.lastmodified != null) {
if (now.difference (aur_infos.lastmodified) < delay_span) {
continue;
}
}
if (Alpm.pkg_vercmp (new_version, old_version) == 1) {
if (alpm_handle.should_ignore (local_pkg) == 1) {
ignored_aur_updates.add (aur_pkg);
Expand Down Expand Up @@ -2320,7 +2331,7 @@ namespace Pamac {
}
pkgcache.next ();
}
get_aur_updates_real (aur_plugin.get_multi_infos (local_pkgs), vcs_local_pkgs, ref updates);
get_aur_updates_real (aur_plugin.get_multi_infos (local_pkgs), vcs_local_pkgs, ref updates, false);
// remove ignorepkgs
foreach (unowned string name in ignorepkgs) {
alpm_handle.remove_ignorepkg (name);
Expand Down
8 changes: 8 additions & 0 deletions src/pamac_config.vala
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ namespace Pamac {
}
}
public bool check_aur_vcs_updates { get; set; }
public uint64 aur_update_delay_days { get; set; }
public bool download_updates {
get {
return _download_updates;
Expand Down Expand Up @@ -247,6 +248,7 @@ namespace Pamac {
max_parallel_downloads = 1;
clean_keep_num_pkgs = 3;
clean_rm_only_uninstalled = false;
aur_update_delay_days = 0;
parse_file (conf_path);
// limited max_parallel_downloads
if (max_parallel_downloads > 10) {
Expand Down Expand Up @@ -345,6 +347,11 @@ namespace Pamac {
check_aur_updates = true;
} else if (key == "CheckAURVCSUpdates") {
check_aur_vcs_updates = true;
} else if (key == "AURUpdateDelayDays") {
if (splitted.length == 2) {
unowned string val = splitted[1]._strip ();
aur_update_delay_days = uint64.parse (val);
}
} else if (key == "DownloadUpdates") {
download_updates = true;
} else if (key == "OfflineUpgrade") {
Expand Down Expand Up @@ -389,6 +396,7 @@ namespace Pamac {
new_pamac_conf.insert ("KeepBuiltPkgs", new Variant.boolean (keep_built_pkgs));
new_pamac_conf.insert ("CheckAURUpdates", new Variant.boolean (check_aur_updates));
new_pamac_conf.insert ("CheckAURVCSUpdates", new Variant.boolean (check_aur_vcs_updates));
new_pamac_conf.insert ("AURUpdateDelayDays", new Variant.uint64 (aur_update_delay_days));
new_pamac_conf.insert ("BuildDirectory", new Variant.string (aur_build_dir));
new_pamac_conf.insert ("EnableSnap", new Variant.boolean (enable_snap));
new_pamac_conf.insert ("EnableFlatpak", new Variant.boolean (enable_flatpak));
Expand Down
17 changes: 17 additions & 0 deletions src/pamac_config_daemon.vala
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace Pamac {
public string aur_build_dir { get; set; }
public bool check_aur_updates { get; set; }
public bool check_aur_vcs_updates { get; set; }
public uint64 aur_update_delay_days { get; set; }
public bool offline_upgrade { get; set; }
public uint64 max_parallel_downloads { get; set; }
public uint64 clean_keep_num_pkgs { get; set; }
Expand Down Expand Up @@ -87,6 +88,7 @@ namespace Pamac {
aur_build_dir = "/var/tmp";
max_parallel_downloads = 1;
offline_upgrade = false;
aur_update_delay_days = 0;
parse_file (conf_path);
// limited max_parallel_downloads
if (max_parallel_downloads > 10) {
Expand Down Expand Up @@ -167,6 +169,11 @@ namespace Pamac {
unowned string val = splitted[1]._strip ();
max_parallel_downloads = uint64.parse (val);
}
} else if (key == "AURUpdateDelayDays") {
if (splitted.length == 2) {
unowned string val = splitted[1]._strip ();
aur_update_delay_days = uint64.parse (val);
}
}
}
} catch (GLib.Error e) {
Expand Down Expand Up @@ -361,6 +368,14 @@ namespace Pamac {
data.append (line);
data.append ("\n");
}
} else if (line.contains ("AURUpdateDelayDays")) {
if (new_conf.lookup_extended ("AURUpdateDelayDays", null, out variant)) {
data.append ("AURUpdateDelayDays = %llu\n".printf (variant.get_uint64 ()));
new_conf.remove ("AURUpdateDelayDays");
} else {
data.append (line);
data.append ("\n");
}
} else if (line.contains ("DownloadUpdates")) {
if (new_conf.lookup_extended ("DownloadUpdates", null, out variant)) {
if (variant.get_boolean ()) {
Expand Down Expand Up @@ -491,6 +506,8 @@ namespace Pamac {
} else {
data.append ("#CheckAURVCSUpdates\n\n");
}
} else if (key == "AURUpdateDelayDays") {
data.append ("AURUpdateDelayDays = %llu\n\n".printf (val.get_uint64 ()));
} else if (key == "DownloadUpdates") {
if (val.get_boolean ()) {
data.append ("DownloadUpdates\n\n");
Expand Down