Package: linda
Version: 0.3.16
Severity: wishlist
Tags: patch
This module adds two Truetype font related checks. The first checks for
non-free fonts by looking for tell-tale strings in the font data. It
works pretty well and finds most non-free fonts currently in the
archive. (People keep uploading things like Arial. I intend to
file bugs later today.)
The second check looks for duplicated fonts. Many packages include
copies of fonts which are already packaged seperately, and thus wasting
disk space (eg, including a copy of FreeSans instead of depending on the
ttf-freefont package). This isn't as serious as non-free fonts, but
still annoying.
I've tested this module against all font-containing packages in the
archive, and had no false positives.
One thing I couldn't figure out is where to put the descriptions of the
errors, so for now there aren't any, and Linda complains about that. If
you could explain me where they go, I'll update the patch.
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.11.7
Locale: LANG=nl_BE.UTF-8, LC_CTYPE=nl_BE.UTF-8 (charmap=UTF-8)
Versions of packages linda depends on:
ii binutils 2.16.1-2 The GNU assembler, linker and bina
ii dash 0.5.2-6 The Debian Almquist Shell
ii file 4.12-1 Determines file type using "magic"
ii man-db 2.4.3-1 The on-line manual pager
ii python 2.3.5-3 An interactive high-level object-o
Versions of packages linda recommends:
pn debian-policy <none> (no description available)
-- no debconf information
from linda import libchecks, checks
class TruetypeFontCheck (libchecks.LindaChecker):
'Checks packages for non-free or duplicated truetype fonts.'
def init (self):
# These strings commonly appear in non-free fonts but never in free
# ones.
self.nonfree_indicators = (
'VeriSign Commercial Software Publishers CA', 'Ray Larabie',
'The Monotype Corporation', 'Bigelow & Holmes Inc', 'Microsoft',
'Pats. Pend.', 'LICENSE AGREEMENT',
'Redistribution strictly prohibited')
# Many packages include one of these fonts, but it would be better
# if the maintainers just added a dependency on the canonical package.
# Note: Bitstream Vera has many forks, be sure to list them first.
self.common_fonts = (
('Danilova Bepa', 'ttf-dejavu'),
('DejaVu', 'ttf-dejavu'),
('Arabeyes.org', 'ttf-arabeyes'),
('Bitstream Vera', 'ttf-bitstream-vera'),
('FreeSans', 'ttf-freefont'),
('FreeSerif', 'ttf-freefont'),
('FreeMono', 'ttf-freefont'),
('Thryomanes', 'ttf-thryomanes'),
('Dustin Norlander', 'ttf-dustin'),
('SummersbyRegular', 'ttf-summersby'),
('B&HLuxi', 'ttf-xfree86-nonfree'))
def check_source_2 (self):
self.check_fonts(source=True)
def check_binary_2 (self):
self.check_fonts(source=False)
def check_fonts (self, source):
packages = []
free = True
for i in self.information['control']['self']:
if 'package' in i:
packages.append(i['package'])
if 'section' in i:
free &= i['section'][0] != 'non-free'
collector = self.information['collector']
for file, type in collector('output', 'file').iteritems():
if type not in ('TrueType font data', 'OpenType font data'):
continue
dir = self.information['dir']
if source:
fullpath = os.path.join(dir, '..', file)
else:
fullpath = os.path.join(dir, 'unpacked', file[1:])
data = open(fullpath).read()
if free:
for indicator in self.nonfree_indicators:
if data.find(indicator) != -1:
self.signal_error('non-free-truetype-font', [file])
break
for indicator, package in self.common_fonts:
if data.find(indicator) != -1:
if package not in packages:
self.signal_error('duplicate-truetype-font', [file, package])
break
checks.register(TruetypeFontCheck)
Tag: non-free-truetype-font
Type: Error
Tag: duplicate-truetype-font
Type: Warning