]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/cacheset.cc
Allow passing a full path to apt-get install /foo/bar.deb
[apt.git] / apt-pkg / cacheset.cc
index 5d7f2851525f2e59c988b5de2f9211b78337e698..346bad3aaa3a587f0fc6b0202be534a4e8e76929 100644 (file)
@@ -24,6 +24,7 @@
 #include <apt-pkg/depcache.h>
 #include <apt-pkg/macros.h>
 #include <apt-pkg/pkgcache.h>
+#include <apt-pkg/fileutl.h>
 
 #include <stddef.h>
 #include <stdio.h>
@@ -445,6 +446,13 @@ bool VersionContainerInterface::FromString(VersionContainerInterface * const vci
                                           pkgCacheFile &Cache, std::string pkg,
                                           Version const &fallback, CacheSetHelper &helper,
                                           bool const onlyFromName) {
+        PackageSet pkgset;
+        if(FileExists(pkg))
+        {
+                PackageContainerInterface::FromString(&pkgset, Cache, pkg, helper);
+                return VersionContainerInterface::FromPackage(vci, Cache, pkgset.begin(), fallback, helper);
+        }
+
        std::string ver;
        bool verIsRel = false;
        size_t const vertag = pkg.find_last_of("/=");
@@ -453,7 +461,6 @@ bool VersionContainerInterface::FromString(VersionContainerInterface * const vci
                verIsRel = (pkg[vertag] == '/');
                pkg.erase(vertag);
        }
-       PackageSet pkgset;
        if (onlyFromName == false)
                PackageContainerInterface::FromString(&pkgset, Cache, pkg, helper);
        else {