Version in base suite: 0.0~git20230203.6f710f8-1+deb12u1 Base version: prometheus-node-exporter-collectors_0.0~git20230203.6f710f8-1+deb12u1 Target version: prometheus-node-exporter-collectors_0.0~git20230203.6f710f8-1+deb12u2 Base file: /srv/ftp-master.debian.org/ftp/pool/main/p/prometheus-node-exporter-collectors/prometheus-node-exporter-collectors_0.0~git20230203.6f710f8-1+deb12u1.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/p/prometheus-node-exporter-collectors/prometheus-node-exporter-collectors_0.0~git20230203.6f710f8-1+deb12u2.dsc changelog | 13 +++ patches/0001-apt_info.py-fix-apt_upgrades_pending-and-apt_upgrade.patch | 35 +++++++++ patches/0001-report-the-apt-cache-timestamp.patch | 2 patches/0001-use-a-better-heuristic-for-the-apt-update-last-run-t.patch | 10 ++ patches/0002-Improve-heuristic-for-the-apt-update-last-run-time-2.patch | 36 ++++++++++ patches/series | 2 6 files changed, 96 insertions(+), 2 deletions(-) diff -Nru prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/changelog prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/changelog --- prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/changelog 2023-10-31 17:57:52.000000000 +0000 +++ prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/changelog 2024-11-16 00:13:55.000000000 +0000 @@ -1,3 +1,16 @@ +prometheus-node-exporter-collectors (0.0~git20230203.6f710f8-1+deb12u2) bookworm; urgency=medium + + * Team upload + + [ Antoine Beaupré ] + * Add missing `apt_package_cache_timestamp_seconds` metrics ommitted from previous upload. + + [ Reinhard Tartler ] + * apt_info.py: fix apt_upgrades_pending and apt_upgrades_held, Closes: #1077694 + * backport another improvement to apt_package_cache_timestamp_seconds + + -- Reinhard Tartler Fri, 15 Nov 2024 19:13:55 -0500 + prometheus-node-exporter-collectors (0.0~git20230203.6f710f8-1+deb12u1) bookworm; urgency=medium * Team upload diff -Nru prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/0001-apt_info.py-fix-apt_upgrades_pending-and-apt_upgrade.patch prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/0001-apt_info.py-fix-apt_upgrades_pending-and-apt_upgrade.patch --- prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/0001-apt_info.py-fix-apt_upgrades_pending-and-apt_upgrade.patch 1970-01-01 00:00:00.000000000 +0000 +++ prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/0001-apt_info.py-fix-apt_upgrades_pending-and-apt_upgrade.patch 2024-11-16 00:13:55.000000000 +0000 @@ -0,0 +1,35 @@ +From: Reinhard Tartler +Date: Sat, 2 Nov 2024 08:20:41 -0400 +Subject: apt_info.py: fix apt_upgrades_pending and apt_upgrades_held + +Backported from +https://github.com/prometheus-community/node-exporter-textfile-collector-scripts/pull/207 +--- + apt_info.py | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/apt_info.py b/apt_info.py +index 82ea4e5..804f89c 100755 +--- a/apt_info.py ++++ b/apt_info.py +@@ -57,7 +57,7 @@ def _write_pending_upgrades(cache): + # only one upgrade, not two). See the following issue for more details: + # https://github.com/prometheus-community/node-exporter-textfile-collector-scripts/issues/85 + candidates = { +- p.candidate for p in cache.get_changes() if p.is_installed and p.marked_upgrade ++ p.candidate for p in cache if p.is_upgradable + } + _write_upgrade_info("apt_upgrades_pending", candidates) + +@@ -66,7 +66,10 @@ def _write_held_upgrades(cache): + print("# HELP apt_upgrades_held Apt packages pending updates but held back.") + print("# TYPE apt_upgrades_held gauge") + +- held_candidates = {p.candidate for p in cache if p.is_upgradable and p.marked_keep} ++ held_candidates = { ++ p.candidate for p in cache ++ if p.is_upgradable and p._pkg.selected_state == apt_pkg.SELSTATE_HOLD ++ } + _write_upgrade_info("apt_upgrades_held", held_candidates) + + diff -Nru prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/0001-report-the-apt-cache-timestamp.patch prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/0001-report-the-apt-cache-timestamp.patch --- prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/0001-report-the-apt-cache-timestamp.patch 2023-10-31 17:57:52.000000000 +0000 +++ prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/0001-report-the-apt-cache-timestamp.patch 2024-11-16 00:13:55.000000000 +0000 @@ -35,7 +35,7 @@ print(f"apt_autoremove_pending {len(autoremovable_packages)}") -+def _write_cache_timestamps(registry): ++def _write_cache_timestamps(): + print('# HELP apt_package_cache_timestamp_seconds Apt update last run time.') + print('# TYPE apt_package_cache_timestamp_seconds gauge') + try: diff -Nru prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/0001-use-a-better-heuristic-for-the-apt-update-last-run-t.patch prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/0001-use-a-better-heuristic-for-the-apt-update-last-run-t.patch --- prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/0001-use-a-better-heuristic-for-the-apt-update-last-run-t.patch 2023-10-31 17:57:52.000000000 +0000 +++ prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/0001-use-a-better-heuristic-for-the-apt-update-last-run-t.patch 2024-11-16 00:13:55.000000000 +0000 @@ -39,7 +39,7 @@ import os @@ -80,10 +81,18 @@ def _write_autoremove_pending(cache): - def _write_cache_timestamps(registry): + def _write_cache_timestamps(): print('# HELP apt_package_cache_timestamp_seconds Apt update last run time.') print('# TYPE apt_package_cache_timestamp_seconds gauge') + apt_pkg.init_config() @@ -58,3 +58,11 @@ ) except OSError: pass +@@ -104,6 +113,7 @@ def _main(): + _write_pending_upgrades(cache) + _write_held_upgrades(cache) + _write_autoremove_pending(cache) ++ _write_cache_timestamps() + _write_reboot_required() + + diff -Nru prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/0002-Improve-heuristic-for-the-apt-update-last-run-time-2.patch prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/0002-Improve-heuristic-for-the-apt-update-last-run-time-2.patch --- prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/0002-Improve-heuristic-for-the-apt-update-last-run-time-2.patch 1970-01-01 00:00:00.000000000 +0000 +++ prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/0002-Improve-heuristic-for-the-apt-update-last-run-time-2.patch 2024-11-16 00:13:55.000000000 +0000 @@ -0,0 +1,36 @@ +From: kennethso168 +Date: Thu, 9 May 2024 03:49:50 +0800 +Subject: Improve heuristic for the apt update last run time (#208) + +As suggested by #194 and this fixes it + +Signed-off-by: kennethso168 +--- + apt_info.py | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/apt_info.py b/apt_info.py +index 804f89c..b82c931 100755 +--- a/apt_info.py ++++ b/apt_info.py +@@ -85,13 +85,16 @@ def _write_cache_timestamps(): + print('# HELP apt_package_cache_timestamp_seconds Apt update last run time.') + print('# TYPE apt_package_cache_timestamp_seconds gauge') + apt_pkg.init_config() +- if apt_pkg.config.find_b("APT::Periodic::Update-Package-Lists"): ++ if ( ++ apt_pkg.config.find_b("APT::Periodic::Update-Package-Lists") and ++ os.path.isfile("/var/lib/apt/periodic/update-success-stamp") ++ ): + # if we run updates automatically with APT::Periodic, we can +- # check this timestamp file ++ # check this timestamp file if it exists + stamp_file = "/var/lib/apt/periodic/update-success-stamp" + else: +- # if not, let's just fallback on the lists directory +- stamp_file = '/var/lib/apt/lists' ++ # if not, let's just fallback on the partial file of the lists directory ++ stamp_file = '/var/lib/apt/lists/partial' + try: + print( + "apt_package_cache_timestamp_seconds %s" diff -Nru prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/series prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/series --- prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/series 2023-10-31 17:57:52.000000000 +0000 +++ prometheus-node-exporter-collectors-0.0~git20230203.6f710f8/debian/patches/series 2024-11-16 00:13:55.000000000 +0000 @@ -1,3 +1,5 @@ 0001-do-not-run-apt-update-or-simulate-apt-dist-upgrade.patch 0001-report-the-apt-cache-timestamp.patch 0001-use-a-better-heuristic-for-the-apt-update-last-run-t.patch +0001-apt_info.py-fix-apt_upgrades_pending-and-apt_upgrade.patch +0002-Improve-heuristic-for-the-apt-update-last-run-time-2.patch