diff options
| author | Julian Andres Klode <jak@debian.org> | 2022-05-06 16:20:52 +0000 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2022-05-06 16:20:52 +0000 |
| commit | 97f16727b50dcaa4810e80d3c16639e0ce6a0958 (patch) | |
| tree | 1228c44118015b13b2f94177571c6780eb861a7e /cmdline | |
| parent | 6778e2d672d84c962a578f6de415c666b9cf6ee1 (diff) | |
| parent | 05fae6fae95d8ef6690f3d56863e3bb6a44d424c (diff) | |
Merge branch 'fix/tagfilekeys' into 'main'
Consistently dealing with fields via pkgTagSection::Key
See merge request apt-team/apt!233
Diffstat (limited to 'cmdline')
| -rw-r--r-- | cmdline/apt-extracttemplates.cc | 9 | ||||
| -rw-r--r-- | cmdline/apt-sortpkgs.cc | 7 |
2 files changed, 9 insertions, 7 deletions
diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc index 01b5dbb11..88a204110 100644 --- a/cmdline/apt-extracttemplates.cc +++ b/cmdline/apt-extracttemplates.cc @@ -28,6 +28,7 @@ #include <apt-pkg/pkgsystem.h> #include <apt-pkg/sourcelist.h> #include <apt-pkg/strutl.h> +#include <apt-pkg/tagfile-keys.h> #include <apt-pkg/tagfile.h> #include <apt-pkg/version.h> @@ -170,11 +171,11 @@ bool DebFile::ParseInfo() if (Section.Scan(Control, ControlLen) == false) return false; - Package = Section.FindS("Package"); + Package = Section.Find(pkgTagSection::Key::Package).to_string(); Version = GetInstalledVer(Package); const char *Start, *Stop; - if (Section.Find("Depends", Start, Stop) == true) + if (Section.Find(pkgTagSection::Key::Depends, Start, Stop)) { while (1) { @@ -191,8 +192,8 @@ bool DebFile::ParseInfo() if (Start == Stop) break; } } - - if (Section.Find("Pre-Depends", Start, Stop) == true) + + if (Section.Find(pkgTagSection::Key::Pre_Depends, Start, Stop)) { while (1) { diff --git a/cmdline/apt-sortpkgs.cc b/cmdline/apt-sortpkgs.cc index da451708f..519825457 100644 --- a/cmdline/apt-sortpkgs.cc +++ b/cmdline/apt-sortpkgs.cc @@ -20,6 +20,7 @@ #include <apt-pkg/init.h> #include <apt-pkg/pkgsystem.h> #include <apt-pkg/strutl.h> +#include <apt-pkg/tagfile-keys.h> #include <apt-pkg/tagfile.h> #include <apt-private/private-cmndline.h> @@ -85,9 +86,9 @@ static bool DoIt(string InFile) /* Fetch the name, auto-detecting if this is a source file or a package file */ - Tmp.Name = Section.FindS("Package"); - Tmp.Ver = Section.FindS("Version"); - Tmp.Arch = Section.FindS("Architecture"); + Tmp.Name = Section.Find(pkgTagSection::Key::Package).to_string(); + Tmp.Ver = Section.Find(pkgTagSection::Key::Version).to_string(); + Tmp.Arch = Section.Find(pkgTagSection::Key::Architecture).to_string(); if (Tmp.Name.empty() == true) return _error->Error(_("Unknown package record!")); |
