From ccf689a426760a69b77394abbcddf7897cbd6488 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 4 Jul 2008 19:53:47 +0200 Subject: * python/apt_pkgmodule.cc: - fix bug in hashsum calculation when the original string contains \0 charackters (thanks to Celso Providelo and Ryan Hass for the test-case) LP: #243630 --- debian/changelog | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 6fa68d7e..8d54596a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +python-apt (0.7.7) unstable; urgency=low + + * python/apt_pkgmodule.cc: + - fix bug in hashsum calculation when the original string + contains \0 charackters (thanks to Celso Providelo and + Ryan Hass for the test-case) LP: #243630 + + -- Michael Vogt Fri, 04 Jul 2008 19:53:28 +0200 + python-apt (0.7.6) unstable; urgency=low * apt/cache.py: -- cgit v1.2.3 From 7625577a6974aa580877cf5d5ed22a6e663843fb Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 4 Jul 2008 20:12:53 +0200 Subject: * tests/test_hashsums.py: - add tests for the hashsum code --- debian/changelog | 2 ++ po/python-apt.pot | 2 +- python/apt_pkgmodule.cc | 1 + tests/test_hashsums.py | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 tests/test_hashsums.py (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 8d54596a..e15a9a96 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ python-apt (0.7.7) unstable; urgency=low - fix bug in hashsum calculation when the original string contains \0 charackters (thanks to Celso Providelo and Ryan Hass for the test-case) LP: #243630 + * tests/test_hashsums.py: + - add tests for the hashsum code -- Michael Vogt Fri, 04 Jul 2008 19:53:28 +0200 diff --git a/po/python-apt.pot b/po/python-apt.pot index 71c9b4a7..c8c93668 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-04 19:45+0200\n" +"POT-Creation-Date: 2008-07-04 20:08+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_pkgmodule.cc b/python/apt_pkgmodule.cc index dea34958..fd7a83cd 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -218,6 +218,7 @@ static PyObject *sha1sum(PyObject *Self,PyObject *Args) char *s; Py_ssize_t len; SHA1Summation Sum; + PyString_AsStringAndSize(Obj, &s, &len); Sum.Add((const unsigned char*)s, len); return CppPyString(Sum.Result().Value()); } diff --git a/tests/test_hashsums.py b/tests/test_hashsums.py new file mode 100644 index 00000000..7fa6eb60 --- /dev/null +++ b/tests/test_hashsums.py @@ -0,0 +1,64 @@ +#!/usr/bin/python + +import unittest +import apt_pkg + +class testHashes(unittest.TestCase): + " test the hashsum functions against strings and files " + + def testMD5(self): + # simple + s = "foo" + s_md5 = "acbd18db4cc2f85cedef654fccc4a4d8" + res = apt_pkg.md5sum(s) + self.assert_(res == s_md5) + # file + res = apt_pkg.md5sum(open("hashsum_test.data")) + self.assert_(res == s_md5) + # with zero (\0) in the string + s = "foo\0bar" + s_md5 = "f6f5f8cd0cb63668898ba29025ae824e" + res = apt_pkg.md5sum(s) + self.assert_(res == s_md5) + # file + res = apt_pkg.md5sum(open("hashsum_test_with_zero.data")) + self.assert_(res == s_md5) + + def testSHA1(self): + # simple + s = "foo" + s_hash = "0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33" + res = apt_pkg.sha1sum(s) + self.assert_(res == s_hash) + # file + res = apt_pkg.sha1sum(open("hashsum_test.data")) + self.assert_(res == s_hash) + # with zero (\0) in the string + s = "foo\0bar" + s_hash = "e2c300a39311a2dfcaff799528415cb74c19317f" + res = apt_pkg.sha1sum(s) + self.assert_(res == s_hash) + # file + res = apt_pkg.sha1sum(open("hashsum_test_with_zero.data")) + self.assert_(res == s_hash) + + def testSHA256(self): + # simple + s = "foo" + s_hash = "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae" + res = apt_pkg.sha256sum(s) + self.assert_(res == s_hash) + # file + res = apt_pkg.sha256sum(open("hashsum_test.data")) + self.assert_(res == s_hash) + # with zero (\0) in the string + s = "foo\0bar" + s_hash = "d6b681bfce7155d44721afb79c296ef4f0fa80a9dd6b43c5cf74dd0f64c85512" + res = apt_pkg.sha256sum(s) + self.assert_(res == s_hash) + # file + res = apt_pkg.sha256sum(open("hashsum_test_with_zero.data")) + self.assert_(res == s_hash) + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.3 From 5de8e3d1ecd159d5c27e62264b794cc1124b14fa Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 14 Jul 2008 13:15:32 +0200 Subject: * apt/package.py: - add "isAutoRemovable()" method --- apt/package.py | 8 ++++++++ debian/changelog | 2 ++ 2 files changed, 10 insertions(+) (limited to 'debian') diff --git a/apt/package.py b/apt/package.py index ac045969..096b1bd1 100644 --- a/apt/package.py +++ b/apt/package.py @@ -319,6 +319,14 @@ class Package(object): return self.isInstalled and self._depcache.IsUpgradable(self._pkg) isUpgradable = property(isUpgradable) + def isAutoRemovable(self): + """ + Package is installed as a automatic dependency and is + no longer required + """ + return self.isInstalled and self._depcache.IsGarbage(self._pkg) + isAutoRemovable = property(isAutoRemovable) + # size def packageSize(self): """ The size of the candidate deb package """ diff --git a/debian/changelog b/debian/changelog index e15a9a96..27004cfa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,8 @@ python-apt (0.7.7) unstable; urgency=low Ryan Hass for the test-case) LP: #243630 * tests/test_hashsums.py: - add tests for the hashsum code + * apt/package.py: + - add "isAutoRemovable()" method -- Michael Vogt Fri, 04 Jul 2008 19:53:28 +0200 -- cgit v1.2.3 From 4551baaf54faa1555b4fc40b9bf34beca8af60eb Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 18 Jul 2008 15:26:48 +0100 Subject: * python/pkgsrcrecords.cc: - add "Record" attribute to the PkgSrcRecord to access the full source record --- debian/changelog | 3 +++ po/python-apt.pot | 2 +- python/pkgsrcrecords.cc | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 27004cfa..78af5f6d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,9 @@ python-apt (0.7.7) unstable; urgency=low - add tests for the hashsum code * apt/package.py: - add "isAutoRemovable()" method + * python/pkgsrcrecords.cc: + - add "Record" attribute to the PkgSrcRecord to access the + full source record -- Michael Vogt Fri, 04 Jul 2008 19:53:28 +0200 diff --git a/po/python-apt.pot b/po/python-apt.pot index c8c93668..7125757c 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-04 20:08+0200\n" +"POT-Creation-Date: 2008-07-18 15:22+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/python/pkgsrcrecords.cc b/python/pkgsrcrecords.cc index 5e04f5fc..c698a925 100644 --- a/python/pkgsrcrecords.cc +++ b/python/pkgsrcrecords.cc @@ -89,6 +89,8 @@ static PyObject *PkgSrcRecordsAttr(PyObject *Self,char *Name) return CppPyString(Struct.Last->Maintainer()); else if (strcmp("Section",Name) == 0) return CppPyString(Struct.Last->Section()); + else if (strcmp("Record",Name) == 0) + return CppPyString(Struct.Last->AsStr()); else if (strcmp("Binaries",Name) == 0) { PyObject *List = PyList_New(0); -- cgit v1.2.3 From e365aa1c9166eb6228cc84818ae3dfa075908420 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 18 Jul 2008 16:21:59 +0100 Subject: * debian/rules: - remove the arch-build target, we have bzr-builddeb now --- debian/changelog | 2 ++ debian/rules | 7 ------- 2 files changed, 2 insertions(+), 7 deletions(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 78af5f6d..c48bdafe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,8 @@ python-apt (0.7.7) unstable; urgency=low * python/pkgsrcrecords.cc: - add "Record" attribute to the PkgSrcRecord to access the full source record + * debian/rules: + - remove the arch-build target, we have bzr-builddeb now -- Michael Vogt Fri, 04 Jul 2008 19:53:28 +0200 diff --git a/debian/rules b/debian/rules index 33d04a21..c8aff2f9 100755 --- a/debian/rules +++ b/debian/rules @@ -15,13 +15,6 @@ PKG=python-apt DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p') DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS) -arch-build:: - rm -rf debian/arch-build - mkdir -p debian/arch-build/$(PKG)-$(DEBVER) - tar -c --exclude=arch-build --no-recursion -f - `bzr inventory` \ - | (cd debian/arch-build/$(PKG)-$(DEBVER);tar xf -) - (cd debian/arch-build/$(PKG)-$(DEBVER) && $(DEB_BUILD_PROG)) - build/python-apt-dbg:: set -e; \ for i in $(cdbs_python_build_versions); do \ -- cgit v1.2.3 From f05130ee834d60bbcf4245185886342584a3a4f9 Mon Sep 17 00:00:00 2001 From: Emanuele Rocca Date: Mon, 21 Jul 2008 17:30:43 +0200 Subject: * data/templates/Debian.info.in: - s/MatchUri/MatchURI/. Thanks, Gustavo Noronha Silva (closes: #487673) * python/cache.cc: - Throw an exception rather than segfaulting when GetCache() is called before InitSystem() (closes: #369147) --- data/templates/Debian.info.in | 10 +++++----- debian/changelog | 10 ++++++++++ python/cache.cc | 5 +++++ 3 files changed, 20 insertions(+), 5 deletions(-) (limited to 'debian') diff --git a/data/templates/Debian.info.in b/data/templates/Debian.info.in index 244e1c6b..b635de19 100644 --- a/data/templates/Debian.info.in +++ b/data/templates/Debian.info.in @@ -3,7 +3,7 @@ _ChangelogURI: http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changel Suite: etch RepositoryType: deb BaseURI: http://http.us.debian.org/debian/ -MatchUri: ftp[0-9]*\.[a-z]\.debian\.org +MatchURI: ftp[0-9]*\.[a-z]\.debian\.org MirrorsFile: /usr/share/python-apt/templates/Debian.mirrors _Description: Debian 4.0 'Etch' Component: main @@ -26,7 +26,7 @@ _Description: Security updates Suite: sarge RepositoryType: deb BaseURI: http://http.us.debian.org/debian/ -MatchUri: ftp[0-9]*\.[a-z]\.debian\.org +MatchURI: ftp[0-9]*\.[a-z]\.debian\.org MirrorsFile: /usr/share/python-apt/templates/Debian.mirrors _Description: Debian 3.1 'Sarge' Component: main @@ -49,7 +49,7 @@ _Description: Security updates Suite: stable RepositoryType: deb BaseURI: http://http.us.debian.org/debian/ -MatchUri: ftp[0-9]*\.[a-z]\.debian\.org +MatchURI: ftp[0-9]*\.[a-z]\.debian\.org MirrorsFile: /usr/share/python-apt/templates/Debian.mirrors _Description: Debian current stable release Component: main @@ -62,7 +62,7 @@ _CompDescription: Non-DFSG-compatible Software Suite: testing RepositoryType: deb BaseURI: http://http.us.debian.org/debian/ -MatchUri: ftp[0-9]*\.[a-z]\.debian\.org +MatchURI: ftp[0-9]*\.[a-z]\.debian\.org MirrorsFile: /usr/share/python-apt/templates/Debian.mirrors _Description: Debian testing Component: main @@ -75,7 +75,7 @@ _CompDescription: Non-DFSG-compatible Software Suite: sid RepositoryType: deb BaseURI: http://http.us.debian.org/debian/ -MatchUri: ftp[0-9]*\.[a-z]\.debian\.org +MatchURI: ftp[0-9]*\.[a-z]\.debian\.org MirrorsFile: /usr/share/python-apt/templates/Debian.mirrors _Description: Debian 'Sid' (unstable) Component: main diff --git a/debian/changelog b/debian/changelog index c48bdafe..dd13d341 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +python-apt (0.7.8) unstable; urgency=low + + * data/templates/Debian.info.in: + - s/MatchUri/MatchURI/. Thanks, Gustavo Noronha Silva (closes: #487673) + * python/cache.cc: + - Throw an exception rather than segfaulting when GetCache() is called + before InitSystem() (closes: #369147) + + -- Emanuele Rocca Mon, 21 Jul 2008 17:20:59 +0200 + python-apt (0.7.7) unstable; urgency=low * python/apt_pkgmodule.cc: diff --git a/python/cache.cc b/python/cache.cc index 36e49710..66a2c5d9 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -928,6 +928,11 @@ PyObject *TmpGetCache(PyObject *Self,PyObject *Args) if (PyArg_ParseTuple(Args, "|O", &pyCallbackInst) == 0) return 0; + if (_system == 0) { + PyErr_SetString(PyExc_ValueError,"_system not initialized"); + return 0; + } + pkgCacheFile *Cache = new pkgCacheFile(); if(pyCallbackInst != 0) { -- cgit v1.2.3 From 8e959eb0c05ebabcb806016e0360c128a23b9ec1 Mon Sep 17 00:00:00 2001 From: Emanuele Rocca Date: Mon, 21 Jul 2008 17:47:36 +0200 Subject: * doc/examples/config.py: - Fix config.py --help (closes: #257007) --- debian/changelog | 2 ++ doc/examples/config.py | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index dd13d341..52ef9f5f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,8 @@ python-apt (0.7.8) unstable; urgency=low * python/cache.cc: - Throw an exception rather than segfaulting when GetCache() is called before InitSystem() (closes: #369147) + * doc/examples/config.py: + - Fix config.py --help (closes: #257007) -- Emanuele Rocca Mon, 21 Jul 2008 17:20:59 +0200 diff --git a/doc/examples/config.py b/doc/examples/config.py index 222c1331..24d90a0d 100755 --- a/doc/examples/config.py +++ b/doc/examples/config.py @@ -42,8 +42,7 @@ if Cnf.FindB("version",0) == 1: print "Version selected - 1.1"; if Cnf.FindB("help",0) == 1: - print apt_pkg.Package,apt_pkg.Version,"for",apt_pkg.Architecture, \ - "compiled on",apt_pkg.Date,apt_pkg.Time; + print "python-apt",apt_pkg.Version,"compiled on",apt_pkg.Date,apt_pkg.Time; print "Hi, I am the help text for this program"; sys.exit(0); -- cgit v1.2.3