aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-10-16 07:18:26 -0400
committerB. Watson <urchlay@slackware.uk>2026-10-16 07:18:26 -0400
commit08a8484d73bd04507c7371fd7b5b582943f07493 (patch)
treebab50337b162320c231d2af9d7ffd8f893db0eb1
parent183a8eef55d925fd75c4c3a0348704887d6e3fbf (diff)
downloadgreypool-08a8484d73bd04507c7371fd7b5b582943f07493.tar.gz
Implement masking.
-rw-r--r--TODO2
-rwxr-xr-xgreypool25
2 files changed, 19 insertions, 8 deletions
diff --git a/TODO b/TODO
index 0483144..8564ace 100644
--- a/TODO
+++ b/TODO
@@ -4,8 +4,6 @@ TODO list for greypool
- handle ^C gracefully during wget downloads.
-- actually implement "mask"
-
- improve the interactive config:
- cache the repo list?
- better UI for choosing a repo
diff --git a/greypool b/greypool
index 5c9abd9..566f70f 100755
--- a/greypool
+++ b/greypool
@@ -327,14 +327,13 @@ sub parse_file {
@$hr{qw/status repo visiblename version/};
if($r_repo eq $repo && $status eq 'outdated') {
- if(!defined($ignore{$proj}) && !defined($ignore{$name})) {
- my %item = (
+ my $item = {
+ name => $name,
projname => $proj,
oldver => $version,
- newver => $newest);
- $report{$name} = \%item;
- last;
- }
+ newver => $newest};
+ $report{$name} = $item unless ignored_or_masked($item);
+ last;
}
}
}
@@ -343,6 +342,20 @@ sub parse_file {
return $lastpkg eq $firstpkg ? undef : $lastpkg;
}
+sub ignored_or_masked {
+ my $i = shift;
+
+ for(qw/name projname/) {
+ return 1 if $ignore{$i->{$_}};
+ }
+
+ my $maskvers = $masked{$i->{name}};
+ $maskvers = $masked{$i->{projname}} unless $maskvers;
+ return unless $maskvers;
+
+ return grep { $i->{newver} eq $_ } @$maskvers;
+}
+
# do our own URL escaping to avoid depending on an external module.
# based on: https://en.wikipedia.org/wiki/URL_escaping
# ...and also the perldoc for URI::Escape