From c085ac239354d78c3093049a4c48a27f514c6da2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 30 Jul 2008 10:25:23 +0200 Subject: * python/cache.cc: - fix crash if Ver.PriorityType() returns NULL --- po/python-apt.pot | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'po/python-apt.pot') diff --git a/po/python-apt.pot b/po/python-apt.pot index 7125757c..9dc6e202 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-07-30 10:24+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \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 "" -- cgit v1.2.3 From b4d0f3a1c38d916c2abda67549a454467a05fb1f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 31 Jul 2008 11:42:55 +0200 Subject: fix GetCandidateVer() reporting incorrect versions after SetCandidateVer() was used. Thanks to Julian Andres Klode for the test-case (LP: #237372) --- debian/changelog | 3 +++ po/python-apt.pot | 2 +- python/depcache.cc | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'po/python-apt.pot') diff --git a/debian/changelog b/debian/changelog index 86e5b0c9..1afcb16e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,9 @@ python-apt (0.7.7.2) UNRELEASED; urgency=low * 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) * apt/cache.py: - support "in" in apt.Cache() (LP: #251587) diff --git a/po/python-apt.pot b/po/python-apt.pot index 9dc6e202..20905fdf 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-30 10:24+0200\n" +"POT-Creation-Date: 2008-07-31 11:40+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" 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(PackageObj); - pkgCache::VerIterator I = GetCpp(VersionObj); + pkgCache::VerIterator &I = GetCpp(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(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; -- cgit v1.2.3 From 19fdcab7acc03ceb6aaf57f7ccdd754a41aa7b6e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 31 Jul 2008 12:01:43 +0200 Subject: * python/apt_instmodule.cc: - do not change working dir in debExtractArchive() (LP: #184093) --- debian/changelog | 2 ++ po/python-apt.pot | 2 +- python/apt_instmodule.cc | 13 ++++++++++--- tests/test_extract_archive.py | 10 ++++++++++ 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 tests/test_extract_archive.py (limited to 'po/python-apt.pot') diff --git a/debian/changelog b/debian/changelog index 1afcb16e..8cac6ae2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,8 @@ python-apt (0.7.7.2) UNRELEASED; urgency=low - 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) diff --git a/po/python-apt.pot b/po/python-apt.pot index 20905fdf..7e731689 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 11:40+0200\n" +"POT-Creation-Date: 2008-07-31 12:00+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/python/apt_instmodule.cc b/python/apt_instmodule.cc index 43d5e7f7..6e6c89dd 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 (cwd != NULL) + chdir (cwd); + return HandleErrors(Py_BuildValue("b",false)); + } // extracts relative to the current dir pkgDirStream Extract; res = Deb.ExtractArchive(Extract); + if (cwd != NULL) + chdir (cwd); if (res == false) - return HandleErrors(); + return HandleErrors(Py_BuildValue("b",res)); } return HandleErrors(Py_BuildValue("b",res)); } 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() -- cgit v1.2.3 From 34503feab88a8aa72ef511f86375933a4d8707ef Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 15 Aug 2008 10:02:54 +0200 Subject: * python/progress.cc: - when pulse() does not return a boolean assume "true" (thanks to Martin Pitt for telling me about the problem) --- debian/changelog | 3 +++ po/python-apt.pot | 2 +- python/progress.cc | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'po/python-apt.pot') diff --git a/debian/changelog b/debian/changelog index 8cac6ae2..6a8b7f7e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,9 @@ python-apt (0.7.7.2) UNRELEASED; urgency=low - do not change working dir in debExtractArchive() (LP: #184093) * apt/cache.py: - support "in" in apt.Cache() (LP: #251587) + * python/progress.cc: + - when pulse() does not return a boolean assume "true" + (thanks to Martin Pitt for telling me about the problem) -- Michael Vogt Wed, 30 Jul 2008 10:24:30 +0200 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 \n" "Language-Team: LANGUAGE \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 -- cgit v1.2.3