[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#504417: marked as done ([PATCH] Allow users to specify DestDir and DestFile in apt_pkg.GetPkgAcqFile())



Your message dated Thu, 27 Nov 2008 18:52:53 +0100
with message-id <20081127175253.GA27847@jak-linux.org>
and subject line Closed in 0.7.8
has caused the Debian Bug report #504417,
regarding [PATCH] Allow users to specify DestDir and DestFile in apt_pkg.GetPkgAcqFile()
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
504417: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=504417
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: python-apt
Version: 0.7.7.1+nmu1
Tags: patch
Severity: wishlist

It would be great if users could specify DestDir
and DestFilename in apt_pkg.GetPkgAcqFile().

This is supported by apt-pkg and could really reduce
code fetching files, like doc/examples/acquire.py.

The attached patch adds the new arguments destDir
and destFilename to GetPkgAcqFile(), as these names
have already been used for the variables. It also
documents all arguments and adjusts doc/examples/acquire.py
to use this new argument.

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages python-apt depends on:
ii  apt [libapt-pkg-libc6.7-6-4.6 0.7.16     Advanced front-end for dpkg
ii  apt-utils [libapt-inst-libc6. 0.7.16     APT utility programs
ii  libc6                         2.7-15     GNU C Library: Shared libraries
ii  libgcc1                       1:4.3.2-1  GCC support library
ii  libstdc++6                    4.3.2-1    The GNU Standard C++ Library v3
ii  lsb-release                   3.2-20     Linux Standard Base version report
ii  python                        2.5.2-2    An interactive high-level object-o
ii  python-central                0.6.8      register and build utility for Pyt

python-apt recommends no packages.

Versions of packages python-apt suggests:
pn  python-apt-dbg                <none>     (no description available)

-- no debconf information

-- 
Julian Andres Klode  - Free Software Developer
   Debian Developer  - Contributing Member of SPI
   Ubuntu Member     - Fellow of FSFE

Website: http://jak-linux.org/   XMPP: juliank@jabber.org
Debian:  http://www.debian.org/  SPI:  http://www.spi-inc.org/
Ubuntu:  http://www.ubuntu.com/  FSFE: http://www.fsfe.org/
--- python-apt-0.7.7.1+nmu1/debian/changelog	2008-10-24 13:46:04.000000000 +0200
+++ python-apt-0.7.7.1+nmu1+jak1/debian/changelog	2008-11-03 18:35:53.000000000 +0100
@@ -1,3 +1,9 @@
+python-apt (0.7.7.1+nmu1+jak1) unstable; urgency=low
+
+  * python/acquire.cc (GetPkgAcqFile): Support DestDir and DestFilename.
+
+ -- Julian Andres Klode <jak@debian.org>  Mon, 03 Nov 2008 18:34:35 +0100
+
 python-apt (0.7.7.1+nmu1) unstable; urgency=medium
 
   * Non-maintainer upload.
--- python-apt-0.7.7.1+nmu1/doc/examples/acquire.py	2008-07-25 20:52:16.000000000 +0200
+++ python-apt-0.7.7.1+nmu1+jak1/doc/examples/acquire.py	2008-11-03 18:57:25.000000000 +0100
@@ -5,24 +5,13 @@
 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")
+                           descr="sample descr", destFile=destFile)
 	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()
--- python-apt-0.7.7.1+nmu1/python/acquire.cc	2008-07-25 20:52:17.000000000 +0200
+++ python-apt-0.7.7.1+nmu1+jak1/python/acquire.cc	2008-11-03 18:44:54.000000000 +0100
@@ -242,6 +242,8 @@
    0,                                   // tp_hash
 };
 
+char *doc_GetPkgAcqFile =
+"GetPkgAcqFile(pkgAquire, uri[, md5, size, descr, shortDescr, destDir, destFile]) -> PkgAcqFile\n";
 PyObject *GetPkgAcqFile(PyObject *Self, PyObject *Args, PyObject * kwds)
 {
    PyObject *pyfetcher;
@@ -250,11 +252,11 @@
    uri = md5 = descr = shortDescr = destDir = destFile = "";
 
    char * kwlist[] = {"owner","uri", "md5", "size", "descr", "shortDescr",
-		      NULL};
+                      "destDir", "destFile", NULL};
 
-   if (PyArg_ParseTupleAndKeywords(Args, kwds, "O!s|siss", kwlist,
+   if (PyArg_ParseTupleAndKeywords(Args, kwds, "O!s|sissss", kwlist,
 				   &PkgAcquireType, &pyfetcher, &uri, &md5, 
-				   &size, &descr, &shortDescr) == 0) 
+				   &size, &descr, &shortDescr, &destDir, &destFile) == 0) 
       return 0;
 
    pkgAcquire *fetcher = GetCpp<pkgAcquire*>(pyfetcher);
@@ -263,7 +265,9 @@
 				   md5,  // md5
 				   size,   // size
 				   descr, // descr
-				   shortDescr); // short-desc
+				   shortDescr,
+				   destDir,
+				   destFile); // short-desc
    CppPyObject<pkgAcqFile*> *AcqFileObj =   CppPyObject_NEW<pkgAcqFile*>(&PkgAcquireFileType);
    AcqFileObj->Object = af;
 
--- python-apt-0.7.7.1+nmu1/python/apt_pkgmodule.cc	2008-07-25 20:52:17.000000000 +0200
+++ python-apt-0.7.7.1+nmu1+jak1/python/apt_pkgmodule.cc	2008-11-03 18:49:25.000000000 +0100
@@ -447,7 +447,7 @@
 
    // Acquire
    {"GetAcquire",GetAcquire,METH_VARARGS,"GetAcquire() -> Acquire"},
-   {"GetPkgAcqFile",(PyCFunction)GetPkgAcqFile,METH_KEYWORDS|METH_VARARGS,"GetPkgAcquireFile() -> pkgAcquireFile"},
+   {"GetPkgAcqFile",(PyCFunction)GetPkgAcqFile,METH_KEYWORDS|METH_VARARGS, doc_GetPkgAcqFile},
 
    // PkgManager
    {"GetPackageManager",GetPkgManager,METH_VARARGS,"GetPackageManager(DepCache) -> PackageManager"},
--- python-apt-0.7.7.1+nmu1/python/apt_pkgmodule.h	2008-07-25 20:52:17.000000000 +0200
+++ python-apt-0.7.7.1+nmu1+jak1/python/apt_pkgmodule.h	2008-11-03 18:48:51.000000000 +0100
@@ -75,6 +75,7 @@
 
 // acquire
 extern PyTypeObject PkgAcquireType;
+extern char *doc_GetPkgAcqFile;
 PyObject *GetAcquire(PyObject *Self,PyObject *Args);
 PyObject *GetPkgAcqFile(PyObject *Self, PyObject *Args, PyObject *kwds);
 

Attachment: signature.asc
Description: Digital signature


--- End Message ---
--- Begin Message ---
Version: 0.7.8

  [ Michael Vogt ]
  * 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)
  * python/apt_instmodule.cc:
    - do not change working dir in debExtractArchive() (LP: #184093)
  * apt/cache.py:
    - support "in" in apt.Cache() (LP: #251587)
  * apt/package.py:
    - do not return None in sourcePackageName (LP: #123062)
  * python/progress.cc:
    - when pulse() does not return a boolean assume "true"
      (thanks to Martin Pitt for telling me about the problem)
  * python/apt_pkgmodule.cc:
    - add "SelState{Unknown,Install,Hold,DeInstall,Purge}" constants
  * 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
  * python/metaindex.cc
    - fix crash when incorrect attribute is given
  * data/templates/Ubuntu.info.in:
    - updated
  * aptsources/distro.py:
    - add parameter to get_distro() to make unit testing easier
  * tests/test_aptsources_ports.py:
    - add test for arch specific handling (when sub arch is on
      a different mirror than "main" arches)

  [ Julian Andres Klode ]
  * python/acquire.cc (GetPkgAcqFile): Support DestDir and DestFilename.

 -- Michael Vogt <mvo@debian.org>  Mon, 24 Nov 2008 10:24:30 +0200

-- 
Julian Andres Klode  - Free Software Developer
   Debian Developer  - Contributing Member of SPI
   Ubuntu Member     - Fellow of FSFE

Website: http://jak-linux.org/   XMPP: juliank@jabber.org
Debian:  http://www.debian.org/  SPI:  http://www.spi-inc.org/
Ubuntu:  http://www.ubuntu.com/  FSFE: http://www.fsfe.org/


--- End Message ---

Reply to: