diff options
| author | Julian Andres Klode <jak@debian.org> | 2024-02-13 15:30:21 +0000 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2024-02-13 15:30:21 +0000 |
| commit | 3749cda6af91e495650018bae39185c2589c9bd7 (patch) | |
| tree | fe7dfd0ab95faafa015de14cd7e3de948e53f853 /apt-pkg/pkgcache.cc | |
| parent | 26e0e9b76fb06afe5250eeb8e5b3d069d4793432 (diff) | |
| parent | 1a0882558da05eaf471c2b4049ae27305e7c70ec (diff) | |
Merge branch 'phasing-api' into 'main'
Add public phased update API and separate message list
See merge request apt-team/apt!327
Diffstat (limited to 'apt-pkg/pkgcache.cc')
| -rw-r--r-- | apt-pkg/pkgcache.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 76336b9b3..06689aa33 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -1017,5 +1017,30 @@ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const } /*}}}*/ +// VerIterator::IsSecurity - check if it is a security update /*{{{*/ +// See if this version is a security update. This also checks, for installed packages, +// if any of the previous versions is a security update +bool pkgCache::VerIterator::IsSecurityUpdate() const +{ + auto Pkg = ParentPkg(); + auto Installed = Pkg.CurrentVer(); + + auto OtherVer = Pkg.VersionList(); + + // Advance to first version < our version + while (OtherVer->ID != S->ID) + ++OtherVer; + + // Iterate over all versions < our version + for (; !OtherVer.end() && (Installed.end() || OtherVer->ID != Installed->ID); OtherVer++) + { + for (auto PF = OtherVer.FileList(); !PF.end(); PF++) + if (PF.File() && PF.File().Archive() != nullptr && APT::String::Endswith(PF.File().Archive(), "-security")) + return true; + } + return false; +} + + /*}}}*/ pkgCache::~pkgCache() {} |
