summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt/cache.py3
-rw-r--r--apt/package.py3
-rw-r--r--aptsources/__init__.py4
-rw-r--r--aptsources/distinfo.py46
-rw-r--r--data/templates/Debian.info.in23
-rw-r--r--data/templates/Ubuntu.info.in9
-rw-r--r--debian/changelog34
-rw-r--r--po/python-apt.pot25
-rw-r--r--python/apt_instmodule.cc13
-rw-r--r--python/apt_pkgmodule.cc6
-rw-r--r--python/cache.cc2
-rw-r--r--python/depcache.cc6
-rw-r--r--python/progress.cc6
-rw-r--r--tests/data/sources.list.testDistribution22
-rw-r--r--tests/test_aptsources.py42
-rwxr-xr-xtests/test_debextract.py13
-rw-r--r--tests/test_extract_archive.py10
17 files changed, 205 insertions, 62 deletions
diff --git a/apt/cache.py b/apt/cache.py
index 384afe31..bbf2165b 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -101,6 +101,9 @@ class Cache(object):
def has_key(self, key):
return self._dict.has_key(key)
+ def __contains__(self, key):
+ return key in self._dict
+
def __len__(self):
return len(self._dict)
diff --git a/apt/package.py b/apt/package.py
index 096b1bd1..c1c2b1e1 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -186,7 +186,8 @@ class Package(object):
def sourcePackageName(self):
""" Return the source package name as string """
if not self._lookupRecord():
- return None
+ if not self._lookupRecord(UseCandidate=False):
+ return self._pkg.Name
src = self._records.SourcePkg
if src != "":
return src
diff --git a/aptsources/__init__.py b/aptsources/__init__.py
index 8d1c8b69..d6b3605c 100644
--- a/aptsources/__init__.py
+++ b/aptsources/__init__.py
@@ -1 +1,5 @@
+
+import apt_pkg
+# init the package system
+apt_pkg.init()
diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py
index 9b438701..a6c0faf8 100644
--- a/aptsources/distinfo.py
+++ b/aptsources/distinfo.py
@@ -40,6 +40,7 @@ class Template:
def __init__(self):
self.name = None
self.child = False
+ self.parents = [] # ref to parent template(s)
self.match_name = None
self.description = None
self.base_uri = None
@@ -127,7 +128,6 @@ class DistInfo:
base_dir = "/usr/share/python-apt/templates"):
self.metarelease_uri = ''
self.templates = []
- apt_pkg.init()
self.arch = apt_pkg.Config.Find("APT::Architecture")
location = None
@@ -163,11 +163,8 @@ class DistInfo:
elif field == 'MetaReleaseURI':
self.metarelease_uri = value
elif field == 'Suite':
- if template:
- if component and not template.has_component(component.name):
- template.components.append(component)
- component = None
- self.templates.append(template)
+ self.finish_template(template, component)
+ component=None
template = Template()
template.name = value
template.distribution = dist
@@ -177,13 +174,10 @@ class DistInfo:
elif field == 'ParentSuite':
template.child = True
for nanny in self.templates:
+ # look for parent and add back ref to it
if nanny.name == value:
+ template.parents.append(nanny)
nanny.children.append(template)
- # reuse some properties of the parent template
- if template.match_uri == None:
- template.match_uri = nanny.match_uri
- if template.mirror_set == {}:
- template.mirror_set = nanny.mirror_set
elif field == 'Available':
template.available = value
elif field == 'RepositoryType':
@@ -227,12 +221,30 @@ class DistInfo:
component.set_description(_(value))
elif field == 'CompDescriptionLong':
component.set_description_long(_(value))
- if template:
- if component:
- template.components.append(component)
- component = None
- self.templates.append(template)
- template = None
+ self.finish_template(template, component)
+ template=None
+ component=None
+
+ def finish_template(self, template, component):
+ " finish the current tempalte "
+ if not template:
+ return
+ # reuse some properties of the parent template
+ if template.match_uri == None and template.child:
+ for t in template.parents:
+ if t.match_uri:
+ template.match_uri = t.match_uri
+ break
+ if template.mirror_set == {} and template.child:
+ for t in template.parents:
+ if t.match_uri:
+ template.mirror_set = t.mirror_set
+ break
+ if component and not template.has_component(component.name):
+ template.components.append(component)
+ component = None
+ self.templates.append(template)
+
if __name__ == "__main__":
d = DistInfo ("Ubuntu", "/usr/share/python-apt/templates")
diff --git a/data/templates/Debian.info.in b/data/templates/Debian.info.in
index b635de19..c3ce7fd7 100644
--- a/data/templates/Debian.info.in
+++ b/data/templates/Debian.info.in
@@ -1,5 +1,28 @@
_ChangelogURI: http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog
+Suite: lenny
+RepositoryType: deb
+BaseURI: http://http.us.debian.org/debian/
+MatchURI: ftp[0-9]*\.[a-z]\.debian\.org
+MirrorsFile: /usr/share/python-apt/templates/Debian.mirrors
+_Description: Debian 5.0 'Lenny'
+Component: main
+_CompDescription: Officially supported
+Component: contrib
+_CompDescription: DFSG-compatible Software with Non-Free Dependencies
+Component: non-free
+_CompDescription: Non-DFSG-compatible Software
+
+Suite: lenny-proposed-updates
+RepositoryType: deb
+ParentSuite: lenny
+_Description: Proposed updates
+
+Suite: lenny/updates
+RepositoryType: deb
+ParentSuite: lenny
+_Description: Security updates
+
Suite: etch
RepositoryType: deb
BaseURI: http://http.us.debian.org/debian/
diff --git a/data/templates/Ubuntu.info.in b/data/templates/Ubuntu.info.in
index c3cfe6df..97554fa8 100644
--- a/data/templates/Ubuntu.info.in
+++ b/data/templates/Ubuntu.info.in
@@ -25,6 +25,7 @@ _CompDescriptionLong: Software restricted by copyright or legal issues
Suite: intrepid
MatchName: .*
BaseURI: cdrom:\[Ubuntu.*8.10
+MatchURI: cdrom:\[Ubuntu.*8.10
_Description: Cdrom with Ubuntu 8.10 'Intrepid Ibex'
Available: False
Component: main
@@ -80,6 +81,7 @@ _CompDescriptionLong: Software restricted by copyright or legal issues
Suite: hardy
MatchName: .*
BaseURI: cdrom:\[Ubuntu.*8.04
+MatchURI: cdrom:\[Ubuntu.*8.04
_Description: Cdrom with Ubuntu 8.04 'Hardy Heron'
Available: False
Component: main
@@ -134,6 +136,7 @@ _CompDescriptionLong: Software restricted by copyright or legal issues
Suite: gutsy
MatchName: .*
BaseURI: cdrom:\[Ubuntu.*7.10
+MatchURI: cdrom:\[Ubuntu.*7.10
_Description: Cdrom with Ubuntu 7.10 'Gutsy Gibbon'
Available: False
Component: main
@@ -186,6 +189,7 @@ _CompDescriptionLong: Software restricted by copyright or legal issues
Suite: feisty
MatchName: .*
BaseURI: cdrom:\[Ubuntu.*7.04
+MatchURI: cdrom:\[Ubuntu.*7.04
_Description: Cdrom with Ubuntu 7.04 'Feisty Fawn'
Available: False
Component: main
@@ -237,6 +241,7 @@ _CompDescriptionLong: Software restricted by copyright or legal issues
Suite: edgy
MatchName: .*
BaseURI: cdrom:\[Ubuntu.*6.10
+MatchURI: cdrom:\[Ubuntu.*6.10
_Description: Cdrom with Ubuntu 6.10 'Edgy Eft'
Available: False
Component: main
@@ -288,6 +293,7 @@ _CompDescriptionLong: Software restricted by copyright or legal issues
Suite: dapper
MatchName: .*
BaseURI: cdrom:\[Ubuntu.*6.06
+MatchURI: cdrom:\[Ubuntu.*6.06
_Description: Cdrom with Ubuntu 6.06 LTS 'Dapper Drake'
Available: False
Component: main
@@ -335,6 +341,7 @@ _CompDescription: Non-free (Multiverse)
Suite: breezy
MatchName: .*
BaseURI: cdrom:\[Ubuntu.*5.10
+MatchURI: cdrom:\[Ubuntu.*5.10
_Description: Cdrom with Ubuntu 5.10 'Breezy Badger'
Available: False
Component: main
@@ -377,6 +384,7 @@ _CompDescription: Non-free (Multiverse)
Suite: hoary
MatchName: .*
BaseURI: cdrom:\[Ubuntu.*5.04
+MatchURI: cdrom:\[Ubuntu.*5.04
_Description: Cdrom with Ubuntu 5.04 'Hoary Hedgehog'
Available: False
Component: main
@@ -418,6 +426,7 @@ _CompDescription: Non-free (Multiverse)
Suite: warty
MatchName: .*
BaseURI: cdrom:\[Ubuntu.*4.10
+MatchURI: cdrom:\[Ubuntu.*4.10
_Description: Cdrom with Ubuntu 4.10 'Warty Warthog'
Available: False
Component: main
diff --git a/debian/changelog b/debian/changelog
index 8b622796..2e1ef1d1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,36 @@
-python-apt (0.7.7ubuntu1) intrepid; urgency=low
+python-apt (0.7.8) UNRELEASED; urgency=low
- * merged from debian-sid
+ * python/cache.cc:
+ - fix crash if Ver.PriorityType() returns NULL
+ - fix GetCandidateVer() reporting incorrect versions after
+ SetCandidateVer() was used. Thanks to Julian Andres Klode for
+ the test-case (LP: #237372)
+ * python/apt_instmodule.cc:
+ - do not change working dir in debExtractArchive() (LP: #184093)
+ * apt/cache.py:
+ - support "in" in apt.Cache() (LP: #251587)
+ * apt/package.py:
+ - do not return None in sourcePackageName (LP: #123062)
+ * python/progress.cc:
+ - when pulse() does not return a boolean assume "true"
+ (thanks to Martin Pitt for telling me about the problem)
+ * python/apt_pkgmodule.cc:
+ - add "SelState{Unknown,Install,Hold,DeInstall,Purge}" constants
+ * aptsources/__init__.py, aptsources/distinfo.py:
+ - run apt_pkg.init() when aptsources gets imported and not
+ the distinfo function
+ - fix detection of cdrom sources and add test for it
+
+ -- Michael Vogt <michael.vogt@ubuntu.com> Wed, 30 Jul 2008 10:24:30 +0200
+
+python-apt (0.7.7.1) unstable; urgency=low
+
+ * data/templates/Debian.info.in:
+ - add 'lenny' template info (closes: #476364)
+ * aptsources/distinfo.py:
+ - fix template matching for arch specific code (LP: #244093)
- -- Michael Vogt <michael.vogt@ubuntu.com> Tue, 22 Jul 2008 15:58:37 +0200
+ -- Michael Vogt <mvo@debian.org> Fri, 25 Jul 2008 18:13:53 +0200
python-apt (0.7.7) unstable; urgency=low
diff --git a/po/python-apt.pot b/po/python-apt.pot
index 7125757c..3d513b7b 100644
--- a/po/python-apt.pot
+++ b/po/python-apt.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-07-18 15:22+0100\n"
+"POT-Creation-Date: 2008-08-15 09:59+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -188,7 +188,7 @@ msgid "Cdrom with Ubuntu 5.04 'Hoary Hedgehog'"
msgstr ""
#. CompDescription
-#: ../data/templates/Ubuntu.info.in:383 ../data/templates/Debian.info.in:94
+#: ../data/templates/Ubuntu.info.in:383 ../data/templates/Debian.info.in:117
msgid "Officially supported"
msgstr ""
@@ -260,46 +260,51 @@ msgstr ""
#. Description
#: ../data/templates/Debian.info.in:8
-msgid "Debian 4.0 'Etch' "
+msgid "Debian 5.0 'Lenny' "
msgstr ""
#. Description
#: ../data/templates/Debian.info.in:31
+msgid "Debian 4.0 'Etch' "
+msgstr ""
+
+#. Description
+#: ../data/templates/Debian.info.in:54
msgid "Debian 3.1 'Sarge'"
msgstr ""
#. Description
-#: ../data/templates/Debian.info.in:42
+#: ../data/templates/Debian.info.in:65
msgid "Proposed updates"
msgstr ""
#. Description
-#: ../data/templates/Debian.info.in:47
+#: ../data/templates/Debian.info.in:70
msgid "Security updates"
msgstr ""
#. Description
-#: ../data/templates/Debian.info.in:54
+#: ../data/templates/Debian.info.in:77
msgid "Debian current stable release"
msgstr ""
#. Description
-#: ../data/templates/Debian.info.in:67
+#: ../data/templates/Debian.info.in:90
msgid "Debian testing"
msgstr ""
#. Description
-#: ../data/templates/Debian.info.in:92
+#: ../data/templates/Debian.info.in:115
msgid "Debian 'Sid' (unstable)"
msgstr ""
#. CompDescription
-#: ../data/templates/Debian.info.in:96
+#: ../data/templates/Debian.info.in:119
msgid "DFSG-compatible Software with Non-Free Dependencies"
msgstr ""
#. CompDescription
-#: ../data/templates/Debian.info.in:98
+#: ../data/templates/Debian.info.in:121
msgid "Non-DFSG-compatible Software"
msgstr ""
diff --git a/python/apt_instmodule.cc b/python/apt_instmodule.cc
index 43d5e7f7..ea703b21 100644
--- a/python/apt_instmodule.cc
+++ b/python/apt_instmodule.cc
@@ -74,6 +74,7 @@ static char *doc_debExtractArchive =
static PyObject *debExtractArchive(PyObject *Self,PyObject *Args)
{
char *Rootdir = NULL;
+ char cwd[512];
PyObject *File;
if (PyArg_ParseTuple(Args,"O!|s",&PyFile_Type,&File,&Rootdir) == 0)
return 0;
@@ -83,21 +84,27 @@ static PyObject *debExtractArchive(PyObject *Self,PyObject *Args)
{
if(Rootdir != NULL)
{
+ getcwd(cwd, sizeof(cwd));
chdir(Rootdir);
}
// Open the file and associate the .deb
FileFd Fd(fileno(PyFile_AsFile(File)),false);
debDebFile Deb(Fd);
- if (_error->PendingError() == true)
- return HandleErrors();
+ if (_error->PendingError() == true) {
+ if (Rootdir != NULL)
+ chdir (cwd);
+ return HandleErrors(Py_BuildValue("b",false));
+ }
// extracts relative to the current dir
pkgDirStream Extract;
res = Deb.ExtractArchive(Extract);
+ if (Rootdir != NULL)
+ chdir (cwd);
if (res == false)
- return HandleErrors();
+ return HandleErrors(Py_BuildValue("b",res));
}
return HandleErrors(Py_BuildValue("b",res));
}
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc
index fd7a83cd..fae85f00 100644
--- a/python/apt_pkgmodule.cc
+++ b/python/apt_pkgmodule.cc
@@ -517,6 +517,12 @@ extern "C" void initapt_pkg()
AddInt(Dict,"CurStateConfigFiles",pkgCache::State::ConfigFiles);
AddInt(Dict,"CurStateInstalled",pkgCache::State::Installed);
+ AddInt(Dict,"SelStateUnknown",pkgCache::State::Unknown);
+ AddInt(Dict,"SelStateInstall",pkgCache::State::Install);
+ AddInt(Dict,"SelStateHold",pkgCache::State::Hold);
+ AddInt(Dict,"SelStateDeInstall",pkgCache::State::DeInstall);
+ AddInt(Dict,"SelStatePurge",pkgCache::State::Purge);
+
AddInt(Dict,"InstStateOk",pkgCache::State::Ok);
AddInt(Dict,"InstStateReInstReq",pkgCache::State::ReInstReq);
AddInt(Dict,"InstStateHold",pkgCache::State::Hold);
diff --git a/python/cache.cc b/python/cache.cc
index 66a2c5d9..bd280dec 100644
--- a/python/cache.cc
+++ b/python/cache.cc
@@ -599,7 +599,7 @@ static PyObject *VersionAttr(PyObject *Self,char *Name)
else if (strcmp("Priority",Name) == 0)
return Py_BuildValue("i",Ver->Priority);
else if (strcmp("PriorityStr",Name) == 0)
- return PyString_FromString(Ver.PriorityType());
+ return Safe_FromString(Ver.PriorityType());
else if (strcmp("Downloadable", Name) == 0)
return Py_BuildValue("b", Ver.Downloadable());
else if (strcmp("TranslatedDescription", Name) == 0) {
diff --git a/python/depcache.cc b/python/depcache.cc
index 5664a6d8..2446dc71 100644
--- a/python/depcache.cc
+++ b/python/depcache.cc
@@ -197,7 +197,7 @@ static PyObject *PkgDepCacheSetCandidateVer(PyObject *Self,PyObject *Args)
return 0;
pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj);
- pkgCache::VerIterator I = GetCpp<pkgCache::VerIterator>(VersionObj);
+ pkgCache::VerIterator &I = GetCpp<pkgCache::VerIterator>(VersionObj);
if(I.end()) {
return HandleErrors(Py_BuildValue("b",false));
}
@@ -215,7 +215,9 @@ static PyObject *PkgDepCacheGetCandidateVer(PyObject *Self,PyObject *Args)
return 0;
pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj);
- pkgCache::VerIterator I = depcache->GetCandidateVer(Pkg);
+ pkgDepCache::StateCache & State = (*depcache)[Pkg];
+ pkgCache::VerIterator I = State.CandidateVerIter(*depcache);
+
if(I.end()) {
Py_INCREF(Py_None);
return Py_None;
diff --git a/python/progress.cc b/python/progress.cc
index 793265db..99ad0a25 100644
--- a/python/progress.cc
+++ b/python/progress.cc
@@ -185,8 +185,10 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner)
bool res = true;
if(!PyArg_Parse(result, "b", &res))
{
- // mvo: this is harmless, we shouldn't print anything here
- //std::cerr << "result could not be parsed" << std::endl;
+ // most of the time the user who subclasses the pulse()
+ // method forgot to add a return {True,False} so we just
+ // assume he wants a True
+ return true;
}
// fetching can be canceld by returning false
diff --git a/tests/data/sources.list.testDistribution b/tests/data/sources.list.testDistribution
index 1687c504..0f40e85a 100644
--- a/tests/data/sources.list.testDistribution
+++ b/tests/data/sources.list.testDistribution
@@ -1,11 +1,13 @@
-deb http://de.archive.ubuntu.com/ubuntu/ edgy main
-deb http://de.archive.ubuntu.com/ubuntu/ edgy restricted
-deb http://de.archive.ubuntu.com/ubuntu/ edgy universe
-deb http://de.archive.ubuntu.com/ubuntu/ edgy-updates universe multiverse
-deb http://de.archive.ubuntu.com/ubuntu/ edgy-updates restricted
-deb http://de.archive.ubuntu.com/ubuntu/ edgy-security main
-deb http://de.archive.ubuntu.com/ubuntu/ edgy-security multiverse
+deb http://de.archive.ubuntu.com/ubuntu/ hardy main
+deb http://de.archive.ubuntu.com/ubuntu/ hardy restricted
+deb http://de.archive.ubuntu.com/ubuntu/ hardy universe
+deb http://de.archive.ubuntu.com/ubuntu/ hardy-updates universe multiverse
+deb http://de.archive.ubuntu.com/ubuntu/ hardy-updates restricted
+deb http://de.archive.ubuntu.com/ubuntu/ hardy-security main
+deb http://de.archive.ubuntu.com/ubuntu/ hardy-security multiverse
deb http://ftp.debian.org/debian sid main
-deb ftp://ubuntu.cs.utah.edu/pub/ubuntu/ubuntu/ breezy main
-deb ftp://ubuntu.cs.utah.edu/pub/ubuntu/ubuntu/ breezy-backports main
-deb http://archive.ubuntu.com/ubuntu/ hoary main
+deb http://ubuntu.cs.uaf.edu/ubuntu/ hardy main
+deb http://ubuntu.cs.uaf.edu/ubuntu/ hardy-backports main
+deb http://archive.ubuntu.com/ubuntu/ intrepid main
+deb cdrom:[Ubuntu 8.10 _Intrepid Ibex_ - Alpha]/ intrepid main
+deb cdrom:[Ubuntu 8.04 _Hardy Heron_] hardy main \ No newline at end of file
diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py
index 3ee106be..49fe6afa 100644
--- a/tests/test_aptsources.py
+++ b/tests/test_aptsources.py
@@ -1,27 +1,32 @@
#!/usr/bin/env python
-import UpdateManager.Common.aptsources as aptsources
import unittest
import apt_pkg
import os
import copy
+import sys
+sys.path.insert(0, "../")
+import aptsources
+import aptsources.sourceslist
+import aptsources.distro
+
class TestAptSources(unittest.TestCase):
def __init__(self, methodName):
unittest.TestCase.__init__(self, methodName)
apt_pkg.init()
apt_pkg.Config.Set("Dir::Etc", os.getcwd())
- apt_pkg.Config.Set("Dir::Etc::sourceparts",".")
+ apt_pkg.Config.Set("Dir::Etc::sourceparts","/xxx")
def testIsMirror(self):
- self.assertTrue(aptsources.is_mirror("http://archive.ubuntu.com",
- "http://de.archive.ubuntu.com"))
- self.assertFalse(aptsources.is_mirror("http://archive.ubuntu.com",
- "http://ftp.debian.org"))
+ self.assertTrue(aptsources.sourceslist.is_mirror("http://archive.ubuntu.com",
+ "http://de.archive.ubuntu.com"))
+ self.assertFalse(aptsources.sourceslist.is_mirror("http://archive.ubuntu.com",
+ "http://ftp.debian.org"))
def testSourcesListReading(self):
apt_pkg.Config.Set("Dir::Etc::sourcelist","data/sources.list")
- sources = aptsources.SourcesList()
+ sources = aptsources.sourceslist.SourcesList()
self.assertEqual(len(sources.list), 6)
# test load
sources.list = []
@@ -30,7 +35,7 @@ class TestAptSources(unittest.TestCase):
def testSourcesListAdding(self):
apt_pkg.Config.Set("Dir::Etc::sourcelist","data/sources.list")
- sources = aptsources.SourcesList()
+ sources = aptsources.sourceslist.SourcesList()
# test to add something that is already there (main)
before = copy.deepcopy(sources)
sources.add("deb","http://de.archive.ubuntu.com/ubuntu/",
@@ -76,10 +81,21 @@ class TestAptSources(unittest.TestCase):
self.assertEqual(found_something, 1)
self.assertEqual(found_universe, 1)
+ def testMatcher(self):
+ apt_pkg.Config.Set("Dir::Etc::sourcelist","data/sources.list.testDistribution")
+ sources = aptsources.sourceslist.SourcesList()
+ distro = aptsources.distro.get_distro()
+ distro.get_sources(sources)
+ # test if all suits of the current distro were detected correctly
+ dist_templates = set()
+ for s in sources:
+ if not s.template:
+ self.fail("source entry '%s' has no matcher" % s)
+
def testDistribution(self):
apt_pkg.Config.Set("Dir::Etc::sourcelist","data/sources.list.testDistribution")
- sources = aptsources.SourcesList()
- distro = aptsources.Distribution()
+ sources = aptsources.sourceslist.SourcesList()
+ distro = aptsources.distro.get_distro()
distro.get_sources(sources)
# test if all suits of the current distro were detected correctly
dist_templates = set()
@@ -87,11 +103,11 @@ class TestAptSources(unittest.TestCase):
if s.template:
dist_templates.add(s.template.name)
#print dist_templates
- for d in ["edgy","edgy-security","edgy-updates","hoary","breezy", "breezy-backports"]:
+ for d in ["hardy","hardy-security","hardy-updates","intrepid","hardy-backports"]:
self.assertTrue(d in dist_templates)
# test enable
comp = "restricted"
- distro.enable_component(sources, comp)
+ distro.enable_component(comp)
found = {}
for entry in sources:
if (entry.type == "deb" and
@@ -108,7 +124,7 @@ class TestAptSources(unittest.TestCase):
# add a not-already available component
comp = "multiverse"
- distro.enable_component(sources, comp)
+ distro.enable_component(comp)
found = {}
for entry in sources:
if (entry.type == "deb" and
diff --git a/tests/test_debextract.py b/tests/test_debextract.py
new file mode 100755
index 00000000..53241e92
--- /dev/null
+++ b/tests/test_debextract.py
@@ -0,0 +1,13 @@
+#!/usr/bin/python
+
+import apt_inst
+import sys
+
+def Callback(What,Name,Link,Mode,UID,GID,Size,MTime,Major,Minor):
+ print "%s '%s','%s',%u,%u,%u,%u,%u,%u,%u" % (
+ What,Name,Link,Mode,UID,GID,Size, MTime, Major, Minor)
+
+member = "data.tar.lzma"
+if len(sys.argv) > 2:
+ member = sys.argv[2]
+apt_inst.debExtract(open(sys.argv[1]), Callback, member)
diff --git a/tests/test_extract_archive.py b/tests/test_extract_archive.py
new file mode 100644
index 00000000..ce202b06
--- /dev/null
+++ b/tests/test_extract_archive.py
@@ -0,0 +1,10 @@
+#!/usr/bin/python
+
+import apt
+import apt_inst
+import os
+import sys
+
+print os.getcwd()
+apt_inst.debExtractArchive(open(sys.argv[1]), "/tmp/")
+print os.getcwd()