Bug#725819: how-can-i-help: report packages installed locally but removed from testing

2013-10-14 Thread David Suárez
Hi,

Updated patch, I was checking against binary packages instead sources ones.

Sorry,
  Daviddiff -ur how-can-i-help-0.6/bin/how-can-i-help how-can-i-help-0.6-modi/bin/how-can-i-help
--- how-can-i-help-0.6/bin/how-can-i-help	2013-09-12 09:05:21.0 +0200
+++ how-can-i-help-0.6-modi/bin/how-can-i-help	2013-10-14 20:45:16.0 +0200
@@ -22,14 +22,40 @@
 require 'zlib'
 require 'stringio'
 require 'json'
+require 'yaml'
+require 'digest/md5'
 require 'optparse'
 
 HELPITEMS_URL = 'http://udd.debian.org/how-can-i-help.json.gz'
+REMOVALS_URL = 'http://udd.debian.org/cgi-bin/autoremovals.yaml.cgi'
 DATADIR = '/var/lib/how-can-i-help'
 SEEN_LOCAL = #{DATADIR}/seen.json
+REMOVALS_SEEN_LOCAL = #{DATADIR}/removals_seen.json
 
 include Debian
 
+def hash_removals(removals)
+  digests = []
+  
+  removals.each_pair do |k, v|  
+digests  hash_removal(k, v)
+  end
+  
+  return digests
+end
+
+def hash_removal(k, v)
+  str = ''
+  
+  str = k
+  v['bugs'].sort!.each do |value|
+str += value
+  end
+  str += v[removal_date].to_s
+
+  return Digest::MD5.hexdigest(str)
+end
+
 $quiet = false
 $all = false
 $root = (Process.euid == 0)
@@ -66,6 +92,12 @@
   seen = []
 end
 
+if $root and File::exists?(REMOVALS_SEEN_LOCAL)
+  removals_seen = JSON::parse(IO::read(REMOVALS_SEEN_LOCAL))
+else
+  removals_seen = []
+end
+
 # FIXME deal with caching locally
 uri = URI.parse(HELPITEMS_URL)
 begin
@@ -83,6 +115,22 @@
 gz = Zlib::GzipReader.new(StringIO.new(response.body.to_s))
 helpitems = JSON::parse(gz.read)
 
+# FIXME deal with caching locally
+uri = URI.parse(REMOVALS_URL)
+begin
+  response = Net::HTTP.get_response(uri)
+
+  if response.code.to_i != 200
+puts Error downloading data file: #{response.code}
+exit(0)
+  end
+rescue
+  puts Error downloading data file: #{$!}
+  exit(0)
+end
+
+removalitems = YAML.load(StringIO.new(response.body.to_s))
+
 # get installed packages
 packages = []
 str = `dpkg -l`
@@ -95,6 +143,15 @@
   end
 end
 
+src_packages = []
+str = `dpkg-query -W -f '${Source:Package}\\n' | sort | uniq`
+if str.respond_to?(:force_encoding)
+  str.force_encoding('utf-8')
+end
+str.split(/\n/).each do |l|
+src_packages  l
+end
+
 helpitems_filtered = []
 helpitems.each do |hi|
   next if (not $all) and seen.include?(hi['hash'])
@@ -109,6 +166,14 @@
   end
 end
 
+removalitems_installed = {}
+removalitems.each_pair do |k, v|
+  next if (not $all) and removals_seen.include?(hash_removal(k, v))
+  if src_packages.include?(k)
+removalitems_installed[k] = v
+  end
+end
+
 unless $quiet
   puts ==  How can you help?  (doc: http://wiki.debian.org/how-can-i-help ) ==
 end
@@ -135,6 +200,18 @@
   end
 end
 
+if removalitems_installed.length  0
+  puts 'Installed packages marked for removal with (posibly hard to fix) RC bug(s):'
+  removalitems_installed.each_pair do |k, v|
+output =  - #{k} 
+v['bugs'].each do |b|
+  output += - http://bugs.debian.org/#{b} 
+end
+output += - removal date: #{v[removal_date]}
+puts output
+  end
+end
+
 if not $all and not $quiet
   puts --  Show all opportunities, not just new ones: how-can-i-help --all  --
 end
@@ -145,4 +222,10 @@
   File::open(SEEN_LOCAL, 'w') do |fd|
 JSON::dump(seen, fd)
   end
+
+  removals_seen = hash_removals(removalitems)  removals_seen
+  removals_seen += hash_removals(removalitems_installed)
+  File::open(REMOVALS_SEEN_LOCAL, 'w') do |fd|
+JSON::dump(removals_seen, fd)
+  end
 end
Sólo en how-can-i-help-0.6-modi/: removals


Bug#725819: how-can-i-help: report packages installed locally but removed from testing

2013-10-14 Thread David Suárez
Forget about...

I undestand that they were marked for removal not removed, my bad.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#725819: how-can-i-help: report packages installed locally but removed from testing

2013-10-13 Thread David Suárez
Hi,

Patch attached, need some refactoring, at least. Let me know what do you 
think.

Thanks
  Daviddiff -ur how-can-i-help-0.6/bin/how-can-i-help how-can-i-help-0.6-modi/bin/how-can-i-help
--- how-can-i-help-0.6/bin/how-can-i-help	2013-09-12 09:05:21.0 +0200
+++ how-can-i-help-0.6-modi/bin/how-can-i-help	2013-10-13 14:19:20.0 +0200
@@ -22,14 +22,40 @@
 require 'zlib'
 require 'stringio'
 require 'json'
+require 'yaml'
+require 'digest/md5'
 require 'optparse'
 
 HELPITEMS_URL = 'http://udd.debian.org/how-can-i-help.json.gz'
+REMOVALS_URL = 'http://udd.debian.org/cgi-bin/autoremovals.yaml.cgi'
 DATADIR = '/var/lib/how-can-i-help'
 SEEN_LOCAL = #{DATADIR}/seen.json
+REMOVALS_SEEN_LOCAL = #{DATADIR}/removals_seen.json
 
 include Debian
 
+def hash_removals(removals)
+  digests = []
+  
+  removals.each_pair do |k, v|  
+digests  hash_removal(k, v)
+  end
+  
+  return digests
+end
+
+def hash_removal(k, v)
+  str = ''
+  
+  str = k
+  v['bugs'].sort!.each do |value|
+str += value
+  end
+  str += v[removal_date].to_s
+
+  return Digest::MD5.hexdigest(str)
+end
+
 $quiet = false
 $all = false
 $root = (Process.euid == 0)
@@ -66,6 +92,12 @@
   seen = []
 end
 
+if $root and File::exists?(REMOVALS_SEEN_LOCAL)
+  removals_seen = JSON::parse(IO::read(REMOVALS_SEEN_LOCAL))
+else
+  removals_seen = []
+end
+
 # FIXME deal with caching locally
 uri = URI.parse(HELPITEMS_URL)
 begin
@@ -83,6 +115,22 @@
 gz = Zlib::GzipReader.new(StringIO.new(response.body.to_s))
 helpitems = JSON::parse(gz.read)
 
+# FIXME deal with caching locally
+uri = URI.parse(REMOVALS_URL)
+begin
+  response = Net::HTTP.get_response(uri)
+
+  if response.code.to_i != 200
+puts Error downloading data file: #{response.code}
+exit(0)
+  end
+rescue
+  puts Error downloading data file: #{$!}
+  exit(0)
+end
+
+removalitems = YAML.load(StringIO.new(response.body.to_s))
+
 # get installed packages
 packages = []
 str = `dpkg -l`
@@ -109,6 +157,14 @@
   end
 end
 
+removalitems_installed = {}
+removalitems.each_pair do |k, v|
+  next if (not $all) and removals_seen.include?(hash_removal(k, v))
+  if packages.include?(k)
+removalitems_installed[k] = v
+  end
+end
+
 unless $quiet
   puts ==  How can you help?  (doc: http://wiki.debian.org/how-can-i-help ) ==
 end
@@ -135,6 +191,18 @@
   end
 end
 
+if removalitems_installed.length  0
+  puts 'Installed packages marked for removal with (posibly hard to fix) RC bug(s):'
+  removalitems_installed.each_pair do |k, v|
+output =  - #{k} 
+v['bugs'].each do |b|
+  output += - http://bugs.debian.org/#{b} 
+end
+output += - removal date: #{v[removal_date]}
+puts output
+  end
+end
+
 if not $all and not $quiet
   puts --  Show all opportunities, not just new ones: how-can-i-help --all  --
 end
@@ -145,4 +213,10 @@
   File::open(SEEN_LOCAL, 'w') do |fd|
 JSON::dump(seen, fd)
   end
+
+  removals_seen = hash_removals(removalitems)  removals_seen
+  removals_seen += hash_removals(removalitems_installed)
+  File::open(REMOVALS_SEEN_LOCAL, 'w') do |fd|
+JSON::dump(removals_seen, fd)
+  end
 end
Sólo en how-can-i-help-0.6-modi/: removals


Bug#725819: how-can-i-help: report packages installed locally but removed from testing

2013-10-08 Thread Lucas Nussbaum
Package: how-can-i-help
Version: 0.6
Severity: normal

Hi,

See discussion at 
http://lists.debian.org/20131007220421.ga17...@master.debian.org

It would be good to improve the awareness around packages removed from
testing. One way to do that would be to list them in how-can-i-help,
with an appropriate warning that the bugs might be hard to fix, but that
they are clearly packages that need some help.

Lucas


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org