From 33fc169591b9dd816cd307618dfebc81e027e1aa Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Mon, 24 Aug 2026 22:11:05 +0200 Subject: [PATCH] Blacklist transitional/dummy stub packages from import Their short description reliably says so (e.g. 'transitional package', 'transitional dummy package for foo'). Verified against production package data: 190 matches, none of them ever had a screenshot. --- lib/tasks/import_debian.rake | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/lib/tasks/import_debian.rake b/lib/tasks/import_debian.rake index 666e074..c82d6a3 100644 --- a/lib/tasks/import_debian.rake +++ b/lib/tasks/import_debian.rake @@ -35,6 +35,14 @@ BLACKLIST_SECTION_PATTERN = [ %r{/?libs$}, ] +# List of regular expressions. If the package's short description +# matches any of these then the package will not be imported. +# Transitional/dummy stub packages exist only to ease upgrades to a +# renamed or split package and never get a useful screenshot. +BLACKLIST_DESCRIPTION_PATTERN = [ + /transitional/i, +] + # Whether to delete a blacklisted package from the database REMOVE_BLACKLISTED_PACKAGE = true @@ -87,7 +95,9 @@ namespace :debshots do Rails.logger.info "> Package: #{package[:Package]}" #Rails.logger.debug "Fetching package informaton from the database" - if package_name_blacklisted? package[:Package] or package_section_blacklisted? package[:Section] + if package_name_blacklisted?(package[:Package]) or + package_section_blacklisted?(package[:Section]) or + package_description_blacklisted?(package[:Description]) # Should the package get removed from the database? if REMOVE_BLACKLISTED_PACKAGE db_package = Package.find_by name: package[:Package] @@ -280,3 +290,16 @@ def package_section_blacklisted?(section) end return false end + +# Check if a package's short description marks it as a transitional or +# dummy stub package (e.g. "transitional package", "transitional dummy +# package for foo"). These never get a useful screenshot. +def package_description_blacklisted?(description) + BLACKLIST_DESCRIPTION_PATTERN.each do |pattern| + if description.to_s =~ pattern + Rails.logger.debug " > Blacklisted by description ('#{description}' matches '#{pattern}')" + return true + end + end + false +end