diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-10-19 18:07:20 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-10-19 18:07:20 +0200 |
| commit | 46885bf24dc2cf9b3986abcf40c040e20566402a (patch) | |
| tree | 1471609c09a6c27624651d179a97e39939f0c747 | |
| parent | 3c35eb3da332cf30781dba78ed777b26934136ac (diff) | |
| parent | b0995cca556668a4eced03e40e3edbc7362c2a10 (diff) | |
| download | python-apt-46885bf24dc2cf9b3986abcf40c040e20566402a.tar.gz | |
* merged from ubuntu:
- use logging instead of print
- update distro template Ubuntu.info.in
- add xz compression support
| -rw-r--r-- | apt/utils.py | 6 | ||||
| -rw-r--r-- | aptsources/distinfo.py | 29 | ||||
| -rw-r--r-- | aptsources/distro.py | 5 | ||||
| -rw-r--r-- | aptsources/sourceslist.py | 22 | ||||
| -rw-r--r-- | data/templates/Ubuntu.info.in | 368 | ||||
| -rw-r--r-- | debian/changelog | 9 | ||||
| -rw-r--r-- | doc/source/library/apt_inst.rst | 6 | ||||
| -rw-r--r-- | po/python-apt.pot | 158 | ||||
| -rw-r--r-- | python/tar.cc | 2 | ||||
| -rw-r--r-- | tests/test_utils.py | 56 | ||||
| -rwxr-xr-x | utils/get_ubuntu_mirrors_from_lp.py | 1 |
11 files changed, 561 insertions, 101 deletions
diff --git a/apt/utils.py b/apt/utils.py index 4b3da39f..49e8bed5 100644 --- a/apt/utils.py +++ b/apt/utils.py @@ -28,11 +28,13 @@ def get_maintenance_end_date(release_date, m_months): ends. Needs the data of the release and the number of months that its is supported as input """ - years = m_months / 12 + # calc end date + years = m_months // 12 months = m_months % 12 support_end_year = (release_date.year + years + - (release_date.month + months)/12) + (release_date.month + months)//12) support_end_month = (release_date.month + months) % 12 + # special case: this happens when e.g. doing 2010-06 + 18 months if support_end_month == 0: support_end_month = 12 support_end_year -= 1 diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py index b21e95b3..c8ec5c46 100644 --- a/aptsources/distinfo.py +++ b/aptsources/distinfo.py @@ -22,11 +22,11 @@ # USA import errno +import logging import os import gettext from os import getenv from subprocess import Popen, PIPE -import ConfigParser import re import apt_pkg @@ -173,9 +173,9 @@ class DistInfo(object): try: dist = Popen(["lsb_release", "-i", "-s"], stdout=PIPE).communicate()[0].strip() - except OSError, exc: + except OSError as exc: if exc.errno != errno.ENOENT: - print 'WARNING: lsb_release failed, using defaults:', exc + logging.warn('lsb_release failed, using defaults:' % exc) dist = "Debian" self.dist = dist @@ -184,9 +184,6 @@ class DistInfo(object): dist_fname = "%s/%s.info" % (base_dir, dist) with open(dist_fname) as dist_file: - - - template = None component = None for line in dist_file: @@ -299,17 +296,17 @@ class DistInfo(object): if __name__ == "__main__": d = DistInfo("Ubuntu", "/usr/share/python-apt/templates") - print d.changelogs_uri + logging.info(d.changelogs_uri) for template in d.templates: - print "\nSuite: %s" % template.name - print "Desc: %s" % template.description - print "BaseURI: %s" % template.base_uri - print "MatchURI: %s" % template.match_uri + logging.info("\nSuite: %s" % template.name) + logging.info("Desc: %s" % template.description) + logging.info("BaseURI: %s" % template.base_uri) + logging.info("MatchURI: %s" % template.match_uri) if template.mirror_set != {}: - print "Mirrors: %s" % template.mirror_set.keys() + logging.info("Mirrors: %s" % template.mirror_set.keys()) for comp in template.components: - print " %s -%s -%s" % (comp.name, - comp.description, - comp.description_long) + logging.info(" %s -%s -%s" % (comp.name, + comp.description, + comp.description_long)) for child in template.children: - print " %s" % child.description + logging.info(" %s" % child.description) diff --git a/aptsources/distro.py b/aptsources/distro.py index 28d5b96f..f777a4ea 100644 --- a/aptsources/distro.py +++ b/aptsources/distro.py @@ -22,6 +22,7 @@ # USA import gettext +import logging import re import os import sys @@ -464,9 +465,9 @@ def _lsb_release(): # Convert to unicode string, needed for Python 3.1 out = out.decode("utf-8") result.update(l.split(":\t") for l in out.split("\n") if ':\t' in l) - except OSError, exc: + except OSError as exc: if exc.errno != errno.ENOENT: - print 'WARNING: lsb_release failed, using defaults:', exc + logging.warn('lsb_release failed, using defaults:' % exc) return result diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 353cce2d..40a0379b 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -25,6 +25,7 @@ import gettext import glob +import logging import os.path import re import shutil @@ -32,7 +33,7 @@ import sys import time import apt_pkg -from aptsources.distinfo import DistInfo +from distinfo import DistInfo from apt.deprecation import function_deprecated_by @@ -373,7 +374,7 @@ class SourcesList(object): source = SourceEntry(line, file) self.list.append(source) except: - print "could not open file '%s'" % file + logging.warn("could not open file '%s'\n" % file) def save(self): """ save the current sources """ @@ -449,7 +450,10 @@ class SourceEntryMatcher(object): found = False for template in self.templates: if (re.search(template.match_uri, source.uri) and - re.match(template.match_name, source.dist)): + re.match(template.match_name, source.dist) and + # deb is a valid fallback for deb-src (if that is not + # definied, see #760035 + (source.type == template.type or template.type == "deb")): found = True source.template = template break @@ -467,14 +471,14 @@ if __name__ == "__main__": sources = SourcesList() for entry in sources: - print entry.str() + logging.info("entry %s" % entry.str()) #print entry.uri mirror = is_mirror("http://archive.ubuntu.com/ubuntu/", "http://de.archive.ubuntu.com/ubuntu/") - print "is_mirror(): %s" % mirror + logging.info("is_mirror(): %s" % mirror) - print is_mirror("http://archive.ubuntu.com/ubuntu", - "http://de.archive.ubuntu.com/ubuntu/") - print is_mirror("http://archive.ubuntu.com/ubuntu/", - "http://de.archive.ubuntu.com/ubuntu") + logging.info(is_mirror("http://archive.ubuntu.com/ubuntu", + "http://de.archive.ubuntu.com/ubuntu/")) + logging.info(is_mirror("http://archive.ubuntu.com/ubuntu/", + "http://de.archive.ubuntu.com/ubuntu")) diff --git a/data/templates/Ubuntu.info.in b/data/templates/Ubuntu.info.in index c6d38910..9e62c0fa 100644 --- a/data/templates/Ubuntu.info.in +++ b/data/templates/Ubuntu.info.in @@ -1,5 +1,360 @@ _ChangelogURI: http://changelogs.ubuntu.com/changelogs/pool/%s/%s/%s/%s_%s/changelog +Suite: precise +RepositoryType: deb +BaseURI: http://ports.ubuntu.com/ubuntu-ports/ +MatchURI: ports.ubuntu.com/ubuntu-ports +BaseURI-amd64: http://archive.ubuntu.com/ubuntu +MatchURI-amd64: archive.ubuntu.com/ubuntu +BaseURI-i386: http://archive.ubuntu.com/ubuntu +MatchURI-i386: archive.ubuntu.com/ubuntu +MirrorsFile-amd64: Ubuntu.mirrors +MirrorsFile-i386: Ubuntu.mirrors +_Description: Ubuntu 12.04 'Precise Pangolin' +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: Canonical-supported Open Source software +Component: universe +_CompDescription: Community-maintained +_CompDescriptionLong: Community-maintained Open Source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices +Component: multiverse +ParentComponent: universe +_CompDescription: Restricted software +_CompDescriptionLong: Software restricted by copyright or legal issues + +Suite: precise +ParentSuite: precise +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Ubuntu 12.04 'Precise Pangolin' + +Suite: precise +RepositoryType: deb +MatchName: .* +BaseURI: cdrom:\[Ubuntu.*12.04 +MatchURI: cdrom:\[Ubuntu.*12.04 +_Description: Cdrom with Ubuntu 12.04 'Precise Pangolin' +Available: False +Component: main +_CompDescription: Officially supported +Component: restricted +_CompDescription: Restricted copyright + +Suite: precise +Official: false +RepositoryType: deb +BaseURI: http://archive.canonical.com +MatchURI: archive.canonical.com +_Description: Canonical Partners +Component: partner +_CompDescription: Software packaged by Canonical for their partners +_CompDescriptionLong: This software is not part of Ubuntu. + +Suite: precise +Official: false +RepositoryType: deb +BaseURI: http://extras.ubuntu.com +MatchURI: extras.ubuntu.com +_Description: Independent +Component: main +_CompDescription: Provided by third-party software developers +_CompDescriptionLong: Software offered by third party developers. + +Suite: precise-security +ParentSuite: precise +RepositoryType: deb +BaseURI: http://ports.ubuntu.com/ubuntu-ports/ +MatchURI: ports.ubuntu.com/ubuntu-ports +BaseURI-amd64: http://security.ubuntu.com/ubuntu/ +MatchURI-amd64: archive.ubuntu.com/ubuntu|security.ubuntu.com +BaseURI-i386: http://security.ubuntu.com/ubuntu/ +MatchURI-i386: archive.ubuntu.com/ubuntu|security.ubuntu.com +_Description: Important security updates + +Suite: precise-security +ParentSuite: precise +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports|security.ubuntu.com +_Description: Important security updates + +Suite: precise-updates +ParentSuite: precise +RepositoryType: deb +_Description: Recommended updates + +Suite: precise-updates +ParentSuite: precise +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Recommended updates + +Suite: precise-proposed +ParentSuite: precise +RepositoryType: deb +_Description: Pre-released updates + +Suite: precise-proposed +ParentSuite: precise +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Pre-released updates + +Suite: precise-backports +ParentSuite: precise +RepositoryType: deb +_Description: Unsupported updates + +Suite: precise-backports +ParentSuite: precise +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Unsupported updates + +Suite: oneiric +RepositoryType: deb +BaseURI: http://ports.ubuntu.com/ubuntu-ports/ +MatchURI: ports.ubuntu.com/ubuntu-ports +BaseURI-amd64: http://archive.ubuntu.com/ubuntu +MatchURI-amd64: archive.ubuntu.com/ubuntu +BaseURI-i386: http://archive.ubuntu.com/ubuntu +MatchURI-i386: archive.ubuntu.com/ubuntu +MirrorsFile-amd64: Ubuntu.mirrors +MirrorsFile-i386: Ubuntu.mirrors +_Description: Ubuntu 11.10 'Oneiric Ocelot' +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: Canonical-supported Open Source software +Component: universe +_CompDescription: Community-maintained +_CompDescriptionLong: Community-maintained Open Source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices +Component: multiverse +ParentComponent: universe +_CompDescription: Restricted software +_CompDescriptionLong: Software restricted by copyright or legal issues + +Suite: oneiric +ParentSuite: oneiric +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Ubuntu 11.10 'Oneiric Ocelot' + +Suite: oneiric +RepositoryType: deb +MatchName: .* +BaseURI: cdrom:\[Ubuntu.*11.10 +MatchURI: cdrom:\[Ubuntu.*11.10 +_Description: Cdrom with Ubuntu 11.10 'Oneiric Ocelot' +Available: False +Component: main +_CompDescription: Officially supported +Component: restricted +_CompDescription: Restricted copyright + +Suite: oneiric +Official: false +RepositoryType: deb +BaseURI: http://archive.canonical.com +MatchURI: archive.canonical.com +_Description: Canonical Partners +Component: partner +_CompDescription: Software packaged by Canonical for their partners +_CompDescriptionLong: This software is not part of Ubuntu. + +Suite: oneiric +Official: false +RepositoryType: deb +BaseURI: http://extras.ubuntu.com +MatchURI: extras.ubuntu.com +_Description: Independent +Component: main +_CompDescription: Provided by third-party software developers +_CompDescriptionLong: Software offered by third party developers. + +Suite: oneiric-security +ParentSuite: oneiric +RepositoryType: deb +BaseURI: http://ports.ubuntu.com/ubuntu-ports/ +MatchURI: ports.ubuntu.com/ubuntu-ports +BaseURI-amd64: http://security.ubuntu.com/ubuntu/ +MatchURI-amd64: archive.ubuntu.com/ubuntu|security.ubuntu.com +BaseURI-i386: http://security.ubuntu.com/ubuntu/ +MatchURI-i386: archive.ubuntu.com/ubuntu|security.ubuntu.com +_Description: Important security updates + +Suite: oneiric-security +ParentSuite: oneiric +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports|security.ubuntu.com +_Description: Important security updates + +Suite: oneiric-updates +ParentSuite: oneiric +RepositoryType: deb +_Description: Recommended updates + +Suite: oneiric-updates +ParentSuite: oneiric +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Recommended updates + +Suite: oneiric-proposed +ParentSuite: oneiric +RepositoryType: deb +_Description: Pre-released updates + +Suite: oneiric-proposed +ParentSuite: oneiric +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Pre-released updates + +Suite: oneiric-backports +ParentSuite: oneiric +RepositoryType: deb +_Description: Unsupported updates + +Suite: oneiric-backports +ParentSuite: oneiric +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Unsupported updates + + +Suite: natty +RepositoryType: deb +BaseURI: http://ports.ubuntu.com/ubuntu-ports/ +MatchURI: ports.ubuntu.com/ubuntu-ports +BaseURI-amd64: http://archive.ubuntu.com/ubuntu +MatchURI-amd64: archive.ubuntu.com/ubuntu +BaseURI-i386: http://archive.ubuntu.com/ubuntu +MatchURI-i386: archive.ubuntu.com/ubuntu +MirrorsFile-amd64: Ubuntu.mirrors +MirrorsFile-i386: Ubuntu.mirrors +_Description: Ubuntu 11.04 'Natty Narwhal' +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: Canonical-supported Open Source software +Component: universe +_CompDescription: Community-maintained +_CompDescriptionLong: Community-maintained Open Source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices +Component: multiverse +ParentComponent: universe +_CompDescription: Restricted software +_CompDescriptionLong: Software restricted by copyright or legal issues + +Suite: natty +ParentSuite: natty +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Ubuntu 11.04 'Natty Narwhal' + +Suite: natty +RepositoryType: deb +MatchName: .* +BaseURI: cdrom:\[Ubuntu.*11.04 +MatchURI: cdrom:\[Ubuntu.*11.04 +_Description: Cdrom with Ubuntu 11.04 'Natty Narwhal' +Available: False +Component: main +_CompDescription: Officially supported +Component: restricted +_CompDescription: Restricted copyright + +Suite: natty +Official: false +RepositoryType: deb +BaseURI: http://archive.canonical.com +MatchURI: archive.canonical.com +_Description: Canonical Partners +Component: partner +_CompDescription: Software packaged by Canonical for their partners +_CompDescriptionLong: This software is not part of Ubuntu. + +Suite: natty +Official: false +RepositoryType: deb +BaseURI: http://extras.ubuntu.com +MatchURI: extras.ubuntu.com +_Description: Independent +Component: main +_CompDescription: Provided by third-party software developers +_CompDescriptionLong: Software offered by third party developers. + +Suite: natty-security +ParentSuite: natty +RepositoryType: deb +BaseURI: http://ports.ubuntu.com/ubuntu-ports/ +MatchURI: ports.ubuntu.com/ubuntu-ports +BaseURI-amd64: http://security.ubuntu.com/ubuntu/ +MatchURI-amd64: archive.ubuntu.com/ubuntu|security.ubuntu.com +BaseURI-i386: http://security.ubuntu.com/ubuntu/ +MatchURI-i386: archive.ubuntu.com/ubuntu|security.ubuntu.com +_Description: Important security updates + +Suite: natty-security +ParentSuite: natty +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports|security.ubuntu.com +_Description: Important security updates + +Suite: natty-updates +ParentSuite: natty +RepositoryType: deb +_Description: Recommended updates + +Suite: natty-updates +ParentSuite: natty +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Recommended updates + +Suite: natty-proposed +ParentSuite: natty +RepositoryType: deb +_Description: Pre-released updates + +Suite: natty-proposed +ParentSuite: natty +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Pre-released updates + +Suite: natty-backports +ParentSuite: natty +RepositoryType: deb +_Description: Unsupported updates + +Suite: natty-backports +ParentSuite: natty +RepositoryType: deb-src +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|ports.ubuntu.com/ubuntu-ports +_Description: Unsupported updates + Suite: maverick RepositoryType: deb BaseURI: http://ports.ubuntu.com/ubuntu-ports/ @@ -26,6 +381,7 @@ _CompDescription: Restricted software _CompDescriptionLong: Software restricted by copyright or legal issues Suite: maverick +RepositoryType: deb MatchName: .* BaseURI: cdrom:\[Ubuntu.*10.10 MatchURI: cdrom:\[Ubuntu.*10.10 @@ -108,6 +464,7 @@ _CompDescription: Restricted software _CompDescriptionLong: Software restricted by copyright or legal issues Suite: lucid +RepositoryType: deb MatchName: .* BaseURI: cdrom:\[Ubuntu.*10.04 MatchURI: cdrom:\[Ubuntu.*10.04 @@ -170,6 +527,7 @@ _CompDescription: Restricted software _CompDescriptionLong: Software restricted by copyright or legal issues Suite: karmic +RepositoryType: deb MatchName: .* BaseURI: cdrom:\[Ubuntu.*9.10 MatchURI: cdrom:\[Ubuntu.*9.10 @@ -231,6 +589,7 @@ _CompDescription: Restricted software _CompDescriptionLong: Software restricted by copyright or legal issues Suite: jaunty +RepositoryType: deb MatchName: .* BaseURI: cdrom:\[Ubuntu.*9.04 MatchURI: cdrom:\[Ubuntu.*9.04 @@ -293,6 +652,7 @@ _CompDescription: Restricted software _CompDescriptionLong: Software restricted by copyright or legal issues Suite: intrepid +RepositoryType: deb MatchName: .* BaseURI: cdrom:\[Ubuntu.*8.10 MatchURI: cdrom:\[Ubuntu.*8.10 @@ -356,6 +716,7 @@ _CompDescription: Restricted software _CompDescriptionLong: Software restricted by copyright or legal issues Suite: hardy +RepositoryType: deb MatchName: .* BaseURI: cdrom:\[Ubuntu.*8.04 MatchURI: cdrom:\[Ubuntu.*8.04 @@ -419,6 +780,7 @@ _CompDescription: Restricted software _CompDescriptionLong: Software restricted by copyright or legal issues Suite: gutsy +RepositoryType: deb MatchName: .* BaseURI: cdrom:\[Ubuntu.*7.10 MatchURI: cdrom:\[Ubuntu.*7.10 @@ -482,6 +844,7 @@ _CompDescription: Restricted software _CompDescriptionLong: Software restricted by copyright or legal issues Suite: feisty +RepositoryType: deb MatchName: .* BaseURI: cdrom:\[Ubuntu.*7.04 MatchURI: cdrom:\[Ubuntu.*7.04 @@ -542,6 +905,7 @@ _CompDescription: Restricted software _CompDescriptionLong: Software restricted by copyright or legal issues Suite: edgy +RepositoryType: deb MatchName: .* BaseURI: cdrom:\[Ubuntu.*6.10 MatchURI: cdrom:\[Ubuntu.*6.10 @@ -602,6 +966,7 @@ _CompDescription: Restricted software (Multiverse) _CompDescriptionLong: Software restricted by copyright or legal issues Suite: dapper +RepositoryType: deb MatchName: .* BaseURI: cdrom:\[Ubuntu.*6.06 MatchURI: cdrom:\[Ubuntu.*6.06 @@ -658,6 +1023,7 @@ Component: multiverse _CompDescription: Non-free (Multiverse) Suite: breezy +RepositoryType: deb MatchName: .* BaseURI: cdrom:\[Ubuntu.*5.10 MatchURI: cdrom:\[Ubuntu.*5.10 @@ -709,6 +1075,7 @@ Component: multiverse _CompDescription: Non-free (Multiverse) Suite: hoary +RepositoryType: deb MatchName: .* BaseURI: cdrom:\[Ubuntu.*5.04 MatchURI: cdrom:\[Ubuntu.*5.04 @@ -755,6 +1122,7 @@ Component: multiverse _CompDescription: Non-free (Multiverse) Suite: warty +RepositoryType: deb MatchName: .* BaseURI: cdrom:\[Ubuntu.*4.10 MatchURI: cdrom:\[Ubuntu.*4.10 diff --git a/debian/changelog b/debian/changelog index 1193e157..a1a3393a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +python-apt (0.8.2) UNRELEASED; urgency=low + + * merged from ubuntu: + - use logging instead of print + - update distro template Ubuntu.info.in + - add xz compression support + + -- Michael Vogt <michael.vogt@ubuntu.com> Wed, 19 Oct 2011 18:03:42 +0200 + python-apt (0.8.1) unstable; urgency=low [ Julian Andres Klode ] diff --git a/doc/source/library/apt_inst.rst b/doc/source/library/apt_inst.rst index d9403a9e..9e6772f5 100644 --- a/doc/source/library/apt_inst.rst +++ b/doc/source/library/apt_inst.rst @@ -134,8 +134,8 @@ Debian Packages .. attribute:: data - The :class:`TarFile` object associated with the data.tar.{gz,bz2,lzma} - member. + The :class:`TarFile` object associated with the + data.tar.{gz,bz2,lzma,xz} member. .. attribute:: debian_binary @@ -307,7 +307,7 @@ function can be replaced. Call the function *func* for each member of the tar file *file*. The parameter *comp* is a string determining the compressor used. Possible - options are "lzma", "bzip2" and "gzip". The parameter *file* may be + options are "xz", "lzma", "bzip2" and "gzip". The parameter *file* may be a :class:`file()` object, a file descriptor, or anything implementing a :meth:`fileno` method. diff --git a/po/python-apt.pot b/po/python-apt.pot index 6d069eea..78f1fd11 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: 2011-10-19 16:45+0200\n" +"POT-Creation-Date: 2011-08-01 09:30+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" @@ -24,297 +24,317 @@ msgid "http://changelogs.ubuntu.com/changelogs/pool/%s/%s/%s/%s_%s/changelog" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:13 +#: ../data/templates/Ubuntu.info.in:32 +msgid "Ubuntu 11.10 'Oneiric Ocelot'" +msgstr "" + +#. Description +#: ../data/templates/Ubuntu.info.in:39 +msgid "Cdrom with Ubuntu 11.10 'Oneiric Ocelot'" +msgstr "" + +#. Description +#: ../data/templates/Ubuntu.info.in:150 +msgid "Ubuntu 11.04 'Natty Narwhal'" +msgstr "" + +#. Description +#: ../data/templates/Ubuntu.info.in:157 +msgid "Cdrom with Ubuntu 11.04 'Natty Narwhal'" +msgstr "" + +#. Description +#: ../data/templates/Ubuntu.info.in:248 msgid "Ubuntu 10.10 'Maverick Meerkat'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:32 +#: ../data/templates/Ubuntu.info.in:267 msgid "Cdrom with Ubuntu 10.10 'Maverick Meerkat'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:44 +#: ../data/templates/Ubuntu.info.in:279 msgid "Canonical Partners" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:46 +#: ../data/templates/Ubuntu.info.in:281 msgid "Software packaged by Canonical for their partners" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:47 +#: ../data/templates/Ubuntu.info.in:282 msgid "This software is not part of Ubuntu." msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:54 +#: ../data/templates/Ubuntu.info.in:289 msgid "Independent" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:56 +#: ../data/templates/Ubuntu.info.in:291 msgid "Provided by third-party software developers" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:57 +#: ../data/templates/Ubuntu.info.in:292 msgid "Software offered by third party developers." msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:95 +#: ../data/templates/Ubuntu.info.in:330 msgid "Ubuntu 10.04 'Lucid Lynx'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:114 +#: ../data/templates/Ubuntu.info.in:349 msgid "Cdrom with Ubuntu 10.04 'Lucid Lynx'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:157 +#: ../data/templates/Ubuntu.info.in:392 msgid "Ubuntu 9.10 'Karmic Koala'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:176 +#: ../data/templates/Ubuntu.info.in:411 msgid "Cdrom with Ubuntu 9.10 'Karmic Koala'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:219 +#: ../data/templates/Ubuntu.info.in:454 msgid "Ubuntu 9.04 'Jaunty Jackalope'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:237 +#: ../data/templates/Ubuntu.info.in:473 msgid "Cdrom with Ubuntu 9.04 'Jaunty Jackalope'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:280 +#: ../data/templates/Ubuntu.info.in:516 msgid "Ubuntu 8.10 'Intrepid Ibex'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:299 +#: ../data/templates/Ubuntu.info.in:535 msgid "Cdrom with Ubuntu 8.10 'Intrepid Ibex'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:343 +#: ../data/templates/Ubuntu.info.in:579 msgid "Ubuntu 8.04 'Hardy Heron'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:362 +#: ../data/templates/Ubuntu.info.in:598 msgid "Cdrom with Ubuntu 8.04 'Hardy Heron'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:407 +#: ../data/templates/Ubuntu.info.in:643 msgid "Ubuntu 7.10 'Gutsy Gibbon'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:425 +#: ../data/templates/Ubuntu.info.in:662 msgid "Cdrom with Ubuntu 7.10 'Gutsy Gibbon'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:470 +#: ../data/templates/Ubuntu.info.in:707 msgid "Ubuntu 7.04 'Feisty Fawn'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:488 +#: ../data/templates/Ubuntu.info.in:726 msgid "Cdrom with Ubuntu 7.04 'Feisty Fawn'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:530 +#: ../data/templates/Ubuntu.info.in:768 msgid "Ubuntu 6.10 'Edgy Eft'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:535 +#: ../data/templates/Ubuntu.info.in:773 msgid "Community-maintained" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:541 +#: ../data/templates/Ubuntu.info.in:779 msgid "Restricted software" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:548 +#: ../data/templates/Ubuntu.info.in:787 msgid "Cdrom with Ubuntu 6.10 'Edgy Eft'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:590 +#: ../data/templates/Ubuntu.info.in:829 msgid "Ubuntu 6.06 LTS 'Dapper Drake'" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:593 +#: ../data/templates/Ubuntu.info.in:832 msgid "Canonical-supported Open Source software" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:595 +#: ../data/templates/Ubuntu.info.in:834 msgid "Community-maintained (universe)" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:596 +#: ../data/templates/Ubuntu.info.in:835 msgid "Community-maintained Open Source software" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:598 +#: ../data/templates/Ubuntu.info.in:837 msgid "Non-free drivers" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:599 +#: ../data/templates/Ubuntu.info.in:838 msgid "Proprietary drivers for devices" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:601 +#: ../data/templates/Ubuntu.info.in:840 msgid "Restricted software (Multiverse)" msgstr "" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:602 +#: ../data/templates/Ubuntu.info.in:841 msgid "Software restricted by copyright or legal issues" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:608 +#: ../data/templates/Ubuntu.info.in:848 msgid "Cdrom with Ubuntu 6.06 LTS 'Dapper Drake'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:624 +#: ../data/templates/Ubuntu.info.in:864 msgid "Important security updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:629 +#: ../data/templates/Ubuntu.info.in:869 msgid "Recommended updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:634 +#: ../data/templates/Ubuntu.info.in:874 msgid "Pre-released updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:639 +#: ../data/templates/Ubuntu.info.in:879 msgid "Unsupported updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:650 +#: ../data/templates/Ubuntu.info.in:890 msgid "Ubuntu 5.10 'Breezy Badger'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:664 +#: ../data/templates/Ubuntu.info.in:905 msgid "Cdrom with Ubuntu 5.10 'Breezy Badger'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:680 +#: ../data/templates/Ubuntu.info.in:921 msgid "Ubuntu 5.10 Security Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:685 +#: ../data/templates/Ubuntu.info.in:926 msgid "Ubuntu 5.10 Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:690 +#: ../data/templates/Ubuntu.info.in:931 msgid "Ubuntu 5.10 Backports" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:701 +#: ../data/templates/Ubuntu.info.in:942 msgid "Ubuntu 5.04 'Hoary Hedgehog'" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:715 +#: ../data/templates/Ubuntu.info.in:957 msgid "Cdrom with Ubuntu 5.04 'Hoary Hedgehog'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:718 ../data/templates/Debian.info.in:149 +#: ../data/templates/Ubuntu.info.in:960 ../data/templates/Debian.info.in:149 msgid "Officially supported" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:731 +#: ../data/templates/Ubuntu.info.in:973 msgid "Ubuntu 5.04 Security Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:736 +#: ../data/templates/Ubuntu.info.in:978 msgid "Ubuntu 5.04 Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:741 +#: ../data/templates/Ubuntu.info.in:983 msgid "Ubuntu 5.04 Backports" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:747 +#: ../data/templates/Ubuntu.info.in:989 msgid "Ubuntu 4.10 'Warty Warthog'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:753 +#: ../data/templates/Ubuntu.info.in:995 msgid "Community-maintained (Universe)" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:755 +#: ../data/templates/Ubuntu.info.in:997 msgid "Non-free (Multiverse)" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:761 +#: ../data/templates/Ubuntu.info.in:1004 msgid "Cdrom with Ubuntu 4.10 'Warty Warthog'" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:764 +#: ../data/templates/Ubuntu.info.in:1007 msgid "No longer officially supported" msgstr "" #. CompDescription -#: ../data/templates/Ubuntu.info.in:766 +#: ../data/templates/Ubuntu.info.in:1009 msgid "Restricted copyright" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:773 +#: ../data/templates/Ubuntu.info.in:1016 msgid "Ubuntu 4.10 Security Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:778 +#: ../data/templates/Ubuntu.info.in:1021 msgid "Ubuntu 4.10 Updates" msgstr "" #. Description -#: ../data/templates/Ubuntu.info.in:783 +#: ../data/templates/Ubuntu.info.in:1026 msgid "Ubuntu 4.10 Backports" msgstr "" @@ -380,7 +400,7 @@ msgid "Non-DFSG-compatible Software" msgstr "" #. TRANSLATORS: %s is a country -#: ../aptsources/distro.py:209 ../aptsources/distro.py:437 +#: ../aptsources/distro.py:210 ../aptsources/distro.py:428 #, python-format msgid "Server for %s" msgstr "" @@ -388,35 +408,35 @@ msgstr "" #. More than one server is used. Since we don't handle this case #. in the user interface we set "custom servers" to true and #. append a list of all used servers -#: ../aptsources/distro.py:227 ../aptsources/distro.py:233 -#: ../aptsources/distro.py:249 +#: ../aptsources/distro.py:228 ../aptsources/distro.py:234 +#: ../aptsources/distro.py:250 msgid "Main server" msgstr "" -#: ../aptsources/distro.py:253 +#: ../aptsources/distro.py:254 msgid "Custom servers" msgstr "" -#: ../apt/progress/gtk2.py:261 ../apt/progress/gtk2.py:317 +#: ../apt/progress/gtk2.py:260 ../apt/progress/gtk2.py:316 #, python-format msgid "Downloading file %(current)li of %(total)li with %(speed)s/s" msgstr "" -#: ../apt/progress/gtk2.py:267 ../apt/progress/gtk2.py:323 +#: ../apt/progress/gtk2.py:266 ../apt/progress/gtk2.py:322 #, python-format msgid "Downloading file %(current)li of %(total)li" msgstr "" #. Setup some child widgets -#: ../apt/progress/gtk2.py:343 +#: ../apt/progress/gtk2.py:342 msgid "Details" msgstr "" -#: ../apt/progress/gtk2.py:431 +#: ../apt/progress/gtk2.py:430 msgid "Starting..." msgstr "" -#: ../apt/progress/gtk2.py:437 +#: ../apt/progress/gtk2.py:436 msgid "Complete" msgstr "" diff --git a/python/tar.cc b/python/tar.cc index b994d4e7..e42a9c50 100644 --- a/python/tar.cc +++ b/python/tar.cc @@ -182,6 +182,8 @@ PyObject *debExtract(PyObject *Self,PyObject *Args) Comp = "bzip2"; else if(strcmp(".lzma", &Chunk[strlen(Chunk)-5]) == 0) Comp = "lzma"; + else if(strcmp(".xz", &Chunk[strlen(Chunk)-3]) == 0) + Comp = "xz"; ExtractTar Tar(Deb.GetFile(),Member->Size,Comp); ProcessTar Proc(Function); if (Tar.Go(Proc) == false) diff --git a/tests/test_utils.py b/tests/test_utils.py new file mode 100644 index 00000000..23511f32 --- /dev/null +++ b/tests/test_utils.py @@ -0,0 +1,56 @@ +#!/usr/bin/python +# +# Copyright (C) 2010 Michael Vogt <michael.vogt@ubuntu.com> +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. + +import sys +sys.path.insert(0, "..") +import apt_pkg +import apt.utils +import datetime +import unittest + +class TestUtils(unittest.TestCase): + + + def test_maintenance_time(self): + from apt.utils import get_maintenance_end_date + months_of_support = 18 + # test historic releases, jaunty + release_date = datetime.datetime(2009, 4, 23) + (end_year, end_month) = get_maintenance_end_date(release_date, months_of_support) + self.assertEqual(end_year, 2010) + self.assertEqual(end_month, 10) + # test historic releases, karmic + release_date = datetime.datetime(2009, 10, 29) + (end_year, end_month) = get_maintenance_end_date(release_date, months_of_support) + self.assertEqual(end_year, 2011) + self.assertEqual(end_month, 4) + # test maverick + release_date = datetime.datetime(2010, 10, 10) + (end_year, end_month) = get_maintenance_end_date(release_date, months_of_support) + self.assertEqual(end_year, 2012) + self.assertEqual(end_month, 4) + + # test with modulo zero + release_date = datetime.datetime(2010, 6, 10) + (end_year, end_month) = get_maintenance_end_date(release_date, months_of_support) + self.assertEqual(end_year, 2011) + self.assertEqual(end_month, 12) + + # test dapper + months_of_support = 60 + release_date = datetime.datetime(2008, 4, 24) + (end_year, end_month) = get_maintenance_end_date(release_date, months_of_support) + self.assertEqual(end_year, 2013) + self.assertEqual(end_month, 4) + + # what datetime says + #d = datetime.timedelta(18*30) + #print "end date: ", release_date + d + +if __name__ == "__main__": + unittest.main() diff --git a/utils/get_ubuntu_mirrors_from_lp.py b/utils/get_ubuntu_mirrors_from_lp.py index 341dba8a..ed0ee936 100755 --- a/utils/get_ubuntu_mirrors_from_lp.py +++ b/utils/get_ubuntu_mirrors_from_lp.py @@ -42,6 +42,7 @@ for entry in d.entries: keys = countries.keys() keys.sort() +print "mirror://mirrors.ubuntu.com/mirrors.txt" for country in keys: print "#LOC:%s" % country print "\n".join(sorted(countries[country])) |
