pax_global_header00006660000000000000000000000064112636335460014523gustar00rootroot0000000000000052 comment=102d37e2021d39604f2327efc56cf845909e7c0b apt-blacklist-0.01/000075500000000000000000000000001126363354600141735ustar00rootroot00000000000000apt-blacklist-0.01/.gear/000075500000000000000000000000001126363354600151675ustar00rootroot00000000000000apt-blacklist-0.01/.gear/merge000064400000000000000000000000271126363354600162100ustar00rootroot00000000000000merge: upstream master apt-blacklist-0.01/.gear/rules000064400000000000000000000000071126363354600162410ustar00rootroot00000000000000tar: . apt-blacklist-0.01/.gitignore000064400000000000000000000000551126363354600161630ustar00rootroot00000000000000.project .pydevproject .settings *.pyc *.pyo apt-blacklist-0.01/apt-blacklist000075500000000000000000000057361126363354600166660ustar00rootroot00000000000000#!/usr/bin/python #vim:set fileencoding=utf-8: # # apt-blacklist - Check packages that apt wants to install and abort the # installation process if some criteria are met. # # Copyright (C) 2009 Andrey Rahmatullin # # 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 3 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, see # . # from __future__ import with_statement from operator import itemgetter import os import sys import rpm packagerBlacklistPath = '/etc/apt-blacklist/packagers' packagerWarnlistPath = '/etc/apt-blacklist/warning' def getHeaders(filename): """Get package name and last packager for .rpm file. """ with open(filename) as f: (headers, _) = rpm.headerFromPackage(f.fileno()) changelogEntry = headers[rpm.RPMTAG_CHANGELOGNAME][0] # 'Who 1.0-alt1' return (headers[rpm.RPMTAG_NAME], changelogEntry[:changelogEntry.rfind(' ')]) if __name__ == '__main__': if not os.path.exists(packagerBlacklistPath): sys.exit(0) filenames = sys.stdin.readlines() pkgInfos = [getHeaders(f.rstrip()) for f in filenames] with open(packagerBlacklistPath) as f: packagerBlacklist = [p.strip() for p in f.readlines() if len(p.strip()) > 0] badPackages = [] for pkg, packager in pkgInfos: for badPackager in packagerBlacklist: if packager.lower().find(badPackager) > -1: badPackages.append((pkg, packager)) break if os.path.exists(packagerWarnlistPath): with open(packagerWarnlistPath) as f: packagerWarnlist = [p.strip() for p in f.readlines() if len(p.strip()) > 0] warnPackages = [] for pkg, packager in pkgInfos: for warnPackager in packagerWarnlist: if packager.lower().find(warnPackager) > -1: warnPackages.append((pkg, packager)) break if len(warnPackages) > 0: print print '=== apt-blacklist-warning ===' for pkg, packager in sorted(warnPackages, key=itemgetter(1)): print 'Package %s is changed by maintainer in warning list: "%s"' % (pkg, packager) print if len(badPackages) > 0: print print '=== apt-blacklist ===' for pkg, packager in sorted(badPackages, key=itemgetter(1)): print 'Package %s is blacklisted: "%s"' % (pkg, packager) print sys.exit(1) apt-blacklist-0.01/apt-blacklist.spec000064400000000000000000000025121126363354600176010ustar00rootroot00000000000000Name: apt-blacklist Version: 0.01 Release: alt2 Summary: Forbids installation of packages based on some criteria License: GPLv3+ Group: System/Configuration/Packaging BuildArch: noarch Packager: Andrey Rahmatullin Source0: %name-%version.tar %description This small tool checks packages that apt wants to install and aborts the installation process if some criteria are met. Now it has only one criterion: last changelog entry author must not contain lines from %_sysconfdir/%name/packagers. Also, it can warn you when apt going to install package that changed by author from %_sysconfdir/%name/warning. %prep %setup %install mkdir -p %buildroot{%_bindir,%_sysconfdir/%name} install -p -m755 %name %buildroot%_bindir/ touch %buildroot%_sysconfdir/%name/packagers touch %buildroot%_sysconfdir/%name/warning install -pD -m644 apt.conf %buildroot/etc/apt/apt.conf.d/10-%name.conf %files %_bindir/* %config(noreplace) /etc/apt/apt.conf.d/* %dir %_sysconfdir/%name %config(noreplace) %_sysconfdir/%name/packagers %config(noreplace) %_sysconfdir/%name/warning %changelog * Fri Oct 09 2009 Andrey Rahmatullin 0.01-alt2 - Sisyphus build * Sun Sep 13 2009 Terechkov Evgenii 0.01-alt1.1 - Warn list support added * Sat Sep 12 2009 Andrey Rahmatullin 0.01-alt1 - initial version apt-blacklist-0.01/apt.conf000064400000000000000000000000651126363354600156270ustar00rootroot00000000000000RPM::Pre-Install-Pkgs { "/usr/bin/apt-blacklist"; };