summaryrefslogtreecommitdiffstats
path: root/urpm/media.pm
diff options
context:
space:
mode:
Diffstat (limited to 'urpm/media.pm')
-rw-r--r--urpm/media.pm21
1 files changed, 21 insertions, 0 deletions
diff --git a/urpm/media.pm b/urpm/media.pm
index 6148d680..81da468d 100644
--- a/urpm/media.pm
+++ b/urpm/media.pm
@@ -755,6 +755,27 @@ sub _auto_update_media {
}
}
+
+=item needed_extra_media($urpm)
+
+Return 2 booleans telling whether nonfree & tainted packages are installed respectively.
+
+=cut
+
+sub needed_extra_media {
+ my ($urpm) = @_;
+ my $db = urpm::db_open_or_die_($urpm);
+ my ($nonfree, $tainted);
+ $db->traverse(sub {
+ my ($pkg) = @_;
+ return if $nonfree && $tainted;
+ my $rel = $pkg->release;
+ $nonfree ||= $rel =~ /nonfree$/;
+ $tainted ||= $rel =~ /tainted$/;
+ });
+ ($nonfree, $tainted);
+}
+
sub non_ignored_media {
my ($urpm, $b_only_marked_update) = @_;