from __future__ import print_function
+import re
import os
import unittest
from tempfile import NamedTemporaryFile, mkdtemp
import subprocess
+import portage
+dir_mode = 0o774
-dir_mode = 0774
-
-CPVS = [u'sys-auth/consolekit-0.4.1', u'sys-apps/devicekit-power-014',
- u'media-libs/sdl-pango-0.1.2', u'sys-apps/help2man-1.37.1',
- u'app-emulation/emul-linux-x86-baselibs-20100220'
-]
+CPVS = [
+ 'sys-auth/consolekit-0.4.1',
+ 'sys-apps/devicekit-power-014',
+ 'media-libs/sdl-pango-0.1.2',
+ 'sys-apps/help2man-1.37.1',
+ 'app-emulation/emul-linux-x86-baselibs-20100220'
+ ]
PROPS = {
- u'sys-apps/devicekit-power-014': {u'SRC_URI':
- u'http://hal.freedesktop.org/releases/DeviceKit-power-014.tar.gz',
- u"RESTRICT": u''},
- u'sys-apps/help2man-1.37.1': {u"SRC_URI": u'mirror://gnu/help2man/help2man-1.37.1.tar.gz',
- u"RESTRICT": u''},
- u'sys-auth/consolekit-0.4.1': { u"SRC_URI":
- u'http://www.freedesktop.org/software/ConsoleKit/dist/ConsoleKit-0.4.1.tar.bz2',
- u"RESTRICT": u''},
- u'app-emulation/emul-linux-x86-baselibs-20100220': {
- u"SRC_URI": u'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz',
- u"RESTRICT": u'strip'},
- u'media-libs/sdl-pango-0.1.2': {
- u"SRC_URI": u'mirror://sourceforge/sdlpango/SDL_Pango-0.1.2.tar.gz http://zarb.org/~gc/t/SDL_Pango-0.1.2-API-adds.patch',
- u"RESTRICT": u''}
+ 'sys-apps/devicekit-power-014': {'SRC_URI':
+ 'http://hal.freedesktop.org/releases/DeviceKit-power-014.tar.gz',
+ "RESTRICT": ''},
+ 'sys-apps/help2man-1.37.1': {"SRC_URI": 'mirror://gnu/help2man/help2man-1.37.1.tar.gz',
+ "RESTRICT": ''},
+ 'sys-auth/consolekit-0.4.1': { "SRC_URI":
+ 'http://www.freedesktop.org/software/ConsoleKit/dist/ConsoleKit-0.4.1.tar.bz2',
+ "RESTRICT": ''},
+ 'app-emulation/emul-linux-x86-baselibs-20100220': {
+ "SRC_URI": 'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz',
+ "RESTRICT": 'strip'},
+ 'media-libs/sdl-pango-0.1.2': {
+ "SRC_URI": 'mirror://sourceforge/sdlpango/SDL_Pango-0.1.2.tar.gz http://zarb.org/~gc/t/SDL_Pango-0.1.2-API-adds.patch',
+ "RESTRICT": ''},
+ 'x11-base/xorg-server-1.6.5-r1': {
+ "SRC_URI": 'http://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.6.5.tar.bz2 mirror://gentoo/xorg-server-1.6.5-gentoo-patches-01.tar.bz2',
+ "RESTRICT": ''},
+ 'perl-core/ExtUtils-ParseXS-2.20.0401': {
+ "SRC_URI": 'mirror://cpan/authors/id/D/DA/DAGOLDEN//ExtUtils-ParseXS-2.200401.tar.gz',
+ "RESTRICT": ''},
+ 'x11-misc/util-macros-1.3.0': {
+ "SRC_URI": 'http://xorg.freedesktop.org/releases/individual/util/util-macros-1.3.0.tar.bz2',
+ "RESTRICT": ''},
+ 'x11-base/xorg-server-1.7.5': {
+ "SRC_URI": 'http://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.7.5.tar.bz2',
+ "RESTRICT": ''},
+ 'app-portage/portage-utils-0.3.1': {
+ "SRC_URI": 'mirror://gentoo/portage-utils-0.3.1.tar.bz2',
+ "RESTRICT": ''},
+ 'x11-misc/util-macros-1.5.0': {
+ "SRC_URI": 'http://xorg.freedesktop.org/releases/individual/util/util-macros-1.5.0.tar.bz2',
+ "RESTRICT": ''},
+ 'perl-core/Module-Build-0.35': {
+ "SRC_URI": 'mirror://cpan/authors/id/D/DA/DAGOLDEN//Module-Build-0.35.tar.gz',
+ "RESTRICT": ''},
+ 'perl-core/ExtUtils-ParseXS-2.22.02': {
+ "SRC_URI": 'mirror://cpan/authors/id/D/DA/DAGOLDEN//ExtUtils-ParseXS-2.2202.tar.gz',
+ "RESTRICT": ''},
+ 'perl-core/ExtUtils-ParseXS-2.22.03': {
+ "SRC_URI": 'mirror://cpan/authors/id/D/DA/DAGOLDEN//ExtUtils-ParseXS-2.2203.tar.gz',
+ "RESTRICT": ''},
+ 'perl-core/ExtUtils-ParseXS-2.22.01': {
+ "SRC_URI": 'mirror://cpan/authors/id/D/DA/DAGOLDEN//ExtUtils-ParseXS-2.2201.tar.gz',
+ "RESTRICT": ''},
+ 'perl-core/Archive-Tar-1.38': {
+ "SRC_URI": 'mirror://cpan/authors/id/K/KA/KANE/Archive-Tar-1.38.tar.gz',
+ "RESTRICT": ''},
+ 'perl-core/Archive-Tar-1.58': {
+ "SRC_URI": 'mirror://cpan/authors/id/B/BI/BINGOS//Archive-Tar-1.58.tar.gz',
+ "RESTRICT": ''},
+ 'perl-core/Archive-Tar-1.54': {
+ "SRC_URI": 'mirror://cpan/authors/id/B/BI/BINGOS//Archive-Tar-1.54.tar.gz',
+ "RESTRICT": ''},
+ 'perl-core/Archive-Tar-1.56': {
+ "SRC_URI": 'mirror://cpan/authors/id/B/BI/BINGOS//Archive-Tar-1.56.tar.gz',
+ "RESTRICT": ''},
+ 'app-portage/portage-utils-0.2.1': {
+ "SRC_URI": 'mirror://gentoo/portage-utils-0.2.1.tar.bz2',
+ "RESTRICT": ''},
+ 'dev-libs/libisofs-0.6.20-r1': {
+ "SRC_URI": 'http://files.libburnia-project.org/releases/libisofs-0.6.20.tar.gz',
+ "RESTRICT": ''},
+ 'perl-core/ExtUtils-ParseXS-2.22.02-r1': {
+ "SRC_URI": 'mirror://cpan/authors/id/D/DA/DAGOLDEN//ExtUtils-ParseXS-2.2202.tar.gz',
+ "RESTRICT": ''},
+ 'x11-misc/util-macros-1.6.0': {
+ "SRC_URI": 'http://xorg.freedesktop.org/releases/individual/util/util-macros-1.6.0.tar.bz2',
+ "RESTRICT": ''},
+ 'x11-libs/pixman-0.16.0': {
+ "SRC_URI": 'http://xorg.freedesktop.org/releases/individual/lib/pixman-0.16.0.tar.bz2',
+ "RESTRICT": ''},
+ 'x11-libs/pixman-0.16.4': {
+ "SRC_URI": 'http://xorg.freedesktop.org/releases/individual/lib/pixman-0.16.4.tar.bz2',
+ "RESTRICT": ''},
+ 'x11-libs/pixman-0.17.4': {
+ "SRC_URI": 'http://xorg.freedesktop.org/releases/individual/lib/pixman-0.17.4.tar.bz2',
+ "RESTRICT": ''},
+ 'x11-libs/pixman-0.17.2': {
+ "SRC_URI": 'http://xorg.freedesktop.org/releases/individual/lib/pixman-0.17.2.tar.bz2',
+ "RESTRICT": ''},
+ 'dev-libs/libburn-0.7.6-r1': {
+ "SRC_URI": 'http://files.libburnia-project.org/releases/libburn-0.7.6.pl00.tar.gz',
+ "RESTRICT": ''},
+ 'dev-libs/libburn-0.7.0': {
+ "SRC_URI": 'http://files.libburnia-project.org/releases/libburn-0.7.0.pl00.tar.gz',
+ "RESTRICT": ''},
+ 'perl-core/Module-Build-0.34.0201': {
+ "SRC_URI": 'mirror://cpan/authors/id/D/DA/DAGOLDEN//Module-Build-0.340201.tar.gz',
+ "RESTRICT": ''},
+ 'dev-libs/libburn-0.6.8': {
+ "SRC_URI": 'http://files.libburnia-project.org/releases/libburn-0.6.8.pl00.tar.gz',
+ "RESTRICT": ''},
+ 'dev-libs/libburn-0.7.4': {
+ "SRC_URI": 'http://files.libburnia-project.org/releases/libburn-0.7.4.pl00.tar.gz',
+ "RESTRICT": ''},
+ 'perl-core/Module-Build-0.36.03': {
+ "SRC_URI": 'mirror://cpan/authors/id/D/DA/DAGOLDEN//Module-Build-0.3603.tar.gz',
+ "RESTRICT": ''},
+ 'perl-core/Module-Build-0.36.01': {
+ "SRC_URI": 'mirror://cpan/authors/id/D/DA/DAGOLDEN//Module-Build-0.3601.tar.gz',
+ "RESTRICT": ''},
+ 'x11-base/xorg-server-1.5.3-r6': {
+ "SRC_URI": 'http://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.5.3.tar.bz2 http://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.5.3.tar.bz2 mirror://gentoo/xorg-server-1.5.3-gentoo-patches-08.tar.bz2',
+ "RESTRICT": ''},
+ 'dev-libs/libisofs-0.6.28': {
+ "SRC_URI": 'http://files.libburnia-project.org/releases/libisofs-0.6.28.tar.gz',
+ "RESTRICT": ''},
+ 'media-libs/xine-lib-1.1.17': {
+ "SRC_URI": 'mirror://sourceforge/xine/xine-lib-1.1.17.tar.bz2 mirror://gentoo/xine-lib-1.1.15-textrel-fix.patch',
+ "RESTRICT": ''},
+ 'media-libs/xine-lib-1.1.18': {
+ "SRC_URI": 'mirror://sourceforge/xine/xine-lib-1.1.18.tar.xz mirror://gentoo/xine-lib-1.1.15-textrel-fix.patch mirror://gentoo/xine-lib-1.1.18-compat.c.tbz2',
+ "RESTRICT": ''},
+ 'perl-core/ExtUtils-ParseXS-2.22': {
+ "SRC_URI": 'mirror://cpan/authors/id/D/DA/DAGOLDEN//ExtUtils-ParseXS-2.22.tar.gz',
+ "RESTRICT": ''},
+ 'perl-core/ExtUtils-ParseXS-2.21': {
+ "SRC_URI": 'mirror://cpan/authors/id/D/DA/DAGOLDEN//ExtUtils-ParseXS-2.21.tar.gz',
+ "RESTRICT": ''},
+ 'x11-base/xorg-server-1.7.5.901': {
+ "SRC_URI": 'http://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.7.5.901.tar.bz2',
+ "RESTRICT": ''},
+ 'dev-libs/libisofs-0.6.24': {
+ "SRC_URI": 'http://files.libburnia-project.org/releases/libisofs-0.6.24.tar.gz',
+ "RESTRICT": ''},
+ 'dev-libs/libisofs-0.6.26': {
+ "SRC_URI": 'http://files.libburnia-project.org/releases/libisofs-0.6.26.tar.gz',
+ "RESTRICT": ''},
+ 'app-portage/portage-utils-0.3.1': {
+ "SRC_URI": 'mirror://gentoo/portage-utils-0.3.1.tar.bz2',
+ "RESTRICT": ''},
+ 'app-portage/gentoolkit-0.3.0_rc8-r1': {
+ "SRC_URI": 'mirror://gentoo/gentoolkit-0.3.0_rc8.tar.gz http://dev.gentoo.org/~fuzzyray/distfiles/gentoolkit-0.3.0_rc8.tar.gz',
+ "RESTRICT": ''},
+ 'app-portage/gentoolkit-0.2.4.6-r1': {
+ "SRC_URI": 'mirror://gentoo/gentoolkit-0.2.4.6.tar.gz http://dev.gentoo.org/~fuzzyray/distfiles/gentoolkit-0.2.4.6.tar.gz',
+ "RESTRICT": ''},
+ 'app-portage/eix-0.20.2': {
+ "SRC_URI": 'mirror://berlios/eix/eix-0.20.2.tar.xz',
+ "RESTRICT": ''},
+ 'app-portage/gentoolkit-0.2.4.5': {
+ "SRC_URI": 'mirror://gentoo/gentoolkit-0.2.4.5.tar.gz http://dev.gentoo.org/~fuzzyray/distfiles/gentoolkit-0.2.4.5.tar.gz',
+ "RESTRICT": ''},
+ 'app-portage/portage-utils-0.2.1': {
+ "SRC_URI": 'mirror://gentoo/portage-utils-0.2.1.tar.bz2',
+ "RESTRICT": ''},
+ 'app-portage/gentoolkit-0.3.0_rc8': {
+ "SRC_URI": 'mirror://gentoo/gentoolkit-0.3.0_rc8.tar.gz http://dev.gentoo.org/~fuzzyray/distfiles/gentoolkit-0.3.0_rc8.tar.gz',
+ "RESTRICT": ''},
+ 'app-portage/gentoolkit-0.2.4.6': {
+ "SRC_URI": 'mirror://gentoo/gentoolkit-0.2.4.6.tar.gz http://dev.gentoo.org/~fuzzyray/distfiles/gentoolkit-0.2.4.6.tar.gz',
+ "RESTRICT": ''},
+ 'app-portage/layman-1.3.0-r1': {
+ "SRC_URI": 'mirror://sourceforge/layman/layman-1.3.0.tar.gz',
+ "RESTRICT": ''},
+ 'app-portage/gentoolkit-0.3.0_rc7': {
+ "SRC_URI": 'mirror://gentoo/gentoolkit-0.3.0_rc7.tar.gz http://dev.gentoo.org/~fuzzyray/distfiles/gentoolkit-0.3.0_rc7.tar.gz',
+ "RESTRICT": ''},
+ 'app-portage/layman-1.3.0': {
+ "SRC_URI": 'mirror://sourceforge/layman/layman-1.3.0.tar.gz',
+ "RESTRICT": ''},
+ 'app-portage/layman-1.3.1': {
+ "SRC_URI": 'mirror://sourceforge/layman/layman-1.3.1.tar.gz',
+ "RESTRICT": ''},
+ 'app-portage/layman-1.2.6': {
+ "SRC_URI": 'mirror://sourceforge/layman/layman-1.2.6.tar.gz',
+ "RESTRICT": ''},
+ 'app-portage/layman-9999': {
+ "SRC_URI": '',
+ "RESTRICT": ''},
+ 'app-portage/layman-1.2.5': {
+ "SRC_URI": 'mirror://sourceforge/layman/layman-1.2.5.tar.gz',
+ "RESTRICT": ''},
+ 'app-portage/layman-1.3.0_rc1-r3': {
+ "SRC_URI": 'mirror://sourceforge/layman/layman-1.3.0_rc1.tar.gz',
+ "RESTRICT": ''},
+ 'app-portage/gentoolkit-0.3.0_rc9': {
+ "SRC_URI": 'mirror://gentoo/gentoolkit-0.3.0_rc9.tar.gz http://dev.gentoo.org/~fuzzyray/distfiles/gentoolkit-0.3.0_rc9.tar.gz',
+ "RESTRICT": ''},
+ 'app-portage/eix-0.20.1': {
+ "SRC_URI": 'mirror://sourceforge/eix/eix-0.20.1.tar.xz',
+ "RESTRICT": ''},
+ 'app-portage/eix-0.19.2': {
+ "SRC_URI": 'mirror://sourceforge/eix/eix-0.19.2.tar.xz',
+ "RESTRICT": ''},
+ 'app-portage/layman-1.3.2-r1': {
+ "SRC_URI": 'mirror://sourceforge/layman/layman-1.3.2.tar.gz',
+ "RESTRICT": ''},
}
FILES = [
- u'DeviceKit-power-014.tar.gz',
- u'help2man-1.37.1.tar.gz',
- u'ConsoleKit-0.4.1.tar.bz2',
- u'emul-linux-x86-baselibs-20100220.tar.gz',
- u'SDL_Pango-0.1.2.tar.gz',
- u'SDL_Pango-0.1.2-API-adds.patch'
+ 'DeviceKit-power-014.tar.gz',
+ 'help2man-1.37.1.tar.gz',
+ 'ConsoleKit-0.4.1.tar.bz2',
+ 'emul-linux-x86-baselibs-20100220.tar.gz',
+ 'SDL_Pango-0.1.2.tar.gz',
+ 'SDL_Pango-0.1.2-API-adds.patch'
]
+CPVS2 = [
+ 'perl-core/Archive-Tar-1.38',
+ 'perl-core/Archive-Tar-1.54',
+ 'perl-core/Archive-Tar-1.56',
+ 'perl-core/Archive-Tar-1.58',
+ 'perl-core/ExtUtils-ParseXS-2.20.0401',
+ 'perl-core/ExtUtils-ParseXS-2.21',
+ 'perl-core/ExtUtils-ParseXS-2.22',
+ 'perl-core/ExtUtils-ParseXS-2.22.01',
+ 'perl-core/ExtUtils-ParseXS-2.22.02',
+ 'perl-core/ExtUtils-ParseXS-2.22.02-r1',
+ 'perl-core/ExtUtils-ParseXS-2.22.03',
+ 'perl-core/Module-Build-0.34.0201',
+ 'perl-core/Module-Build-0.35',
+ 'perl-core/Module-Build-0.36.01',
+ 'perl-core/Module-Build-0.36.03',
+ 'dev-libs/libburn-0.6.8',
+ 'dev-libs/libburn-0.7.0',
+ 'dev-libs/libburn-0.7.4',
+ 'dev-libs/libburn-0.7.6-r1',
+ 'dev-libs/libisofs-0.6.20-r1',
+ 'dev-libs/libisofs-0.6.24',
+ 'dev-libs/libisofs-0.6.26',
+ 'dev-libs/libisofs-0.6.28',
+ 'x11-libs/pixman-0.16.0',
+ 'x11-libs/pixman-0.16.4',
+ 'x11-libs/pixman-0.17.2',
+ 'x11-libs/pixman-0.17.4',
+ 'app-portage/portage-utils-0.2.1',
+ 'app-portage/portage-utils-0.3.1',
+ 'x11-misc/util-macros-1.3.0',
+ 'x11-misc/util-macros-1.5.0',
+ 'x11-misc/util-macros-1.6.0',
+ 'media-libs/xine-lib-1.1.17',
+ 'media-libs/xine-lib-1.1.18',
+ 'x11-base/xorg-server-1.5.3-r6',
+ 'x11-base/xorg-server-1.6.5-r1',
+ 'x11-base/xorg-server-1.7.5',
+ 'x11-base/xorg-server-1.7.5.901',
+ 'app-portage/layman-1.2.5',
+ 'app-portage/layman-1.2.6',
+ 'app-portage/layman-1.3.0_rc1-r3',
+ 'app-portage/layman-1.3.0',
+ 'app-portage/layman-1.3.0-r1',
+ 'app-portage/layman-1.3.1',
+ 'app-portage/layman-1.3.2-r1',
+ 'app-portage/layman-9999',
+ 'app-portage/eix-0.19.2',
+ 'app-portage/eix-0.20.1',
+ 'app-portage/eix-0.20.2',
+ 'app-portage/gentoolkit-0.2.4.5',
+ 'app-portage/gentoolkit-0.2.4.6',
+ 'app-portage/gentoolkit-0.2.4.6-r1',
+ 'app-portage/gentoolkit-0.3.0_rc7',
+ 'app-portage/gentoolkit-0.3.0_rc8',
+ 'app-portage/gentoolkit-0.3.0_rc8-r1',
+ 'app-portage/gentoolkit-0.3.0_rc9',
+ 'app-portage/portage-utils-0.2.1',
+ 'app-portage/portage-utils-0.3.1'
+ ]
+
+CPVS3 = [
+ 'x11-base/xorg-server-1.6.5-r1',
+ 'x11-misc/util-macros-1.6.0',
+ 'x11-libs/pixman-0.16.4',
+ #'dev-libs/libisofs-0.6.28',
+ #'perl-core/Module-Build-0.36.03',
+ #'perl-core/ExtUtils-ParseXS-2.22.02-r1',
+ #'perl-core/Archive-Tar-1.56',
+ #'app-portage/gentoolkit-0.3.0_rc8-r1',
+ #'app-portage/layman-1.3.1',
+ #'app-portage/eix-0.20.1',
+ ]
+
+
+Exclude= {'packages': {
+ 'media-libs/sdl-pango': None,
+ },
+ 'anti-packages': {'app-emulation/emul-linux-x86-baselibs': None},
+ 'categories': {'app-portage': None,
+ 'app-portage/gentoolkit': None
+ },
+ 'filenames': {'sys-auth/consolekit-0.4.1': re.compile('sys-auth/consolekit-0.4.1')
+ }
+ }
+
+
+def get_props(cpvs):
+ props = {}
+ for cpv in cpvs:
+ props[cpv] = PROPS[cpv]
+ return props
class Dbapi(object):
"""Fake portage dbapi class used to return
return self._cp_all[:]
def cp_list(self, package):
- #need to determine the data to return
- # and gather some from a live system to use for testing
- pass
+ print(self._cp_list)
+ if self._cp_list is None or self._cp_list==[]:
+ cplist = []
+ for cpv in self._cpv_all:
+ parts = portage.catpkgsplit(cpv)
+ cp='/'.join(parts[:2])
+ print(package, cp)
+ if cp == package:
+ cplist.append(cpv)
+ return cplist
+ else:
+ return self._cp_list
def cpv_all(self):
+ #print(self.name, type(self._cpv_all), self._cpv_all)
return self._cpv_all
def cpv_exists(self, cpv):
if cpv in self._props:
props.append(self._props[cpv][prop])
else:
- raise KeyError, self.name
+ raise KeyError(self.name)
return props
+#!/usr/bin/python
+
+
# Copyright(c) 2009, Gentoo Foundation
# Copyright 2010 Brian Dolbec <brian.dolbec@gmail.com>
#
from test import support as test_support
from gentoolkit.test.eclean.distsupport import *
+import gentoolkit.eclean.search as search
from gentoolkit.eclean.search import DistfilesSearch
-
+from gentoolkit.eclean.exclude import parseExcludeFile
"""Tests for eclean's distfiles search functions."""
self.vardb = Dbapi(cp_all=[], cpv_all=CPVS,
props=PROPS, cp_list=[], name="FAKE VARDB")
self.portdb = Dbapi(cp_all=[], cpv_all=CPVS[:4],
- props=self.get_props(CPVS[:4]), cp_list=[], name="FAKE PORTDB")
+ props=get_props(CPVS[:4]), cp_list=[], name="FAKE PORTDB")
# set a fetch restricted pkg
- self.portdb._props[CPVS[0]]["RESTRICT"] = u'fetch'
+ self.portdb._props[CPVS[0]]["RESTRICT"] = 'fetch'
self.callback_data = []
self.output = self.output = OutputSimulator(self.callback)
self.target_class = DistfilesSearch(self.output.einfo, self.portdb, self.vardb)
self.target_class.portdb = self.portdb
self.target_class.portdb = self.portdb
+ self.results = {}
self.testdata = {
'fetch_restricted1':{
'deprecated':
- {u'app-emulation/emul-linux-x86-baselibs-20100220': u'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz'
+ {'app-emulation/emul-linux-x86-baselibs-20100220': 'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz'
},
'pkgs':
- {u'sys-auth/consolekit-0.4.1': u'http://www.freedesktop.org/software/ConsoleKit/dist/ConsoleKit-0.4.1.tar.bz2'
+ {'sys-auth/consolekit-0.4.1': 'http://www.freedesktop.org/software/ConsoleKit/dist/ConsoleKit-0.4.1.tar.bz2'
},
'output': [
- u'!!! "Deprecation Warning: Installed package: app-emulation/emul-linux-x86-baselibs-20100220\n\tIs no longer in the tree or an installed overlay\n'
+ '!!! "Deprecation Warning: Installed package: app-emulation/emul-linux-x86-baselibs-20100220\n\tIs no longer in the tree or an installed overlay\n'
]
},
'fetch_restricted2':{
'deprecated':
- {u'app-emulation/emul-linux-x86-baselibs-20100220': u'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz'
+ {'app-emulation/emul-linux-x86-baselibs-20100220': 'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz'
},
'pkgs':
- {u'sys-auth/consolekit-0.4.1': u'http://www.freedesktop.org/software/ConsoleKit/dist/ConsoleKit-0.4.1.tar.bz2'
+ {'sys-auth/consolekit-0.4.1': 'http://www.freedesktop.org/software/ConsoleKit/dist/ConsoleKit-0.4.1.tar.bz2'
},
'output': [
- u'!!! "Deprecation Warning: Installed package: app-emulation/emul-linux-x86-baselibs-20100220\n\tIs no longer in the tree or an installed overlay\n',
+ '!!! "Deprecation Warning: Installed package: app-emulation/emul-linux-x86-baselibs-20100220\n\tIs no longer in the tree or an installed overlay\n',
' - Key Error looking up: app-portage/deprecated-pkg-1.0.0'
]
},
'unrestricted1':{
'deprecated':{
- u'app-emulation/emul-linux-x86-baselibs-20100220': u'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz'
+ 'app-emulation/emul-linux-x86-baselibs-20100220': 'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz'
},
'pkgs': {
- u'sys-apps/devicekit-power-014': u'http://hal.freedesktop.org/releases/DeviceKit-power-014.tar.gz',
- u'sys-apps/help2man-1.37.1': u'mirror://gnu/help2man/help2man-1.37.1.tar.gz',
- u'sys-auth/consolekit-0.4.1': u'http://www.freedesktop.org/software/ConsoleKit/dist/ConsoleKit-0.4.1.tar.bz2',
- u'app-emulation/emul-linux-x86-baselibs-20100220': u'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz',
- u'media-libs/sdl-pango-0.1.2': u'mirror://sourceforge/sdlpango/SDL_Pango-0.1.2.tar.gz http://zarb.org/~gc/t/SDL_Pango-0.1.2-API-adds.patch'
+ 'sys-apps/devicekit-power-014': 'http://hal.freedesktop.org/releases/DeviceKit-power-014.tar.gz',
+ 'sys-apps/help2man-1.37.1': 'mirror://gnu/help2man/help2man-1.37.1.tar.gz',
+ 'sys-auth/consolekit-0.4.1': 'http://www.freedesktop.org/software/ConsoleKit/dist/ConsoleKit-0.4.1.tar.bz2',
+ 'app-emulation/emul-linux-x86-baselibs-20100220': 'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz',
+ 'media-libs/sdl-pango-0.1.2': 'mirror://sourceforge/sdlpango/SDL_Pango-0.1.2.tar.gz http://zarb.org/~gc/t/SDL_Pango-0.1.2-API-adds.patch'
},
'output': [
- u'!!! "Deprecation Warning: Installed package: app-emulation/emul-linux-x86-baselibs-20100220\n\tIs no longer in the tree or an installed overlay\n',
+ '!!! "Deprecation Warning: Installed package: app-emulation/emul-linux-x86-baselibs-20100220\n\tIs no longer in the tree or an installed overlay\n',
]
},
'unrestricted2':{
'deprecated':{
- u'app-emulation/emul-linux-x86-baselibs-20100220': u'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz'
+ 'app-emulation/emul-linux-x86-baselibs-20100220': 'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz'
},
'pkgs': {
- u'sys-apps/devicekit-power-014': u'http://hal.freedesktop.org/releases/DeviceKit-power-014.tar.gz',
- u'sys-apps/help2man-1.37.1': u'mirror://gnu/help2man/help2man-1.37.1.tar.gz',
- u'sys-auth/consolekit-0.4.1': u'http://www.freedesktop.org/software/ConsoleKit/dist/ConsoleKit-0.4.1.tar.bz2',
- u'app-emulation/emul-linux-x86-baselibs-20100220': u'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz',
- u'media-libs/sdl-pango-0.1.2': u'mirror://sourceforge/sdlpango/SDL_Pango-0.1.2.tar.gz http://zarb.org/~gc/t/SDL_Pango-0.1.2-API-adds.patch'
+ 'sys-apps/devicekit-power-014': 'http://hal.freedesktop.org/releases/DeviceKit-power-014.tar.gz',
+ 'sys-apps/help2man-1.37.1': 'mirror://gnu/help2man/help2man-1.37.1.tar.gz',
+ 'sys-auth/consolekit-0.4.1': 'http://www.freedesktop.org/software/ConsoleKit/dist/ConsoleKit-0.4.1.tar.bz2',
+ 'app-emulation/emul-linux-x86-baselibs-20100220': 'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz',
+ 'media-libs/sdl-pango-0.1.2': 'mirror://sourceforge/sdlpango/SDL_Pango-0.1.2.tar.gz http://zarb.org/~gc/t/SDL_Pango-0.1.2-API-adds.patch'
},
'output': [
- u'!!! "Deprecation Warning: Installed package: app-emulation/emul-linux-x86-baselibs-20100220\n\tIs no longer in the tree or an installed overlay\n',
+ '!!! "Deprecation Warning: Installed package: app-emulation/emul-linux-x86-baselibs-20100220\n\tIs no longer in the tree or an installed overlay\n',
' - Key Error looking up: app-portage/deprecated-pkg-1.0.0'
]
}
}
-
- def get_props(self, cpvs):
- props = {}
- for cpv in cpvs:
- props[cpv] = PROPS[cpv]
- return props
-
-
def callback(self, id, data):
self.callback_data.append(data)
def test__fetch_restricted(self):
+ self.results = {}
pkgs, deprecated = self.target_class._fetch_restricted(None, CPVS)
- self.results = {
- 'fetch_restricted1': {
- 'pkgs': pkgs,
- 'deprecated': deprecated,
- 'output': self.callback_data
- }
- }
+ self.record_results('fetch_restricted1', pkgs, deprecated)
self.callback_data = []
cpvs = CPVS[:]
cpvs.append('app-portage/deprecated-pkg-1.0.0')
pkgs, deprecated = self.target_class._fetch_restricted(None, cpvs)
- self.results['fetch_restricted2'] = {
- 'pkgs': pkgs,
- 'deprecated': deprecated,
- 'output': self.callback_data
- }
+ self.record_results('fetch_restricted2', pkgs, deprecated)
+ self.test_results("test_fetch_restricted")
+
+ def test_unrestricted(self):
+ self.results = {}
+ pkgs, deprecated = self.target_class._unrestricted(None, CPVS)
+ self.record_results('unrestricted1', pkgs, deprecated)
+ self.callback_data = []
+ cpvs = CPVS[:]
+ cpvs.append('app-portage/deprecated-pkg-1.0.0')
+ pkgs, deprecated = self.target_class._unrestricted(None, cpvs)
+ self.record_results('unrestricted2', pkgs, deprecated)
+ self.test_results("test_unrestricted")
+
+
+ def test_results(self, test_name):
+ print("\nChecking results for %s,............" %test_name)
for key in sorted(self.results):
testdata = self.testdata[key]
results = self.results[key]
for item in sorted(testdata):
+ #print("comparing %s, %s" %(key, item))
self.failUnlessEqual(sorted(testdata[item]), sorted(results[item]),
- "\ntest_fetch_restricted: %s %s data does not match\nresult=" %(key, item) +\
+ "\n%s: %s %s data does not match\nresult=" %(test_name, key, item) +\
str(results[item]) + "\ntestdata=" + str(testdata[item]))
-
- def test_unrestricted(self):
- pkgs, deprecated = self.target_class._unrestricted(None, CPVS)
- self.results = {
- 'unrestricted1': {
- 'pkgs': pkgs,
+ def record_results(self, test, pkgs, deprecated):
+ self.results[test] = {'pkgs': pkgs,
'deprecated': deprecated,
'output': self.callback_data
}
+
+
+class TestNonDestructive(unittest.TestCase):
+ """Tests eclean.search.DistfilesSearch._non_destructive and _destructive
+ functions, with addition useage tests of fetch_restricted() and _unrestricted()
+ """
+
+ def setUp(self):
+ self.vardb = Dbapi(cp_all=[], cpv_all=CPVS,
+ props=PROPS, cp_list=[], name="FAKE VARDB")
+ self.portdb = Dbapi(cp_all=[], cpv_all=CPVS[:4],
+ props=get_props(CPVS[:4]), cp_list=[], name="FAKE PORTDB")
+ # set a fetch restricted pkg
+ self.portdb._props[CPVS[0]]["RESTRICT"] = 'fetch'
+ self.callback_data = []
+ self.output = self.output = OutputSimulator(self.callback)
+ self.target_class = DistfilesSearch(self.output.einfo, self.portdb, self.vardb)
+ self.target_class.portdb = self.portdb
+ self.target_class.portdb = self.portdb
+ search.exclDictExpand = self.exclDictExpand
+ self.exclude = parseExcludeFile(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'distfiles.exclude'), self.output.einfo)
+ #print(self.callback_data)
+ #print(self.exclude)
+ self.callback_data = []
+ self.results = {}
+ self.testdata = {
+ 'non_destructive1':{
+ 'deprecated':
+ {'app-emulation/emul-linux-x86-baselibs-20100220': 'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz'
+ },
+ 'pkgs': {
+ 'sys-auth/consolekit-0.4.1': 'http://www.freedesktop.org/software/ConsoleKit/dist/ConsoleKit-0.4.1.tar.bz2',
+ 'sys-apps/help2man-1.37.1': 'mirror://gnu/help2man/help2man-1.37.1.tar.gz',
+ 'sys-apps/devicekit-power-014': 'http://hal.freedesktop.org/releases/DeviceKit-power-014.tar.gz',
+ 'app-emulation/emul-linux-x86-baselibs-20100220': 'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz',
+ 'media-libs/sdl-pango-0.1.2': 'mirror://sourceforge/sdlpango/SDL_Pango-0.1.2.tar.gz http://zarb.org/~gc/t/SDL_Pango-0.1.2-API-adds.patch'
+ },
+ 'output': [
+ ' - getting complete ebuild list',
+ ' - getting source file names for 5 ebuilds',
+ '!!! "Deprecation Warning: Installed package: app-emulation/emul-linux-x86-baselibs-20100220\n\tIs no longer in the tree or an installed overlay\n'
+ ]
+ },
+ 'non_destructive2':{
+ 'deprecated': {
+ },
+ 'pkgs': {
+ 'sys-auth/consolekit-0.4.1': 'http://www.freedesktop.org/software/ConsoleKit/dist/ConsoleKit-0.4.1.tar.bz2',
+ 'sys-apps/devicekit-power-014': 'http://hal.freedesktop.org/releases/DeviceKit-power-014.tar.gz',
+ 'media-libs/sdl-pango-0.1.2': 'mirror://sourceforge/sdlpango/SDL_Pango-0.1.2.tar.gz http://zarb.org/~gc/t/SDL_Pango-0.1.2-API-adds.patch'
+ },
+ 'output': [
+ ' - getting complete ebuild list',
+ ' - getting source file names for 3 installed ebuilds',
+ ' - getting fetch-restricted source file names for 2 remaining ebuilds'
+ ]
+ },
+ 'non_destructive3':{
+ 'deprecated':{
+ },
+ 'pkgs': {
+ 'sys-apps/devicekit-power-014': 'http://hal.freedesktop.org/releases/DeviceKit-power-014.tar.gz',
+ 'sys-auth/consolekit-0.4.1': 'http://www.freedesktop.org/software/ConsoleKit/dist/ConsoleKit-0.4.1.tar.bz2',
+ 'app-emulation/emul-linux-x86-baselibs-20100220': 'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz',
+ },
+ 'output': [
+ ' - getting complete ebuild list',
+ ' - getting source file names for 2 installed ebuilds',
+ ' - getting fetch-restricted source file names for 3 remaining ebuilds'
+ ]
+ },
+ 'destructive1':{
+ 'deprecated':{
+ 'app-emulation/emul-linux-x86-baselibs-20100220': 'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz'
+ },
+ 'pkgs': {
+ 'sys-apps/devicekit-power-014': 'http://hal.freedesktop.org/releases/DeviceKit-power-014.tar.gz',
+ 'sys-apps/help2man-1.37.1': 'mirror://gnu/help2man/help2man-1.37.1.tar.gz',
+ 'sys-auth/consolekit-0.4.1': 'http://www.freedesktop.org/software/ConsoleKit/dist/ConsoleKit-0.4.1.tar.bz2',
+ 'app-emulation/emul-linux-x86-baselibs-20100220': 'mirror://gentoo/emul-linux-x86-baselibs-20100220.tar.gz',
+ 'media-libs/sdl-pango-0.1.2': 'mirror://sourceforge/sdlpango/SDL_Pango-0.1.2.tar.gz http://zarb.org/~gc/t/SDL_Pango-0.1.2-API-adds.patch'
+ },
+ 'output': [
+ ' - processing 5 installed ebuilds', ' - processing excluded',
+ ' - (5 of 0 total) additional excluded packages to get source filenames for',
+ '!!! "Deprecation Warning: Installed package: app-emulation/emul-linux-x86-baselibs-20100220\n\tIs no longer in the tree or an installed overlay\n'
+ ]
+ },
+ 'destructive2':{
+ 'deprecated':{
+ },
+ 'pkgs': {
+ },
+ 'output': [
+ ' - processing 0 installed packages',
+ ' - processing excluded', ' - (0 of 0 total) additional excluded packages to get source filenames for'
+ ]
+ },
+ 'destructive3':{
+ 'deprecated':{
+ },
+ 'pkgs': {
+ 'app-portage/portage-utils-0.3.1': 'mirror://gentoo/portage-utils-0.3.1.tar.bz2',
+ 'app-portage/gentoolkit-0.2.4.5': 'mirror://gentoo/gentoolkit-0.2.4.5.tar.gz http://dev.gentoo.org/~fuzzyray/distfiles/gentoolkit-0.2.4.5.tar.gz',
+ 'app-portage/gentoolkit-0.3.0_rc8-r1': 'mirror://gentoo/gentoolkit-0.3.0_rc8.tar.gz http://dev.gentoo.org/~fuzzyray/distfiles/gentoolkit-0.3.0_rc8.tar.gz',
+ 'app-portage/gentoolkit-0.2.4.6-r1': 'mirror://gentoo/gentoolkit-0.2.4.6.tar.gz http://dev.gentoo.org/~fuzzyray/distfiles/gentoolkit-0.2.4.6.tar.gz',
+ 'app-portage/eix-0.20.2': 'mirror://berlios/eix/eix-0.20.2.tar.xz',
+ 'sys-apps/devicekit-power-014': {'SRC_URI': 'http://hal.freedesktop.org/releases/DeviceKit-power-014.tar.gz'},
+ 'app-portage/portage-utils-0.2.1': 'mirror://gentoo/portage-utils-0.2.1.tar.bz2',
+ 'app-portage/eix-0.20.1': 'mirror://sourceforge/eix/eix-0.20.1.tar.xz',
+ 'app-portage/layman-1.2.5': 'mirror://sourceforge/layman/layman-1.2.5.tar.gz',
+ 'app-portage/layman-1.3.0-r1': 'mirror://sourceforge/layman/layman-1.3.0.tar.gz',
+ 'app-portage/gentoolkit-0.3.0_rc7': 'mirror://gentoo/gentoolkit-0.3.0_rc7.tar.gz http://dev.gentoo.org/~fuzzyray/distfiles/gentoolkit-0.3.0_rc7.tar.gz',
+ 'app-portage/layman-1.3.0': 'mirror://sourceforge/layman/layman-1.3.0.tar.gz',
+ 'app-portage/layman-1.3.1': 'mirror://sourceforge/layman/layman-1.3.1.tar.gz',
+ 'app-portage/layman-1.2.6': 'mirror://sourceforge/layman/layman-1.2.6.tar.gz',
+ 'app-portage/layman-9999': '',
+ 'app-portage/gentoolkit-0.2.4.6': 'mirror://gentoo/gentoolkit-0.2.4.6.tar.gz http://dev.gentoo.org/~fuzzyray/distfiles/gentoolkit-0.2.4.6.tar.gz',
+ 'app-portage/layman-1.3.0_rc1-r3': 'mirror://sourceforge/layman/layman-1.3.0_rc1.tar.gz',
+ 'app-portage/gentoolkit-0.3.0_rc9': 'mirror://gentoo/gentoolkit-0.3.0_rc9.tar.gz http://dev.gentoo.org/~fuzzyray/distfiles/gentoolkit-0.3.0_rc9.tar.gz',
+ 'app-portage/gentoolkit-0.3.0_rc8': 'mirror://gentoo/gentoolkit-0.3.0_rc8.tar.gz http://dev.gentoo.org/~fuzzyray/distfiles/gentoolkit-0.3.0_rc8.tar.gz',
+ 'app-portage/eix-0.19.2': 'mirror://sourceforge/eix/eix-0.19.2.tar.xz', 'app-portage/layman-1.3.2-r1': 'mirror://sourceforge/layman/layman-1.3.2.tar.gz'
+ },
+ 'output': [
+ ' - processing excluded',
+ ' - (20 of 20 total) additional excluded packages to get source filenames for'
+ ]
+ },
+ 'destructive4':{
+ 'deprecated':{
+ },
+ 'pkgs': {
+ 'sys-auth/consolekit-0.4.1':
+ 'http://www.freedesktop.org/software/ConsoleKit/dist/ConsoleKit-0.4.1.tar.bz2',
+ 'sys-apps/devicekit-power-014':
+ 'http://hal.freedesktop.org/releases/DeviceKit-power-014.tar.gz',
+ 'media-libs/sdl-pango-0.1.2':
+ 'mirror://sourceforge/sdlpango/SDL_Pango-0.1.2.tar.gz http://zarb.org/~gc/t/SDL_Pango-0.1.2-API-adds.patch'
+ },
+ 'output': [
+ ' - processing 3 installed ebuilds',
+ ' - processing excluded',
+ ' - (3 of 0 total) additional excluded packages to get source filenames for'
+ ]
+ },
+ 'destructive5':{
+ 'deprecated':{
+ 'x11-base/xorg-server-1.6.5-r1': 'http://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.6.5.tar.bz2 mirror://gentoo/xorg-server-1.6.5-gentoo-patches-01.tar.bz2',
+ 'x11-misc/util-macros-1.6.0': 'http://xorg.freedesktop.org/releases/individual/util/util-macros-1.6.0.tar.bz2',
+ 'x11-libs/pixman-0.16.4': 'http://xorg.freedesktop.org/releases/individual/lib/pixman-0.16.4.tar.bz2'
+ },
+ 'pkgs': {
+ 'sys-apps/devicekit-power-014': 'http://hal.freedesktop.org/releases/DeviceKit-power-014.tar.gz',
+ 'dev-libs/libisofs-0.6.28': 'http://files.libburnia-project.org/releases/libisofs-0.6.28.tar.gz',
+ 'perl-core/Module-Build-0.36.03': 'mirror://cpan/authors/id/D/DA/DAGOLDEN//Module-Build-0.3603.tar.gz',
+ 'x11-base/xorg-server-1.6.5-r1': 'http://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.6.5.tar.bz2 mirror://gentoo/xorg-server-1.6.5-gentoo-patches-01.tar.bz2',
+ 'perl-core/Archive-Tar-1.56': 'mirror://cpan/authors/id/B/BI/BINGOS//Archive-Tar-1.56.tar.gz',
+ 'perl-core/ExtUtils-ParseXS-2.22.02-r1': 'mirror://cpan/authors/id/D/DA/DAGOLDEN//ExtUtils-ParseXS-2.2202.tar.gz',
+ 'x11-misc/util-macros-1.6.0': 'http://xorg.freedesktop.org/releases/individual/util/util-macros-1.6.0.tar.bz2',
+ 'sys-auth/consolekit-0.4.1': 'http://www.freedesktop.org/software/ConsoleKit/dist/ConsoleKit-0.4.1.tar.bz2',
+ 'media-libs/sdl-pango-0.1.2': 'mirror://sourceforge/sdlpango/SDL_Pango-0.1.2.tar.gz http://zarb.org/~gc/t/SDL_Pango-0.1.2-API-adds.patch',
+ 'x11-libs/pixman-0.16.4': 'http://xorg.freedesktop.org/releases/individual/lib/pixman-0.16.4.tar.bz2'
+ },
+ 'output': [' - processing 10 installed ebuilds',
+ ' - processing excluded',
+ ' - (10 of 0 total) additional excluded packages to get source filenames for',
+ '!!! "Deprecation Warning: Installed package: perl-core/Archive-Tar-1.56\n\tIs no longer in the tree or an installed overlay\n',
+ '!!! "Deprecation Warning: Installed package: perl-core/ExtUtils-ParseXS-2.22.02-r1\n\tIs no longer in the tree or an installed overlay\n',
+ '!!! "Deprecation Warning: Installed package: perl-core/Module-Build-0.36.03\n\tIs no longer in the tree or an installed overlay\n',
+ '!!! "Deprecation Warning: Installed package: x11-base/xorg-server-1.6.5-r1\n\tIs no longer in the tree or an installed overlay\n',
+ '!!! "Deprecation Warning: Installed package: dev-libs/libisofs-0.6.28\n\tIs no longer in the tree or an installed overlay\n',
+ '!!! "Deprecation Warning: Installed package: x11-misc/util-macros-1.6.0\n\tIs no longer in the tree or an installed overlay\n',
+ '!!! "Deprecation Warning: Installed package: x11-libs/pixman-0.16.4\n\tIs no longer in the tree or an installed overlay\n'
+ ]
+ }
}
+
+
+ def callback(self, id, data):
+ self.callback_data.append(data)
+
+
+ def exclDictExpand(self, exclude):
+ print("Testing exclDictExpand()")
+ return [
+ 'app-portage/layman',
+ 'app-portage/eix',
+ 'app-portage/gentoolkit',
+ 'app-portage/portage-utils',
+ ]
+
+
+ def test_non_destructive(self):
+ self.results = {}
+ pkgs, deprecated = self.target_class._non_destructive(destructive=False,
+ fetch_restricted=False, pkgs_=None)
+ self.record_results('non_destructive1', pkgs, deprecated)
+
self.callback_data = []
- cpvs = CPVS[:]
- cpvs.append('app-portage/deprecated-pkg-1.0.0')
- pkgs, deprecated = self.target_class._unrestricted(None, cpvs)
- self.results['unrestricted2'] = {
- 'pkgs': pkgs,
- 'deprecated': deprecated,
- 'output': self.callback_data
- }
+ self.vardb._cpv_all=CPVS[:3]
+ self.vardb._props=get_props(CPVS[:3])
+ self.portdb._cpv_all=CPVS[:]
+ self.portdb._props=get_props(CPVS)
+ pkgs, deprecated = self.target_class._non_destructive(destructive=True,
+ fetch_restricted=True, pkgs_=None)
+ self.record_results('non_destructive2', pkgs, deprecated)
+
+ self.callback_data = []
+ self.vardb._cpv_all=CPVS[:2]
+ self.vardb._props=get_props(CPVS[:2])
+ self.portdb._cpv_all=CPVS[:]
+ self.portdb._props=get_props(CPVS)
+ # set a fetch restricted pkg
+ self.portdb._props[CPVS[4]]["RESTRICT"] = 'fetch'
+ pkgs = {'sys-apps/devicekit-power-014': {'SRC_URI':
+ 'http://hal.freedesktop.org/releases/DeviceKit-power-014.tar.gz'}
+ }
+ pkgs, deprecated = self.target_class._non_destructive(destructive=True,
+ fetch_restricted=True, pkgs_=pkgs)
+ self.record_results('non_destructive3', pkgs, deprecated)
+ self.test_results("test_non_destructive")
+
+
+ def test_results(self, test_name):
+ print("\nChecking results for %s,............" %test_name)
for key in sorted(self.results):
testdata = self.testdata[key]
results = self.results[key]
for item in sorted(testdata):
- self.failUnlessEqual( sorted(testdata[item]), sorted(results[item]),
- "\ntest_unrestricted: %s %s data does not match\nresult=" %(key, item) +\
+ #print("comparing %s, %s" %(key, item))
+ self.failUnlessEqual(sorted(testdata[item]), sorted(results[item]),
+ "\n%s: %s %s data does not match\nresult=" %(test_name, key, item) +\
str(results[item]) + "\ntestdata=" + str(testdata[item]))
+ def record_results(self, test, pkgs, deprecated):
+ self.results[test] = {'pkgs': pkgs,
+ 'deprecated': deprecated,
+ 'output': self.callback_data
+ }
+
+ def test_destructive(self):
+ self.results = {}
+ pkgs, deprecated = self.target_class._destructive(package_names=False,
+ exclude={}, pkgs_=None, installed_included=False )
+ self.record_results('destructive1', pkgs, deprecated)
+
+ self.callback_data = []
+ self.vardb._cpv_all=CPVS[:3]
+ self.vardb._props=get_props(CPVS[:3])
+ self.portdb._cpv_all=CPVS[:]
+ self.portdb._props=get_props(CPVS)
+ pkgs, deprecated = self.target_class._destructive(package_names=True,
+ exclude={}, pkgs_=None, installed_included=False )
+ self.record_results('destructive2', pkgs, deprecated)
+
+ self.callback_data = []
+ cpvs = CPVS[2:4]
+ cpvs.extend(CPVS3)
+ self.vardb._cpv_all=sorted(cpvs)
+ self.vardb._props= PROPS.update(get_props(CPVS3))
+ self.portdb._cpv_all=sorted(CPVS + CPVS2)
+ self.portdb._props=get_props(CPVS+CPVS2)
+ # set a fetch restricted pkg
+ self.portdb._props[CPVS[4]]["RESTRICT"] = 'fetch'
+ pkgs = {'sys-apps/devicekit-power-014': {'SRC_URI':
+ 'http://hal.freedesktop.org/releases/DeviceKit-power-014.tar.gz'}
+ }
+ pkgs, deprecated = self.target_class._destructive(package_names=True,
+ exclude={}, pkgs_=pkgs, installed_included=True )
+ self.record_results('destructive3', pkgs, deprecated)
+
+ self.callback_data = []
+ self.vardb._cpv_all=CPVS[:3]
+ self.vardb._props=get_props(CPVS[:3])
+ self.portdb._cpv_all=CPVS[:]
+ self.portdb._props=get_props(CPVS)
+ pkgs, deprecated = self.target_class._destructive(package_names=False,
+ exclude=self.exclude, pkgs_=None, installed_included=False )
+ self.record_results('destructive4', pkgs, deprecated)
+ self.test_results("test_destructive")
+
+ self.callback_data = []
+ self.vardb._cpv_all=CPVS[:3]
+ self.vardb._cpv_all.extend(CPVS3)
+ self.vardb._props=get_props(self.vardb._cpv_all)
+ self.portdb._cpv_all=CPVS[:]
+ self.portdb._cpv_all.extend(CPVS2)
+ self.portdb._props=get_props(CPVS)
+ pkgs, deprecated = self.target_class._destructive(package_names=False,
+ exclude=self.exclude, pkgs_=None, installed_included=False )
+ self.record_results('destructive5', pkgs, deprecated)
+ self.test_results("test_destructive")
+
def test_main():
test_support.run_unittest(TestCheckLimits('test_check_limits'))
test_support.run_unittest( TestFetchRestricted('test__fetch_restricted'))
test_support.run_unittest( TestFetchRestricted('test_unrestricted'))
+ test_support.run_unittest( TestNonDestructive('test_non_destructive'))
+ #test_support.run_unittest( TestNonDestructive('test_destructive'))
if __name__ == '__main__':