From 5a85473e745e989576fadb07049e77377e274768 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 11 Mar 2009 17:17:06 +0100 Subject: [PATCH] add technical info --- popcorn-client | 12 ++++++------ technical.txt | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 technical.txt diff --git a/popcorn-client b/popcorn-client index f892867..853bfd8 100755 --- a/popcorn-client +++ b/popcorn-client @@ -27,18 +27,17 @@ import os import re import rpm import platform -import time import httplib package_name = 'popcorn-client' popcorn_server = 'stats.opensuse.org' -pathre = '^/(bin|sbin|usr/bin|usr/sbin|usr/games|opt/kde3/bin|opt/kde3/sbin|opt/gnome/bin|opt/gnome/sbin|lib|lib64|usr/lib|usr/lib64|include|boot)/' + +pathre = '^/(bin|boot|lib|lib64|opt/gnome/bin|opt/gnome/sbin|opt/kde3/bin|opt/kde3/sbin|sbin|usr/bin|usr/games|usr/include|usr/lib|usr/lib64|usr/libexec|usr/sbin|usr/share)/' class Statistics: package_ver = 'unknown' arch = platform.machine() packages = [] - now = int(time.time()) def __init__(self): ts = rpm.TransactionSet() @@ -64,13 +63,14 @@ class Statistics: accessed = atime except: pass - self.packages.append( (max(self.now-installed, 0), '-' if accessed==0 else max(self.now-accessed, 0), name) ) + self.packages.append( (installed, accessed, name) ) def serialize(self): ret = '' - ret += '%s\n%s\n%s\n' % (self.now, self.arch, self.package_ver) + ret += 'START %s %s\n' % (self.package_ver, self.arch) for pkg in self.packages: ret += '%s %s %s\n' % pkg + ret += 'END\n' return ret class Client: @@ -88,4 +88,4 @@ stats.fill_packages() # client = Client() # client.submit( stats.serialize() ) -print stats.serialize() +print stats.serialize(), diff --git a/technical.txt b/technical.txt new file mode 100644 index 0000000..e5facb9 --- /dev/null +++ b/technical.txt @@ -0,0 +1,47 @@ +Submission format +----------------- + +START + +... +END + +where +- installed_time is when the package installed +- accessed_time is when the package was last used (any of its files touched) + (0 if none of the files from the package were used) +- submission date could be calculated as max(accessed_time) + +Watched files +------------- + +Only files in the following directories are watched: + +/bin +/boot +/lib +/lib64 +/opt/gnome/bin +/opt/gnome/sbin +/opt/kde3/bin +/opt/kde3/sbin +/sbin +/usr/bin +/usr/games +/usr/include +/usr/lib +/usr/lib64 +/usr/libexec +/usr/sbin +/usr/share + +Package categories +------------------ + +installed - package is in the list +voted - installed_time > 30 days, accessed_time < 30 days +old - installed_time > 30 days, accessed_time > 30 days +recent - installed_time < 30 days +no-files - accessed_time = 0 + +note: voted + old + recent + no-files = installed -- 2.11.4.GIT