Package: apticron
Version: 1.2.3+nmu1
Severity: normal

>From 5a522f855b1bb79d237b44b4757b2878e60ebe70 Mon Sep 17 00:00:00 2001
From: Jonathan Kamens <j...@kamens.us>
Date: Tue, 23 Mar 2021 16:25:09 -0400
Subject: [PATCH 2/2] When NOTIFY_HOLDS=0, ignore new packages depended on by
 held ones

When NOTIFY_HOLDS=0, apticron shouldn't notify about a new package
that is an install candidate only because it is a dependency of the
new version of a package currently being held.

For example, if linux-headers-generic is held and NOTIFY_HOLDS=0,
then apticron shouldn't notify about a kernel-specific headers
package, i.e., linux-headers-#-generic, that the new version of
linux-headers-generic depends on.

To implement this, I've changed the script so that when
NOTIFY_HOLDS=0 it invokes `apt-get dist-upgrade` without the
`--ignore-hold` and `--allow-change-held-packages` flags.

With this change, I'm not sure if the logic which queries hold lists
from `aptitude` and `dpkg` is necessary any longer. I don't think it
is, but I'm not 100% certain, so I've left it in since it doesn't hurt
anything.

Note that this patch won't apply cleanly unless my other fix
(https://bugs.launchpad.net/bugs/1921000,
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=985794) is applied
first.
---
 apticron | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/apticron b/apticron
index aba64e7..1d16332 100755
--- a/apticron
+++ b/apticron
@@ -132,6 +132,8 @@ APTITUDE_HOLDS=`grep "^State: 2" -B 3 
/var/lib/aptitude/pkgstates 2>/dev/null |g
 DSELECT_HOLDS=`dpkg --get-selections |grep "hold$" |cut -f1 |sed -e "s/:$(dpkg 
--print-architecture)$//"`
 
 if [ "$NOTIFY_HOLDS" = "0" ]; then
+       PKGNAMES=`/usr/bin/apt-get -q -y --allow-unauthenticated -s 
dist-upgrade | \
+                  /bin/grep ^Inst | /usr/bin/cut -d\  -f2 | /usr/bin/sort`
        # packages hold by aptitude don't go to the upgrading candidates list
        for p in $APTITUDE_HOLDS; do
                PKGNAMES=`echo $PKGNAMES |sed "s/\(^\| \)$p\( \|$\)/ /g;s/^ 
//g"`
-- 
2.30.2

Reply via email to