diff -Nru how-can-i-help-16/bin/how-can-i-help how-can-i-help-17/bin/how-can-i-help --- how-can-i-help-16/bin/how-can-i-help 2018-03-18 23:12:16.000000000 +0000 +++ how-can-i-help-17/bin/how-can-i-help 2019-11-18 03:27:59.000000000 +0000 @@ -44,6 +44,8 @@ $kas = false $apt = false $show = [] +$download = true +$installed_packages = true $proxy_url = ENV['HTTP_PROXY'] || ENV['http_proxy'] optparse = OptionParser.new do |opts| @@ -88,6 +90,18 @@ $show = show end + opts.on("--[no-]download", "Enable/disable cache update when cache is populated") do |download| + $download = download + end + + opts.on("--[no-]installed-packages", "Enable/disable showing opportunities for packages installed locally") do |installed_packages| + $installed_packages = installed_packages + end + + opts.on("--autorm-days ", Integer, "Only show autoremovals within the next N days") do |autorm_days| + $autorm_days = autorm_days + end + end optparse.parse! @@ -145,29 +159,29 @@ http_object.use_ssl = uri.scheme == 'https' # proceeding get_response -begin - response = http_object.request(request) -rescue - puts "how-can-i-help: Error downloading data file: #{$!}" - exit(1) +unless $download == false && File::exists?(CACHE) + begin + response = http_object.request(request) + rescue + puts "how-can-i-help: Error downloading data file: #{$!}" + exit(1) + end + open CACHE, 'w' do |cc| + cc.write response.body.to_s + end if response.is_a?(Net::HTTPSuccess) end -open CACHE, 'w' do |cc| - cc.write response.body.to_s -end if response.is_a?(Net::HTTPSuccess) gz = Zlib::GzipReader.open(CACHE) helpitems = JSON::parse(gz.read) # get installed packages packages = [] -str = `dpkg -l` -if str.respond_to?(:encode!) - str.encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') -end -str.split(/\n/).each do |l| - if l =~ /^(i|h).\s+([^ ]+)\s/ - packages << $2 +if $installed_packages + str = `dpkg-query -W -f '${Package}\n'` + if str.respond_to?(:encode!) + str.encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') end + packages += str.split(/\n/) end # add user defined packages @@ -316,8 +330,13 @@ end if autoremoval.length > 0 - puts $old ? 'Packages going to be removed from Debian \'testing\' (the maintainer might need help):' : 'New packages going to be removed from Debian \'testing\' (the maintainer might need help):' + if defined?($autorm_days) + autorm_date = Time.now.to_date + $autorm_days + autorm = "until #{autorm_date.to_s} " + end + puts $old ? "Packages going to be removed from Debian 'testing' #{autorm}(the maintainer might need help):" : "New packages going to be removed from Debian 'testing' #{autorm}(the maintainer might need help):" autoremoval.sort_by { |r| [r['source'], r['package']] }.each do |r| + next if defined?($autorm_days) && Time.at(r['removal_time']).to_date > autorm_date bugs = r['bugs'].map { |b| "##{b}" } if bugs.count == 0 bugs = '' diff -Nru how-can-i-help-16/debian/changelog how-can-i-help-17/debian/changelog --- how-can-i-help-16/debian/changelog 2018-03-18 23:12:16.000000000 +0000 +++ how-can-i-help-17/debian/changelog 2020-06-26 20:07:33.000000000 +0000 @@ -1,3 +1,26 @@ +how-can-i-help (17) unstable; urgency=medium + + [ Paul Wise ] + * Switch from `dpkg -l` to dpkg-query + * Add an option to disable updating the cache when it is populated + * Add an option to disable opportunities for packages installed locally + * Add an option to hide autoremovals too far in the future (Closes: #826935) + * Use the canonical value for salsa in the Vcs-Browser field + * Switch from debian/compat to debhelper-compat Build-Depends + * Switch from debhelper compat 11 to 12, no changes needed + * Set Rules-Requires-Root to no + * Declare compliance with Debian Policy 4.4.0 + + [ lintian-brush ] + * Set Homepage field in Source rather than Binary package. + * Update standards version to 4.4.1, no changes needed. + + [ Tomasz Nitecki ] + * debian/control: Bump Standards-Version to 4.5.0; no changes needed. + * debian/copyright: Bump years to include 2020. + + -- Tomasz Nitecki Fri, 26 Jun 2020 22:07:33 +0200 + how-can-i-help (16) unstable; urgency=medium [ Paul Wise ] diff -Nru how-can-i-help-16/debian/compat how-can-i-help-17/debian/compat --- how-can-i-help-16/debian/compat 2018-03-18 23:12:16.000000000 +0000 +++ how-can-i-help-17/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -11 diff -Nru how-can-i-help-16/debian/control how-can-i-help-17/debian/control --- how-can-i-help-16/debian/control 2018-03-18 23:12:16.000000000 +0000 +++ how-can-i-help-17/debian/control 2020-06-26 20:05:17.000000000 +0000 @@ -5,12 +5,14 @@ Uploaders: Lucas Nussbaum , Build-Depends: - debhelper (>= 11~), + debhelper-compat (= 12), gem2deb (>= 0.3.0~), -Standards-Version: 4.1.3 +Standards-Version: 4.5.0 Vcs-Git: https://salsa.debian.org/debian/how-can-i-help.git -Vcs-Browser: https://salsa.debian.org/debian/how-can-i-help.git +Vcs-Browser: https://salsa.debian.org/debian/how-can-i-help XS-Ruby-Versions: all +Rules-Requires-Root: no +Homepage: https://wiki.debian.org/how-can-i-help Package: how-can-i-help Architecture: all @@ -20,7 +22,6 @@ ruby-debian (>= 0.3.8~), ruby-json (>= 1.7.3-3), ${misc:Depends}, -Homepage: https://wiki.debian.org/how-can-i-help Description: show opportunities for contributing to Debian how-can-i-help hooks into APT to list opportunities for contributions to Debian (orphaned packages, bugs tagged 'newcomer') for packages installed diff -Nru how-can-i-help-16/debian/copyright how-can-i-help-17/debian/copyright --- how-can-i-help-16/debian/copyright 2018-03-18 23:12:16.000000000 +0000 +++ how-can-i-help-17/debian/copyright 2020-06-26 20:06:32.000000000 +0000 @@ -2,8 +2,8 @@ Upstream-Name: how-can-i-help Files: * -Copyright: 2013-2018 Lucas Nussbaum - 2015-2018 Tomasz Nitecki +Copyright: 2013-2020 Lucas Nussbaum + 2015-2020 Tomasz Nitecki License: GPL-3+ License: GPL-3+ diff -Nru how-can-i-help-16/how-can-i-help.1.txt how-can-i-help-17/how-can-i-help.1.txt --- how-can-i-help-16/how-can-i-help.1.txt 2018-03-18 23:12:16.000000000 +0000 +++ how-can-i-help-17/how-can-i-help.1.txt 2019-11-18 03:27:59.000000000 +0000 @@ -42,6 +42,16 @@ *-s ...*, *--show ...*:: Show only specific types of opportunities. Provided types have to be separated by commas. +*--download*, *--no-download*:: + Enable or disable updating the cache when it is present. + The cache is updated by default and when it is missing. + +*--installed-packages*, *--no-installed-packages*:: + Enable or disable showing opportunities for packages installed locally. + +*--autorm-days *:: + Only show autoremovals within the next N days. + PROXY SUPPORT ------------- *how-can-i-help* uses the HTTP_PROXY (or http_proxy) environment variable as @@ -165,7 +175,7 @@ For example one can monitor all package from a server as follow: - # ssh myserver dpkg -l | tail -n+6 | awk '{ print $2 }' \ + # ssh myserver dpkg-query -W -f \''${Package}\n'\' \ >> ~/.config/how-can-i-help/packages SEE ALSO