Репозиторий Sisyphus
Последнее обновление: 1 апреля 2020 | Пакетов: 17566 | Посещений: 17797862
en ru br
Репозитории ALT
S:0.01.2-alt2
5.1: 0.01-alt2
www.altlinux.org/Changes

Группа :: Система/Настройка/Пакеты
Пакет: apt-blacklist

 Главная   Изменения   Спек   Патчи   Исходники   Загрузить   Gear   Bugs and FR  Repocop 

pax_global_header00006660000000000000000000000064116505232220014510gustar00rootroot0000000000000052 comment=3925bbd218341bef0142f993a2000efe6f97b623
apt-blacklist-0.01/000075500000000000000000000000001165052322200141605ustar00rootroot00000000000000apt-blacklist-0.01/.gear/000075500000000000000000000000001165052322200151545ustar00rootroot00000000000000apt-blacklist-0.01/.gear/merge000064400000000000000000000000271165052322200161750ustar00rootroot00000000000000merge: upstream master
apt-blacklist-0.01/.gear/rules000064400000000000000000000000071165052322200162260ustar00rootroot00000000000000tar: .
apt-blacklist-0.01/.gitignore000064400000000000000000000000551165052322200161500ustar00rootroot00000000000000.project
.pydevproject
.settings
*.pyc
*.pyo
apt-blacklist-0.01/apt-blacklist000075500000000000000000000102041165052322200166350ustar00rootroot00000000000000#!/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 <wrar@altlinux.org>
#
# 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
# <http://www.gnu.org/licenses/>.
#

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'
packagerWatchlistPath = '/etc/apt-blacklist/watch'

def getHeaders(filename):
"""Get package name and last two packagers for .rpm file.
"""
with open(filename) as f:
(headers, _) = rpm.headerFromPackage(f.fileno())
changelogEntry1 = headers[rpm.RPMTAG_CHANGELOGNAME][0] # 'Who1 <email1> 1.0-alt2'
newpackager = changelogEntry1[:changelogEntry1.rfind(' ')]
try:
changelogEntry2 = headers[rpm.RPMTAG_CHANGELOGNAME][1] # 'Who2 <email2> 1.0-alt1'
oldpackager = changelogEntry2[:changelogEntry2.rfind(' ')]
except:
oldpackager = None # package with one changelog entry
return (headers[rpm.RPMTAG_NAME],
newpackager,
oldpackager)

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, dummy 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, dummy in pkgInfos:
for warnPackager in packagerWarnlist:
if packager.lower().find(warnPackager) > -1:
warnPackages.append((pkg, packager))

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 os.path.exists(packagerWatchlistPath):
with open(packagerWatchlistPath) as f:
packagerWatchlist = [p.strip() for p in f.readlines() if len(p.strip()) > 0]

watchPackages = []
for pkg, newpackager, oldpackager in pkgInfos:
for watchPackager in packagerWatchlist:
if oldpackager and (oldpackager.lower().find(watchPackager) > -1) and (newpackager.lower() != oldpackager.lower()):
watchPackages.append((pkg, newpackager, oldpackager))

if len(watchPackages) > 0:
print
print '=== apt-blacklist-watch ==='
for pkg, newpackager, oldpackager in sorted(watchPackages, key=itemgetter(1)):
print 'Note: package %s was built by %s (after %s)' % (pkg, newpackager, oldpackager)
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.spec000064400000000000000000000036561165052322200176000ustar00rootroot00000000000000Name: apt-blacklist
Version: 0.01
Release: alt2.3.1

Summary: Forbids installation of packages based on some criteria
License: GPLv3+
Group: System/Configuration/Packaging

BuildArch: noarch

Packager: Andrey Rahmatullin <wrar@altlinux.ru>

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
and inform about packager changes for authors from %_sysconfdir/%name/watch.

%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
touch %buildroot%_sysconfdir/%name/watch
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
%config(noreplace) %_sysconfdir/%name/watch

%changelog
* Sat Oct 22 2011 Vitaly Kuznetsov <vitty@altlinux.ru> 0.01-alt2.3.1
- Rebuild with Python-2.7

* Fri Mar 26 2010 Terechkov Evgenii <evg@altlinux.ru> 0.01-alt2.3
- Fix new package installation (with just one changelog entry)

* Sat Mar 20 2010 Terechkov Evgenii <evg@altlinux.ru> 0.01-alt2.2
- Watching for packager change added (#23182)

* Mon Dec 07 2009 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 0.01-alt2.1
- Rebuilt with python 2.6

* Fri Oct 09 2009 Andrey Rahmatullin <wrar@altlinux.ru> 0.01-alt2
- Sisyphus build

* Sun Sep 13 2009 Terechkov Evgenii <evg@altlinux.ru> 0.01-alt1.1
- Warn list support added

* Sat Sep 12 2009 Andrey Rahmatullin <wrar@altlinux.ru> 0.01-alt1
- initial version
apt-blacklist-0.01/apt.conf000064400000000000000000000000651165052322200156140ustar00rootroot00000000000000RPM::Pre-Install-Pkgs { "/usr/bin/apt-blacklist"; };
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin