summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-11-15 16:55:07 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2011-11-15 16:55:07 +0100
commit92cc00805d175dc013d544bcee603e8a0c031c2b (patch)
treee33d5d7e7ae3910b67b3193401bf331aa5e80b07
parenta0c9ec82095d2e09715e5dc953119ec4fa7b4c2e (diff)
parentfcd268692450231c98bfb6ac2e573ce466e014c7 (diff)
downloadpython-apt-92cc00805d175dc013d544bcee603e8a0c031c2b.tar.gz
merged from lp:~mvo/apt/mvo
-rw-r--r--apt/cache.py4
-rw-r--r--debian/changelog4
-rw-r--r--po/python-apt.pot2
-rw-r--r--python/apt_pkgmodule.cc11
-rw-r--r--python/apt_pkgmodule.h1
-rw-r--r--python/arfile.cc8
-rw-r--r--python/cdrom.cc4
-rw-r--r--python/configuration.cc2
-rw-r--r--python/depcache.cc1
-rw-r--r--python/lock.cc2
-rw-r--r--python/metaindex.cc4
-rw-r--r--python/progress.cc14
-rw-r--r--python/progress.h6
-rw-r--r--python/tag.cc1
-rw-r--r--python/tarfile.cc2
-rw-r--r--tests/test_debfile.py13
16 files changed, 52 insertions, 27 deletions
diff --git a/apt/cache.py b/apt/cache.py
index a4585277..8a456715 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -83,6 +83,10 @@ class Cache(object):
apt_pkg.config.set("Dir", rootdir)
apt_pkg.config.set("Dir::State::status",
rootdir + "/var/lib/dpkg/status")
+ # also set dpkg to the rootdir path so that its called for the
+ # --print-foreign-architectures call
+ apt_pkg.config.set("Dir::bin::dpkg",
+ os.path.join(rootdir, "usr", "bin", "dpkg"))
# create required dirs/files when run with special rootdir
# automatically
self._check_and_create_required_dirs(rootdir)
diff --git a/debian/changelog b/debian/changelog
index 0c116489..27eb8e97 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -22,6 +22,10 @@ python-apt (0.8.2) UNRELEASED; urgency=low
on list of package objects
* debian/control:
- add recommends to xz-lzma to ensure we have the unlzma command
+ * apt/cache.py:
+ - set Dir::bin::dpkg if a alternate rootdir is given
+ (LP: #885895)
+ * build fixes for the apt in experimental
[ Tshepang Lekhonkhobe ]
* rm usage of camelcase in cache.py doc (closes: #626617)
diff --git a/po/python-apt.pot b/po/python-apt.pot
index d19871d0..046f5779 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-21 10:10+0200\n"
+"POT-Creation-Date: 2011-11-10 17:20+0100\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"
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc
index 8532b1e3..acfdf019 100644
--- a/python/apt_pkgmodule.cc
+++ b/python/apt_pkgmodule.cc
@@ -26,6 +26,7 @@
#include <apt-pkg/pkgsystem.h>
#include <apt-pkg/orderlist.h>
#include <apt-pkg/aptconfiguration.h>
+#include <apt-pkg/fileutl.h>
#include <sys/stat.h>
#include <libintl.h>
@@ -185,11 +186,11 @@ static const char *parse_src_depends_doc =
"only contains those dependencies for the architecture set in the\n"
"configuration variable APT::Architecture";
static PyObject *RealParseDepends(PyObject *Self,PyObject *Args,
- bool ParseArchFlags, string name,
+ bool ParseArchFlags, std::string name,
bool debStyle=false)
{
- string Package;
- string Version;
+ std::string Package;
+ std::string Version;
unsigned int Op;
bool StripMultiArch=true;
@@ -408,8 +409,8 @@ static PyObject *GetArchitectures(PyObject *Self,PyObject *Args)
return 0;
PyObject *List = PyList_New(0);
- vector<string> arches = APT::Configuration::getArchitectures();
- vector<string>::const_iterator I;
+ std::vector<std::string> arches = APT::Configuration::getArchitectures();
+ std::vector<std::string>::const_iterator I;
for (I = arches.begin(); I != arches.end(); I++)
{
PyList_Append(List, CppPyString(*I));
diff --git a/python/apt_pkgmodule.h b/python/apt_pkgmodule.h
index b3534a30..85c34130 100644
--- a/python/apt_pkgmodule.h
+++ b/python/apt_pkgmodule.h
@@ -24,6 +24,7 @@
#include <apt-pkg/pkgsystem.h>
#include <apt-pkg/cdrom.h>
#include <apt-pkg/algorithms.h>
+#include <apt-pkg/metaindex.h>
#include "generic.h"
// Configuration Stuff
diff --git a/python/arfile.cc b/python/arfile.cc
index c31ea35e..44cd3c82 100644
--- a/python/arfile.cc
+++ b/python/arfile.cc
@@ -204,7 +204,7 @@ static PyObject *_extract(FileFd &Fd, const ARArchive::Member *member,
if (!Fd.Seek(member->Start))
return HandleErrors();
- string outfile_str = flCombine(dir,member->Name);
+ std::string outfile_str = flCombine(dir,member->Name);
char *outfile = (char*)outfile_str.c_str();
// We are not using FileFd here, because we want to raise OSErrror with
@@ -539,8 +539,8 @@ static PyObject *debfile_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
for (std::vector<std::string>::const_iterator t = types.begin();
t != types.end(); ++t)
{
- string member = string("data.tar.").append(*t);
- string comp = _config->Find(string("Acquire::CompressionTypes::").append(*t));
+ std::string member = std::string("data.tar.").append(*t);
+ std::string comp = _config->Find(std::string("Acquire::CompressionTypes::").append(*t));
self->data = _gettar(self, self->Object->FindMember(member.c_str()),
comp.c_str());
if (self->data)
@@ -548,7 +548,7 @@ static PyObject *debfile_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
}
// no data found, we need to
if (!self->data) {
- string error;
+ std::string error;
for (std::vector<std::string>::const_iterator t = types.begin();
t != types.end(); ++t)
error.append(*t + ",");
diff --git a/python/cdrom.cc b/python/cdrom.cc
index 6ac16d59..46bb769c 100644
--- a/python/cdrom.cc
+++ b/python/cdrom.cc
@@ -67,7 +67,7 @@ static PyObject *cdrom_ident(PyObject *Self,PyObject *Args)
PyCdromProgress progress;
progress.setCallbackInst(pyCdromProgressInst);
- string ident;
+ std::string ident;
bool res = Cdrom.Ident(ident, &progress);
if (res)
@@ -94,7 +94,7 @@ static PyObject *cdrom_ident_old(PyObject *Self,PyObject *Args)
PyCdromProgress progress;
progress.setCallbackInst(pyCdromProgressInst);
- string ident;
+ std::string ident;
bool res = Cdrom.Ident(ident, &progress);
PyObject *boolres = PyBool_FromLong(res);
diff --git a/python/configuration.cc b/python/configuration.cc
index 9000f71f..3e634901 100644
--- a/python/configuration.cc
+++ b/python/configuration.cc
@@ -262,7 +262,7 @@ static PyObject *CnfDump(PyObject *Self,PyObject *Args)
if (PyArg_ParseTuple(Args,"") == 0)
return 0;
- stringstream ss;
+ std::stringstream ss;
GetSelf(Self).Dump(ss);
return CppPyString(ss.str());
}
diff --git a/python/depcache.cc b/python/depcache.cc
index e6113429..73993c82 100644
--- a/python/depcache.cc
+++ b/python/depcache.cc
@@ -22,6 +22,7 @@
#include <apt-pkg/sourcelist.h>
#include <apt-pkg/pkgrecords.h>
#include <apt-pkg/acquire-item.h>
+#include <apt-pkg/fileutl.h>
#include <Python.h>
#include <iostream>
diff --git a/python/lock.cc b/python/lock.cc
index 2c957df1..38a2bc74 100644
--- a/python/lock.cc
+++ b/python/lock.cc
@@ -21,6 +21,8 @@
#include <Python.h>
#include <apt-pkg/init.h>
#include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/pkgsystem.h>
#include "generic.h"
static PyObject *systemlock_exit(PyObject *self, PyObject *args)
diff --git a/python/metaindex.cc b/python/metaindex.cc
index a00cf04e..9e330d3d 100644
--- a/python/metaindex.cc
+++ b/python/metaindex.cc
@@ -33,8 +33,8 @@ static PyObject *MetaIndexGetIsTrusted(PyObject *Self,void*) {
static PyObject *MetaIndexGetIndexFiles(PyObject *Self,void*) {
metaIndex *meta = GetCpp<metaIndex*>(Self);
PyObject *List = PyList_New(0);
- vector<pkgIndexFile *> *indexFiles = meta->GetIndexFiles();
- for (vector<pkgIndexFile *>::const_iterator I = indexFiles->begin();
+ std::vector<pkgIndexFile *> *indexFiles = meta->GetIndexFiles();
+ for (std::vector<pkgIndexFile *>::const_iterator I = indexFiles->begin();
I != indexFiles->end(); I++)
{
CppPyObject<pkgIndexFile*> *Obj;
diff --git a/python/progress.cc b/python/progress.cc
index bd3c2ad6..a7fd7ae1 100644
--- a/python/progress.cc
+++ b/python/progress.cc
@@ -127,7 +127,7 @@ PyObject *PyFetchProgress::GetDesc(pkgAcquire::ItemDesc *item) {
return pyDesc;
}
-bool PyFetchProgress::MediaChange(string Media, string Drive)
+bool PyFetchProgress::MediaChange(std::string Media, std::string Drive)
{
PyCbObj_END_ALLOW_THREADS
//std::cout << "MediaChange" << std::endl;
@@ -485,7 +485,7 @@ pkgPackageManager::OrderResult PyInstallProgress::Run(pkgPackageManager *pm)
PyObject *v = PyObject_GetAttrString(callbackInst, "writefd");
if(v) {
int fd = PyObject_AsFileDescriptor(v);
- cout << "got fd: " << fd << endl;
+ std::cout << "got fd: " << fd << std::endl;
res = pm->DoInstall(fd);
} else {
res = pm->DoInstall();
@@ -542,7 +542,7 @@ pkgPackageManager::OrderResult PyInstallProgress::Run(pkgPackageManager *pm)
//-----------------------------------------------------------------------------
// apt-cdrom interface
-void PyCdromProgress::Update(string text, int current)
+void PyCdromProgress::Update(std::string text, int current)
{
PyObject *arglist = Py_BuildValue("(si)", text.c_str(), current);
setattr(callbackInst, "total_steps", "i", totalSteps);
@@ -569,7 +569,7 @@ bool PyCdromProgress::ChangeCdrom()
}
-bool PyCdromProgress::AskCdromName(string &Name)
+bool PyCdromProgress::AskCdromName(std::string &Name)
{
PyObject *arglist = Py_BuildValue("()");
const char *new_name;
@@ -582,7 +582,7 @@ bool PyCdromProgress::AskCdromName(string &Name)
if(!PyArg_Parse(result, "(bs)", &res, &new_name))
std::cerr << "AskCdromName: result could not be parsed" << std::endl;
// set the new name
- Name = string(new_name);
+ Name =std:: string(new_name);
return res;
}
// New style: String on success, None on failure.
@@ -593,7 +593,7 @@ bool PyCdromProgress::AskCdromName(string &Name)
if(!PyArg_Parse(result, "s", &new_name))
std::cerr << "ask_cdrom_name: result could not be parsed" << std::endl;
else
- Name = string(new_name);
- return true;
+ Name = std::string(new_name);
+ return true;
}
}
diff --git a/python/progress.h b/python/progress.h
index 4e66c771..af8e3acc 100644
--- a/python/progress.h
+++ b/python/progress.h
@@ -72,7 +72,7 @@ struct PyFetchProgress : public pkgAcquireStatus, public PyCallbackObj
void UpdateStatus(pkgAcquire::ItemDesc & Itm, int status);
- virtual bool MediaChange(string Media, string Drive);
+ virtual bool MediaChange(std::string Media, std::string Drive);
void setPyAcquire(PyObject *o) {
Py_CLEAR(pyAcquire);
@@ -107,11 +107,11 @@ struct PyInstallProgress : public PyCallbackObj
struct PyCdromProgress : public pkgCdromStatus, public PyCallbackObj
{
// update steps, will be called regularly as a "pulse"
- virtual void Update(string text="", int current=0);
+ virtual void Update(std::string text="", int current=0);
// ask for cdrom insert
virtual bool ChangeCdrom();
// ask for cdrom name
- virtual bool AskCdromName(string &Name);
+ virtual bool AskCdromName(std::string &Name);
PyCdromProgress() : PyCallbackObj() {};
};
diff --git a/python/tag.cc b/python/tag.cc
index 94554400..3996af8e 100644
--- a/python/tag.cc
+++ b/python/tag.cc
@@ -26,6 +26,7 @@
#include "apt_pkgmodule.h"
#include <apt-pkg/tagfile.h>
+#include <apt-pkg/fileutl.h>
#include <stdio.h>
#include <iostream>
diff --git a/python/tarfile.cc b/python/tarfile.cc
index cdfe0a7c..bd903b57 100644
--- a/python/tarfile.cc
+++ b/python/tarfile.cc
@@ -348,7 +348,7 @@ static const char *tarfile_extractall_doc =
"can be used to change the target directory.";
static PyObject *tarfile_extractall(PyObject *self, PyObject *args)
{
- string cwd = SafeGetCWD();
+ std::string cwd = SafeGetCWD();
char *rootdir = 0;
if (PyArg_ParseTuple(args,"|s:extractall",&rootdir) == 0)
return 0;
diff --git a/tests/test_debfile.py b/tests/test_debfile.py
index 951c2afe..501b8f61 100644
--- a/tests/test_debfile.py
+++ b/tests/test_debfile.py
@@ -87,7 +87,7 @@ class TestDebfilee(unittest.TestCase):
self.assertEqual(deb["Maintainer"],
"Samuel Lidén Borell <samuel@slbdata.se>")
- def testContent(self):
+ def test_content(self):
# no python-debian for python3 yet, so fail gracefully
try:
import debian
@@ -130,6 +130,17 @@ Description: testpackage for gdebi - contains usr/bin/binary for file reading
# we need to support python2.6
self.assertTrue(raised)
+ def test_multiarch_deb(self):
+ print apt_pkg.get_architectures()
+ if apt_pkg.get_architectures() != ["amd64", "i386"]:
+ logging.warn("skipping test because running on a non-multiarch system")
+ return
+ deb = apt.debfile.DebPackage("./data/test_debs/multiarch-test1_i386.deb")
+ print deb.missing_deps()
+
+
+
+
if __name__ == "__main__":
#logging.basicConfig(level=logging.DEBUG)
unittest.main()