summaryrefslogtreecommitdiff
path: root/src/cmdline/cmdline_util.h
diff options
context:
space:
mode:
authorDaniel Hartwig <mandyke@gmail.com>2012-06-08 17:11:48 +0800
committerDaniel Hartwig <mandyke@gmail.com>2012-06-08 17:11:48 +0800
commit24e4c8dab029ac59437f9392a8d3732c6893a3e3 (patch)
tree65da6aa7aef3c16ac40b3c5a4536a025172d8272 /src/cmdline/cmdline_util.h
parent85d6f30683f6ede36e7a6a0e78e6e7efa079e056 (diff)
downloadaptitude-24e4c8dab029ac59437f9392a8d3732c6893a3e3.tar.gz
Add pkgset helpers
Ported some code from apt cacheset.cc to populate a pkgset. The function pkgset_from_string will fill a given pkgset with either the exactly named package, or the packages matched by a string predicated by is_pattern. In the future, we should look to directly use the apt cacheset infrastructure. This is currently blocked by our custom implementation of pkgCacheFile (see aptcache.h). Errors that occur in looking up the package (such as no package with that name, or an invalid search pattern) are pushed to the global error list with a customizable error_type (default: ERROR).
Diffstat (limited to 'src/cmdline/cmdline_util.h')
-rw-r--r--src/cmdline/cmdline_util.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/cmdline/cmdline_util.h b/src/cmdline/cmdline_util.h
index 9b88c393..b87daa1d 100644
--- a/src/cmdline/cmdline_util.h
+++ b/src/cmdline/cmdline_util.h
@@ -431,6 +431,26 @@ namespace aptitude
return std::wstring();
}
};
+
+ /** \brief Fill a pkgset using the given matching pattern.
+ *
+ * This does not try any string as a search pattern, only those
+ * which contain explicit search terms or regex characters.
+ */
+ bool pkgset_from_pattern(pkgset *packages, const string &pattern,
+ GlobalError::MsgType error_type = GlobalError::ERROR);
+
+ /** \brief Fill a pkgset using the given string. If the
+ * string names exactly a package then insert that package,
+ * otherwise, if the string is a search pattern, add all matching
+ * packages.
+ *
+ * Based on cacheset.cc(PackageContainerInterface::FromString).
+ * TODO: Should be replaced with cacheset functions once we have
+ * become more compatible with them.
+ */
+ bool pkgset_from_string(pkgset *packages, const string &str,
+ GlobalError::MsgType error_type = GlobalError::ERROR);
}
}