summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2008-09-18 14:43:26 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2008-09-18 14:43:26 +0200
commit17e8b974718928e8e5a1b80ac2c45e6f7ff98441 (patch)
tree3c9a3d0c3495b024f9f8fe788c6598b939413ca3
parent6f6671a3375128c075a20927b58ad9d7b4bbb543 (diff)
parentd44831bb1d10ac1bc29690fd226209fb71b91b42 (diff)
downloadpython-apt-17e8b974718928e8e5a1b80ac2c45e6f7ff98441.tar.gz
* python/progress.cc:
- when pulse() does not return a boolean assume "true" (thanks to Martin Pitt for telling me about the problem) * 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
-rw-r--r--aptsources/__init__.py4
-rw-r--r--aptsources/distinfo.py1
-rw-r--r--data/templates/Ubuntu.info.in9
-rw-r--r--debian/changelog12
-rw-r--r--po/python-apt.pot2
-rw-r--r--python/progress.cc6
-rw-r--r--tests/data/sources.list.testDistribution22
-rw-r--r--tests/test_aptsources.py42
8 files changed, 71 insertions, 27 deletions
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 b962def6..a6c0faf8 100644
--- a/aptsources/distinfo.py
+++ b/aptsources/distinfo.py
@@ -128,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
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 c6e8313c..cc4c2aef 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+python-apt (0.7.7.1ubuntu4) intrepid; urgency=low
+
+ * python/progress.cc:
+ - when pulse() does not return a boolean assume "true"
+ (thanks to Martin Pitt for telling me about the problem)
+ * 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> Thu, 18 Sep 2008 14:42:46 +0200
+
python-apt (0.7.7.1ubuntu3) intrepid; urgency=low
* Rebuild against current apt on hppa.
diff --git a/po/python-apt.pot b/po/python-apt.pot
index 7e731689..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-31 12:00+0200\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"
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