From 5177f8024b512f1dca86aaececc5fbc708948ad4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 9 Aug 2007 12:31:46 +0200 Subject: [PATCH] * apt-pkg/pkgcachegen.cc: - increase default mmap size * tests/local-repo: - added local repository testcase --- apt-pkg/acquire-item.cc | 3 -- apt-pkg/pkgcachegen.cc | 4 +- debian/changelog | 4 ++ test/local-repo/Packages | 11 +++++ test/local-repo/Packages.gz | Bin 0 -> 269 bytes test/local-repo/Packages.gz.save | Bin 0 -> 603 bytes test/local-repo/Release | 13 ++++++ test/local-repo/Release.gpg | 7 ++++ test/local-repo/gdebi-test4.deb | Bin 0 -> 2306 bytes test/pre-upload-check.py | 69 ++++++++++++++++++++++--------- 10 files changed, 86 insertions(+), 25 deletions(-) create mode 100644 test/local-repo/Packages create mode 100644 test/local-repo/Packages.gz create mode 100644 test/local-repo/Packages.gz.save create mode 100644 test/local-repo/Release create mode 100644 test/local-repo/Release.gpg create mode 100644 test/local-repo/gdebi-test4.deb diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index f3784a58b..32798335c 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -674,10 +674,7 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash, { // The files timestamp matches if (StringToBool(LookupTag(Message,"Alt-IMS-Hit"),false) == true) - { - unlink(FileName.c_str()); return; - } Decompression = true; Local = true; DestFile += ".decomp"; diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 4e186f466..d00cd4e64 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -781,7 +781,7 @@ static bool BuildCache(pkgCacheGenerator &Gen, bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress, MMap **OutMap,bool AllowMem) { - unsigned long MapSize = _config->FindI("APT::Cache-Limit",16*1024*1024); + unsigned long MapSize = _config->FindI("APT::Cache-Limit",24*1024*1024); vector Files; for (vector::const_iterator i = List.begin(); @@ -928,7 +928,7 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress, /* */ bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap) { - unsigned long MapSize = _config->FindI("APT::Cache-Limit",12*1024*1024); + unsigned long MapSize = _config->FindI("APT::Cache-Limit",20*1024*1024); vector Files; unsigned long EndOfSource = Files.size(); if (_system->AddStatusFiles(Files) == false) diff --git a/debian/changelog b/debian/changelog index c730f85b0..24663ffa9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,10 @@ apt (0.7.7) UNRELEASED; urgency=low * merged apt--sha256 branch to fully support the new sha256 checksums in the Packages and Release files (ABI break) + * apt-pkg/pkgcachegen.cc: + - increase default mmap size + * tests/local-repo: + - added local repository testcase -- Michael Vogt Thu, 02 Aug 2007 11:55:54 +0200 diff --git a/test/local-repo/Packages b/test/local-repo/Packages new file mode 100644 index 000000000..fe62fc038 --- /dev/null +++ b/test/local-repo/Packages @@ -0,0 +1,11 @@ +Package: gdebi-test4 +Architecture: all +Version: 1.0 +Conflicts: apt (<= 0.1) +Filename: ./gdebi-test4.deb +Size: 2306 +MD5sum: 0952a2b4a566215e0794c7603f3fcfcc +SHA1: 318688ea2d53352a1bdb669ebd2cd4847f6c4e7c +SHA256: 35f600b57253cef807a1da7c5deb06e7821de9223842a310a77b4da87cf51e2c +Description: testpackage for gdebi - Conflicts: apt (<= 0.1) + diff --git a/test/local-repo/Packages.gz b/test/local-repo/Packages.gz new file mode 100644 index 0000000000000000000000000000000000000000..b5d528435156080de573d436b302d3dd729fa17c GIT binary patch literal 269 zcmV+o0rLJIiwFpw=(E8RD?!EVbU*SXpKP8G~S81!7?N|IPm9Spcri5{1AGB^| zo(3*E!Jg+Sj|J=2w59U9$0sg2dCy+TNK-gBqtu4^MZmhZL)B`kY8nC)^NxabW8 zh&mW+K^hXS*XXQJS!K+K?D)Eu16R^p?RT*t)SOlvTNf5?>bb=t$reaG_7m4;o1aR=vMGYj3$h5iT*Lz0q&9aa55f? zOEnkII_-mx=3*pmf68v1-f3c6zJQMP!qpPjhG0gdwSEQ;aN>9>z~ zpV@^qZKq{;hd85r*Bu((ldS0L2d^JK;5^U}kwU>{W1E6}y)69Lub_^zRu-6Imhe2w z3z1tWtoaJ5gf}{7B!Ylu2deQDpju9CND9I^Qk>8$`vGe zs_MKfk;}A5+qe|6DJoT!Eha+LRa=*BshB39oT%*9{6hsq&-Z|-LB^{?B_Rm6av`#pgV^Di{<7(_)VvseU2pHuhvLZNAlU_oh5 psXIWA-qSS?+A!$2*^S4OrHj*TZs5vLO8h=z>={h{jXtIW008ArE201Z literal 0 HcmV?d00001 diff --git a/test/local-repo/Release b/test/local-repo/Release new file mode 100644 index 000000000..7f206ef25 --- /dev/null +++ b/test/local-repo/Release @@ -0,0 +1,13 @@ +Date: Thu, 09 Aug 2007 10:13:06 UTC +MD5Sum: + 29f79161fafe1f0c393e7fc6ddcb99b5 338 Packages + 2f885b2ebdb77d3354ba63d8b5aad614 269 Packages.gz + d41d8cd98f00b204e9800998ecf8427e 0 Release +SHA1: + d8860d409a8b0db443fbf254e2d6afbfc9bc04a8 338 Packages + 8b668a7b730ceb4d702737a13a723959c20b67df 269 Packages.gz + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 Release +SHA256: + 39aa9fc59d868a71030d24aeaa4b574d7a11a10ea79491a0881f8d755b36a06d 338 Packages + 62898623498ebf8304647db1ba2d33e4d8ec0e3e45250c2b66907c812b099297 269 Packages.gz + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 Release diff --git a/test/local-repo/Release.gpg b/test/local-repo/Release.gpg new file mode 100644 index 000000000..e1c309566 --- /dev/null +++ b/test/local-repo/Release.gpg @@ -0,0 +1,7 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.6 (GNU/Linux) + +iD8DBQBGuui6liSD4VZixzQRApSlAJ9D6G1QXvtXH1jH1I4SStsb1VsImQCbBPfp ++1p0bDANcBVY+GckjJvFRkY= +=a0AR +-----END PGP SIGNATURE----- diff --git a/test/local-repo/gdebi-test4.deb b/test/local-repo/gdebi-test4.deb new file mode 100644 index 0000000000000000000000000000000000000000..9eb92d1b4dd644ce7a25348af15f2a9121953505 GIT binary patch literal 2306 zcmah~X*d*$8lI5Ga3mp18B3PJSQEx}T}}2SW@JfbEQO3LB??81t-)AhY{?SMFjJ9X z?2KKSgzQ_k?2avFZqGUQp6A?O=Y78C{g&r>f4uLXPh1=6?|N4kgO*JtwrCF8#rAB1@mXWVFWGrk!YFRU)05Ek+b-kSo>`P2n8T z5rPrVcfz|n7it|D{)GZ1@A@(W=KB`=e>Wi!SE_u3Zw0Ic`H0FCG8!)#gJV-gns>&> zESXH(8WIvG*dDdrKQPhLfMR6n1-M_nCVZf{R#Qz2yYDDGF;;#%-t;q{B19Totl;-1 z9&`7!Gd|6x$Msl4AQAa3al)jl-+mDtWJ#HWZ_eRfgrz4AZWkT+<9EfK*XUVj1-U<+ z{EhbsK|2p6-2t)y0LTp)i2N&}U;h6oWo3=4nt#UR0{UA@gF#j)o}#BV#C{+CfG0nl zGQ!WwN=%z$B2_6AqqH(0-ZSQ@l)ja!zF0&vL_&fEmLw4xKy)dEH35wptx!PxTZz&y zjRxtwS<>qTP)Coo-N1!*Io0)r#J%8&t)9B=pE}#2Jc!Cf?we6G)FjqOTVQ{FUs8}) zztB&Ei@k9MkvD5sqNE|P3%;*4!xzPkX<>;p@MJF6?opX~QI!T_ShgE_Axt~RpWesU zXObEg^@LBdCIQ$nQB5aGnc#7CC`d=_QOWMID6rs@{2OsKkPa_5Ml$&>A8$Ol-JxX~ za6|wTJAw$$Ta-7z$seqN`cSddhjF4IEF=drL#r=8hYCL}=6w~B@;=^BEwe$bF+5x% z+3op)o2(8$VvdzMp*BU<{8L`sX`=FE;@hMmE%5#=R9)E7K``QHA?Y#0BqSMa4VB)*>>PqFG0z%sz3??xOYyD2QsYPiAyKwoLVd;zl}9?tGW2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z?rX*En zE@8m;2XQr(T;~`%H^9%yR-VZk&^CZZZSZuf9Xh95A{Wj|nfA@K$|KwxI;BC%)$*J6PWLs)S zzl)SfZ+Sk|cmQam&I;`fdYbd|oBiVqj)tXHT4@t(5EMVr4q#(>rZ2_={J+*g+X)ib KRrLMiC;tbP2vD5> literal 0 HcmV?d00001 diff --git a/test/pre-upload-check.py b/test/pre-upload-check.py index 837a25023..8131d891e 100755 --- a/test/pre-upload-check.py +++ b/test/pre-upload-check.py @@ -11,11 +11,13 @@ import unittest stdout = os.open("/dev/null",0) #sys.stdout stderr = os.open("/dev/null",0) # sys.stderr +apt_args = [] # ["-o","Debug::pkgAcquire::Auth=true"] + + 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" @@ -44,13 +46,13 @@ class testAuthentication(unittest.TestCase): expected_res = self._expectedRes(result) # update first call([self.apt,"update", - "-o","Dir::Etc::sourcelist=./%s" % f]+self.args, + "-o","Dir::Etc::sourcelist=./%s" % f]+apt_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, + res = call([self.apt, "-o","Dir::Etc::sourcelist=./%s" % f]+cmd+apt_args, stdout=stdout, stderr=stderr) self.assert_(res == expected_res, "test '%s' failed (got %s expected %s" % (f,res,expected_res)) @@ -63,14 +65,14 @@ class testAuthentication(unittest.TestCase): expected_res = self._expectedRes(result) # update first call([self.apt,"update", - "-o","Dir::Etc::sourcelist=./%s" % f]+self.args, + "-o","Dir::Etc::sourcelist=./%s" % f]+apt_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, + cmd+apt_args, stdout=stdout, stderr=stderr) self.assert_(res == expected_res, "test '%s' failed (got %s expected %s" % (f,res,expected_res)) @@ -81,33 +83,60 @@ class testAuthentication(unittest.TestCase): (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, + res = call([self.apt,"-o","Dir::Etc::sourcelist=./%s" % f]+cmd+apt_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 " +class testLocalRepositories(unittest.TestCase): + " test local repository regressions " + repo_dir = "local-repo" apt = "apt-get" - pkg = "coreutils" + pkg = "gdebi-test4" - def testInstall(self): - res = call([self.apt,"-y","install","--reinstall",self.pkg], + def setUp(self): + self.repo = os.path.abspath(os.path.join(os.getcwd(), self.repo_dir)) + self.sources = os.path.join(self.repo, "sources.list") + s = open(self.sources,"w") + s.write("deb file://%s/ /\n" % self.repo) + s.close() + + def testLocalRepoAuth(self): + # two times to get at least one i-m-s hit + for i in range(2): + self.assert_(os.path.exists(self.sources)) + cmd = [self.apt,"update","-o", "Dir::Etc::sourcelist=%s" % self.sources]+apt_args + res = call(cmd, stdout=stdout, stderr=stderr) + self.assertEqual(res, 0, "local repo test failed") + self.assert_(os.path.exists(os.path.join(self.repo,"Packages.gz")), + "Packages.gz vanished from local repo") + + def testInstallFromLocalRepo(self): + apt = [self.apt,"-o", "Dir::Etc::sourcelist=%s"% self.sources]+apt_args + cmd = apt+["update"] + res = call(cmd, stdout=stdout, stderr=stderr) + self.assertEqual(res, 0) + res = call(apt+["-y","install","--reinstall",self.pkg], stdout=stdout, stderr=stderr) self.assert_(res == 0, "installing %s failed (got %s)" % (self.pkg, res)) + res = call(apt+["-y","remove",self.pkg], + stdout=stdout, stderr=stderr) + self.assert_(res == 0, + "removing %s failed (got %s)" % (self.pkg, res)) + + def testPythonAptInLocalRepo(self): + import apt, apt_pkg + apt_pkg.Config.Set("Dir::Etc::sourcelist",self.sources) + cache = apt.Cache() + cache.update() + pkg = cache["apt"] + self.assert_(pkg.name == 'apt') + + if __name__ == "__main__": print "Runing simple testsuit on current apt-get and libapt" -- 2.50.0