File: debfoster2aptitude

package info (click to toggle)
debfoster 2.7-2.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, stretch
  • size: 1,188 kB
  • sloc: sh: 4,243; ansic: 2,397; perl: 39; makefile: 26; sed: 16
file content (53 lines) | stat: -rw-r--r-- 1,035 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#! /usr/bin/perl -w

use strict;
use utf8;

system qw(debfoster
	-o MaxPriority=required
	-o UseHold=no
	-o UsePreDepends=yes
	-o UseRecommends=no
	-o UseSuggests=no
	-o UseEssential=no
	-o UseTasks=no
	-o KeepSections=
	-o NokeepSections=
	-o GuessDepends=no) and die;

my %debfoster;

open KEEPERS, '<', '/var/lib/debfoster/keepers'
	or die "/var/lib/debfoster/keepers: $!";

while(<KEEPERS>) {
	next if /^-/;
	chomp;
	undef $debfoster{$_}
}

close KEEPERS or die $!;

open PKG, '<', '/var/lib/aptitude/pkgstates'
	or die "/var/lib/aptitude/pkgstates: $!";

open NEW, '>', '/var/lib/aptitude/pkgstates.new'
	or die "/var/lib/aptitude/pkgstates.new: $!";

my $name;

while(<PKG>) {
	$name = $1 if /^Package:\s+(\S+)/;

	if(/Last-Change:/) {
		$_ = 'Last-Change: '.(exists $debfoster{$name} ? 0 : 1)."\n"
	}
	print NEW
		or die "/var/lib/aptitude/pkgstates.new: $!";
}

close NEW or die $!;
close PKG or die $!;

rename '/var/lib/aptitude/pkgstates.new', '/var/lib/aptitude/pkgstates'
	or die "rename(/var/lib/aptitude/pkgstates): $!"