Michael Vogt пре 19 година
родитељ
комит
04b38410e8

+ 2 - 2
apt-pkg/cdrom.cc

@@ -668,8 +668,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log)
    DropRepeats(TransList,"");
    if(log) {
       msg.str("");
-      ioprintf(msg, _("Found %i package indexes, %i source indexes, "
-		      "%i translation indexes and %i signatures\n"), 
+      ioprintf(msg, _("Found %lu package indexes, %lu source indexes, "
+		      "%lu translation indexes and %lu signatures\n"), 
 	       List.size(), SourceList.size(), TransList.size(),
 	       SigList.size());
       log->Update(msg.str(), STEP_SCAN);

+ 2 - 5
apt-pkg/deb/dpkgpm.cc

@@ -44,8 +44,8 @@ using namespace std;
 // ---------------------------------------------------------------------
 /* */
 pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache) 
-   : pkgPackageManager(Cache), dpkgbuf_pos(0), PackagesTotal(0), 
-     PackagesDone(0), term_out(NULL)
+   : pkgPackageManager(Cache), dpkgbuf_pos(0), 
+     PackagesTotal(0), PackagesDone(0), term_out(NULL)
 {
 }
 									/*}}}*/
@@ -773,9 +773,6 @@ bool pkgDPkgPM::Go(int OutStatusFd)
       int _dpkgin = fd[0];
       close(fd[1]);                        // close the write end of the pipe
 
-      // the read buffers for the communication with dpkg
-      char buf[2] = {0,0};
-      
       // the result of the waitpid call
       int res;
       close(slave);

+ 3 - 3
apt-pkg/deb/dpkgpm.h

@@ -45,10 +45,10 @@ class pkgDPkgPM : public pkgPackageManager
    // the dpkg states that are already done; the string is the package
    // the int is the state that is already done (e.g. a package that is
    // going to be install is already in state "half-installed")
-   map<string,int> PackageOpsDone;
+   map<string,unsigned int> PackageOpsDone;
    // progress reporting
-   int PackagesDone;
-   int PackagesTotal;
+   unsigned int PackagesDone;
+   unsigned int PackagesTotal;
   
    struct Item
    {

+ 1 - 1
debian/control

@@ -16,7 +16,7 @@ Priority: important
 Replaces: libapt-pkg-doc (<< 0.3.7), libapt-pkg-dev (<< 0.3.7)
 Provides: ${libapt-pkg:provides}
 Recommends: ubuntu-keyring
-Suggests: aptitude | synaptic | gnome-apt | wajig, dpkg-dev, apt-doc, bzip2, gnupg, lzma
+Suggests: aptitude | synaptic | gnome-apt | wajig, dpkg-dev, apt-doc, bzip2, lzma, gnupg
 Section: admin
 Description: Advanced front-end for dpkg
  This is Debian's next generation front-end for the dpkg package manager.

+ 119 - 0
test/pre-upload-check.py

@@ -0,0 +1,119 @@
+#!/usr/bin/python
+
+import sys
+import os
+import glob
+import os.path
+from subprocess import call, PIPE
+
+import unittest
+
+stdout = os.open("/dev/null",0) #sys.stdout
+stderr = os.open("/dev/null",0) # sys.stderr
+
+class testAuthentication(unittest.TestCase):
+
+    # some class wide data
+    apt = "apt-get"
+    args = []  # ["-q", "-q", "-o","Debug::pkgAcquire::Auth=true"]
+    pkg = "libglib2.0-data"
+    pkgver = "2.13.6-1ubuntu1"
+    pkgpath = "/var/cache/apt/archives/libglib2.0-data_2.13.6-1ubuntu1_all.deb"
+
+    def setUp(self):
+        for f in glob.glob("testkeys/*,key"):
+            call(["apt-key", "add", f], stdout=stdout, stderr=stderr)
+
+    def _cleanup(self):
+        " make sure we get new lists and no i-m-s "
+        call(["rm","-f", "/var/lib/apt/lists/*"])
+        if os.path.exists(self.pkgpath):
+            os.unlink(self.pkgpath)
+
+    def _expectedRes(self, resultstr):
+        if resultstr == 'ok':
+            return 0
+        elif resultstr == 'broken':
+            return 100
+        
+
+    def testPackages(self):
+        for f in glob.glob("testsources.list/sources.list*package*"):
+            self._cleanup()
+            (prefix, testtype, result) = f.split("-")
+            expected_res = self._expectedRes(result)
+            # update first
+            call([self.apt,"update",
+                  "-o","Dir::Etc::sourcelist=./%s" % f]+self.args,
+                 stdout=stdout, stderr=stderr)
+            # then get the pkg
+            cmd = ["install", "-y", "-d", "--reinstall",
+                   "%s=%s" % (self.pkg, self.pkgver),
+                   "-o","Dir::state::Status=./fake-status"]
+            res = call([self.apt, "-o","Dir::Etc::sourcelist=./%s" % f]+cmd+self.args,
+                       stdout=stdout, stderr=stderr)
+            self.assert_(res == expected_res,
+                         "test '%s' failed (got %s expected %s" % (f,res,expected_res))
+            
+
+    def testGPG(self):
+        for f in glob.glob("testsources.list/sources.list*gpg*"):
+            self._cleanup()
+            (prefix, testtype, result) = f.split("-")
+            expected_res = self._expectedRes(result)
+            # update first
+            call([self.apt,"update",
+                  "-o","Dir::Etc::sourcelist=./%s" % f]+self.args,
+                 stdout=stdout, stderr=stderr)
+            # then get the pkg
+            cmd = ["install", "-y", "-d", "--reinstall",
+                   "%s=%s" % (self.pkg, self.pkgver),
+                   "-o","Dir::state::Status=./fake-status"]
+            res = call([self.apt, "-o","Dir::Etc::sourcelist=./%s" % f]+
+                       cmd+self.args,
+                       stdout=stdout, stderr=stderr)
+            self.assert_(res == expected_res,
+                         "test '%s' failed (got %s expected %s" % (f,res,expected_res))
+
+    def testRelease(self):
+        for f in glob.glob("testsources.list/sources.list*release*"):
+            self._cleanup()
+            (prefix, testtype, result) = f.split("-")
+            expected_res = self._expectedRes(result)
+            cmd = ["update"]
+            res = call([self.apt,"-o","Dir::Etc::sourcelist=./%s" % f]+cmd+self.args,
+                       stdout=stdout, stderr=stderr)
+            self.assert_(res == expected_res,
+                         "test '%s' failed (got %s expected %s" % (f,res,expected_res))
+
+
+class testPythonApt(unittest.TestCase):
+    " test if python-apt is still working and if we not accidently broke the ABI "
+    
+    def testPythonApt(self):
+        import apt
+        cache = apt.Cache()
+        cache.update()
+        pkg = cache["apt"]
+        self.assert_(pkg.name == 'apt')
+
+class testAptInstall(unittest.TestCase):
+    " test if installing still works "
+
+    apt = "apt-get"
+    pkg = "coreutils"
+
+    def testInstall(self):
+        res = call([self.apt,"-y","install","--reinstall",self.pkg],
+                   stdout=stdout, stderr=stderr)
+        self.assert_(res == 0,
+                     "installing %s failed (got %s)" % (self.pkg, res))
+
+if __name__ == "__main__":
+    print "Runing simple testsuit on current apt-get and libapt"
+    if len(sys.argv) > 1 and sys.argv[1] == "-v":
+        stdout = sys.stdout
+        stderr = sys.stderr
+    unittest.main()
+
+

Разлика између датотеке није приказан због своје велике величине
+ 1182 - 0
test/testkeys/mvo.key


+ 2 - 0
test/testsources.list/sources.list.all-gpg-broken

@@ -0,0 +1,2 @@
+deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/gpg-package-broken/ /
+

+ 2 - 0
test/testsources.list/sources.list.all-gpg-ok

@@ -0,0 +1,2 @@
+deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/gpg-package-ok/ /
+

+ 1 - 0
test/testsources.list/sources.list.all-release-broken

@@ -0,0 +1 @@
+deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/all-release-broken/ /

+ 1 - 0
test/testsources.list/sources.list.all-release-ok

@@ -0,0 +1 @@
+deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/all-release-ok/ /

+ 2 - 0
test/testsources.list/sources.list.md5-package-broken

@@ -0,0 +1,2 @@
+deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/md5-package-broken/ /
+

+ 2 - 0
test/testsources.list/sources.list.md5-package-ok

@@ -0,0 +1,2 @@
+deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/md5-package-ok/ /
+

+ 1 - 0
test/testsources.list/sources.list.md5-release-broken

@@ -0,0 +1 @@
+deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/md5-release-broken/ /

+ 1 - 0
test/testsources.list/sources.list.md5-release-ok

@@ -0,0 +1 @@
+deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/md5-release-ok/ /

+ 1 - 0
test/testsources.list/sources.list.sha1-release-broken

@@ -0,0 +1 @@
+deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/sha1-release-broken/ /

+ 1 - 0
test/testsources.list/sources.list.sha1-release-ok

@@ -0,0 +1 @@
+deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/sha1-release-ok/ /

+ 2 - 0
test/testsources.list/sources.list.sha256-package-broken

@@ -0,0 +1,2 @@
+deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/sha256-package-broken/ /
+

+ 2 - 0
test/testsources.list/sources.list.sha256-package-ok

@@ -0,0 +1,2 @@
+deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/sha256-package-ok/ /
+

+ 1 - 0
test/testsources.list/sources.list.sha256-release-broken

@@ -0,0 +1 @@
+deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/sha256-release-broken/ /

+ 1 - 0
test/testsources.list/sources.list.sha256-release-ok

@@ -0,0 +1 @@
+deb http://people.ubuntu.com/~mvo/apt/auth-test-suit/sha256-release-ok/ /