From 25b0cfc0fe92da8a0114bd15aec16e47318b6f48 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 9 Nov 2005 04:28:04 +0000 Subject: * changelog finalized and synced with the debian upload --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'debian/control') diff --git a/debian/control b/debian/control index bfa67c67..8fb8a669 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,7 @@ Priority: optional Maintainer: APT Development Team Uploaders: Matt Zimmerman , Michael Vogt Standards-Version: 3.6.1.1 -Build-Depends: debhelper (>= 4.2.28), libapt-pkg-dev (>= 0.6.40), apt-utils, python-dev, python2.4-dev, python2.3-dev +Build-Depends: debhelper (>= 4.2.28), libapt-pkg-dev (>= 0.6.40.1), apt-utils, python-dev, python2.4-dev, python2.3-dev Package: python-apt Architecture: all -- cgit v1.2.3 From 0a8598b3b728e0445f84186b3f302734d1347371 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 28 Nov 2005 12:27:33 +0000 Subject: * rewrote the cache.commit() code to make use of the new pkgAcquire/pkgPackageManager interface --- apt/cache.py | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++---- debian/changelog | 3 ++ debian/control | 2 +- python/acquire.cc | 7 +++-- 4 files changed, 88 insertions(+), 9 deletions(-) (limited to 'debian/control') diff --git a/apt/cache.py b/apt/cache.py index 1fb128a3..ab3775aa 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -21,8 +21,9 @@ import apt_pkg from apt import Package -from apt.progress import OpTextProgress -from UserDict import UserDict +import apt.progress +import os +import sys class Cache(object): """ Dictionary-like package cache @@ -48,6 +49,8 @@ class Cache(object): self._cache = apt_pkg.GetCache(progress) self._depcache = apt_pkg.GetDepCache(self._cache) self._records = apt_pkg.GetPkgRecords(self._cache) + self._list = apt_pkg.GetPkgSourceList() + self._list.ReadMainList() self._dict = {} # build the packages dict @@ -115,9 +118,71 @@ class Cache(object): else: self._cache.Update(fetchProgress); - def commit(self, fprogress, iprogress): + def _fetchArchives(self, pm, fetchProgress): + """ fetch the needed archives """ + + # get lock + lockfile = apt_pkg.Config.FindDir("Dir::Cache::Archives") + "lock" + lock = apt_pkg.GetLock(lockfile) + if lock < 0: + raise IOError, "Failed to lock %s" % lockfile + fetcher = apt_pkg.GetAcquire(fetchProgress) + # this may as well throw a SystemError exception + if not pm.GetArchives(fetcher, self._list, self._records): + return False + # do the actual fetching + res = fetcher.Run() + if res == fetcher.ResultFailed: + return False + + # now check the result (this is the code from apt-get.cc) + failed = False + transient = False + errMsg = "" + for item in fetcher.Items: + if item.StatDone and item.Complete: + continue + if item.StatIdle: + transient = True + continue + errMsg += "Failed to fetch %s %s\n" % (item.DescURI,item.ErrorText) + failed = True + + # we raise a exception if the download failed + if failed: + raise IOError, errMsg + + # cleanup + fetcher.Shutdown() + os.close(lock) + return res + + def installArchives(self, pm, installProgress): + return pm.DoInstall() + + def commit(self, fetchProgress=None, installProgress=None): """ Apply the marked changes to the cache """ - return self._depcache.Commit(fprogress, iprogress) + # FIXME: + # use the new acquire/pkgmanager interface here, + # raise exceptions when a download or install fails + # and send proper error strings to the application. + # Current a failed download will just display "error" + # which is less than optimal! + + while True: + pm = apt_pkg.GetPackageManager(self._depcache) + + # fetch archives first + res = self._fetchArchives(pm, fetchProgress) + + # then install + res = self.installArchives(pm, installProgress) + if res == pm.ResultCompleted: + break + if res == pm.ResultFailed: + raise SystemError, "install failed" + + return res # cache changes def cachePostChange(self): @@ -228,7 +293,7 @@ def cache_post_changed(): if __name__ == "__main__": print "Cache self test" apt_pkg.init() - c = Cache(OpTextProgress()) + c = Cache(apt.progress.OpTextProgress()) c.connect("cache_pre_change", cache_pre_changed) c.connect("cache_post_change", cache_post_changed) print c.has_key("aptitude") @@ -246,6 +311,16 @@ if __name__ == "__main__": #print p.name x = p.name + + # see if fetching works + for dir in ["/tmp/pytest", "/tmp/pytest/partial"]: + if not os.path.exists(dir): + os.mkdir(dir) + apt_pkg.Config.Set("Dir::Cache::Archives","/tmp/pytest") + pm = apt_pkg.GetPackageManager(c._depcache) + c._fetchArchives(pm, apt.progress.TextFetchProgress()) + #sys.exit(1) + print "Testing filtered cache (argument is old cache)" f = FilteredCache(c) f.cache.connect("cache_pre_change", cache_pre_changed) diff --git a/debian/changelog b/debian/changelog index 9ffd5b12..1a4cb0a8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,9 @@ python-apt (0.6.15) unstable; urgency=low * fix a invalid return from cache.commit(), fail if a download failed * apt.Package.candidateOrigin returns a class now * added pkgAcquire, pkgPackageManager and a example (acquire.py) + * tightend build-dependencies for new apt and the c++ transition + * rewrote cache.Commit() and make it raise proper Exception if stuff + goes wrong -- Michael Vogt Thu, 17 Nov 2005 13:00:14 +0100 diff --git a/debian/control b/debian/control index 8fb8a669..eec81bd3 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,7 @@ Priority: optional Maintainer: APT Development Team Uploaders: Matt Zimmerman , Michael Vogt Standards-Version: 3.6.1.1 -Build-Depends: debhelper (>= 4.2.28), libapt-pkg-dev (>= 0.6.40.1), apt-utils, python-dev, python2.4-dev, python2.3-dev +Build-Depends: debhelper (>= 4.2.28), libapt-pkg-dev (>= 0.6.43ubuntu1), apt-utils, python-dev, python2.4-dev, python2.3-dev Package: python-apt Architecture: all diff --git a/python/acquire.cc b/python/acquire.cc index 1bbed72a..2bcd94c1 100644 --- a/python/acquire.cc +++ b/python/acquire.cc @@ -94,11 +94,11 @@ static PyObject *PkgAcquireRun(PyObject *Self,PyObject *Args) { pkgAcquire *fetcher = GetCpp(Self); - if (PyArg_ParseTuple(Args, "") == 0) + int pulseInterval = 500000; + if (PyArg_ParseTuple(Args, "|i", &pulseInterval) == 0) return 0; - //FIXME: add pulse interval here - pkgAcquire::RunResult run = fetcher->Run(); + pkgAcquire::RunResult run = fetcher->Run(pulseInterval); return HandleErrors(Py_BuildValue("i",run)); } @@ -119,6 +119,7 @@ static PyObject *PkgAcquireShutdown(PyObject *Self,PyObject *Args) static PyMethodDef PkgAcquireMethods[] = { {"Run",PkgAcquireRun,METH_VARARGS,"Run the fetcher"}, + {"Shutdown",PkgAcquireShutdown, METH_VARARGS,"Shutdown the fetcher"}, {} }; -- cgit v1.2.3 From 20ef36a125021a171b831a52d3e9143f5c3682ec Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 28 Nov 2005 22:54:17 +0000 Subject: * fix build-deps --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'debian/control') diff --git a/debian/control b/debian/control index eec81bd3..472712d9 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,7 @@ Priority: optional Maintainer: APT Development Team Uploaders: Matt Zimmerman , Michael Vogt Standards-Version: 3.6.1.1 -Build-Depends: debhelper (>= 4.2.28), libapt-pkg-dev (>= 0.6.43ubuntu1), apt-utils, python-dev, python2.4-dev, python2.3-dev +Build-Depends: debhelper (>= 4.2.28), libapt-pkg-dev (>= 0.6.43), apt-utils, python-dev, python2.4-dev, python2.3-dev Package: python-apt Architecture: all -- cgit v1.2.3 From cce2b71c2fd64c8587238178c27a049ec450ce07 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 Dec 2005 10:40:14 +0000 Subject: * make pkgAcqFile use the old interface so that we don't depend on a new apt and still work with breezys apt --- debian/changelog | 2 +- debian/control | 2 +- doc/examples/acquire.py | 28 +++++++++++++++++++++++----- python/acquire.cc | 12 ++++-------- 4 files changed, 29 insertions(+), 15 deletions(-) (limited to 'debian/control') diff --git a/debian/changelog b/debian/changelog index 2c202597..5f4c0856 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,7 @@ python-apt (0.6.16) unstable; urgency=low * added GetPkgAcqFile to queue individual file downloads with the - system + system (dosn't make use of the improved pkgAcqFile yet) * added SourceList.GetIndexes() * rewrote apt.cache.update() to use the improved aquire interface * apt/ API change: apt.Package.candidateOrigin returns a list of origins diff --git a/debian/control b/debian/control index 472712d9..bfa67c67 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,7 @@ Priority: optional Maintainer: APT Development Team Uploaders: Matt Zimmerman , Michael Vogt Standards-Version: 3.6.1.1 -Build-Depends: debhelper (>= 4.2.28), libapt-pkg-dev (>= 0.6.43), apt-utils, python-dev, python2.4-dev, python2.3-dev +Build-Depends: debhelper (>= 4.2.28), libapt-pkg-dev (>= 0.6.40), apt-utils, python-dev, python2.4-dev, python2.3-dev Package: python-apt Architecture: all diff --git a/doc/examples/acquire.py b/doc/examples/acquire.py index 516a3d6d..a0790c98 100644 --- a/doc/examples/acquire.py +++ b/doc/examples/acquire.py @@ -2,6 +2,28 @@ import apt import apt_pkg import os import sys +import tempfile + +def get_file(fetcher, uri, destFile): + cwd = os.getcwd() + # create a temp dir + dir = tempfile.mkdtemp() + os.chdir(dir) + # get the file + af = apt_pkg.GetPkgAcqFile(fetcher, + uri=uri, + descr="sample descr") + res = fetcher.Run() + if res != fetcher.ResultContinue: + os.rmdir(dir) + os.chdir(cwd) + return False + filename = os.path.basename(uri) + os.rename(dir+"/"+filename,destFile) + # cleanup + os.rmdir(dir) + os.chdir(cwd) + return True apt_pkg.init() @@ -45,11 +67,7 @@ pm = apt_pkg.GetPackageManager(depcache) print pm print fetcher -af = apt_pkg.GetPkgAcqFile(fetcher, - uri="ftp://ftp.debian.org/debian/dists/README", - descr="sample descr", - destFile="/tmp/lala2") -fetcher.Run() +get_file(fetcher, "ftp://ftp.debian.org/debian/dists/README", "/tmp/lala") sys.exit(1) pm.GetArchives(fetcher,list,recs) diff --git a/python/acquire.cc b/python/acquire.cc index 97064c43..65f8f2d7 100644 --- a/python/acquire.cc +++ b/python/acquire.cc @@ -250,12 +250,11 @@ PyObject *GetPkgAcqFile(PyObject *Self, PyObject *Args, PyObject * kwds) uri = md5 = descr = shortDescr = destDir = destFile = ""; char * kwlist[] = {"owner","uri", "md5", "size", "descr", "shortDescr", - "destDir", "destFile", NULL}; + NULL}; - if (PyArg_ParseTupleAndKeywords(Args, kwds, "O!s|sissss", kwlist, + if (PyArg_ParseTupleAndKeywords(Args, kwds, "O!s|siss", kwlist, &PkgAcquireType, &pyfetcher, &uri, &md5, - &size, &descr, &shortDescr, &destDir, - &destFile) == 0) + &size, &descr, &shortDescr) == 0) return 0; pkgAcquire *fetcher = GetCpp(pyfetcher); @@ -264,10 +263,7 @@ PyObject *GetPkgAcqFile(PyObject *Self, PyObject *Args, PyObject * kwds) md5, // md5 size, // size descr, // descr - shortDescr, // shortdescr - destDir, // destdir - destFile // destfile - ); + shortDescr); // short-desc CppPyObject *AcqFileObj = CppPyObject_NEW(&PkgAcquireFileType); AcqFileObj->Object = af; -- cgit v1.2.3 From 0e8fd33b1b741cc65c284a08faa50b3a2995ac3c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 26 Apr 2006 10:17:09 +0200 Subject: * debian/compat: - debhelper compat level set to 5 * debian/changelog: - merged the changelog from the NMU * debian/control: - merged the changes from the NMU - set standards version to 3.6.2.0 * debian/rules: - fix arch-build target * setup.py: - simplify the patch magling by using map() instead of "for i in range()" --- debian/changelog | 13 +++++++++++-- debian/compat | 1 + debian/control | 8 ++++---- debian/rules | 5 +---- setup.py | 18 +++++++----------- 5 files changed, 24 insertions(+), 21 deletions(-) create mode 100644 debian/compat (limited to 'debian/control') diff --git a/debian/changelog b/debian/changelog index 976e078f..e1dfd27a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -python-apt (0.6.16.2) unstable; urgency=low +python-apt (0.6.17) unstable; urgency=low * apt/progress.py: - initialize FetchProgress.eta with the correct type @@ -19,8 +19,17 @@ python-apt (0.6.16.2) unstable; urgency=low * python/indexfile.cc: - added ArchiveURI() method - -- + -- +python-apt (0.6.16.2) unstable; urgency=low + + * Non-maintainer upload. + * debian/control: + + Replaces: python-apt (<< 0.6.11), instead of Conflicts which is not + correct here. (closes: #308586). + + -- Pierre Habouzit Fri, 14 Apr 2006 19:30:51 +0200 + python-apt (0.6.16.1) unstable; urgency=low * memleak fixed when pkgCache objects are deallocated diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..7813681f --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git a/debian/control b/debian/control index bfa67c67..6966077f 100644 --- a/debian/control +++ b/debian/control @@ -3,8 +3,8 @@ Section: python Priority: optional Maintainer: APT Development Team Uploaders: Matt Zimmerman , Michael Vogt -Standards-Version: 3.6.1.1 -Build-Depends: debhelper (>= 4.2.28), libapt-pkg-dev (>= 0.6.40), apt-utils, python-dev, python2.4-dev, python2.3-dev +Standards-Version: 3.6.2.0 +Build-Depends: debhelper (>= 5.0), libapt-pkg-dev (>= 0.6.40), apt-utils, python-dev, python2.4-dev, python2.3-dev Package: python-apt Architecture: all @@ -23,7 +23,7 @@ Description: Python interface to libapt-pkg Package: python2.3-apt Architecture: any Depends: python2.3, ${shlibs:Depends} -Conflicts: python-apt (<< 0.6.11) +Replaces: python-apt (<< 0.6.11) Priority: optional Description: Python interface to libapt-pkg The apt-pkg Python interface will provide full access to the internal @@ -38,7 +38,7 @@ Description: Python interface to libapt-pkg Package: python2.4-apt Architecture: any Depends: python2.4, ${shlibs:Depends} -Conflicts: python-apt (<< 0.6.11) +Replaces: python-apt (<< 0.6.11) Priority: optional Description: Python interface to libapt-pkg The apt-pkg Python interface will provide full access to the internal diff --git a/debian/rules b/debian/rules index 0ab6fa27..584abdf5 100755 --- a/debian/rules +++ b/debian/rules @@ -6,9 +6,6 @@ # This has to be exported to make some magic below work. export DH_OPTIONS -# This is the debhelper compatibility version to use. -export DH_COMPAT=3 - 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) @@ -83,7 +80,7 @@ source diff: arch-build: rm -rf debian/arch-build mkdir -p debian/arch-build/python-apt-$(DEBVER) - baz inventory -s | xargs cp -a --parents --target=debian/arch-build/python-apt-$(DEBVER) + tar -c --exclude=arch-build --no-recursion -f - `bzr inventory` | (cd debian/arch-build/python-apt-$(DEBVER);tar xf -) (cd debian/arch-build/python-apt-$(DEBVER); $(DEB_BUILD_PROG)) binary: binary-indep binary-arch diff --git a/setup.py b/setup.py index f9255607..5adb0376 100644 --- a/setup.py +++ b/setup.py @@ -7,22 +7,18 @@ import string, glob # The apt_pkg module -files = string.split(parse_makefile("python/makefile")["APT_PKG_SRC"]); -for i in range(0,len(files)): - files[i] = "python/"+ files[i]; -apt_pkg = Extension("apt_pkg", files, - libraries=["apt-pkg"]); +files = map(lambda source: "python/"+source, + string.split(parse_makefile("python/makefile")["APT_PKG_SRC"])) +apt_pkg = Extension("apt_pkg", files, libraries=["apt-pkg"]); # The apt_inst module -files = string.split(parse_makefile("python/makefile")["APT_INST_SRC"]); -for i in range(0,len(files)): - files[i] = "python/"+ files[i]; -apt_inst = Extension("apt_inst", files, - libraries=["apt-pkg","apt-inst"]); +files = map(lambda source: "python/"+source, + string.split(parse_makefile("python/makefile")["APT_INST_SRC"])) +apt_inst = Extension("apt_inst", files, libraries=["apt-pkg","apt-inst"]); setup(name="python-apt", - version="0.6.13", + version="0.6.17", description="Python bindings for APT", author="APT Development Team", author_email="deity@lists.debian.org", -- cgit v1.2.3 From 76fb1f457228cc5efa5f45a7a875ec5bc0e17b3a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 26 Jun 2006 06:08:07 +0200 Subject: * merging the NMU changes --- debian/changelog | 9 ++++++++- debian/control | 39 +++++++-------------------------------- debian/rules | 21 +++++---------------- 3 files changed, 20 insertions(+), 49 deletions(-) (limited to 'debian/control') diff --git a/debian/changelog b/debian/changelog index 287605e0..d9b428bd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -python-apt (0.6.18) unstable; urgency=low +python-apt (0.6.19) unstable; urgency=low [ Michael Vogt ] * doc/examples/print_uris.py: @@ -12,6 +12,13 @@ python-apt (0.6.18) unstable; urgency=low -- +python-apt (0.6.18) unstable; urgency=low + + * Non-maintainer upload. + * Update for the new Python policy. Closes: #373512 + + -- Raphael Hertzog Sat, 17 Jun 2006 15:09:28 +0200 + python-apt (0.6.17) unstable; urgency=low * apt/progress.py: diff --git a/debian/control b/debian/control index 6966077f..f313dff5 100644 --- a/debian/control +++ b/debian/control @@ -4,42 +4,17 @@ Priority: optional Maintainer: APT Development Team Uploaders: Matt Zimmerman , Michael Vogt Standards-Version: 3.6.2.0 -Build-Depends: debhelper (>= 5.0), libapt-pkg-dev (>= 0.6.40), apt-utils, python-dev, python2.4-dev, python2.3-dev +XS-Python-Version: all +Build-Depends: debhelper (>= 5.0.37.1), libapt-pkg-dev (>= 0.6.40), apt-utils, python-all-dev, python-central Package: python-apt -Architecture: all -Depends: ${python:Depends} -Priority: optional -Description: Python interface to libapt-pkg - The apt-pkg Python interface will provide full access to the internal - libapt-pkg structures allowing Python programs to easily perform a - variety of functions, such as: - . - - Access to the APT configuration system - - Access to the APT package information database - - Parsing of Debian package control files, and other files with a - similar structure - -Package: python2.3-apt Architecture: any -Depends: python2.3, ${shlibs:Depends} -Replaces: python-apt (<< 0.6.11) -Priority: optional -Description: Python interface to libapt-pkg - The apt-pkg Python interface will provide full access to the internal - libapt-pkg structures allowing Python programs to easily perform a - variety of functions, such as: - . - - Access to the APT configuration system - - Access to the APT package information database - - Parsing of Debian package control files, and other files with a - similar structure - -Package: python2.4-apt -Architecture: any -Depends: python2.4, ${shlibs:Depends} -Replaces: python-apt (<< 0.6.11) +Depends: ${python:Depends} Priority: optional +Replaces: python2.3-apt (<< 0.6.18), python2.4-apt (<< 0.6.18) +Conflicts: python2.3-apt (<< 0.6.18), python2.4-apt (<< 0.6.18) +Provides: ${python:Provides} +XB-Python-Version: ${python:Versions} Description: Python interface to libapt-pkg The apt-pkg Python interface will provide full access to the internal libapt-pkg structures allowing Python programs to easily perform a diff --git a/debian/rules b/debian/rules index 584abdf5..ffd39a6f 100755 --- a/debian/rules +++ b/debian/rules @@ -12,7 +12,7 @@ DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -PYTHON=python2.3 python2.4 +PYTHON=$(shell pyversions -r debian/control) build: build-stamp build-stamp: @@ -38,18 +38,6 @@ clean: # Build architecture-independent files here. binary-indep: DH_OPTIONS=-i binary-indep: build - dh_testdir - dh_testroot - dh_installdocs - dh_installexamples doc/examples/*.py - dh_installchangelogs - dh_compress - dh_fixperms - dh_installdeb - dh_python - dh_gencontrol - dh_md5sums - dh_builddeb # Build architecture-dependent files here. binary-arch: DH_OPTIONS=-a @@ -57,11 +45,11 @@ binary-arch: build dh_testdir dh_testroot dh_clean -k - + for PY in $(PYTHON); do \ - /usr/bin/$$PY setup.py install --prefix=`pwd`/debian/$${PY}-apt/usr; \ + /usr/bin/$$PY setup.py install --prefix=`pwd`/debian/python-apt/usr; \ done - + dh_installdocs dh_installchangelogs dh_strip @@ -69,6 +57,7 @@ binary-arch: build dh_fixperms dh_installdeb dh_shlibdeps + dh_pycentral dh_python dh_gencontrol dh_md5sums -- cgit v1.2.3