Browse Source

popularity-contest: report dpkg Vendor field

suites/ascii
Bill Allombert 9 years ago
parent
commit
f14b2da5cc
  1. 14
      FAQ
  2. 1
      debian/changelog
  3. 18
      examples/bin/popanal.py
  4. 15
      popularity-contest

14
FAQ

@ -2,12 +2,14 @@
Q) What information is reported by popularity-contest ?
A) popularity-contest reports the system architecture you use, the version of
popularity-contest you use and the list of packages installed on your
system. For each package, popularity-contest looks at the most recently used
(based on atime) files, and reports the filename, its last access time
(atime) and last change time (ctime). However, some files are not
considered, because they have unreliable atime.
A) popularity-contest reports the system vendor [1], the system architecture
you use, the version of popularity-contest you use and the list of packages
installed on your system. For each package, popularity-contest looks at the
most recently used (based on atime) files, and reports the filename, its
last access time (atime) and last change time (ctime). However, some files
are not considered, because they have unreliable atime.
[1] i.e. the dpkg Vendor field, see dpkg-vendor(1).
Q) What is considered a 'vote' for a package ?

1
debian/changelog

@ -4,6 +4,7 @@ popularity-contest (1.58) UNRELEASED; urgency=low
- Add gensections.pl
- Do not install clean-filter/clean-genpkglist
- rename popcon-submit.cgi to popcon.cgi
* popcon now report the dpkg Vendor field. Suggested by Paul Wise.
-- Bill Allombert <ballombe@debian.org> Sat, 18 May 2013 23:18:28 +0200

18
examples/bin/popanal.py

@ -34,6 +34,7 @@ provlist = {}
class Stat:
def __init__(self):
self.vote = {}
self.vendor = {}
self.release = {}
self.arch = {}
self.count = 0
@ -51,6 +52,11 @@ class Stat:
for arch in archlist:
out.write("Architecture: %-30s %5d\n"
% (arch, self.arch[arch]))
vendorlist = self.vendor.keys()
vendorlist.sort()
for vendor in vendorlist:
out.write("Vendor: %-30s %5d\n"
% (vendor, self.vendor[vendor]))
pkglist = self.vote.keys()
pkglist.sort()
for package in pkglist:
@ -126,6 +132,7 @@ class Submission:
arch = "unknown"
release= "unknown"
vendor= "Debian"
# initialize a new entry with known data
def __init__(self, version, owner_id, date):
@ -163,6 +170,11 @@ class Submission:
st.vote[package] = Vote()
st.vote[package].vote_for(package, self.entries[package])
if not st.vendor.has_key(self.vendor):
st.vendor[self.vendor] = 1
else:
st.vendor[self.vendor] = st.vendor[self.vendor] + 1
if not st.release.has_key(self.release):
st.release[self.release] = 1
else:
@ -209,6 +221,12 @@ def read_submissions(stream):
ewrite('Invalid date: ' + header['TIME'] + ' for ID ' + header['ID'])
continue
if header.has_key('VENDOR'):
if header['VENDOR']=='':
e.vendor = 'unknown'
else:
e.vendor = header['VENDOR']
if header.has_key('POPCONVER'):
if header['POPCONVER']=='':
e.release = 'unknown'

15
popularity-contest

@ -26,6 +26,7 @@ use strict;
use 5.6.0;
my $dpkg_db="/var/lib/dpkg/info";
my $dpkg_origin="/etc/dpkg/origins/default";
my $popcon_conf="/etc/popularity-contest.conf";
# $popcon_conf is in shell-script format
@ -59,6 +60,18 @@ chomp $debarch;
# Popcon release
my $popconver=`dpkg-query --showformat='\${version}' --show popularity-contest`;
# Vendor
my $vendor="unknown";
if (open(VENDOR, "<", $dpkg_origin))
{
while (<VENDOR>)
{
m/^Vendor: *(.*)/ and $vendor=$1;
}
close(VENDOR);
}
# Initialise time computations
my $now = time;
@ -149,7 +162,7 @@ close PACKAGES;
# add a header/footer.
print "POPULARITY-CONTEST-0 TIME:",time," ID:$HOSTID ".
"ARCH:$debarch POPCONVER:$popconver\n";
"ARCH:$debarch POPCONVER:$popconver VENDOR:$vendor\n";
for (sort { $popcon{$b}[0] <=> $popcon{$a}[0] } keys %popcon)
{

Loading…
Cancel
Save