diff -Nru debtags-2.0.1ubuntu6/autogen.sh debtags-2.1.2/autogen.sh --- debtags-2.0.1ubuntu6/autogen.sh 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/autogen.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -#!/bin/sh - -# Rebuild the build system -./update_files diff -Nru debtags-2.0.1ubuntu6/deb debtags-2.1.2/deb --- debtags-2.0.1ubuntu6/deb 2015-10-28 10:02:33.000000000 +0000 +++ debtags-2.1.2/deb 1970-01-01 00:00:00.000000000 +0000 @@ -1,75 +0,0 @@ -diff -Nru debtags-2.0+nmu1/debian/control debtags-2.0+nmu1ubuntu1/debian/control ---- debtags-2.0+nmu1/debian/control 2015-07-08 15:21:17.000000000 +0000 -+++ debtags-2.0+nmu1ubuntu1/debian/control 2015-08-16 16:05:57.000000000 +0000 -@@ -1,10 +1,14 @@ - Source: debtags - Section: admin - Priority: optional --Maintainer: Enrico Zini -+Maintainer: Ubuntu Developers -+XSBC-Original-Maintainer: Enrico Zini - Uploaders: Enrico Rossi - Build-Depends: - debhelper (>= 9), dh-buildinfo, dh-python, -+ python-setuptools, python-all, -+ python-apt, python-debian, -+ python-docutils, - python3-setuptools, python3-all, - python3-apt, python3-debian, - python3-docutils, help2man -@@ -28,6 +32,16 @@ - . - debtags also provides some handy command to query tag information. - -+Package: python-debtagshw -+Section: python -+Architecture: all -+Depends: ${python:Depends}, ${misc:Depends} -+Recommends: gir1.2-gudev-1.0, laptop-detect, sane-utils, python-cups -+Description: Match debtags hardware:: tags against the actual hardware -+ debtagshw provides a python library to match a given hardware:: debtag -+ against the current system in order to verify that the system supports -+ the hardware. -+ - Package: python3-debtagshw - Section: python - Architecture: all -diff -Nru debtags-2.0+nmu1/debian/python-debtagshw.install debtags-2.0+nmu1ubuntu1/debian/python-debtagshw.install ---- debtags-2.0+nmu1/debian/python-debtagshw.install 1970-01-01 00:00:00.000000000 +0000 -+++ debtags-2.0+nmu1ubuntu1/debian/python-debtagshw.install 2015-08-16 16:04:09.000000000 +0000 -@@ -0,0 +1 @@ -+usr/lib/python2*/ -diff -Nru debtags-2.0+nmu1/debian/rules debtags-2.0+nmu1ubuntu1/debian/rules ---- debtags-2.0+nmu1/debian/rules 2015-06-21 13:15:56.000000000 +0000 -+++ debtags-2.0+nmu1ubuntu1/debian/rules 2015-08-16 16:04:30.000000000 +0000 -@@ -1,7 +1,7 @@ - #!/usr/bin/make -f - - %: -- dh $@ --with=python3 --buildsystem=pybuild -+ dh $@ --with=python2,python3 --buildsystem=pybuild - - override_dh_auto_build: - ./rebuild-manpages -diff -Nru debtags-2.0+nmu1/debtags debtags-2.0+nmu1ubuntu1/debtags ---- debtags-2.0+nmu1/debtags 2015-06-21 13:26:41.000000000 +0000 -+++ debtags-2.0+nmu1ubuntu1/debtags 2015-08-16 16:09:02.000000000 +0000 -@@ -19,6 +19,7 @@ - # along with this program; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -+from __future__ import print_function - import argparse - import sys - import logging -Binary files /tmp/mFuySEStG3/debtags-2.0+nmu1/debtagsc and /tmp/B2zBqoieMe/debtags-2.0+nmu1ubuntu1/debtagsc differ -diff -Nru debtags-2.0+nmu1/setup.py debtags-2.0+nmu1ubuntu1/setup.py ---- debtags-2.0+nmu1/setup.py 2015-06-21 13:15:56.000000000 +0000 -+++ debtags-2.0+nmu1ubuntu1/setup.py 2015-08-16 16:07:27.000000000 +0000 -@@ -1,5 +1,6 @@ - #!/usr/bin/env python3 - -+from __future__ import print_function - from setuptools import setup - import imp - diff -Nru debtags-2.0.1ubuntu6/debian/changelog debtags-2.1.2/debian/changelog --- debtags-2.0.1ubuntu6/debian/changelog 2016-01-24 19:29:06.000000000 +0000 +++ debtags-2.1.2/debian/changelog 2016-09-09 12:42:59.000000000 +0000 @@ -1,44 +1,42 @@ -debtags (2.0.1ubuntu6) xenial; urgency=medium +debtags (2.1.2) unstable; urgency=low - * No-change rebuild to drop python3.4 support. + * Add facet:suite and tag:mysql to the vocabulary. (Closes: #830626) - -- Matthias Klose Sun, 24 Jan 2016 19:29:06 +0000 + -- Enrico Rossi Fri, 09 Sep 2016 14:42:59 +0200 -debtags (2.0.1ubuntu5) xenial; urgency=medium +debtags (2.1.1) unstable; urgency=low - * Shrug, actually upload the change described + * New maintainer. (Closes: #813204) + * Set standards-version to 3.9.8 no changes required. + * Fix UnicodeDecodeError on non-utf8 data from apt cache. + (Closes: #828776, #799584) - -- Sebastien Bacher Wed, 28 Oct 2015 16:16:30 +0100 + -- Enrico Rossi Tue, 05 Jul 2016 15:33:30 +0200 -debtags (2.0.1ubuntu4) xenial; urgency=medium +debtags (2.1) unstable; urgency=low - * debian/control: - - laptop-detect is needed as well, should be enough and pbuilder tested + * Removed no longer maintained debtagshw software (Closes: #821407) + * Removed no longer maintained debtags-submit-patch. + * Fix missing manpage. + * removed no longer supported "debtags submit" command, it was + based on debtags-submit-patch. + * Set standard version to 3.9.7 no changes required. - -- Sebastien Bacher Wed, 28 Oct 2015 16:11:19 +0100 + -- Enrico Rossi Mon, 25 Apr 2016 14:45:21 +0200 -debtags (2.0.1ubuntu3) xenial; urgency=medium +debtags (2.0.2) unstable; urgency=high - * debian/control: - - build-depends on python3-cups as well + [ Enrico Rossi ] + * Fix "obsolete conffiles" by remove + /etc/bash-completion.d/bash-completion and + /etc/bash-completion.d/debtags left from upgrades. (Closes: #798520) + * Fix "FTBFS: FileNotFoundError: [Errno 2] No such file or directory: + 'pyflakes'". Missing build dep. (Closes: #808642) - -- Sebastien Bacher Wed, 28 Oct 2015 11:33:21 +0100 + [ Enrico Zini ] + * Set Enrico Rossi as Maintainer -debtags (2.0.1ubuntu2) xenial; urgency=medium - - * debian/control: - - build-depends on pyflakes and python-mock, fixes the build - - -- Sebastien Bacher Wed, 28 Oct 2015 11:22:11 +0100 - -debtags (2.0.1ubuntu1) xenial; urgency=medium - - * Resynchronize with Debian, remaining changes - * Restore python2 bindings (hopefully temporarily) for software-center, - to unblock the g++5 transition. - * Requires from __future__ import print_function for python2 compatibility - - -- Sebastien Bacher Wed, 28 Oct 2015 11:01:47 +0100 + -- Enrico Zini Thu, 04 Feb 2016 11:46:23 +0100 debtags (2.0.1) unstable; urgency=high diff -Nru debtags-2.0.1ubuntu6/debian/clean debtags-2.1.2/debian/clean --- debtags-2.0.1ubuntu6/debian/clean 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/debian/clean 2016-08-09 11:55:48.000000000 +0000 @@ -1,4 +1,3 @@ -build/* -debtags-submit-patch.1 -debtags.1 -debtagshw.egg-info/* +build/ +debian/debtags.1 +debtags.egg-info/ diff -Nru debtags-2.0.1ubuntu6/debian/control debtags-2.1.2/debian/control --- debtags-2.0.1ubuntu6/debian/control 2015-10-28 15:16:16.000000000 +0000 +++ debtags-2.1.2/debian/control 2016-08-09 11:55:48.000000000 +0000 @@ -1,55 +1,28 @@ Source: debtags Section: admin Priority: optional -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Enrico Zini -Uploaders: Enrico Rossi +Maintainer: Enrico Rossi +Uploaders: Enrico Zini Build-Depends: debhelper (>= 9), dh-buildinfo, dh-python, - python-setuptools, python-all, - python-apt, python-debian, - pyflakes, python3-mock, python3-cups, laptop-detect, - python-docutils, python3-setuptools, python3-all, python3-apt, python3-debian, - python3-docutils, help2man, bash-completion -Standards-Version: 3.9.6.0 -X-Python-Version: >= 2.6 + pyflakes, help2man, bash-completion +Standards-Version: 3.9.8.0 X-Python3-Version: >= 3.2 -Vcs-Git: git://git.debian.org/debtags/debtags.git -Vcs-Browser: http://git.debian.org/?p=debtags/debtags.git;a=summary +Vcs-Git: https://anonscm.debian.org/git/debtags/debtags.git +Vcs-Browser: https://anonscm.debian.org/cgit/debtags/debtags.git/ Homepage: http://wiki.debian.org/Debtags Package: debtags Section: admin Architecture: all -Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}, python3-apt, python3-debian +Depends: ${misc:Depends}, ${python3:Depends}, python3-apt, python3-debian Suggests: tagcoll Description: Debian Package Tags support tools debtags extracts tag information from the apt database and makes it available to the system, either in /var/lib/debtags/debtags or via apt-xapian-index. . - Package tags are categories for debian packages. + Package tags are categories for Debian packages. . debtags also provides some handy command to query tag information. - -Package: python-debtagshw -Section: python -Architecture: all -Depends: ${python:Depends}, ${misc:Depends} -Recommends: gir1.2-gudev-1.0, laptop-detect, sane-utils, python-cups -Description: Match debtags hardware:: tags against the actual hardware - debtagshw provides a python library to match a given hardware:: debtag - against the current system in order to verify that the system supports - the hardware. - -Package: python3-debtagshw -Section: python -Architecture: all -Depends: ${python3:Depends}, ${misc:Depends} -Recommends: gir1.2-gudev-1.0, laptop-detect, sane-utils, python-cups -Description: Match debtags hardware:: tags against the actual hardware (Python 3) - debtagshw provides a python library to match a given hardware:: debtag - against the current system in order to verify that the system supports - the hardware. - This package is for Python 3. diff -Nru debtags-2.0.1ubuntu6/debian/debtags.install debtags-2.1.2/debian/debtags.install --- debtags-2.0.1ubuntu6/debian/debtags.install 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/debian/debtags.install 2016-08-09 11:55:48.000000000 +0000 @@ -1,4 +1,3 @@ -usr/bin debian/80debtags etc/apt/apt.conf.d/ vocabulary usr/share/debtags tags-current.gz usr/share/debtags diff -Nru debtags-2.0.1ubuntu6/debian/debtags.maintscript debtags-2.1.2/debian/debtags.maintscript --- debtags-2.0.1ubuntu6/debian/debtags.maintscript 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/debian/debtags.maintscript 2016-08-09 11:55:48.000000000 +0000 @@ -1,3 +1,5 @@ mv_conffile /etc/apt.conf.d/80debtags /etc/apt/apt.conf.d/80debtags 1.12.1~ rm_conffile /etc/debtags/sources.list.d/source-example 1.12.2~ rm_conffile /etc/debtags/sources.list 1.12.2~ +rm_conffile /etc/bash_completion.d/bash-completion 2.0.2~ +rm_conffile /etc/bash_completion.d/debtags 2.0.2~ diff -Nru debtags-2.0.1ubuntu6/debian/debtags.manpages debtags-2.1.2/debian/debtags.manpages --- debtags-2.0.1ubuntu6/debian/debtags.manpages 1970-01-01 00:00:00.000000000 +0000 +++ debtags-2.1.2/debian/debtags.manpages 2016-08-09 11:55:48.000000000 +0000 @@ -0,0 +1 @@ +debian/debtags.1 diff -Nru debtags-2.0.1ubuntu6/debian/python3-debtagshw.install debtags-2.1.2/debian/python3-debtagshw.install --- debtags-2.0.1ubuntu6/debian/python3-debtagshw.install 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/debian/python3-debtagshw.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -usr/lib/python3* diff -Nru debtags-2.0.1ubuntu6/debian/python-debtagshw.install debtags-2.1.2/debian/python-debtagshw.install --- debtags-2.0.1ubuntu6/debian/python-debtagshw.install 2015-10-28 10:02:36.000000000 +0000 +++ debtags-2.1.2/debian/python-debtagshw.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -usr/lib/python2*/ diff -Nru debtags-2.0.1ubuntu6/debian/README.Debian debtags-2.1.2/debian/README.Debian --- debtags-2.0.1ubuntu6/debian/README.Debian 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/debian/README.Debian 2016-08-09 11:55:48.000000000 +0000 @@ -1,22 +1,18 @@ debtags for Debian ------------------ -Some links if you want to know more about Debtags: +If you want to know more about Debtags please visit the Debtags website: - The Debtags website - http://debtags.alioth.debian.org + https://wiki.debian.org/Debtags - An introductory paper about Debtags, written for Debconf5 - http://debtags.alioth.debian.org/paper-debtags.html +In which you can find an introductory paper about Debtags, written for +Debconf5, also available in text format in: - (also available in text format in - /usr/share/doc/debtags/paper-debtags.rst.gz) - - My Debtags talk at Debconf 5 (includes slides and video of the presentation) - http://people.debian.org/~enrico/talks/20050710-Debconf/ + /usr/share/doc/debtags/paper-debtags.rst.gz +and my Debtags talk at Debconf 5 (includes slides and video of the +presentation). You can have a look at the manpage for some example queries. - -- Enrico Zini , Sun Jul 31 16:06:49 CEST 2005 diff -Nru debtags-2.0.1ubuntu6/debian/rules debtags-2.1.2/debian/rules --- debtags-2.0.1ubuntu6/debian/rules 2015-10-28 10:03:01.000000000 +0000 +++ debtags-2.1.2/debian/rules 2016-08-09 11:55:48.000000000 +0000 @@ -1,11 +1,11 @@ #!/usr/bin/make -f %: - dh $@ --with=python2,python3 --buildsystem=pybuild --with bash-completion + dh $@ --with=python3 --buildsystem=pybuild --with bash-completion override_dh_auto_build: - ./rebuild-manpages - make -C doc + help2man --name="Debian Package Tags support tools" --section=1 --no-info --opt-include=doc/debtags-man-hooks ./debtags > debian/debtags.1 + dh_auto_build override_dh_fixperms: dh_fixperms @@ -18,3 +18,10 @@ gbp buildpackage -S -us -uc rm -f ../$(RELEASE_PACKAGE)_$(VERSION)_source.changes +# Download the tags and vocabulary files for a new release. +# +release: + curl https://anonscm.debian.org/cgit/debtags/tagdb.git/plain/tags | tagcoll copy | gzip -n9 > tags-current.gz + curl https://anonscm.debian.org/cgit/debtags/vocabulary.git/plain/debian-packages > vocabulary + curl https://anonscm.debian.org/cgit/debtags/vocabulary.git/plain/security-team >> vocabulary + dch --release diff -Nru debtags-2.0.1ubuntu6/debtags debtags-2.1.2/debtags --- debtags-2.0.1ubuntu6/debtags 2015-10-28 10:02:36.000000000 +0000 +++ debtags-2.1.2/debtags 2016-08-09 11:55:48.000000000 +0000 @@ -19,7 +19,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -from __future__ import print_function import argparse import sys import logging @@ -34,7 +33,7 @@ from collections import Counter, deque import tempfile -VERSION = "2.0" +VERSION = "2.1" DEBTAGS_TAGS = "/var/lib/debtags/package-tags" DEBTAGS_VOCABULARY = "/var/lib/debtags/vocabulary" @@ -258,7 +257,12 @@ for pkg in cache: cand = pkg.candidate if not cand: continue - tags = tags_from_apt_record(cand.record) + + try: + tags = tags_from_apt_record(cand.record) + except UnicodeDecodeError: + tags = set() + yield pkg.name, tags def get_tag_output_func(self, args, default=output_tag_tagcoll): @@ -526,21 +530,12 @@ @Action.register class Submit(Action): """ - Upload the given patch file to the central tag repository - (uses debtags-submit-patch) + (no longer supported) + see https://debtags.debian.org/api/patch for patch submit. """ def main(self, args): - cmd = ["debtags-submit-patch"] - if args.verbose: - cmd.append("--verbose") - cmd.append(args.patchfile) - os.execvp("debtags-submit-patch", cmd) - - @classmethod - def setup_parser(cls, subparsers): - sp = super().setup_parser(subparsers) - sp.add_argument("patchfile", action="store", help="pathname of the tag diff file to submit") - return sp + raise Fail("debtags submit is no longer supported." + " see https://debtags.debian.org/api/patch for patch submit.") @Action.register @@ -557,7 +552,7 @@ @Action.register class TagShow(Action): """ - Show the vocabulary informations about a tag + Show the vocabulary information about a tag """ def main(self, args): found = False @@ -606,8 +601,7 @@ class Update(Action): """ Updates the package tag database (requires root) - Collect package tag data from the sources listed in - /etc/debtags/sources.list, then regenerate the debtags + Collect package tag data from apt cache, regenerate the debtags tag database and main index. It needs to be run as root """ Binary files /tmp/tmpYFEeYO/IP_5zOxoeZ/debtags-2.0.1ubuntu6/debtagsc and /tmp/tmpYFEeYO/XH2XupaAPi/debtags-2.1.2/debtagsc differ diff -Nru debtags-2.0.1ubuntu6/debtags-hardware debtags-2.1.2/debtags-hardware --- debtags-2.0.1ubuntu6/debtags-hardware 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/debtags-hardware 1970-01-01 00:00:00.000000000 +0000 @@ -1,167 +0,0 @@ -#!/usr/bin/python - -# debtags-hardware: detect what hardware tags apply to the current system -# -# Copyright (C) 2012 Enrico Zini -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -import pwd -import os -import sys -import hashlib -import urllib -import urllib2 -import json -import logging - -log = logging.getLogger(sys.argv[0]) - -def list_packages(opts): - from debtagshw import debtagshw - hw = debtagshw.DebtagsAvailableHW() - - from debian import debtags - import apt - cache = apt.Cache() - - db = debtags.DB() - with open("/var/lib/debtags/package-tags", "r") as fd: - db.read(fd) - - for status, tags in hw.generate_tag_expressions(): - if opts.incompatible: - if status != debtagshw.HardwareSupported.NO: continue - else: - if status != debtagshw.HardwareSupported.YES: continue - pkgsets = [db.packages_of_tag(t) for t in tags] - res = set(pkgsets[0]) - for s in pkgsets[1:]: - res &= s - if not res: continue - print "#" - print "# Packages for %s:" % ",".join(sorted(tags)) - print "#" - for pkg in sorted(res): - try: - # FIXME: I wish I had cache.get(pkg, None) - p = cache[pkg] - except KeyError: - continue - if opts.installed and not p.is_installed: continue - if opts.uninstalled and p.is_installed: continue - ver = p.candidate - print p.name, "-", ver.summary - -def pkgreport(opts): - from debtagshw import debtagshw - hw = debtagshw.DebtagsAvailableHW() - - from debian import debtags - import apt - cache = apt.Cache() - - db = debtags.DB() - with open("/var/lib/debtags/package-tags", "r") as fd: - db.read(fd) - - class Pkginfo(object): - def __init__(self, name): - self.pkg = cache[name] - self.rules = [] - - pkgs = dict() - seen_tags = set() - - for status, tags in hw.generate_tag_expressions(): - seen_tags.update(tags) - pkgsets = [db.packages_of_tag(t) for t in tags] - res = set(pkgsets[0]) - for s in pkgsets[1:]: - res &= s - if not res: continue - for name in res: - info = pkgs.get(name, None) - if info is None: - try: - info = Pkginfo(name) - except KeyError: - continue - pkgs[name] = info - info.rules.append((status, tags)) - - for name, info in sorted(pkgs.iteritems()): - print info.pkg.name, "-", info.pkg.candidate.summary - print " ", ", ".join(sorted(t for t in db.tags_of_package(name) if t in seen_tags)) - # Use the following line instead if you want to see all tags of package - # print " ", ", ".join(sorted(db.tags_of_package(name))) - for status, tags in info.rules: - print " ", status, ", ".join(sorted(tags)) - print - -if __name__ == "__main__": - from optparse import OptionParser - import sys - - VERSION="1.8" - - class Parser(OptionParser): - def error(self, msg): - sys.stderr.write("%s: error: %s\n\n" % (self.get_prog_name(), msg)) - self.print_help(sys.stderr) - sys.exit(2) - - parser = Parser(usage="usage: %prog [options]", - version="%prog "+ VERSION, - description="Detects what tag combinations make sense for the current system.") - parser.add_option("-q", "--quiet", action="store_true", - help="quiet mode: only output errors.") - parser.add_option("-v", "--verbose", action="store_true", - help="verbose mode: output progress and non-essential information.") - parser.add_option("-d", "--debug", action="store_true", - help="debug mode: output debug informationn.") - parser.add_option("--packages", action="store_true", - help="show packages for all tags found.") - parser.add_option("--incompatible", action="store_true", - help="show packages that would not work instead of those that would work.") - parser.add_option("--installed", action="store_true", - help="show only installed packages.") - parser.add_option("--uninstalled", action="store_true", - help="show only uninstalled packages.") - parser.add_option("--pkgreport", action="store_true", - help="show a details reports of what packages match what rules and why.") - (opts, args) = parser.parse_args() - - #FORMAT = "%(asctime)-15s %(levelname)s %(message)s" - FORMAT = "%(message)s" - if opts.quiet: - logging.basicConfig(level=logging.ERROR, stream=sys.stderr, format=FORMAT) - elif not opts.verbose: - logging.basicConfig(level=logging.WARNING, stream=sys.stderr, format=FORMAT) - elif opts.debug: - logging.basicConfig(level=logging.DEBUG, stream=sys.stderr, format=FORMAT) - else: - logging.basicConfig(level=logging.INFO, stream=sys.stderr, format=FORMAT) - - if opts.packages: - list_packages(opts) - elif opts.pkgreport: - pkgreport(opts) - else: - from debtagshw import debtagshw - hw = debtagshw.DebtagsAvailableHW() - - for status, tag in hw.generate_tag_expressions(): - print status, tag diff -Nru debtags-2.0.1ubuntu6/debtagshw/debtagshw.py debtags-2.1.2/debtagshw/debtagshw.py --- debtags-2.0.1ubuntu6/debtagshw/debtagshw.py 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/debtagshw/debtagshw.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ -# debtagshw: lib to detect what hardware tags apply to the current system -# -# Copyright (C) 2012 Canonical -# -# Author: -# Michael Vogt -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import - -import logging -LOG=logging.getLogger(__name__) - -# get the detectors lib -from . import detectors - -from .enums import HardwareSupported - -class DebtagsAvailableHW(object): - """ Match the currents system hardware to debtags """ - - def __init__(self): - self._init_detectors() - - def _init_detectors(self): - self._detectors = detectors.get_detectors() - - # public functions - def get_hardware_support_for_tags(self, tags_list): - """ Check list of tags against the hardware of the system. - - Check the given tag list and return a dict of: - "tag" -> HardwareSupported.{YES,NO,UNKOWN} - """ - result = {} - for tag in tags_list: - if not tag.startswith("hardware::"): - continue - result[tag] = self._check_hw_debtag(tag) - return result - - def generate_tag_expressions(self): - """ - Generate a sequence of (HardwareSupported, taglist) - - HardwareSupported is one of the constants defined in HardwareSupported - - taglist is a sequence of tags that applies or does not apply to the - current system. - - The resulting positive or negative tag lists can be used to evaluate - whether a package is suitable or not for the current system, or to list - uninstalled packages that could use the hardware of the current system. - """ - for detector in self._detectors: - for supported, tags in detector.generate_tag_expressions(): - yield supported, tags - - def get_supported_tags(self): - supported_tags = [] - for detector in self._detectors: - supported_tags += detector.get_supported_tags() - return supported_tags - - # private - def _check_hw_debtag(self, tag): - """ helper that checks a individual tag for support """ - # ask each detector - res = HardwareSupported.UNKNOWN - for detector in self._detectors: - res = detector.is_supported(tag) - if res != HardwareSupported.UNKNOWN: - break - return res - - diff -Nru debtags-2.0.1ubuntu6/debtagshw/detectors.py debtags-2.1.2/debtagshw/detectors.py --- debtags-2.0.1ubuntu6/debtagshw/detectors.py 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/debtagshw/detectors.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,256 +0,0 @@ -# detectors: lib to detect what hardware tags apply to the current system -# -# Copyright (C) 2012 Canonical -# -# Author: -# Michael Vogt -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import - -import logging -import os -import subprocess - -LOG=logging.getLogger(__name__) - -try: - from gi.repository import GUdev - HAVE_GUDEV = True -except ImportError: - HAVE_GUDEV = False - -from .enums import HardwareSupported -from . import opengl - -class Detector(object): - """ Base detector class """ - - # helper functions for tags have this prefix, so the code can find them - # via introspecton, e.g. - # hardware::video:opengl -> _run_check_hardware__video_opengl - CHECK_FUNCTION_PREFIX = "_run_check_" - - def is_supported(self, tag): - """ check if the given tag is supported, returns a - HardwareSupported class - """ - f = self._get_func_for_tag(tag) - if f: - return f() - return HardwareSupported.UNKNOWN - - def generate_tag_expressions(self): - """ Generate debtags expressions for the given HW """ - for tag in self.get_supported_tags(): - res = self.is_supported(tag) - if res == HardwareSupported.UNKNOWN: - continue - yield res, [tag] - - def get_supported_tags(self): - """ return list of supported tags by this detector """ - supported = [] - for name in dir(self): - tag = self._get_tag_for_func(name) - if tag: - supported.append(tag) - return supported - - # private helpers - def _has_func_for_tag(self, tag): - return hasattr(self, "%s%s" % ( - self.CHECK_FUNCTION_PREFIX, tag.replace(":", "_"))) - - def _get_func_for_tag(self, tag): - return getattr(self, "%s%s" % ( - self.CHECK_FUNCTION_PREFIX, tag.replace(":", "_")), None) - - def _get_tag_for_func(self, func_name): - if not func_name.startswith("%shardware" % self.CHECK_FUNCTION_PREFIX): - return None - tag = func_name[len(self.CHECK_FUNCTION_PREFIX):].replace("_",":") - return tag - - -class DetectorUdev(Detector): - """ detect hardware based on udev """ - - DEBTAG_TO_UDEV_PROPERTY = { - # storage - "hardware::storage:cd" : "ID_CDROM", - "hardware::storage:cd-writer" : "ID_CDROM_CD_R", - "hardware::storage:dvd" : "ID_CDROM_DVD", - "hardware::storage:dvd-writer" : "ID_CDROM_DVD_R", - # input - "hardware::input:touchscreen" : "ID_INPUT_TOUCH", - "hardware::input:mouse" : "ID_INPUT_MOUSE", - "hardware::input:keyboard" : "ID_INPUT_KEYBOARD", - "hardware::input:joystick" : "ID_INPUT_JOYSTICK", - # digicam - "hardware::digicam" : "ID_GPHOTO2", - } - - DEBTAG_TO_ID_TYPE = { - # webcam - 'hardware::webcam' : 'video', - # floppy - 'hardware::floppy' : 'floppy', - } - - # all tags this class knows about - SUPPORTED_TAGS = list(DEBTAG_TO_UDEV_PROPERTY.keys()) + \ - list(DEBTAG_TO_ID_TYPE.keys()) - - def __init__(self): - if HAVE_GUDEV: - self._uc = GUdev.Client() - else: - self._uc = None - - def is_supported(self, tag): - LOG.debug("DetectorUdev.is_supported: '%s'" % tag) - if self._uc is None: - return HardwareSupported.UNKNOWN - for device in self._uc.query_by_subsystem(None): - #print device.get_property_keys(), device.get_property("DEVPATH") - # supported a (theoretical at this point) udev property that - # sets the debtag tag directly - if device.has_property("HW_DEBTAGS"): - return tag in device.get_property("HW_DEBTAGS") - # use our own device detection magic - prop = self.DEBTAG_TO_UDEV_PROPERTY.get(tag) - if prop and device.has_property(prop): - #print device.get_property(prop) - if bool(device.get_property(prop)): - return HardwareSupported.YES - else: - return HardwareSupported.NO - # use ID_TYPE - if device.has_property("ID_TYPE"): - id_type = device.get_property("ID_TYPE") - if (tag in self.DEBTAG_TO_ID_TYPE and - id_type == self.DEBTAG_TO_ID_TYPE[tag]): - return HardwareSupported.YES - # if we know about the tag and did not find it, return NO - # (LP: #1020057) - if tag in self.SUPPORTED_TAGS: - return HardwareSupported.NO - # otherwise its UNKNOWN - return HardwareSupported.UNKNOWN - - def get_supported_tags(self): - return self.SUPPORTED_TAGS - - -class DetectorCmdline(Detector): - """ detect hardware using cmdline helpers """ - - LAPTOP_DETECT = "/usr/sbin/laptop-detect" - SCANIMAGE = ["scanimage", "-L"] - - # hardware::laptop - def _run_check_hardware__laptop(self): - if os.path.exists(self.LAPTOP_DETECT): - if subprocess.call([self.LAPTOP_DETECT]) == 0: - return HardwareSupported.YES - else: - return HardwareSupported.NO - else: - LOG.warn( - "No laptop-detect '%s' helper found" % self.LAPTOP_DETECT) - return HardwareSupported.UNKOWN - - # hardware::scanner - def _run_check_hardware__scanner(self): - # note that this is slow to run (1-2s) - #ver = c_int() - #devices = c_long() - #sane = cdll.LoadLibrary("libsane.so.1") - #res = sane.sane_init(byref(ver), None) - #print res, ver - #if not res == SANE_STATUS_GOOD: - # return False - #print res - #sane.sane_get_devices(byref(devices), False) - # device is SANE_device** device_list how to get data? - # - # Note: you can use multiprocessing.Pool.map to run all checks in - # parallel - try: - output = subprocess.check_output(self.SCANIMAGE, - universal_newlines=True) - if output.startswith("device"): - return HardwareSupported.YES - else: - return HardwareSupported.NO - except Exception: - LOG.warn("error running '%s'" % self.SCANIMAGE) - return HardwareSupported.UNKNOWN - -class DetectorCtypes(Detector): - """ detect hardware using ctypes c calls """ - - def __init__(self): - self.TAG_TO_FUNC = { - 'hardware::video:opengl' : self._is_supported, - } - - def _is_supported(self): - return opengl.run_check() - - def is_supported(self, tag): - if tag in self.TAG_TO_FUNC: - func = self.TAG_TO_FUNC[tag] - res = func() - if res is True: - return HardwareSupported.YES - elif res is False: - return HardwareSupported.NO - return HardwareSupported.UNKNOWN - - def get_supported_tags(self): - return list(self.TAG_TO_FUNC.keys()) - - -class DetectorPython(Detector): - """ detect hadware using python imports """ - - # hardware::printer - def _run_check_hardware__printer(self): - try: - # alternative use lpstat -p - import cups - c = cups.Connection() - if len(c.getPrinters()) > 0: - return HardwareSupported.YES - else: - return HardwareSupported.NO - except ImportError: - LOG.warn("No python-cups installed") - except: - LOG.exception("_run_cups_check") - return HardwareSupported.UNKNOWN - - -def get_detectors(): - """ hepler that returns a list of all lowlevel detector classes """ - # introspect the detectors modules to load all availalbe detectors - detectors = [] - for name, klass in globals().items(): - if name.startswith("Detector"): - detectors.append(klass()) - return detectors diff -Nru debtags-2.0.1ubuntu6/debtagshw/enums.py debtags-2.1.2/debtagshw/enums.py --- debtags-2.0.1ubuntu6/debtagshw/enums.py 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/debtagshw/enums.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -# detectors: lib to detect what hardware tags apply to the current system -# -# Copyright (C) 2012 Canonical -# -# Author: -# Michael Vogt -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -class HardwareSupported: - """ Small enum type class with YES,NO,UNKNOWN values """ - YES = "yes" - NO = "no" - UNKNOWN = "unknown" diff -Nru debtags-2.0.1ubuntu6/debtagshw/__init__.py debtags-2.1.2/debtagshw/__init__.py --- debtags-2.0.1ubuntu6/debtagshw/__init__.py 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/debtagshw/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -# debtagshw: lib to detect what hardware tags apply to the current system -# -# Copyright (C) 2012 Canonical -# -# Author: -# Michael Vogt -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff -Nru debtags-2.0.1ubuntu6/debtagshw/opengl.py debtags-2.1.2/debtagshw/opengl.py --- debtags-2.0.1ubuntu6/debtagshw/opengl.py 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/debtagshw/opengl.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,249 +0,0 @@ -# debtagshw: lib to detect what hardware tags apply to the current system -# -# Copyright (C) 2012 Canonical -# -# Author: -# Michael Vogt -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import print_function - -import logging -import multiprocessing -import os -import sys - -LOG=logging.getLogger(__name__) - -class OpenGLError(Exception): - pass - -class OpenGL(object): - - # 3d driver detection data, map render/vendor string to driver - RENDERER_TO_DRIVER = [ - # from tools/unity_support_test.c in the nux-tools pkg - ("Software Rasterizer", "sw"), - ("Mesa X11", "sw"), - ("on softpipe", "sw"), - ("on llvmpipe", "sw"), - # real drivers - ("AMD", "amd"), - ("Intel(R)", "intel"), - ] - - VENDOR_TO_DRIVER = [ - ("nouveau", "nouveau"), - ("NVIDIA Corporation", "nvidia"), - # this is strange, fglrxinfo returns this vendor - ("Advanced Micro Devices, Inc.", "fglrx"), - # but glxinfo/the ctypes based code this one, so we support both - ("ATI Technologies Inc.", "fglrx"), - ] - - # from /usr/include/GL/glx.h - GLX_VENDOR=1 - GLX_VERSION=2 - GLX_EXTENSIONS=3 - - # for the visinfo - GLX_RGBA = 4 - GLX_RED_SIZE = 8 - GLX_GREEN_SIZE = 9 - GLX_BLUE_SIZE = 10 - GLX_DOUBLEBUFFER = 5 - - # GL, from /usr/include/GL/gl.h - GL_VENDOR = 0x1F00 - GL_RENDERER = 0x1F01 - GL_VERSION = 0x1F02 - GL_EXTENSIONS = 0x1F03 - - def __init__(self, direct_rendering=True): - self.direct = direct_rendering - - def _find_opengl_lib_path(self): - """ This is a helper for the fglrx case """ - # fglrx puts its own libGL.so under a private directory and plays - # tricks with /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf to - # make it the default libGL.so but apparently the cdll.LoadLibrary - # does not support the ld.so.conf.d directory (yet?) - if os.path.exists("/usr/lib/fglrx/libGL.so.1"): - return "/usr/lib/fglrx/libGL.so.1" - return "libGL.so.1" - - def _get_opengl_vendor_renderer_version_tuple(self): - """ returns a vendor, renderer, version tuple """ - from ctypes import cdll, c_char, c_char_p, c_int, byref - # load stuff - x11 = cdll.LoadLibrary("libX11.so.6") - glx = cdll.LoadLibrary(self._find_opengl_lib_path()) - # get display - display = x11.XOpenDisplay("") - if not display: - return None, None, None - # get extenstion - dummy1 = c_char() - dummy2 = c_char() - res = glx.glXQueryExtension(display, byref(dummy1), byref(dummy2) ) - if not res: - return None, None, None - # get screen and window - screen = x11.XDefaultScreen(display) - root = x11.XRootWindow(display, screen) - # create a window to make glGetString work - attribSingleType = c_int * 8 - attribSingle = attribSingleType( - self.GLX_RGBA, - self.GLX_RED_SIZE, 1, - self.GLX_GREEN_SIZE, 1, - self.GLX_BLUE_SIZE, 1, - 0) - visinfo = glx.glXChooseVisual(display, 0, attribSingle) - if not visinfo: - attribDoubleType = c_int * 9 - attribDouble = attribDoubleType( - self.GLX_RGBA, - self.GLX_RED_SIZE, 1, - self.GLX_GREEN_SIZE, 1, - self.GLX_BLUE_SIZE, 1, - self.GLX_DOUBLEBUFFER, - 0) - visinfo = glx.glXChooseVisual(display, 0, attribDouble) - if not visinfo: - raise OpenGLError("Can not get visinfo") - # create context etc - context = glx.glXCreateContext (display, visinfo, None, self.direct) - if not context: - raise OpenGLError("Can not create glx context") - # make root current - glx.glXMakeCurrent(display, root, context) - # and get the actual useful gl data - glx.glGetString.restype = c_char_p - - opengl_tuple = [] - for gl_item in ["vendor", "renderer", "version", "extensions"]: - gl_hex = getattr(self, "GL_%s" % gl_item.upper()) - gl_string = glx.glGetString(gl_hex) - if sys.version > '3': - gl_string = gl_string.decode() - if gl_item == "extensions": - LOG.debug("gl %s: %s" % (gl_item, gl_string)) - else: - LOG.info("gl %s: %s" % (gl_item, gl_string)) - opengl_tuple.append(gl_string) - return opengl_tuple[:3] - - def opengl_driver(self): - vendor, renderer, version = self._get_opengl_vendor_renderer_version_tuple() - if not renderer: - return "sw" - # check the vendor string - for search_str, driver in self.VENDOR_TO_DRIVER: - if search_str in vendor: - return driver - # and the renderer too - for search_str, driver in self.RENDERER_TO_DRIVER: - if search_str in renderer: - return driver - return "unknown" - - def opengl_version(self): - vendor, renderer, version = self._get_opengl_vendor_renderer_version_tuple() - if not version: - return "unknown" - opengl_version = version.split(" ")[0] - return opengl_version - - def opengl_supported(self): - driver = self.opengl_driver() - # sw driver is not good enough - if driver == "sw": - return False - # stuff looks ok - return True - - -# private helpers - -def _apply_in_multiprocessing_pool(func): - """ private helper to run the given func in a multiprocessing env - to protect against segfaults in the ctypes code """ - # Launch in a seperate subprocess, since the ctypes opengl stuff might - # be fragile (segfault happy). A multiprocessing.Pool would be easier, - # but for me it caused "hangs" when the child segfaults, so use this - # (rather more cumbersome) approach - # multiprocessing is python 2.6+ - queue = multiprocessing.Queue() - p = multiprocessing.Process(target=func, args=(queue,)) - p.start() - p.join() - if p.exitcode < 0: - LOG.warn("function: '%s' return exitcode '%s" % (func, p.exitcode)) - if queue.empty(): - return None - return queue.get() -def _do_run_check(queue): - """ private helper run inside the "Process" context for extra robustness - against segfaults """ - oh = OpenGL() - queue.put(oh.opengl_supported()) -def _do_get_version(queue): - """ private helper run inside the "Process" context for extra robustness - against segfaults """ - oh = OpenGL() - queue.put(oh.opengl_version()) -def _do_get_driver(queue): - """ private helper run inside the "Process" context for extra robustness - against segfaults """ - oh = OpenGL() - queue.put(oh.opengl_driver()) - -# public API -def run_check(): - """ get the current 3d driver or "unknown" """ - try: - return _apply_in_multiprocessing_pool(_do_run_check) - except OSError: - return None - -def get_driver(): - """ get the current 3d driver or "unknown" """ - try: - return _apply_in_multiprocessing_pool(_do_get_driver) - except OSError: - return None - -def get_version(): - """ Get the maximum opengl version supported or "unknown" - - Note that this is not a float number because values like - 4.2.2 are supported. It should probably be compared using - something like apt_pkg.version_compare() - """ - try: - return _apply_in_multiprocessing_pool(_do_get_version) - except OSError: - return None - -if __name__ == "__main__": - logging.basicConfig(level=logging.INFO) - supported = run_check() - driver = get_driver() - version = get_version() - print("opengl_supported: ", supported) - print("opengl_driver: ", driver) - print("opengl_version: ", version) diff -Nru debtags-2.0.1ubuntu6/debtags-submit-patch debtags-2.1.2/debtags-submit-patch --- debtags-2.0.1ubuntu6/debtags-submit-patch 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/debtags-submit-patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,130 +0,0 @@ -#!/usr/bin/python - -# debtags-submit-patch: submit a tag patch to the debtags website -# -# Copyright (C) 2007--2012 Enrico Zini -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -import pwd -import os -import sys -import hashlib -import urllib -import urllib2 -import json -import logging - -log = logging.getLogger(sys.argv[0]) - -SUBMIT_URL = "http://debtags.debian.net/api/patch" - -def make_default_tag(): - "Autogenerate a mostly persistant, non-trackable tag" - m = hashlib.md5() - m.update(":".join(str(x) for x in pwd.getpwuid(os.getuid()))) - return m.hexdigest()[:20] - -def submit(opts, patch, fname="[stdin]"): - log.info("Submitting patch %s to %s...", fname, opts.url) - try: - conn = urllib2.urlopen(opts.url, - urllib.urlencode(( - ("tag", opts.tag), - ("patch", patch), - ))) - res = json.load(conn) - for note in res.get("notes", ()): - log.warn("%s: %s", fname, note) - - for pkg, tags in sorted(res.get("pkgs", {}).iteritems()): - log.info("%s: %s: %s", fname, pkg, ", ".join(tags)) - - if opts.dump_http_error: - try: - os.unlink(opts.dump_http_error) - except OSError: - pass - except urllib2.HTTPError, e: - log.error("%s", str(e)) - if opts.dump_http_error: - with open(opts.dump_http_error, "w") as fd: - fd.write(e.read()) - - -if __name__ == "__main__": - from optparse import OptionParser - import sys - - VERSION="1.8" - - class Parser(OptionParser): - def print_help(self, out=None): - if out is None: out = sys.stdout - OptionParser.print_help(self, out) - print >>out, """Patch files can be generated with 'debtags diff' or 'tagcoll diff'. - -Patch submissions are marked with a tag of your choice. It does not need to -identify yourself (but feel free to use your email address), but reusing your -tag allows to handle all your edits as if they were a single one. This helps -greatly when tags are reviewed. - -By default, a mostly persistent but anonymous tag is generated by hashing your -passwd entry. -""" - def error(self, msg): - sys.stderr.write("%s: error: %s\n\n" % (self.get_prog_name(), msg)) - self.print_help(sys.stderr) - sys.exit(2) - - parser = Parser(usage="usage: %prog [-t TAG] [options] [patchfile [patchfile...]]", - version="%prog "+ VERSION, - description="Submits a tag patch to the Debtags website." - " Each patch file is submitted in a different query.") - parser.add_option("-t", "--tag", action="store", metavar="tag", default=make_default_tag(), - help="tag the patch with the given string (default: %default).") - parser.add_option("-q", "--quiet", action="store_true", - help="quiet mode: only output errors.") - parser.add_option("-v", "--verbose", action="store_true", - help="verbose mode: output progress and non-essential information.") - parser.add_option("--stdin", action="store_true", - help="read patch from standard input.") - parser.add_option("--url", action="store", metavar="url", default=SUBMIT_URL, - help="URL to submit to (default: %default).") - parser.add_option("--dump-http-error", action="store", metavar="file", - help="if the server returns an error, dump the contents" - "of the error page to the given file (default:" - "discard the error page).") - (opts, args) = parser.parse_args() - - #FORMAT = "%(asctime)-15s %(levelname)s %(message)s" - FORMAT = "%(message)s" - if opts.quiet: - logging.basicConfig(level=logging.ERROR, stream=sys.stderr, format=FORMAT) - elif not opts.verbose: - logging.basicConfig(level=logging.WARNING, stream=sys.stderr, format=FORMAT) - else: - logging.basicConfig(level=logging.INFO, stream=sys.stderr, format=FORMAT) - - if opts.stdin: - patch = sys.stdin.read() - submit(opts, patch) - elif args: - for fname in args: - with open(fname, "r") as fd: - patch = fd.read() - submit(opts, patch, fname) - else: - parser.error("please invoke with a patch file name or use --stdin.") diff -Nru debtags-2.0.1ubuntu6/doc/debtags-man-hooks debtags-2.1.2/doc/debtags-man-hooks --- debtags-2.0.1ubuntu6/doc/debtags-man-hooks 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/doc/debtags-man-hooks 2016-08-09 11:55:48.000000000 +0000 @@ -22,8 +22,8 @@ # Update the package tag database debtags update - # Show apt-cache informations about the mutt package, - # adding tag informations + # Show apt-cache information about the mutt package, + # adding tag information debtags show mutt # Search the tag vocabulary for mail-related tags diff -Nru debtags-2.0.1ubuntu6/doc/paper-debtags.html debtags-2.1.2/doc/paper-debtags.html --- debtags-2.0.1ubuntu6/doc/paper-debtags.html 1970-01-01 00:00:00.000000000 +0000 +++ debtags-2.1.2/doc/paper-debtags.html 2015-08-04 08:29:46.000000000 +0000 @@ -0,0 +1,1318 @@ + + + + + + + + + + +
+ + +
+

A cute introduction to Debtags

+ +++ + + + + + + + + + + + + + +
Author:

Enrico Zini

+
Contact:

enrico@debian.org

+
Revision:

$Revision: 1.0 $

+
Date:

$Date: 2005/05/31 23:02:42 $

+
Copyright:

GNU GPL v2 or later.

+
Abstract:

The Debian archive is getting larger and larger, and the software more and +more diverse and complex. Organising software in the archive is difficult, +and the existing section system, designed to cope with a much smaller number +of packages, is no longer sufficient. The goal of Debtags is to provide a +working alternative for categorising software that can cope with our numbers.

+

The core idea of Debtags is to adapt the technique of Faceted Classification +to be used for our packages. Faceted Classification is a 70-years-old +library science technique which is being rediscovered and loved by +modern Information Architects.

+

Debags attaches categories (we call them tags) to +packages, creating a new set of useful structured metadata that can be +used to implement more advanced ways of presenting, searching, +maintaining and navigating the package archive.

+

Example uses of Debtags include searching for software, browsing the archive, +and filtering out unwanted groups of packages.

+

The Debtags effort needs to face three major problems:

+
    +
  1. Creating a suitable vocabulary of categories.
  2. +
  3. Categorizing the vast array of packages.
  4. +
  5. Having applications make use of Debtags data.
  6. +
+

All three issues are being actively addressed with good results:

+
    +
  • Debtags has already acquired a large set of tags, even if the set is in +continuous need of refining;
  • +
  • a large part of our package archive has been at least partially categorised, +and there is a tool called debtags-edit that every developer and user can +use to categorise the packages they know best;
  • +
  • a new library called libapt-front is being developed as a smart front-end +to libapt which can also access other data sources, such as Debtags, +popularity contest (popcon) results, debram metadata and more.
  • +
+

This paper gives a broad technical overview of the Debtags project, +its theoretical foundations, and the tools available for it now. The +paper also offers some practical tutorials on how to do all sort of +nice Debtags tricks.

+
+ + +
+

Introduction

+
+

Lots and lots of packages

+

As of May 24, 2005, my Debian unstable system counts 16769 different +binary packages, and I feel very powerful.

+

I can access at least three complete office suites, various painting programs +(of which at least one is designed for kids and one for world-famous digital +effect movie studios), software for massively parallel quantum chemistry, GIS +geographical tools, dental office management software, and, my favourite, a +tool to have a cute cow read my presentations:

+
+ ________________________________
+/ a tool to have a cute cow read \
+\ my presentations:              /
+ --------------------------------
+        \   ^__^
+         \  (oo)\_______
+            (__)\       )\/\
+                ||----w |
+                ||     ||
+
+

As a Debian user, I am very powerful. However, there is a simple question that +I'm having a hard time answering:

+
+What do you want to install in your computer?
+
+[ ] 3dchess      3D chess for X11
+[ ] 3ddesktop    "Three-dimensional" desktop switcher
+[ ] 44bsd-rdist  4.4BSD rdist.
+[ ] 6tunnel      TCP proxy for non-IPv6 applications
+    [... 16765 more options follow ...]
+
+

And another one:

+
+What do you want to remove from your system to make up some space?
+
+[1563 options follow]
+
+

If I search the package archive, I get:

+
    +
  • apt-cache search web browser: 197 results.
  • +
  • apt-cache search text editor: 170 results.
  • +
  • apt-cache search image editor: 22 results, but Gimp is NOT among them.
  • +
+

Now, I profoundly believe that having choice is really good: what we need is not +to reduce the size of the archive, but to create some way to make it easier for +people to find what they need.

+

What does it mean, "make it easier"? Here is a nice measure: "in front of a +list with more than about 7 plus or minus 2 items, our brain goes banana" +[ZEN] [MILLER].

+
+
+

Archive sections

+

The way we are currently organizing packages is by grouping them in +sections: Debian main has about 16197 binary packages divided in 33 +different sections. However, this means an average of 490 packages per +section, which is too many.

+

In fact the problem is even worse than this, because some sections are more +lightly subscribed than others. After all, the more packages a section has, +the more likely that the one package you want is found therein. By this +metric, the Debtags team calculates that the typical Debian package is found +in a section of 785 binaries. Such a number approaches the size of the +entire archive at the time when the section system was first introduced.

+

Increasing the number of sections would not help too much: to have an average +of 20 packages per section we would need 800 different sections: but then, how +does one choose among 800 sections?

+

Besides the numbers, current software is getting more and more complex: for +example, which section should a full-featured web browser such as Mozilla be +put in? net? web? mail?

+

Sections were fine when Debian was smaller and simpler. Now there is a bug +(#144046: Sections are not finely grained) asking for something better.

+

That bug has been assigned to Debtags. And Debtags is going to close it.

+
+
+
+

Debtags theoretical foundations

+

The original idea of Debtags' was just to allow more than one section +per package. That would have allowed us to categorize Mozilla under +net, web and mail simultaneously, allowing the user to find +it under whichever classification they had in mind.

+

That is how we started, and that is how we got stuck. What do we mean with +net? Some possibilities are:

+
    +
  • The package has a program that can use information not stored in the local +computer;
  • +
  • The package has code which invokes the socket() system call;
  • +
  • The package analyses firewall logs;
  • +
  • The package is useful to configure and maintain a network;
  • +
  • All of the above.
  • +
+

All of these are probably valid interpretations. And then, why shouldn't all +of Gnome belonging to net, since the 'N' in GNOME means 'Network'?

+

Classifying packages is a bigger problem than it seems at first sight. Luckily +I suspected that someone has been thinking about it already, and I did some +research.

+

It turned out that there is a whole new science calling "Information +Architecture" whose goal is to sort out the Information Mess of the Information +Age.

+

It also turned out that our problem had been solved somewhere in 1933, but they +forgot to leave me a note.

+
+

Classifying software

+
+ranganathan.png +

Shiyali Ramamrita Ranganathan

+
+

Once upon a time in India, a mathematician and librarian called Shiyali +Ramamrita Ranganathan started a secret project to innovate software +categorization for Debian. It was about 1931, and he did not want to use the +words "Debian" and "software" just yet, so he disguised all of his work under +words such as "library", "books" and "library science" [STECKEL].

+

Ranganathan is famous for his five laws of library science:

+
    +
  1. Books are for use.
  2. +
  3. Every reader his or her book.
  4. +
  5. Every book its reader.
  6. +
  7. Save the time of the reader.
  8. +
  9. The Library is a growing organism.
  10. +
+

If we do a simple word substitution, we obtain the perfect rules for +classifying Debian packages:

+
    +
  1. Software is for use.
  2. +
  3. Every user his or her software.
  4. +
  5. Every software its user.
  6. +
  7. Save the time of the user.
  8. +
  9. Debian is a growing organism.
  10. +
+

These rules look simple, yet they are important and deep: rule number 1 tells +us that software is there to be used, which means that people need to know +about it and find it. This is the main reason for organizing packages: to +allow people to use them.

+

Rules number 2 and 3 tell us that not every software is appropriate for every +user, and users need to be able not only to find software, but also to find the +software which is appropriate for them.

+

Rule number 4 tells us that the research must be quick and efficient, and the +user should not spend a lot of time trying to search through long lists of +packages, or learning a complicated search system.

+

Rule number 5 says that Debian keeps growing and evolving, and any system we +design will have to cope with that.

+

This is exactly the purpose of Debtags. Codified by Ranganathan in 1931.

+
+
+

Faceted Classification

+

Ranganathan has been working all his life to solve the problem of classifying +books in big libraries. To do so, he designed a system that he called +Faceted Classification or Colon Classification:

+
+

A faceted classification [is a way of classification that] uses clearly +defined, mutually exclusive, and collectively exhaustive aspects, properties, +or characteristics of a class or specific subject.

+

Wynar, Bohdan S. ''Introduction to cataloging and classification''. 8th +edition. p. 320

+
+

In other words, with faceted classification we have more than one set of +categories: one for each aspect of our packages. Every different aspect of +an object is described using a separate set of categories, called "facet".

+

Ranganathan has also given suggestions on how to identify the facets to +categorise. He suggested that there are 5 fundamental kinds of facets, which +are sometimes addressed as "PMEST" because of their initials:

+
+
+
Personality
+
what the object is primarily about. This is considered the "main +facet."
+
Matter
+
the material of the object.
+
Energy
+
the processes or activities that take place in relation to the object.
+
Space
+
where the object happens or exists.
+
Time
+
when the object occurs.
+
+
+

If at first sight this seems unrelated to software, remember that +Ranganathan was talking about books, and we need to do some mapping. For +example, pixelcharmer has been mapping the PMEST to blog entries:

+
    +
  • Personality = topic
  • +
  • Matter = form
  • +
  • Energy = process
  • +
  • Space = I don't believe I've used this facet, or perhaps it's the +permalink of the post itself? Yes, let's go with that for now.
  • +
  • Time = date
  • +
+

Let's follow her steps and map the PMEST to Debian packages:

+
+
+
Personality
+
What the package is primarily about. Answers the question what is it?
+
Matter
+
The "material" that constitutes the package. Answers the question what is +it made of?
+
Energy
+
The processes or activities that take place in relation to the object. +Answers the question what do I do with it?
+
Space
+
Where the object happens or exists. Answers the question where do I use +this?
+
Time
+
When the object occurs. I still haven't found a suitable mapping for +this: it might just be that Debian packages exist a bit outside of time, +and that would explain how come Sarge took so much to release.
+
+
+

In Debtags theoretical foundations I gave an example of many different ways to +interpret the section net. We can try to look at some of them again using +the PMEST:

+
    +
  • "The package has a program that can use information not stored in the local +computer". Is storing such information the main purpose of the program? +Then the program's personality would need to be categorised as related to +the network. Else, the program's energy would be categorised as +network-related instead.
  • +
  • The package has code which invokes the socket() system call. This is about +the matter of the package: the technology it uses, the functions it invokes.
  • +
  • The package analyses firewall logs. This would mean that the +personality, or the energy of the program is related to the network, but +not its matter: if we look at how the package is made, we mainly see a text +parser.
  • +
+

The PMEST is useful in that it gives us more mental structure to understand the +properties of an object and to resolve the ambiguities in its categorisation.

+
+
+

Some use case examples

+

Let's see how this could help, with three examples:

+
    +
  • User A wants to find a simple software to manage their collection of audio +CDs, which integrates nicely with his or her Gnome desktop;
  • +
  • Developer B wants to write a software to manage a collection of audio CDs, +and is looking for code and examples in existing applications and libraries;
  • +
  • System administrator C works for a radio broadcaster and wants to set up a mail +interface that allows people to search the radio collection of audio CDs; he +or she is looking for the right existing tools to get it done.
  • +
+

Now, let's look better at what they want:

+
    +
  • User A is interested in integration with Gnome, not implementation details.
  • +
  • Developer B mainly cares about implementation details, to find good examples +to build from.
  • +
  • System administrator C is only interested in commandline applications (no +matter how they are implemented) or alternatively perl libraries.
  • +
+

User A will probably start searching through Gnome software. User B will +probably start searching among software implemented in C. User C will probably +start searching for commandline tools. And they will probably all look for +software to manage an audio CD collection.

+

These three people are looking at the package archive from different angles.

+

Luckily, Faceted Classification does just that: it categorizes the items from +different aspects. If we do things right, there will be something like a +'Desktop' facet, an 'Implemented-in' facet, a 'Kind-of-interface' facet and a +'Purpose' facet, each of these facets categorised with their sets of tags; and +everyone will be able to find what they are looking for.

+
+
+

The design of Debtags

+

The key concepts of Debtags are Facets, Tags, the Vocabulary and the Tag +Database. Let's consider them one by one.

+
+

Facets

+

Facets are the aspects of our packages that we choose to categorise. Example +of facets in Debtags are implemented-in, culture, interface, +media.

+

Each facet defines an aspect of packages we look at. For each facet there is a +set of categories that we use to describe what we see when we look at that +aspect of a package.

+

Faceted categorization is like saying, "If I look at what is the use of this +package, I see editing". "If I look at what is its user interface, I see +a text-mode user interface".

+

Facets are "If I look at X"; tags are "I see X".

+

The list of facets currently categorised by Debtags is available in The +Vocabulary.

+
+
+

Tags

+

The tag is a Debtags category. Debtags uses different sets of categories, +that we call tags, to categorise different facets of software. +We use the word tags instead of categories because it's shorter, and we talk +about tags a lot.

+

In Debtags, we represent tags with a short English name, prefixed by the name +of the facet it categorises. For example, when we look at what media types a +package can work with and we categorise "The Gimp", we use the tag +media::rasterimage.

+
+
+

The Vocabulary

+

The Vocabulary is where we store the list of facets and tags that we +use for Debian packages.

+

Having a common vocabulary is important so that we all refer to the same +property with the same name. Other benefits of the common vocabulary +include the abilities to present selections of facets +and tags in a user interface, to store meta-information about them (such as a +short and long description, possibly in many languages), and to validate +classification information.

+

The Debtags vocabulary is the file that delineates the facets and +lists the respective tags that can be used to categorize Debian packages. +The vocabulary file contains whatever needs to be stored about facets and tags. +At the moment this means:

+
    +
  • a list of facets and their tags;
  • +
  • description of facets and tags;
  • +
  • editorial information;
  • +
  • comments.
  • +
+

This information is stored in a format similar to the usual Debian package +records. For example:

+
+Facet: implemented-in
+Description: Language that the package is implemented in
+Nature: matter
+Status: complete
+
+Tag: implemented-in::c++
+Description: C++
+
+

This defines a facet called implemented-in and a tag c++ inside it.

+

The main location of the vocabulary is in the subversion repository at +svn://svn.debian.org/debtags/vocabulary/debian-packages; from there, it +makes its way to the default Debtags tag source and then, by means of +debtags update, it is stored locally in /var/lib/debtags/vocabulary. +It is also indexed by debtags update to allow applications to quickly +lookup entries inside it.

+

There are currently 32 facets defined, containing a total of 440 tags. To see +the facets along with their descriptions and other data, you can run +debtags update and then use grep-dctrl:

+
+grep-dctrl -FFacet -r . /var/lib/debtags/vocabulary
+
+

A tutorial on sending patches to the vocabulary can be found at +http://debtags.alioth.debian.org/vocabulary.html

+
+
+

The tag database

+

A tag is assigned to a package by entering the appropriate information in the Tag Database.

+

Designing this database is one of the most tricky and important implementation +details of Debtags, as it is the way to share the tags and make them useful.

+

An obvious place for storing the tags is in the control file of the packages, +together with the other package metadata. This possibility has been +discarded, however, for a couple of good reasons:

+
    +
  • The aggregated package database is already big enough, and there are no clear +short term ways of addressing this problem
  • +
  • "Debian is a living organism": tags can change fairly often, +because the classification is refined, a new tag is introduced or a whole new +facet of packages is classified, and we cannot afford a new package upload or +ftpmaster intervention every time such a change happens.
  • +
+

We chose instead to store tag data in a central tag repository, located at +http://debian.vitavonni.de/packagebrowser, from which it can be downloaded in +the user's computer by means of the debtags update command, just like the +package database can be downloaded by means of apt-get update.

+

This makes it possible to store and maintain the categorization data without +causing an added burden to the Debian infrastructure. It also allows to have +different tag sources merged together. Check this out because it's cool!

+

Let's make an example with a fictitious Debian-Circus CDD (Custom Debian +Distribution) that chooses to categorise packages also from the aspect +("facet") of their possible use in a circus. To do so, they want to have in +Debtags a circus facet, categorised with tags such as travel-info, +installation-procedures, inventory, artist-management, +show-management, propaganda, accounting.

+

To realise this, Debian-Circus can create their own piece of Vocabulary and Tag +Database and make it available to be downloaded as a tag source. debtags +is able to download data from various tag sources (listed in +/etc/debtags/sources.list) and merge them together.

+

Different tag sources can be merged easily when facets differ, and they +complete each other's view of packages by shedding light on more aspects of +them.

+

Now, Debian-Circus provides categorization along the circus facet, and +Debian provides categorization for the suite and media facets. Any +circus sysadmin can now merge this information together and look for +circus::propaganda software for suite::gnome that can work with +media::vectorimage.

+

Isn't it exciting?

+

The main location of the database is inside Erich Schubert's packagebrowser +at http://debian.vitavonni.de/packagebrowser. From there, it makes its way to +the default Debtags tag source and then, by means of debtags update, it +is merged with other tag sources and stored locally in +/var/lib/debtags/package-tags.

+

The database is stored locally in an easily parsable format that can also be +understood by tools such as tagcoll and tagcolledit. It is also +indexed by debtags update to allow applications to look entries up +quickly in it.

+

The individual user can modify the Debtags database locally. Such local +modifications are stored as +tag patches in the file ~/.debtags/patch in the user's home +directory. A tag patch is a special patch format +that can represent a change to a tag database, and can also be applied to +future versions of the database, so that your changes are preserved across +debtags update invocations.

+

Another useful feature of the tag patches is that you can send them to +the central database, which will integrate them with the rest of the data. +You can do this by using debtags-edit (it has a "File/Mail changes to +central database" feature) or by using the command debtags send.

+
+
+
+
+

Using debtags

+

Debtags is not only categorization data, but also a suite of tools that allow +to work with the data:

+
+
debtags
+
Commandline interface to libdebtags functions and Debtags administration +tool.
+
debtags-edit
+
GUI application to search and tag packages.
+
tagcoll
+
Commandline tool to manipulate generic collections of tagged items.
+
tagcoll-edit
+
GUI application to perform mass-editing of collections of tagged items.
+
libtagcoll1
+
Library providing generic functions to manipulate collections of tagged +items .
+
libdebtags1
+
Main library with Debtags functions, and wrappers to many languages.
+
Erich Schubert's packagebrowser
+
Central tag archive, browsable and editable online.
+
autodebtags
+
Experimental tool to perform some automatic and heuristic tagging tasks.
+
+

The suite is quite large and diverse, and it allows to do many different kinds +of analyses and manipulations of the tagged data.

+

If you are new to Debtags and you are looking for some function, chances are +that it is already implemented somewhere: if you cannot find it, don't hesitate +to ask in the debtags-devel mailinglist.

+
+

debtags

+

These are some example uses of debtags:

+
+
debtags update
+
Updates the local Debtags information.
+
debtags stats
+
Prints some statistics about Debtags.
+
debtags show mutt
+
Like apt-cache show mutt, but also shows the mutt's Debtags tags.
+
debtags grep 'use::editing && media::rasterimage'
+

Shows all packages that allow to edit raster images. You can use full +arbitrarily complex boolean expressions such as (use::playing && ! +use::recording) && media::audio && (interface::commandline || +interface::text-mode).

+

An interesting one is this: !culture::* || culture::italian: it shows all +packages that are either not locale-specific or that are specific to my +locale. This can be used in package managers to filter out packages for +locales not used by the system.

+
+
debtags tagshow use::editing
+
Shows the vocabulary information about the tag use::editing.
+
debtags tagsearch edit
+
Shows all the tags whose information (such as the name or the description) +matches the string "edit".
+
debtags cat
+
Outputs the entire tag database, including local modifications. It is useful +to provide data to other packages such as tagcoll or tagcolledit.
+
debtags todo
+
Prints a list of the packages installed in the system that are not yet tagged.
+
debtags todoreport
+
Generates a report of packages that probably need to be tagged better.
+
+
+
+

debtags-edit

+
+debtags-edit.png +

Screenshot of the main window of debtags-edit.

+
+

debtags-edit is a graphical interface for searching and tagging packages.

+

Since I'm always busy experimenting with new features, the interface is quite +rough and I'll have to explain it a moment.

+
+

Running debtags-edit

+

Try running debtags-edit. If it does not work, it might be because you +have not yet run debtags update to download the Debtags data: do it now +and run debtags-edit again.

+
+
+

Searching packages

+

On the left-hand side of the application window there is a Filter area which +allows you to look for packages: you play with the controls, and a list of +matching packages appears in the bottom left part of the screen. A notable +part of the filter area is the Tags area, which lets you add tags to the +filter.

+

Try pushing the Add button of the tags area and add something like +"Use/Editing": the list will display all packages which can edit something.

+

Now push "Add" again: the list of facets and tags has narrowed down to only the +available possibilities, and if you look inside the "Media" facet, you'll see a +list of the possible kinds of media that can be edited using Debian packages.

+
+

Note

+

If this example does not work for you, check what is in the +"Maintainer:" field: there might be your e-mail there. That is because +debtags-edit wants to kindly suggest you to tag the packages you +maintain [1]. For the purpose of this example, you can clear the +"Maintainer:" field and try again. After I tell you how to tag packages, +please put your address back there ;)

+
+

Using the filter can search packages by name, do a full-text search à-la +apt-cache search, search by maintainer, installed status or tags. This +makes debtags-edit an interesting tool already, but let's see more.

+ + + + + +
[1]If debtags-edit cannot find the DEBEMAIL environment variable, +it will instead leave the "Maintainer:" field empty and preselect "Status: +Installed", kindly suggesting you to check if the packages you know and use +everyday are tagged well enough.
+
+
+

Tagging packages

+

You can now click on a package name in the bottom-left part of the application: +that will display the package in the main display on the right side. At the +bottom part you will see all the package data, very much like the output of +apt-cache show, while in the top part you will see the tags of the package. +If the package you chose has no tags, try looking for debtags: that will be +nicely tagged.

+

Now try adding a new tag to debtags: try adding "Games/Toys". Push the +other "Add" button below the tag list in the top-right part of the window, and +navigate the complete facet list until you find the "Games" facet: inside it +you will find "Toys". Select it: the tag has been added, and you made your +first step into Debtags tagging!

+

Now try doing "File/Save", then go to a terminal and type +debtags show debtags: you will notice that your new games::toys tag is +already there. Cool, isn't it?

+

What happened is that debtags-edit saved your modifications in +~/.debtags/patch, and all Debtags-aware applications read that file at +startup. Have a look at the file: it's just a patch with the change you made, +and its format is such that it can be applied to any future version of the tag +database. Isn't it smart? I'm so proud of it!

+

Now go back to debtags-edit and look in the "File" menu: there's a "Mail +changes to central archive" option. If you click on it, it will mail the +contents of your ~/.debtags/patch to the central archive, and the next day +your contribute will be available to everyone when they will do debtags +update.

+

What else do you need to contribute to the categorization? Only one more +thing maybe: subscribe to the debtags-devel mailing list.

+
+
+
+

packagesearch

+
+packagesearch.png +

Screenshot of the main window of packagesearch.

+
+

packagesearch is a package search program written by Benjamin Mesing. +Among its many features, it is able to make use of Debtags data.

+

To use packagesearch, you set search parameters in the top part of the +application, and it displays the results in the bottom. The Debtags search is +on the right side, on a tab named "Debtags".

+

Try running packagesearch, then select the Debtags tag "Use/Editing": you +will see all the packages that can edit something. Then select "Media/Raster +Image" and you will see all raster image editors in Debian that are known to +Debtags.

+

Compared to debtags-edit, packagesearch does not allow to change the +categorization, but it features more search functionalities, and it also +integrates apt-file searches.

+
+
+

packagebrowser

+

Lastly, the central tag archive has a web interface (the packagebrowser, +written by Erich Schubert) that can be used to navigate the Debtags data and +edit them online. You can find it at +http://debian.vitavonni.de/packagebrowser/.

+

One way of working with the packagebrowser is to help with the not yet +tagged packages, following the link at the top of the main page.

+

Another way is to work on packages is from the Debtags TODO report, in +which all package names directly link to their edit page.

+
+

Note

+

The packagebrowser edit page lists all available tags and is very +long. However, modern browsers have very quick and convenient search +functions such as the "/" function in Firefox. Using those functions it +becomes quite fast and easy to find what you need in the list of tags to +add.

+
+
+
+

debram

+

In the words of its developer Thaddeus H. Black, Debram was a +primitive attempt to treat the same Debian package problem Debtags more +properly solves. Today, Thaddeus has enthusiastically joined Debtags +development and is now in the process of merging the large body of +Debram data into Debtags. Unable to attend Debconf5, Thaddeus has asked +me to recommend to Debram users that they migrate directly to Debtags at +their convenience. Post-sarge, Debian Maintainers need not tag their +packages in Debram at all; standard Debtags tagging suffices.

+
+
+
+

Where to go from here

+
+

Contributing to the categorization

+
+

Tag your packages, you will

+

(Master Yoda)

+
+
+

Using debtags-edit

+

These are some examples on how to use debtags-edit to do some more +serious categorization work. Most of them are ways of identifying packages that +need some work: once you find them in debtags-edit, you can directly +work on them

+
    +
  1. Fire up debtags-edit and set the filter to display all installed +packages with the tag special::not-yet-tagged. Now look at the results, +pick something you know and add tags to it. After you are satisfied with +its categorization, remove the not-yet-tagged tags and submit.

    +
  2. +
  3. Click on "Edit/TODO dialog": a dialog will open with various TODO options:

    +
    +
    +
    Empty tagset
    +

    lists all packages with no tags at all. Those are usually not reported, +because the central repository should automatically add +special::not-yet-tagged tags to them; however this is sometimes not +the case, especially for local packages or packages that have recently +been added in the archive, so this option is available to spot such +packages.

    +
    +
    Uitoolkit and not interface
    +

    lists all packages which have uitoolkit tags but not interface +tags. This might be a normal situation, especially for software +libraries, but for normal applications it is probably an anomaly worth +checking.

    +
    +
    Uitoolkit and not implemented-in
    +

    lists all packages which have uitoolkit tags but not +implemented-in tags. This might be normal for documentation about +user interface toolkits, however it is an anomaly for applications and +libraries, and it's worth checking as well.

    +
    +
    Missing Role
    +

    Ideally every package should have a kind of role in the distribution. +However, there are lots of packages which do not yet have a role::* +tag. Since the tags in the Role facet are still under discussion, this +function is good to bring up food for ideas.

    +
    +
    Specials
    +

    The options starting with "Specials" allow to see packages whose tag +sets are special cases compared to all the other packages with similar +tags. How this is computed is a bit complex, but this is proving to be +very useful to highlight some corner cases that lead to extra reasoning +and improvements of the vocabulary.

    +
    +
    +
    +
  4. +
  5. Click on "Edit/Facet dialog" to activate an experimental new feature of +debtags-edit to find even more corner cases.

    +

    This will pop up a dialog with two columns: the Has column and the And +not column. Both columns list facets.

    +

    If you click on a facet on the "Has" column, the "And not" column will list +all the other facets, together with a number. The number represents how many +packages have the "Has" facet, but do not have that "And not" facet. The +"And not" facets are sorted by increasing values of this number.

    +

    Sometimes all the "And not" facets have similar numbers, but sometimes there +are facets with numbers that are definitely smaller than the others. Those +facets are very likely to have something in common with the current facet in +the "Has" column, since a lot of packages have tags from both facets.

    +

    For instance, it happens at the time of writing that, when selecting the +"Game" facet on the left side, the corresponding "Use" facet reports a +count which is one order of magnitude less than the others. +This is because of the existence of use::gaming, which is normally found +in most, if not all, game::* packages.

    +

    What are then those packages that have game::* but not use::gaming? +Let's see them: click on "Use" on the right column, then click ok. That +will set game:: && !use:: as the base for the package list, and further +filtering will be based on them. You can now see what are those packages, +and if you want you can check which of them are installed in your computer.

    +

    With game::*, it turns out that there is a reason: there are games (many +of which are game::toys) that are not useful for gaming. Some examples +are cappuccino, cowsay, polygen and fortune. Howewer, one +could realise that these toys have some other use before gaming.

    +

    Maybe a new "use::something" tag is needed?

    +

    The Facet Dialog has helped finding out.

    +
  6. +
+
+
+

Using debtags

+

debtags can be useful for tagging in two ways: both to give you hints on +what needs to be worked on, and as a low-level tool you can use if you want to +automate tagging tasks.

+

There are three features of debtags you can use to get hints on what to do:

+
+
debtags todo:
+
debtags todo prints a list of packages you have installed which are +tagged with the special::not-yet-tagged tags. No need for further +explanations: tag them!
+
debtags todoreport:
+

this prints a text report about packages that need some work to do. It +includes a range of simple to very complex checks to find out problematic +areas of the categorization, and the report that it outputs contains +explanations about the reasons behind every group of packages. The report +also includes packages that are not installed.

+

The output of debtags todoreport is periodically processed with +rst2html and published at http://debtags.alioth.debian.org/todoreport.html

+
+
debtags related:
+

debtags related shows you what packages are similar (tagging-wise) to a +given one. Try running debtags related cdcd: you will see a list of +other CD players. You can use the -d switch to increase the distance +of the search, that is, to include more packages that are "a bit less +similar".

+

You can use this function to check if the list of related packages is what +you would expect: if not, you can check the tags of the missing or extra +packages to see if there is anything wrong.

+
+
+

You can also use debtags as a low-level backend if you want to experiment +with scripted or automated tagging ideas:

+
+
debtags tagsearch and debtags tagshow:
+
They allow you to search the tag vocabulary and show information about a +tag.
+
debtags tag ls, debtags tag add and debtags tag rm:
+

These commands are intended to be run from scripts, and they list the tags +attached to a package and allow you to add or remove tags to it. Try this:

+
+debtags tag ls debtags
+debtags tag add debtags game::toys
+debtags tag ls debtags
+debtags tag rm debtags game::toys
+debtags tag ls debtags
+
+
+
+
+
+

Using tagcolledit

+

tagcolledit is a generic tool to do mass-editing of tags. It is not specific +for Debtags, so it does not know about packages, but compared to +debtags-edit it can make it easy to do large-scale operations like renaming +of tags.

+

Let's run tagcolledit:

+
+# Get a version of the tag database including the local patch
+debtags cat > /tmp/tags
+tagcolledit /tmp/tags
+
+

The interface of tagcolledit is unfortunately very rough, just like +debtags-edit, and it needs some explanation. It is divided in two panels, +like Midnight Commander, and every panel works in the same way: it has a +filter, and a list of matching items (that are packages in our case).

+

Now try doing this: in the left panel, select the uitookit::qt tag. In the +right panel, select the implemented-in::c++ and the interface::x11. +Now, QT is a C++ library, so one would expect most of the QT applications to +have an X11 interface and to be implemented in C++. With tagcolledit it's +very easy to have a look at the left panel, select groups of packages that need +fixing (the list supports multiple selection), then right click on the +selection and choose "Copy to other panel". This will add the tags +implemented-in::c++ and interface::x11 to the selected packages, and +they will show up in the other panel as well.

+

You can do many other tricks with tagcolledit: merge or intersect tag sets, +add a tag to a group of items or even to all of them (right click on the tag in +the filter: you will see the "Add to all" and "Remove from all" functions).

+

It is however easy to get carried away and make mistakes, such as adding the +use::gaming tag to all the games::toys, to find out later that packages such as +fortune or cowsay cannot really be used to play games.

+

Once you are finished with tagcolledit, you can save the tag database and +quit. If you are happy with your changes you will want to integrate them in +the main tag database: first create a patch:

+
+debtags mkpatch /tmp/tags > /tmp/tags.patch
+
+

This will create a tag patch with the changes you have made with +tagcolledit. You can then add your patch to the local tag patch:

+
+cat /tmp/tags.patch >> ~/.debtags/patch
+
+

And see your changes in all the Debtags-aware applications.

+

Then you can submit it, with either debtags-edit or debtags submit.

+

You can even submit it directly:

+
+debtags submit /tmp/tags.patch
+
+
+
+

Automated tagging

+

While generally there is a need for a smart brain to do good categorization, +there are some tagging tasks that can be automated. For example, it's good +enough to assume that all packages that depend on libgtk2.0 will need a +uitoolkit::gtk tag, while all packages that depend on libstdc++6 will +probably need an implemented-in::c++ tag.

+

These ideas have brought to creating autodebtag, which is a Perl script that +does all kinds of automated reasoning that I and other people in the +debtags-devel list conceived so far. Then it prints out a tag patch that +can be evaluated, tested and submitted to the central tag database.

+

autodebtag has also some experimental code to try and bring categorization +data from the debram database into the Debtags world.

+

Benjamin Mesing is also experimenting with setting up a smart Bayesian engine +to infer new tags based on what tags are there now. This has very promising +and exciting possibilities: there is a prototype available in the autodebtag +subversion repository, and it needs more people to play with it.

+
+
+

Adopting a tag or a facet

+

If you regularly try out all image manipulation software, if you are a Gnome +expert, if you are addicted to role-playing games, you might consider adopting +a tag.

+

Adopting a tag means that you take responsibility for checking from time to +time that all packages that should have your tag actually have it. It is a +very important task, because it introduces a level of reliability and +guaranteed accurateness into some parts of the tag database.

+

For example, Stefano Zacchiroli is an Ocaml guru, and is taking care of +the implemented-in::ocaml tag. You will notice that all Ocaml +applications have the implemented-in::ocaml tag, and thanks to Stefano you +can rely on that tag to be accurate. We need more people to do what he is +doing.

+

To adopt a tag, just send an e-mail to the debtags-devel list, introduce +yourself and tell what you want to adopt. If it's already taken, you can team +up with the others and share the brainwork.

+
+
+
+

Contributing to the vocabulary

+

The vocabulary is another area needing help. Debian spans a very wide and +diverse range of areas, and knowing about all of them is nearly impossible.

+

There are two ways of having a good vocabulary to cover all of Debian's +interests:

+
    +
  1. Wait until I learn about everything in Debian, reach enlightenment and open +a Debian monastery in the Alps, or
  2. +
  3. Create a group of people with knowledge on different fields to work on the +vocabulary together.
  4. +
+

So far, we have been working mainly on 1. This was because there was poor +documentation on Debtags and its technical foundations. Now there is this +paper, and it's time to switch to the second strategy.

+

If you feel like you could help (and you do not need to be a Debian Developer, +but a Debian user with a lot of experience in some field), you can read the +tutorial at http://debtags.alioth.debian.org/vocabulary.html and join the +debtags-devel mailing list.

+

You can also make local experiments with the vocabulary: the Debtags FAQ has +an entry with a small tutorial on how to do it. Someone is trying to do it to +provide specific sets of tags for their Custom Debian Distribution, but it's +also a good way to experiment with ideas for new facets or tags.

+ +
+
+

If you are a package maintainer

+

If you are a package maintainer, please run debtags-edit and have a +look at your packages. You are probably the best person in Debian to assign +tags such as implemented-in::*, interface::* and uitoolkit::*, +and it's going to be very easy for you to do it.

+

Also remember that you can use more than one tag from the same facet, as your +package may contain more than one program, or it may contain programs with +multiple behaviours: for example, mutt or aptitude have uses both as +interface::text-mode and interface::command-line programs.

+
+
+

Integrating Debtags in other applications

+

Now that you know everything about Debtags, you may want to make use of the +Debtags data in your applications, or play with Debtags using code +instead of existing tools.

+

If that is the case, there is a selection of libraries and modules available +for you.

+
+

libdebtags1-dev, python-debtags, libdebtags-perl

+

If you look inside the code of debtags and debtags-edit, you will notice +that most of what they do related to tags is calling functions from the +libdebtags1 or libtagcoll1 libraries. libtagcoll1 provides generic +manipulation functions for tagged stuff, while libdebtags1 uses +libtagcoll1 to implement all Debtags functionality.

+

If you like programming in C++, install libdebtags1-dev; from there, you +can either look at debtags and debtags-edit source code for examples +(debtags is particularly straightforward) and use +/usr/share/doc/libdebtags1-dev/html/index.html for the doxygen +documentation.

+

The documentation still has missing parts. If you have questions, no matter +how silly they could seem, please ask them freely in debtags-devel list: I +have promised to myself that I will turn every answer I give into more +documentation of libdebtags1-dev.

+

If you instead like coding in Perl or Python rather than C++, +you can install either libdebtags-perl or +python-debtags: they are swig-generated bindings to +libdebtags1.

+

Again, for whatever documentation or examples that are missing, ask in +debtags-devel, and every answer will also contribute to improve the +documentation and examples in the packages.

+

This is an example Python code that plays with Debtags a bit (please teach me +how to use iterators properly):

+
+import Debtags
+
+# Instantiate the simple Debtags class
+dt = Debtags.DebtagsSimple(0)
+
+# Get some information from the vocabulary
+voc = dt.vocabulary()
+print "Facets:"
+for a in voc.getFacets().getIterable():
+   print "%s: %s %s" % (a.name(), a.field("Status"), a.field("Nature"))
+
+# List the accessibility tags
+fac = voc.getFacet("accessibility");
+print "Tags in 'accessibility::':"
+for a in fac.tags().getIterable():
+   print a.name()
+
+# Print the tags of ``debtags``
+tags = dt.getTags("debtags")
+for a in tags.getIterable():
+   print a.name()
+
+# List the image editors in Debian
+tags = Debtags.TagSet()
+tags.insert(voc.getTag("use::editing"))
+tags.insert(voc.getTag("media::rasterimage"))
+editors = dt.getPackages(tags)
+print "Raster image editors:"
+for a in editors.getIterable():
+   print a.name()
+
+

This is the same example, written in Perl:

+
+#!/usr/bin/perl -w
+use strict;
+use warnings;
+use Debtags;
+
+my $dt = Debtags::DebtagsSimple->new(0);
+my $voc = $dt->vocabulary();
+
+print "Facets: ",
+  join(', ', map { $_->name() }
+    @{$voc->getFacets()->getIterable()}), "\n";
+
+my $fac = $voc->getFacet("accessibility");
+print "Tags in 'accessibility::': ",
+  join(', ', map { $_->name() }
+    @{$fac->tags()->getIterable()}), "\n";
+
+print "Tags for 'debtags': ",
+  join(', ', map { $_->fullname() }
+    @{$dt->getTags('debtags')->getIterable()}), "\n";
+
+my $tags = Debtags::TagSet->new();
+$tags->insert($voc->getTag('use::editing'));
+$tags->insert($voc->getTag('media::rasterimage'));
+my $editors = $dt->getPackages($tags);
+print "Raster image editors: ",
+  join(', ', map { $_->name() } @{$editors->getIterable()} ), "\n";
+
+
+

Note

+

I'm sorry for the need of that getIterable function, but swig +does not properly wrap C++ std::set classes yet. This is hopefully +going to change as swig evolves.

+
+
+
+

libapt-front

+

libapt-front is the next-generation wrapper for libapt. The goal of the +project is having a library to base all package managers on, and to have it +able to access different sources of metadata besides libapt. Including +Debtags.

+

libapt-front is still under heavy development, and Debtags support is +still not implemented. However, I have commit access to the libapt-front +repository and I've recently been able to take libdebtags1 where I wanted +it to be in order to support libapt-front: expect exciting news from this +corner of Alioth!

+
+
+
+

User interface issues

+

Once we have the data and the functions to access it, we can improve the way we +navigate our package archive.

+

One area where more research is needed is finding good ways of navigating the +package archive using Debtags. As I mentioned before, in front of a list +with more than about 7 plus or minus 2 items, our brain goes banana [ZEN] +[MILLER]. This sets a first goal for Debtags: to allow people to navigate +the package archive in such a way that no list of unrelated choices should have +more than 7 plus or minus 2 items.

+

Do you know of any existing and very good interfaces to navigate such a large +archive using faceted categorization? I don't. I know of very good examples +on a much smaller scale, but we seem to have a much more large, complex and +heterogeneous dataset.

+

We need mockups and prototypes of interfaces offering an intuitive and +efficient way of navigating through tags, keeping in mind those 7+/-2 and EVN +requirements.

+

As you can see running debtags-edit and tagcolledit, I still haven't +done much progress in this field, and I'm desperately in need of good ideas.

+
+

Effective View Navigation

+

Prof. G. W. Furnas, who usually writes good stuff, made a very nice +research (check it out!) and found 4 properties that something should have to +be easy to navigate. He called them the properties of Effective View +Navigation or EVN properties [FURNAS]:

+
    +
  1. (EVT1) The number of outgoing links must be "small" compared to the size +of the structure
  2. +
  3. (EVT2) The distance between pair of nodes in the structure must be "small" +compared to the size of the structure
  4. +
  5. (VN1) Every node must contain some valid information (called residue) on how +to reach any given other node
  6. +
  7. (VN2) The information associated to each outgoing link (called outlink-info) +must be small.
  8. +
+

I did some research on this idea related to categorization [TAGCOLL], and +designed an algorithm that is able to present navigational choices of tags in a +way that is compatible with the 4 EVN requirements. It is a good start, and +recent debtags-edit are making use of it in the filter, to reduce the amount +of facets when there are too many to display.

+

This algorithm has potential, but the results are still not perfect: you can +now start the navigation with 19 facets instead of the 32 available, but that's +still far beyond 7 plus or minus 2. The main cause of this is that tag data is +still incomplete: the "TODO Specials" features of debtags-edit are there to +expose those packages that are causing problems.

+

From my experience, however, I see that algorithm as a point of departure +rather than a point of arrival, and more smart navigation ideas are waiting to +come to life.

+
+
+
+
+

Conclusions

+

This paper is the first single comprehensive source of information about the +Debtags project. It has covered the theoretical foundations, the tools existing +at the moment, how to take advantage of Debtags and various ways of getting +involved.

+

Since we would really like to get help, I'll repeat a short summary on how to +get involved:

+ +

If you are interested in helping, or just curious to see what's happening, join +the debtags-devel mailing list: that's where people hang out, discussions +happens and announcements are posted.

+
+
+

Bibliography

+ + + + + +
[STECKEL]Mike Steckel, "Ranganathan for IAs", 2002, +http://www.boxesandarrows.com/archives/ranganathan_for_ias.php
+ + + + + +
[ZEN](1, 2) Enrico Zini, "Zen and the art of Free Software: know your user, know +yourself", 2004, http://people.debian.org/~enrico/talks/2004linuxtag/
+ + + + + +
[MILLER](1, 2) George A. Miller, "The magical number seven, plus or minus two: +Some limits on our capacity for processing information", 1956, Psychological +Review n.63 pp. 81-91, http://www.well.com/user/smalin/miller.html
+ + + + + +
[FURNAS]George W. Furnas, "Effective View Navigation", 1997, Proceedings of +CHI'97 pp. 367--374, ACM Conference on Human Factors in Computing Systems, +Atlanta, http://www.si.umich.edu/~furnas/Papers/CHI97-EVN.2.pdf
+ + + + + +
[TAGCOLL]Enrico Zini, "The tagged collection: an alternative way of +organizing a collection of bookmark-like items and its integration with +existing web browsers", 2001, http://svn.debian.org/wsvn/debtags/tagcoll/trunk/doc/
+
+
+
+ + diff -Nru debtags-2.0.1ubuntu6/IDEAS debtags-2.1.2/IDEAS --- debtags-2.0.1ubuntu6/IDEAS 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/IDEAS 2016-08-09 11:55:48.000000000 +0000 @@ -16,11 +16,6 @@ debtags facetcoll | tagcoll hierarchy | cut -f2 -d/ | cut -f1 -d: | sort | uniq -Interesting links: - - * http://www.itconsult.it/knowledge/articoli/detArticoli.asp?ID=18 - - TODO-list items being worked on ------------------------------- diff -Nru debtags-2.0.1ubuntu6/quicktest debtags-2.1.2/quicktest --- debtags-2.0.1ubuntu6/quicktest 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/quicktest 2016-08-09 11:55:48.000000000 +0000 @@ -11,17 +11,12 @@ run "$DEBTAGS tagshow use::editing" run "$DEBTAGS tagsearch edit" run "$DEBTAGS show debtags" -run "$DEBTAGS related -d 3 debtags" run "$DEBTAGS cat | wc -l" -run "$DEBTAGS cat --group | wc -l" run "$DEBTAGS search use::editing | wc -l" run "$DEBTAGS search --invert use::editing | wc -l" run "$DEBTAGS grep use::editing | wc -l" run "$DEBTAGS grep --invert use::editing | wc -l" -run "$DEBTAGS grep --group use::editing | wc -l" -run "$DEBTAGS grep --group --invert use::editing | wc -l" -run "$DEBTAGS maintainers | wc -l" -run "$DEBTAGS maintainers --group | wc -l" + # tag [add # tag [rm # tag [ls diff -Nru debtags-2.0.1ubuntu6/rebuild-manpages debtags-2.1.2/rebuild-manpages --- debtags-2.0.1ubuntu6/rebuild-manpages 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/rebuild-manpages 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -#!/bin/sh - -help2man --section=1 --no-info --opt-include=doc/debtags-man-hooks debtags > debtags.1 || rm debtags.1 -#debtags.1: $(top_builddir)/debtags $(srcdir)/doc/debtags-man-hooks - #$(top_builddir)/debtags --manpage=$(srcdir)/doc/debtags-man-hooks > $@ || rm $@ - -help2man --name='submit tag patches to http://debtags.debian.net' --section=1 --no-info debtags-submit-patch > debtags-submit-patch.1 || rm debtags-submit-patch.1 - diff -Nru debtags-2.0.1ubuntu6/setup.py debtags-2.1.2/setup.py --- debtags-2.0.1ubuntu6/setup.py 2015-10-28 10:02:36.000000000 +0000 +++ debtags-2.1.2/setup.py 2016-08-09 11:55:48.000000000 +0000 @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -from __future__ import print_function from setuptools import setup import imp @@ -15,7 +14,6 @@ #install_requires=["debian", "apt"], license="GPL", version=debtags.VERSION, - scripts=["debtags", "debtags-hardware", "debtags-submit-patch"], - packages=['debtagshw'], + scripts=["debtags"], #test_suite="test", ) Binary files /tmp/tmpYFEeYO/IP_5zOxoeZ/debtags-2.0.1ubuntu6/tags-current.gz and /tmp/tmpYFEeYO/XH2XupaAPi/debtags-2.1.2/tags-current.gz differ diff -Nru debtags-2.0.1ubuntu6/test/test_hw.py debtags-2.1.2/test/test_hw.py --- debtags-2.0.1ubuntu6/test/test_hw.py 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/test/test_hw.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,195 +0,0 @@ -#!/usr/bin/python - -# debtagshw: lib to detect what hardware tags apply to the current system -# -# Copyright (C) 2012 Canonical -# -# Author: -# Michael Vogt -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import - -import logging -import unittest -import tempfile - -from mock import Mock, patch - - -import sys - -from debtagshw.detectors import ( - Detector, - DetectorCmdline, -) - -from debtagshw.debtagshw import ( - DebtagsAvailableHW, - HardwareSupported, - ) - -class TestDebtagsHW(unittest.TestCase): - - def test__check_hw_debtags(self): - hw = DebtagsAvailableHW() - # run over all hwtags that we support - for hwtag in hw.get_supported_tags() + [ - # TODO - "hardware::camera", - "hardware::gps", - "hardware::input:joystick", - "hardware::memory:1GB", - "hardware::power:ups", - "hardware::storage:floppy", - ]: - hw._check_hw_debtag(hwtag) - - def test_keyboard(self): - # this may fail on a buildd with no keyboard - hw = DebtagsAvailableHW() - self.assertTrue(hw._check_hw_debtag("hardware::input:keyboard")) - - def test_laptop_detect(self): - d = DetectorCmdline() - d.LAPTOP_DETECT = "/bin/true" - self.assertEqual(d.is_supported("hardware::laptop"), - HardwareSupported.YES) - d.LAPTOP_DETECT = "/bin/false" - self.assertEqual(d.is_supported("hardware::laptop"), - HardwareSupported.NO) - - def test_scanner(self): - f = tempfile.NamedTemporaryFile() - test_bytes = "device 'uri' is a foo bar bar" - if sys.version > '3': - test_bytes = test_bytes.encode() - f.write(test_bytes) - f.flush() - d = DetectorCmdline() - d.SCANIMAGE = ["cat", f.name] - self.assertEqual(d.is_supported("hardware::scanner"), - HardwareSupported.YES) - d.SCANIMAGE = ["cat", "/dev/null"] - self.assertEqual(d.is_supported("hardware::scanner"), - HardwareSupported.NO) - -class TestPublicAPI(unittest.TestCase): - - def setUp(self): - class MockDetector(Detector): - TEST_TAGS = { "hardware::scanner" : HardwareSupported.YES, - "hardware::printer": HardwareSupported.NO, - "hardware::gps": HardwareSupported.NO, - "hardware::testme1": HardwareSupported.NO, - "hardware::testme2": HardwareSupported.YES, - } - def get_supported_tags(self): - return self.TEST_TAGS.keys() - def is_supported(self, tag): - if tag in self.TEST_TAGS: - return self.TEST_TAGS[tag] - return HardwareSupported.UNKNOWN - self._mock_detector = MockDetector() - self.hw = DebtagsAvailableHW() - self.hw._detectors.insert(0, self._mock_detector) - - def test_get_missing_hw(self): - # test - tags = ["hardware::scanner", "hardware::gps", "hardware::xxx" ] - result = self.hw.get_hardware_support_for_tags(tags) - self.assertEqual(result, { - 'hardware::scanner' : HardwareSupported.YES, - 'hardware::gps' : HardwareSupported.NO, - 'hardware::xxx' : HardwareSupported.UNKNOWN, - }) - - def test_generate_tag_expressions(self): - res = {} - # test - for supported, tags in self.hw.generate_tag_expressions(): - for tag in tags: - res[tag] = supported - self.assertEqual(res["hardware::testme2"], "yes") - self.assertEqual(res["hardware::testme1"], "no") - -class TestCasePrinter(unittest.TestCase): - - def _make_cups_mock(self): - import cups - cups_mock = Mock() - cups_connection_mock = Mock(cups.Connection) - cups_mock.Connection.return_value = cups_connection_mock - return cups_mock, cups_connection_mock - - def test_printer(self): - cups_mock, cups_connection_mock = self._make_cups_mock() - with patch.dict('sys.modules', { 'cups' : cups_mock }): - hw = DebtagsAvailableHW() - cups_connection_mock.getPrinters.return_value = {} - self.assertEqual(hw._check_hw_debtag("hardware::printer"), - HardwareSupported.NO) - cups_connection_mock.getPrinters.return_value = { - 'deskjet' : { 'print-info' : "some info", - }, - } - self.assertEqual(hw._check_hw_debtag("hardware::printer"), - HardwareSupported.YES) - -class TestCaseOpenGL(unittest.TestCase): - - TEST_DATA = { - # these are the strings returns from pyhton debtagshw/opengl.py - # (vendor, renderer, version) - ('intel' , ( "Tungsten Graphics, Inc", - "Mesa DRI Intel(R) Ironlake Mobile", - "2.1 Mesa 7.11")), - ('amd', ( "X.Org", - "Gallium 0.4 on AMD REDWOOD", - "2.1 Mesa 8.0.1")), - ('nouveau', ( "nouveau", - "Gallium 0.4 on NVC3", - "3.0 Mesa 8.0.1")), - # binary-only - ('fglrx', ( "Advanced Micro Devices, Inc.", - "ATI Radeon HD 5570", - "4.1.11251 Compatibility Profile Context")), - ('fglrx', ( "Advanced Micro Devices, Inc.", - "ATI Radeon HD 5570", - "4.1.11251 Compatibility Profile Context")), - ('nvidia', ( "NVIDIA Corporation", - "GeForce GT 440/PCIe/SSE2", - "4.2.0 NVIDIA 295.20")), - # ensure the random one is right - ('unknown', ( "xxx", "yyy", "zzz" )), - } - - def test_opengl_driver_detection(self): - from debtagshw.opengl import OpenGL - detector = OpenGL() - func = "_get_opengl_vendor_renderer_version_tuple" - with patch.object(detector, func) as mock_func: - for driver, mock_data in self.TEST_DATA: - mock_func.return_value = mock_data - self.assertEqual(detector.opengl_driver(), driver) - if driver != "unknown": - opengl_version = detector.opengl_version() - self.assertNotEqual(opengl_version, "unknown") - - -if __name__ == "__main__": - logging.basicConfig(level=logging.INFO) - unittest.main() diff -Nru debtags-2.0.1ubuntu6/update_files debtags-2.1.2/update_files --- debtags-2.0.1ubuntu6/update_files 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/update_files 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -#!/bin/sh - -# Update the copy of the debtags information that is shipped with the package - -set -ue - -OK=true - -# Commit or rollback on exit -commit_or_rollback() { - if [ $OK = true ] - then - mv tags-current.gz.tmp tags-current.gz - cat vocabulary1.tmp vocabulary2.tmp > vocabulary - rm vocabulary1.tmp vocabulary2.tmp - else - rm -f tags-current.gz.tmp vocabulary1.tmp vocabulary2.tmp - fi -} - -trap commit_or_rollback EXIT - -cat_tags() { - if [ $USER = enrico ] && [ -f ../tagdb/tags ] - then - cat ../tagdb/tags - else - svn cat svn://anonscm.debian.org/debtags/tagdb/tags - fi -} - -cat_voc() { - if [ $USER = enrico ] && [ -f ../vocabulary/debian-packages ] - then - cat ../vocabulary/debian-packages - else - svn cat svn://anonscm.debian.org/debtags/vocabulary/trunk/debian-packages - fi -} - -echo -n "Exporting a new version of the reviewed tags from SVN... " -if cat_tags | tagcoll copy | gzip -9 > tags-current.gz.tmp -then - echo "ok." -else - echo "failed." - OK=false - exit 1 -fi - -echo -n "Exporting a new version of the vocabulary data from SVN... " -if cat_voc > vocabulary1.tmp -then - echo "ok." -else - echo "failed." - OK=false - exit 1 -fi - -echo -n "Exporting a new version of the security team tag vocabulary data from SVN... " -if svn cat svn://anonscm.debian.org/debtags/vocabulary/trunk/security-team > vocabulary2.tmp -then - echo "ok." -else - echo "failed." - OK=false - exit 1 -fi - -exit 0 diff -Nru debtags-2.0.1ubuntu6/update_report_on_alioth debtags-2.1.2/update_report_on_alioth --- debtags-2.0.1ubuntu6/update_report_on_alioth 2015-09-08 15:05:23.000000000 +0000 +++ debtags-2.1.2/update_report_on_alioth 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -#!/bin/sh - -echo "Generating the report..." -src/debtags todoreport 30 > /tmp/todoreport.rst -echo "Converting to HTML..." -rst2html --no-doc-title --stylesheet=main.css /tmp/todoreport.rst > /tmp/todoreport.html -echo "Uploading to Alioth..." -scp /tmp/todoreport.html alioth.debian.org:/org/alioth.debian.org/chroot/home/groups/debtags/htdocs/todoreport.html -echo "Done." diff -Nru debtags-2.0.1ubuntu6/vocabulary debtags-2.1.2/vocabulary --- debtags-2.0.1ubuntu6/vocabulary 2015-09-09 18:36:12.000000000 +0000 +++ debtags-2.1.2/vocabulary 2016-09-09 12:42:59.000000000 +0000 @@ -904,7 +904,7 @@ Tag: interface::framebuffer Description: Framebuffer -Tag: interface::graphcial +Tag: interface::graphical Description: Graphical User Interface Packages that provide the user with a 2D graphical user interface. @@ -1649,8 +1649,8 @@ Description: Service tags Group of special tags -Tag: special::not-yet-tagged -Description: !Not yet tagged packages! +Tag: special::unreviewed +Description: Needs review Tag: special::TODO Description: Need an extra tag @@ -1721,6 +1721,10 @@ Description: Mozilla Mozilla Browser and extensions +Tag: suite::mysql +Description: MySQL + MySQL and variants like MariaDB and Percona + Tag: suite::netscape Description: Netscape Navigator The pre-6.0 versions of netscape browser