소스 검색

support regex and co in 'apt-cache policy $pkg' again

Regression of 1e064088bf7b3e29cd36d30760fb3e4143a1a49a (1.1~exp4) which
moved code around and renamed methods heavily ending up calling the
wrong method matching packagenames only instead of calling the full
array. Most commands work with versions, so this managed to fly under
the radar for quite a while.

Closes: 807870
David Kalnischkies 10 년 전
부모
커밋
27e4c1664a
2개의 변경된 파일10개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      apt-pkg/cacheset.cc
  2. 9 0
      test/integration/test-policy-pinning

+ 1 - 1
apt-pkg/cacheset.cc

@@ -336,7 +336,7 @@ bool CacheSetHelper::PackageFromString(PackageContainerInterface * const pci, pk
 bool CacheSetHelper::PackageFromCommandLine(PackageContainerInterface * const pci, pkgCacheFile &Cache, const char **cmdline) {
 	bool found = false;
 	for (const char **I = cmdline; *I != 0; ++I)
-		found |= PackageFrom(CacheSetHelper::PACKAGENAME, pci, Cache, *I);
+		found |= PackageFrom(CacheSetHelper::STRING, pci, Cache, *I);
 	return found;
 }
 									/*}}}*/

+ 9 - 0
test/integration/test-policy-pinning

@@ -83,6 +83,15 @@ buildsimplenativepackage "coolstuff" "all" "2.0~bpo1" "backports"
 
 setupaptarchive
 
+testsuccessequal "coolstuff:
+  Installed: (none)
+  Candidate: 2.0~bpo1
+  Version table:
+     2.0~bpo1 500
+        500 file:${APTARCHIVE} backports/main all Packages
+     1.0 500
+        500 file:${APTARCHIVE} stable/main all Packages" apt policy '^cool.*'
+
 testequalpolicycoolstuff() {
 	local INSTALLED="${1:-(none)}"
 	local CANDIDATE="${2:-(none)}"