You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

deblistparser.cc 32 KiB

* merged changes from the conference Patches applied: * apt@arch.ubuntu.com/apt--experimental--0.6--base-0 tag of apt@arch.ubuntu.com/apt--MAIN--0--patch-1190 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-1 Creation of branch v0_6 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-2 Creation of branch v0_6 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-3 Creation of branch v0_6 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-4 Creation of branch v0_6 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-5 Creation of branch v0_6 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-6 Creation of branch v0_6 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-7 Merge working copy of v0.6 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-8 0.6.0 is headed for experimental, not unstable * apt@arch.ubuntu.com/apt--experimental--0.6--patch-9 Date * apt@arch.ubuntu.com/apt--experimental--0.6--patch-10 Update LIB_APT_PKG_MAJOR * apt@arch.ubuntu.com/apt--experimental--0.6--patch-11 - Fix a heap corruption bug in pkgSrcRecords::pkgSrcRec... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-12 Resynch * apt@arch.ubuntu.com/apt--experimental--0.6--patch-13 * Merge apt 0.5.17 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-14 * Rearrange Release file authentication code to be more... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-15 * Convert distribution "../project/experimental" to "ex... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-16 Merge 1.11 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-17 Merge 1.7 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-18 Merge 1.10 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-19 * Make a number of Release file errors into warnings; f... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-20 * Add space between package names when multiple unauthe... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-21 * Provide apt-key with a secret keyring and a trustdb, ... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-22 * Fix typo in apt-key(8) (standard input is '-', not '/') * apt@arch.ubuntu.com/apt--experimental--0.6--patch-23 0.6.2 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-24 Resynch * apt@arch.ubuntu.com/apt--experimental--0.6--patch-25 * Fix MetaIndexURI for flat ("foo/") sources * apt@arch.ubuntu.com/apt--experimental--0.6--patch-26 0.6.3 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-27 * Use the top-level Release file in LoadReleaseInfo, ra... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-28 0.6.4 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-29 Clarify * apt@arch.ubuntu.com/apt--experimental--0.6--patch-30 * Move the authentication check into a separate functio... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-31 * Fix display of unauthenticated packages when they are... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-32 * Move the authentication check into a separate functio... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-33 * Restore the ugly hack I removed from indexRecords::Lo... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-34 0.6.6 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-35 * Forgot to revert part of the changes to tagfile in 0.... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-36 * Add a config option and corresponding command line option * apt@arch.ubuntu.com/apt--experimental--0.6--patch-37 0.6.8 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-38 hopefully avoid more segfaults * apt@arch.ubuntu.com/apt--experimental--0.6--patch-39 XXX * apt@arch.ubuntu.com/apt--experimental--0.6--patch-40 * Another tagfile workaround * apt@arch.ubuntu.com/apt--experimental--0.6--patch-41 * Use "Codename" (woody, sarge, etc.) to supply the val... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-42 * Support IMS requests of Release.gpg and Release * apt@arch.ubuntu.com/apt--experimental--0.6--patch-43 * Have pkgAcquireIndex calculate an MD5 sum if one is n... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-44 * Merge 0.5.18 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-45 apt (0.6.13) experimental; urgency=low * apt@arch.ubuntu.com/apt--experimental--0.6--patch-46 0.6.13 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-47 Merge 0.5.20 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-48 The source list works a bit differently in 0.6; fix the... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-49 * s/Debug::Acquire::gpg/&v/ * apt@arch.ubuntu.com/apt--experimental--0.6--patch-50 * Honor the [vendor] syntax in sources.list again (thou... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-51 * Don't ship vendors.list(5) since it isn't used yet * apt@arch.ubuntu.com/apt--experimental--0.6--patch-52 * Revert change from 0.6.10; it was right in the first ... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-53 * Fix some cases where the .gpg file could be left in p... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-54 Print a warning if gnupg is not installed * apt@arch.ubuntu.com/apt--experimental--0.6--patch-55 * Handle more IMS stuff correctly * apt@arch.ubuntu.com/apt--experimental--0.6--patch-56 0.6.17 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-57 * Merge 0.5.21 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-58 * Add new Debian Archive Automatic Signing Key to the d... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-59 0.6.18 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-60 * Merge 0.5.22 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-61 * Convert apt-key(8) to docbook XML * apt@arch.ubuntu.com/apt--experimental--0.6--patch-62 Merge 0.5.23 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-63 Remove bogus partial 0.5.22 changelog entry * apt@arch.ubuntu.com/apt--experimental--0.6--patch-64 Make the auth warning a bit less redundant * apt@arch.ubuntu.com/apt--experimental--0.6--patch-65 * Merge 0.5.24 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-66 * Make the unauthenticated packages prompt more intuiti... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-67 Merge 0.5.25 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-68 * Remove obsolete pkgIterator::TargetVer() (Closes: #230159) * apt@arch.ubuntu.com/apt--experimental--0.6--patch-69 * Reverse test in CheckAuth to match new prompt (Closes... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-70 Update version * apt@arch.ubuntu.com/apt--experimental--0.6--patch-71 Fix backwards sense of CheckAuth prompt * apt@arch.ubuntu.com/apt--experimental--0.6--patch-72 0.6.24 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-73 Close bug * apt@arch.ubuntu.com/apt--experimental--0.6--patch-74 * Fix handling of two-part sources for sources.list deb... * apt@arch.ubuntu.com/apt--experimental--0.6--patch-75 0.6.25 * apt@packages.debian.org/apt--authentication--0--base-0 tag of apt@arch.ubuntu.com/apt--experimental--0.6--patch-75 * apt@packages.debian.org/apt--authentication--0--patch-1 Michael Vogt's merge of apt--experimental--0 onto apt--main--0 * apt@packages.debian.org/apt--authentication--0--patch-2 Merge from apt--main--0 * apt@packages.debian.org/apt--authentication--0--patch-3 Merge from main * apt@packages.debian.org/apt--authentication--0--patch-4 Merge from main * apt@packages.debian.org/apt--authentication--0--patch-5 Update version number in configure.in * apt@packages.debian.org/apt--authentication--0--patch-6 Merge from main * apt@packages.debian.org/apt--authentication--0--patch-7 Merge from main * apt@packages.debian.org/apt--authentication--0--patch-8 Merge from mvo's branch * apt@packages.debian.org/apt--authentication--0--patch-9 Merge from mvo's tree * apt@packages.debian.org/apt--authentication--0--patch-10 Merge from mvo * apt@packages.debian.org/apt--authentication--0--patch-11 Fix permissions AGAIN * apt@packages.debian.org/apt--bzip2-debs--0--base-0 tag of apt@packages.debian.org/apt--main--0--patch-30 * apt@packages.debian.org/apt--bzip2-debs--0--patch-1 Create baz branch * apt@packages.debian.org/apt--bzip2-debs--0--patch-2 Implement data.tar.bz2 support * apt@packages.debian.org/apt--main--0--patch-30 Fix changelog * apt@packages.debian.org/apt--main--0--patch-31 Fix permissions again * apt@packages.debian.org/apt--main--0--patch-32 Fix permissions again * apt@packages.debian.org/apt--main--0--patch-33 Use baz instead of tla * apt@packages.debian.org/apt--main--0--patch-34 Merge bzip2-debs branch * apt@packages.debian.org/apt--main--0--patch-35 Fix changelog * apt@packages.debian.org/apt--main--0--patch-36 untagged-source precious * apt@packages.debian.org/apt--main--0--patch-37 Add .arch-inventory files * apt@packages.debian.org/apt--main--0--patch-38 Fix permissions again * apt@packages.debian.org/apt--main--0--patch-39 Merge apt--authentication--0 * apt@packages.debian.org/apt--main--0--patch-40 Merge misc-abi-changes * apt@packages.debian.org/apt--main--0--patch-41 Merge from mvo * apt@packages.debian.org/apt--misc-abi-changes--0--base-0 tag of apt@packages.debian.org/apt--main--0--patch-16 * apt@packages.debian.org/apt--misc-abi-changes--0--patch-1 Fix apt-get -s remove to not display the candidate version * apt@packages.debian.org/apt--misc-abi-changes--0--patch-2 Merge from main * apt@packages.debian.org/apt--misc-abi-changes--0--patch-3 Use pid_t throughout to hold process IDs * michael.vogt@canonical.com--2004--laptop/apt--authentication-mvo--0--base-0 tag of michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-12 * michael.vogt@canonical.com--2004--laptop/apt--authentication-mvo--0--patch-1 * star-merged matt's changes (bz2 support for data-members in debs) * michael.vogt@canonical.com--2004--laptop/apt--authentication-mvo--0--patch-2 * ignore errors when a Packages.bz2/Sources.bz2 can't be found and try with Packages.gz/Sources.gz again * michael.vogt@canonical.com--2004--laptop/apt--mvo--0--base-0 tag of apt@packages.debian.org/apt--main--0--patch-34 * michael.vogt@canonical.com--2004--laptop/apt--mvo--0--patch-1 * merged matt's tree (with all those apt-authentication changes) * michael.vogt@canonical.com--2004--laptop/apt--mvo--0--patch-2 don't display a error if a bzip2 package can not be downloaded, just ignore (Ign) it * michael.vogt@canonical.com--2004--laptop/apt--mvo--0--patch-3 * "chmod 755 cmdline/apt-key", changed version to 0.6.27ubuntu1 * michael.vogt@canonical.com--2004--laptop/apt--mvo--0--patch-4 * fix for a stupid merge error (from 0.5->0.6) * michael.vogt@canonical.com--2004--laptop/apt--mvo--0--patch-5 * unstable should really be hoary * michael.vogt@canonical.com--2004--laptop/apt--mvo--0--patch-6 * stronger dependencies for libapt-pkg-dev (depends on the source version of apt and apt-watch now) * michael.vogt@canonical.com--2004--laptop/apt--mvo--0--patch-7 * distro really should be hoary, not unstable :/ * michael.vogt@canonical.com--2004--laptop/apt--mvo--0--patch-8 * documented the "--allow-unauthenticated" switch * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-1 tag of apt@packages.debian.org/apt--authentication--0--base-0 * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-2 merged "tla apply-delta -A foo@ apt@arch.ubuntu.com/apt--MAIN--0--patch-1190 apt@arch.ubuntu.com/apt--MAIN--0--patch-1343" and cleaned up conflicts * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-3 * missing bits from the merge added * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-4 * star-merged with apt@packages.debian.org/apt--main--0 * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-5 * tree-synced to the apt--authentication tree * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-6 * use the ubuntu-key in this version * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-7 * imported the patches from mdz * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-8 * apt-get update --print-uris works now as before (fallback to 0.5.x behaviour) * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-9 * fix for the "if any source unauthenticated, all other sources are unauthenticated too" problem * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-10 * reworked the "--print-uris" patch. it no longer uses: "APT::Get::Print-URIs" in the library * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-11 * version of the library set to 3.6 * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-12 * changelog finallized, will upload to people.ubuntulinux.org/~mvo/apt-authentication * michael.vogt@canonical.com--2004/apt--main-authentication--0--base-0 tag of apt@packages.debian.org/apt--main--0--patch-22 * michael.vogt@canonical.com--2004/apt--main-authentication--0--patch-1 * star-merge from apt--experimental--0.6 * michael.vogt@canonical.com--2004/apt--main-authentication--0--patch-2 * compile failure fix for methods/http.cc, po-file fixes
17 years ago
implement dpkgs vision of interpreting pkg:<arch> dependencies How the Multi-Arch field and pkg:<arch> dependencies interact was discussed at DebConf15 in the "MultiArch BoF". dpkg and apt (among other tools like dose) had a different interpretation in certain scenarios which we resolved by agreeing on dpkg view – and this commit realizes this agreement in code. As was the case so far libapt sticks to the idea of trying to hide MultiArch as much as possible from individual frontends and instead translates it to good old SingleArch. There are certainly situations which can be improved in frontends if they know that MultiArch is upon them, but these are improvements – not necessary changes needed to unbreak a frontend. The implementation idea is simple: If we parse a dependency on foo:amd64 the dependency is formed on a package 'foo:amd64' of arch 'any'. This package is provided by package 'foo' of arch 'amd64', but not by 'foo' of arch 'i386'. Both of those foo packages provide each other through (assuming foo is M-A:foreign) to allow a dependency on 'foo' to be satisfied by either foo of amd64 or i386. Packages can also declare to provide 'foo:amd64' which is translated to providing 'foo:amd64:any' as well. This indirection over provides was chosen as the alternative would be to teach dependency resolvers how to deal with architecture specific dependencies – which violates the design idea of avoiding resolver changes, especially as architecture-specific dependencies are a cornercase with quite a few subtil rules. Handling it all over versioned provides as we already did for M-A in general seems much simpler as it just works for them. This switch to :any has actually a "surprising" benefit as well: Even frontends showing a package name via .Name() [which doesn't show the architecture] will display the "architecture" for dependencies in which it was explicitely requested, while we will not show the 'strange' :any arch in FullName(true) [= pretty-print] either. Before you had to specialcase these and by default you wouldn't get these details shown. The only identifiable disadvantage is that this complicates error reporting and handling. apt-get's ShowBroken has existing problems with virtual packages [it just shows the name without any reason], so that has to be worked on eventually. The other case is that detecting if a package is completely unknown or if it was at least referenced somewhere needs to acount for this "split" – not that it makes a practical difference which error is shown… but its one of the improvements possible.
6 years ago
implement dpkgs vision of interpreting pkg:<arch> dependencies How the Multi-Arch field and pkg:<arch> dependencies interact was discussed at DebConf15 in the "MultiArch BoF". dpkg and apt (among other tools like dose) had a different interpretation in certain scenarios which we resolved by agreeing on dpkg view – and this commit realizes this agreement in code. As was the case so far libapt sticks to the idea of trying to hide MultiArch as much as possible from individual frontends and instead translates it to good old SingleArch. There are certainly situations which can be improved in frontends if they know that MultiArch is upon them, but these are improvements – not necessary changes needed to unbreak a frontend. The implementation idea is simple: If we parse a dependency on foo:amd64 the dependency is formed on a package 'foo:amd64' of arch 'any'. This package is provided by package 'foo' of arch 'amd64', but not by 'foo' of arch 'i386'. Both of those foo packages provide each other through (assuming foo is M-A:foreign) to allow a dependency on 'foo' to be satisfied by either foo of amd64 or i386. Packages can also declare to provide 'foo:amd64' which is translated to providing 'foo:amd64:any' as well. This indirection over provides was chosen as the alternative would be to teach dependency resolvers how to deal with architecture specific dependencies – which violates the design idea of avoiding resolver changes, especially as architecture-specific dependencies are a cornercase with quite a few subtil rules. Handling it all over versioned provides as we already did for M-A in general seems much simpler as it just works for them. This switch to :any has actually a "surprising" benefit as well: Even frontends showing a package name via .Name() [which doesn't show the architecture] will display the "architecture" for dependencies in which it was explicitely requested, while we will not show the 'strange' :any arch in FullName(true) [= pretty-print] either. Before you had to specialcase these and by default you wouldn't get these details shown. The only identifiable disadvantage is that this complicates error reporting and handling. apt-get's ShowBroken has existing problems with virtual packages [it just shows the name without any reason], so that has to be worked on eventually. The other case is that detecting if a package is completely unknown or if it was at least referenced somewhere needs to acount for this "split" – not that it makes a practical difference which error is shown… but its one of the improvements possible.
6 years ago
implement dpkgs vision of interpreting pkg:<arch> dependencies How the Multi-Arch field and pkg:<arch> dependencies interact was discussed at DebConf15 in the "MultiArch BoF". dpkg and apt (among other tools like dose) had a different interpretation in certain scenarios which we resolved by agreeing on dpkg view – and this commit realizes this agreement in code. As was the case so far libapt sticks to the idea of trying to hide MultiArch as much as possible from individual frontends and instead translates it to good old SingleArch. There are certainly situations which can be improved in frontends if they know that MultiArch is upon them, but these are improvements – not necessary changes needed to unbreak a frontend. The implementation idea is simple: If we parse a dependency on foo:amd64 the dependency is formed on a package 'foo:amd64' of arch 'any'. This package is provided by package 'foo' of arch 'amd64', but not by 'foo' of arch 'i386'. Both of those foo packages provide each other through (assuming foo is M-A:foreign) to allow a dependency on 'foo' to be satisfied by either foo of amd64 or i386. Packages can also declare to provide 'foo:amd64' which is translated to providing 'foo:amd64:any' as well. This indirection over provides was chosen as the alternative would be to teach dependency resolvers how to deal with architecture specific dependencies – which violates the design idea of avoiding resolver changes, especially as architecture-specific dependencies are a cornercase with quite a few subtil rules. Handling it all over versioned provides as we already did for M-A in general seems much simpler as it just works for them. This switch to :any has actually a "surprising" benefit as well: Even frontends showing a package name via .Name() [which doesn't show the architecture] will display the "architecture" for dependencies in which it was explicitely requested, while we will not show the 'strange' :any arch in FullName(true) [= pretty-print] either. Before you had to specialcase these and by default you wouldn't get these details shown. The only identifiable disadvantage is that this complicates error reporting and handling. apt-get's ShowBroken has existing problems with virtual packages [it just shows the name without any reason], so that has to be worked on eventually. The other case is that detecting if a package is completely unknown or if it was at least referenced somewhere needs to acount for this "split" – not that it makes a practical difference which error is shown… but its one of the improvements possible.
6 years ago
implement dpkgs vision of interpreting pkg:<arch> dependencies How the Multi-Arch field and pkg:<arch> dependencies interact was discussed at DebConf15 in the "MultiArch BoF". dpkg and apt (among other tools like dose) had a different interpretation in certain scenarios which we resolved by agreeing on dpkg view – and this commit realizes this agreement in code. As was the case so far libapt sticks to the idea of trying to hide MultiArch as much as possible from individual frontends and instead translates it to good old SingleArch. There are certainly situations which can be improved in frontends if they know that MultiArch is upon them, but these are improvements – not necessary changes needed to unbreak a frontend. The implementation idea is simple: If we parse a dependency on foo:amd64 the dependency is formed on a package 'foo:amd64' of arch 'any'. This package is provided by package 'foo' of arch 'amd64', but not by 'foo' of arch 'i386'. Both of those foo packages provide each other through (assuming foo is M-A:foreign) to allow a dependency on 'foo' to be satisfied by either foo of amd64 or i386. Packages can also declare to provide 'foo:amd64' which is translated to providing 'foo:amd64:any' as well. This indirection over provides was chosen as the alternative would be to teach dependency resolvers how to deal with architecture specific dependencies – which violates the design idea of avoiding resolver changes, especially as architecture-specific dependencies are a cornercase with quite a few subtil rules. Handling it all over versioned provides as we already did for M-A in general seems much simpler as it just works for them. This switch to :any has actually a "surprising" benefit as well: Even frontends showing a package name via .Name() [which doesn't show the architecture] will display the "architecture" for dependencies in which it was explicitely requested, while we will not show the 'strange' :any arch in FullName(true) [= pretty-print] either. Before you had to specialcase these and by default you wouldn't get these details shown. The only identifiable disadvantage is that this complicates error reporting and handling. apt-get's ShowBroken has existing problems with virtual packages [it just shows the name without any reason], so that has to be worked on eventually. The other case is that detecting if a package is completely unknown or if it was at least referenced somewhere needs to acount for this "split" – not that it makes a practical difference which error is shown… but its one of the improvements possible.
6 years ago
implement dpkgs vision of interpreting pkg:<arch> dependencies How the Multi-Arch field and pkg:<arch> dependencies interact was discussed at DebConf15 in the "MultiArch BoF". dpkg and apt (among other tools like dose) had a different interpretation in certain scenarios which we resolved by agreeing on dpkg view – and this commit realizes this agreement in code. As was the case so far libapt sticks to the idea of trying to hide MultiArch as much as possible from individual frontends and instead translates it to good old SingleArch. There are certainly situations which can be improved in frontends if they know that MultiArch is upon them, but these are improvements – not necessary changes needed to unbreak a frontend. The implementation idea is simple: If we parse a dependency on foo:amd64 the dependency is formed on a package 'foo:amd64' of arch 'any'. This package is provided by package 'foo' of arch 'amd64', but not by 'foo' of arch 'i386'. Both of those foo packages provide each other through (assuming foo is M-A:foreign) to allow a dependency on 'foo' to be satisfied by either foo of amd64 or i386. Packages can also declare to provide 'foo:amd64' which is translated to providing 'foo:amd64:any' as well. This indirection over provides was chosen as the alternative would be to teach dependency resolvers how to deal with architecture specific dependencies – which violates the design idea of avoiding resolver changes, especially as architecture-specific dependencies are a cornercase with quite a few subtil rules. Handling it all over versioned provides as we already did for M-A in general seems much simpler as it just works for them. This switch to :any has actually a "surprising" benefit as well: Even frontends showing a package name via .Name() [which doesn't show the architecture] will display the "architecture" for dependencies in which it was explicitely requested, while we will not show the 'strange' :any arch in FullName(true) [= pretty-print] either. Before you had to specialcase these and by default you wouldn't get these details shown. The only identifiable disadvantage is that this complicates error reporting and handling. apt-get's ShowBroken has existing problems with virtual packages [it just shows the name without any reason], so that has to be worked on eventually. The other case is that detecting if a package is completely unknown or if it was at least referenced somewhere needs to acount for this "split" – not that it makes a practical difference which error is shown… but its one of the improvements possible.
6 years ago
implement dpkgs vision of interpreting pkg:<arch> dependencies How the Multi-Arch field and pkg:<arch> dependencies interact was discussed at DebConf15 in the "MultiArch BoF". dpkg and apt (among other tools like dose) had a different interpretation in certain scenarios which we resolved by agreeing on dpkg view – and this commit realizes this agreement in code. As was the case so far libapt sticks to the idea of trying to hide MultiArch as much as possible from individual frontends and instead translates it to good old SingleArch. There are certainly situations which can be improved in frontends if they know that MultiArch is upon them, but these are improvements – not necessary changes needed to unbreak a frontend. The implementation idea is simple: If we parse a dependency on foo:amd64 the dependency is formed on a package 'foo:amd64' of arch 'any'. This package is provided by package 'foo' of arch 'amd64', but not by 'foo' of arch 'i386'. Both of those foo packages provide each other through (assuming foo is M-A:foreign) to allow a dependency on 'foo' to be satisfied by either foo of amd64 or i386. Packages can also declare to provide 'foo:amd64' which is translated to providing 'foo:amd64:any' as well. This indirection over provides was chosen as the alternative would be to teach dependency resolvers how to deal with architecture specific dependencies – which violates the design idea of avoiding resolver changes, especially as architecture-specific dependencies are a cornercase with quite a few subtil rules. Handling it all over versioned provides as we already did for M-A in general seems much simpler as it just works for them. This switch to :any has actually a "surprising" benefit as well: Even frontends showing a package name via .Name() [which doesn't show the architecture] will display the "architecture" for dependencies in which it was explicitely requested, while we will not show the 'strange' :any arch in FullName(true) [= pretty-print] either. Before you had to specialcase these and by default you wouldn't get these details shown. The only identifiable disadvantage is that this complicates error reporting and handling. apt-get's ShowBroken has existing problems with virtual packages [it just shows the name without any reason], so that has to be worked on eventually. The other case is that detecting if a package is completely unknown or if it was at least referenced somewhere needs to acount for this "split" – not that it makes a practical difference which error is shown… but its one of the improvements possible.
6 years ago
implement dpkgs vision of interpreting pkg:<arch> dependencies How the Multi-Arch field and pkg:<arch> dependencies interact was discussed at DebConf15 in the "MultiArch BoF". dpkg and apt (among other tools like dose) had a different interpretation in certain scenarios which we resolved by agreeing on dpkg view – and this commit realizes this agreement in code. As was the case so far libapt sticks to the idea of trying to hide MultiArch as much as possible from individual frontends and instead translates it to good old SingleArch. There are certainly situations which can be improved in frontends if they know that MultiArch is upon them, but these are improvements – not necessary changes needed to unbreak a frontend. The implementation idea is simple: If we parse a dependency on foo:amd64 the dependency is formed on a package 'foo:amd64' of arch 'any'. This package is provided by package 'foo' of arch 'amd64', but not by 'foo' of arch 'i386'. Both of those foo packages provide each other through (assuming foo is M-A:foreign) to allow a dependency on 'foo' to be satisfied by either foo of amd64 or i386. Packages can also declare to provide 'foo:amd64' which is translated to providing 'foo:amd64:any' as well. This indirection over provides was chosen as the alternative would be to teach dependency resolvers how to deal with architecture specific dependencies – which violates the design idea of avoiding resolver changes, especially as architecture-specific dependencies are a cornercase with quite a few subtil rules. Handling it all over versioned provides as we already did for M-A in general seems much simpler as it just works for them. This switch to :any has actually a "surprising" benefit as well: Even frontends showing a package name via .Name() [which doesn't show the architecture] will display the "architecture" for dependencies in which it was explicitely requested, while we will not show the 'strange' :any arch in FullName(true) [= pretty-print] either. Before you had to specialcase these and by default you wouldn't get these details shown. The only identifiable disadvantage is that this complicates error reporting and handling. apt-get's ShowBroken has existing problems with virtual packages [it just shows the name without any reason], so that has to be worked on eventually. The other case is that detecting if a package is completely unknown or if it was at least referenced somewhere needs to acount for this "split" – not that it makes a practical difference which error is shown… but its one of the improvements possible.
6 years ago
implement dpkgs vision of interpreting pkg:<arch> dependencies How the Multi-Arch field and pkg:<arch> dependencies interact was discussed at DebConf15 in the "MultiArch BoF". dpkg and apt (among other tools like dose) had a different interpretation in certain scenarios which we resolved by agreeing on dpkg view – and this commit realizes this agreement in code. As was the case so far libapt sticks to the idea of trying to hide MultiArch as much as possible from individual frontends and instead translates it to good old SingleArch. There are certainly situations which can be improved in frontends if they know that MultiArch is upon them, but these are improvements – not necessary changes needed to unbreak a frontend. The implementation idea is simple: If we parse a dependency on foo:amd64 the dependency is formed on a package 'foo:amd64' of arch 'any'. This package is provided by package 'foo' of arch 'amd64', but not by 'foo' of arch 'i386'. Both of those foo packages provide each other through (assuming foo is M-A:foreign) to allow a dependency on 'foo' to be satisfied by either foo of amd64 or i386. Packages can also declare to provide 'foo:amd64' which is translated to providing 'foo:amd64:any' as well. This indirection over provides was chosen as the alternative would be to teach dependency resolvers how to deal with architecture specific dependencies – which violates the design idea of avoiding resolver changes, especially as architecture-specific dependencies are a cornercase with quite a few subtil rules. Handling it all over versioned provides as we already did for M-A in general seems much simpler as it just works for them. This switch to :any has actually a "surprising" benefit as well: Even frontends showing a package name via .Name() [which doesn't show the architecture] will display the "architecture" for dependencies in which it was explicitely requested, while we will not show the 'strange' :any arch in FullName(true) [= pretty-print] either. Before you had to specialcase these and by default you wouldn't get these details shown. The only identifiable disadvantage is that this complicates error reporting and handling. apt-get's ShowBroken has existing problems with virtual packages [it just shows the name without any reason], so that has to be worked on eventually. The other case is that detecting if a package is completely unknown or if it was at least referenced somewhere needs to acount for this "split" – not that it makes a practical difference which error is shown… but its one of the improvements possible.
6 years ago
implement dpkgs vision of interpreting pkg:<arch> dependencies How the Multi-Arch field and pkg:<arch> dependencies interact was discussed at DebConf15 in the "MultiArch BoF". dpkg and apt (among other tools like dose) had a different interpretation in certain scenarios which we resolved by agreeing on dpkg view – and this commit realizes this agreement in code. As was the case so far libapt sticks to the idea of trying to hide MultiArch as much as possible from individual frontends and instead translates it to good old SingleArch. There are certainly situations which can be improved in frontends if they know that MultiArch is upon them, but these are improvements – not necessary changes needed to unbreak a frontend. The implementation idea is simple: If we parse a dependency on foo:amd64 the dependency is formed on a package 'foo:amd64' of arch 'any'. This package is provided by package 'foo' of arch 'amd64', but not by 'foo' of arch 'i386'. Both of those foo packages provide each other through (assuming foo is M-A:foreign) to allow a dependency on 'foo' to be satisfied by either foo of amd64 or i386. Packages can also declare to provide 'foo:amd64' which is translated to providing 'foo:amd64:any' as well. This indirection over provides was chosen as the alternative would be to teach dependency resolvers how to deal with architecture specific dependencies – which violates the design idea of avoiding resolver changes, especially as architecture-specific dependencies are a cornercase with quite a few subtil rules. Handling it all over versioned provides as we already did for M-A in general seems much simpler as it just works for them. This switch to :any has actually a "surprising" benefit as well: Even frontends showing a package name via .Name() [which doesn't show the architecture] will display the "architecture" for dependencies in which it was explicitely requested, while we will not show the 'strange' :any arch in FullName(true) [= pretty-print] either. Before you had to specialcase these and by default you wouldn't get these details shown. The only identifiable disadvantage is that this complicates error reporting and handling. apt-get's ShowBroken has existing problems with virtual packages [it just shows the name without any reason], so that has to be worked on eventually. The other case is that detecting if a package is completely unknown or if it was at least referenced somewhere needs to acount for this "split" – not that it makes a practical difference which error is shown… but its one of the improvements possible.
6 years ago
implement dpkgs vision of interpreting pkg:<arch> dependencies How the Multi-Arch field and pkg:<arch> dependencies interact was discussed at DebConf15 in the "MultiArch BoF". dpkg and apt (among other tools like dose) had a different interpretation in certain scenarios which we resolved by agreeing on dpkg view – and this commit realizes this agreement in code. As was the case so far libapt sticks to the idea of trying to hide MultiArch as much as possible from individual frontends and instead translates it to good old SingleArch. There are certainly situations which can be improved in frontends if they know that MultiArch is upon them, but these are improvements – not necessary changes needed to unbreak a frontend. The implementation idea is simple: If we parse a dependency on foo:amd64 the dependency is formed on a package 'foo:amd64' of arch 'any'. This package is provided by package 'foo' of arch 'amd64', but not by 'foo' of arch 'i386'. Both of those foo packages provide each other through (assuming foo is M-A:foreign) to allow a dependency on 'foo' to be satisfied by either foo of amd64 or i386. Packages can also declare to provide 'foo:amd64' which is translated to providing 'foo:amd64:any' as well. This indirection over provides was chosen as the alternative would be to teach dependency resolvers how to deal with architecture specific dependencies – which violates the design idea of avoiding resolver changes, especially as architecture-specific dependencies are a cornercase with quite a few subtil rules. Handling it all over versioned provides as we already did for M-A in general seems much simpler as it just works for them. This switch to :any has actually a "surprising" benefit as well: Even frontends showing a package name via .Name() [which doesn't show the architecture] will display the "architecture" for dependencies in which it was explicitely requested, while we will not show the 'strange' :any arch in FullName(true) [= pretty-print] either. Before you had to specialcase these and by default you wouldn't get these details shown. The only identifiable disadvantage is that this complicates error reporting and handling. apt-get's ShowBroken has existing problems with virtual packages [it just shows the name without any reason], so that has to be worked on eventually. The other case is that detecting if a package is completely unknown or if it was at least referenced somewhere needs to acount for this "split" – not that it makes a practical difference which error is shown… but its one of the improvements possible.
6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: deblistparser.cc,v 1.29.2.5 2004/01/06 01:43:44 mdz Exp $
  4. /* ######################################################################
  5. Package Cache Generator - Generator for the cache structure.
  6. This builds the cache structure from the abstract package list parser.
  7. ##################################################################### */
  8. /*}}}*/
  9. // Include Files /*{{{*/
  10. #include <config.h>
  11. #include <apt-pkg/deblistparser.h>
  12. #include <apt-pkg/error.h>
  13. #include <apt-pkg/configuration.h>
  14. #include <apt-pkg/cachefilter.h>
  15. #include <apt-pkg/aptconfiguration.h>
  16. #include <apt-pkg/strutl.h>
  17. #include <apt-pkg/crc-16.h>
  18. #include <apt-pkg/md5.h>
  19. #include <apt-pkg/pkgcache.h>
  20. #include <apt-pkg/cacheiterators.h>
  21. #include <apt-pkg/tagfile.h>
  22. #include <apt-pkg/macros.h>
  23. #include <stddef.h>
  24. #include <string.h>
  25. #include <algorithm>
  26. #include <string>
  27. #include <vector>
  28. #include <ctype.h>
  29. /*}}}*/
  30. using std::string;
  31. static debListParser::WordList PrioList[] = {
  32. {"required",pkgCache::State::Required},
  33. {"important",pkgCache::State::Important},
  34. {"standard",pkgCache::State::Standard},
  35. {"optional",pkgCache::State::Optional},
  36. {"extra",pkgCache::State::Extra},
  37. {NULL, 0}};
  38. // ListParser::debListParser - Constructor /*{{{*/
  39. // ---------------------------------------------------------------------
  40. /* Provide an architecture and only this one and "all" will be accepted
  41. in Step(), if no Architecture is given we will accept every arch
  42. we would accept in general with checkArchitecture() */
  43. debListParser::debListParser(FileFd *File) :
  44. pkgCacheListParser(), d(NULL), Tags(File)
  45. {
  46. }
  47. /*}}}*/
  48. // ListParser::Package - Return the package name /*{{{*/
  49. // ---------------------------------------------------------------------
  50. /* This is to return the name of the package this section describes */
  51. string debListParser::Package() {
  52. string const Result = Section.FindS("Package");
  53. if(unlikely(Result.empty() == true))
  54. _error->Error("Encountered a section with no Package: header");
  55. return Result;
  56. }
  57. /*}}}*/
  58. // ListParser::Architecture - Return the package arch /*{{{*/
  59. // ---------------------------------------------------------------------
  60. /* This will return the Architecture of the package this section describes */
  61. string debListParser::Architecture() {
  62. std::string const Arch = Section.FindS("Architecture");
  63. return Arch.empty() ? "none" : Arch;
  64. }
  65. /*}}}*/
  66. // ListParser::ArchitectureAll /*{{{*/
  67. // ---------------------------------------------------------------------
  68. /* */
  69. bool debListParser::ArchitectureAll() {
  70. return Section.FindS("Architecture") == "all";
  71. }
  72. /*}}}*/
  73. // ListParser::Version - Return the version string /*{{{*/
  74. // ---------------------------------------------------------------------
  75. /* This is to return the string describing the version in debian form,
  76. epoch:upstream-release. If this returns the blank string then the
  77. entry is assumed to only describe package properties */
  78. string debListParser::Version()
  79. {
  80. return Section.FindS("Version");
  81. }
  82. /*}}}*/
  83. unsigned char debListParser::ParseMultiArch(bool const showErrors) /*{{{*/
  84. {
  85. unsigned char MA;
  86. string const MultiArch = Section.FindS("Multi-Arch");
  87. if (MultiArch.empty() == true || MultiArch == "no")
  88. MA = pkgCache::Version::No;
  89. else if (MultiArch == "same") {
  90. if (ArchitectureAll() == true)
  91. {
  92. if (showErrors == true)
  93. _error->Warning("Architecture: all package '%s' can't be Multi-Arch: same",
  94. Section.FindS("Package").c_str());
  95. MA = pkgCache::Version::No;
  96. }
  97. else
  98. MA = pkgCache::Version::Same;
  99. }
  100. else if (MultiArch == "foreign")
  101. MA = pkgCache::Version::Foreign;
  102. else if (MultiArch == "allowed")
  103. MA = pkgCache::Version::Allowed;
  104. else
  105. {
  106. if (showErrors == true)
  107. _error->Warning("Unknown Multi-Arch type '%s' for package '%s'",
  108. MultiArch.c_str(), Section.FindS("Package").c_str());
  109. MA = pkgCache::Version::No;
  110. }
  111. if (ArchitectureAll() == true)
  112. MA |= pkgCache::Version::All;
  113. return MA;
  114. }
  115. /*}}}*/
  116. // ListParser::NewVersion - Fill in the version structure /*{{{*/
  117. // ---------------------------------------------------------------------
  118. /* */
  119. bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
  120. {
  121. const char *Start;
  122. const char *Stop;
  123. // Parse the section
  124. if (Section.Find("Section",Start,Stop) == true)
  125. {
  126. map_stringitem_t const idx = StoreString(pkgCacheGenerator::SECTION, Start, Stop - Start);
  127. Ver->Section = idx;
  128. }
  129. // Parse the source package name
  130. pkgCache::GrpIterator const G = Ver.ParentPkg().Group();
  131. Ver->SourcePkgName = G->Name;
  132. Ver->SourceVerStr = Ver->VerStr;
  133. if (Section.Find("Source",Start,Stop) == true)
  134. {
  135. const char * const Space = (const char * const) memchr(Start, ' ', Stop - Start);
  136. pkgCache::VerIterator V;
  137. if (Space != NULL)
  138. {
  139. Stop = Space;
  140. const char * const Open = (const char * const) memchr(Space, '(', Stop - Space);
  141. if (likely(Open != NULL))
  142. {
  143. const char * const Close = (const char * const) memchr(Open, ')', Stop - Open);
  144. if (likely(Close != NULL))
  145. {
  146. std::string const version(Open + 1, (Close - Open) - 1);
  147. if (version != Ver.VerStr())
  148. {
  149. map_stringitem_t const idx = StoreString(pkgCacheGenerator::VERSIONNUMBER, version);
  150. Ver->SourceVerStr = idx;
  151. }
  152. }
  153. }
  154. }
  155. std::string const pkgname(Start, Stop - Start);
  156. if (pkgname != G.Name())
  157. {
  158. for (pkgCache::PkgIterator P = G.PackageList(); P.end() == false; P = G.NextPkg(P))
  159. {
  160. for (V = P.VersionList(); V.end() == false; ++V)
  161. {
  162. if (pkgname == V.SourcePkgName())
  163. {
  164. Ver->SourcePkgName = V->SourcePkgName;
  165. break;
  166. }
  167. }
  168. if (V.end() == false)
  169. break;
  170. }
  171. if (V.end() == true)
  172. {
  173. map_stringitem_t const idx = StoreString(pkgCacheGenerator::PKGNAME, pkgname);
  174. Ver->SourcePkgName = idx;
  175. }
  176. }
  177. }
  178. Ver->MultiArch = ParseMultiArch(true);
  179. // Archive Size
  180. Ver->Size = Section.FindULL("Size");
  181. // Unpacked Size (in K)
  182. Ver->InstalledSize = Section.FindULL("Installed-Size");
  183. Ver->InstalledSize *= 1024;
  184. // Priority
  185. if (Section.Find("Priority",Start,Stop) == true)
  186. {
  187. if (GrabWord(string(Start,Stop-Start),PrioList,Ver->Priority) == false)
  188. Ver->Priority = pkgCache::State::Extra;
  189. }
  190. if (ParseDepends(Ver,"Pre-Depends",pkgCache::Dep::PreDepends) == false)
  191. return false;
  192. if (ParseDepends(Ver,"Depends",pkgCache::Dep::Depends) == false)
  193. return false;
  194. if (ParseDepends(Ver,"Conflicts",pkgCache::Dep::Conflicts) == false)
  195. return false;
  196. if (ParseDepends(Ver,"Breaks",pkgCache::Dep::DpkgBreaks) == false)
  197. return false;
  198. if (ParseDepends(Ver,"Recommends",pkgCache::Dep::Recommends) == false)
  199. return false;
  200. if (ParseDepends(Ver,"Suggests",pkgCache::Dep::Suggests) == false)
  201. return false;
  202. if (ParseDepends(Ver,"Replaces",pkgCache::Dep::Replaces) == false)
  203. return false;
  204. if (ParseDepends(Ver,"Enhances",pkgCache::Dep::Enhances) == false)
  205. return false;
  206. // Obsolete.
  207. if (ParseDepends(Ver,"Optional",pkgCache::Dep::Suggests) == false)
  208. return false;
  209. if (ParseProvides(Ver) == false)
  210. return false;
  211. return true;
  212. }
  213. /*}}}*/
  214. // ListParser::Description - Return the description string /*{{{*/
  215. // ---------------------------------------------------------------------
  216. /* This is to return the string describing the package in debian
  217. form. If this returns the blank string then the entry is assumed to
  218. only describe package properties */
  219. string debListParser::Description(std::string const &lang)
  220. {
  221. if (lang.empty())
  222. return Section.FindS("Description");
  223. else
  224. return Section.FindS(string("Description-").append(lang).c_str());
  225. }
  226. /*}}}*/
  227. // ListParser::AvailableDescriptionLanguages /*{{{*/
  228. std::vector<std::string> debListParser::AvailableDescriptionLanguages()
  229. {
  230. std::vector<std::string> const understood = APT::Configuration::getLanguages();
  231. std::vector<std::string> avail;
  232. if (Section.Exists("Description") == true)
  233. avail.push_back("");
  234. for (std::vector<std::string>::const_iterator lang = understood.begin(); lang != understood.end(); ++lang)
  235. {
  236. std::string const tagname = "Description-" + *lang;
  237. if (Section.Exists(tagname.c_str()) == true)
  238. avail.push_back(*lang);
  239. }
  240. return avail;
  241. }
  242. /*}}}*/
  243. // ListParser::Description_md5 - Return the description_md5 MD5SumValue /*{{{*/
  244. // ---------------------------------------------------------------------
  245. /* This is to return the md5 string to allow the check if it is the right
  246. description. If no Description-md5 is found in the section it will be
  247. calculated.
  248. */
  249. MD5SumValue debListParser::Description_md5()
  250. {
  251. string const value = Section.FindS("Description-md5");
  252. if (value.empty() == true)
  253. {
  254. std::string const desc = Description("") + "\n";
  255. if (desc == "\n")
  256. return MD5SumValue();
  257. MD5Summation md5;
  258. md5.Add(desc.c_str());
  259. return md5.Result();
  260. }
  261. else if (likely(value.size() == 32))
  262. {
  263. if (likely(value.find_first_not_of("0123456789abcdefABCDEF") == string::npos))
  264. return MD5SumValue(value);
  265. _error->Error("Malformed Description-md5 line; includes invalid character '%s'", value.c_str());
  266. return MD5SumValue();
  267. }
  268. _error->Error("Malformed Description-md5 line; doesn't have the required length (32 != %d) '%s'", (int)value.size(), value.c_str());
  269. return MD5SumValue();
  270. }
  271. /*}}}*/
  272. // ListParser::UsePackage - Update a package structure /*{{{*/
  273. // ---------------------------------------------------------------------
  274. /* This is called to update the package with any new information
  275. that might be found in the section */
  276. bool debListParser::UsePackage(pkgCache::PkgIterator &Pkg,
  277. pkgCache::VerIterator &Ver)
  278. {
  279. string const static myArch = _config->Find("APT::Architecture");
  280. // Possible values are: "all", "native", "installed" and "none"
  281. // The "installed" mode is handled by ParseStatus(), See #544481 and friends.
  282. string const static essential = _config->Find("pkgCacheGen::Essential", "all");
  283. if (essential == "all" ||
  284. (essential == "native" && Pkg->Arch != 0 && myArch == Pkg.Arch()))
  285. if (Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false)
  286. return false;
  287. if (Section.FindFlag("Important",Pkg->Flags,pkgCache::Flag::Important) == false)
  288. return false;
  289. if (strcmp(Pkg.Name(),"apt") == 0)
  290. {
  291. if ((essential == "native" && Pkg->Arch != 0 && myArch == Pkg.Arch()) ||
  292. essential == "all")
  293. Pkg->Flags |= pkgCache::Flag::Essential | pkgCache::Flag::Important;
  294. else
  295. Pkg->Flags |= pkgCache::Flag::Important;
  296. }
  297. if (ParseStatus(Pkg,Ver) == false)
  298. return false;
  299. return true;
  300. }
  301. /*}}}*/
  302. // ListParser::VersionHash - Compute a unique hash for this version /*{{{*/
  303. // ---------------------------------------------------------------------
  304. /* */
  305. unsigned short debListParser::VersionHash()
  306. {
  307. const char *Sections[] ={"Installed-Size",
  308. "Depends",
  309. "Pre-Depends",
  310. // "Suggests",
  311. // "Recommends",
  312. "Conflicts",
  313. "Breaks",
  314. "Replaces",0};
  315. unsigned long Result = INIT_FCS;
  316. char S[1024];
  317. for (const char * const *I = Sections; *I != 0; ++I)
  318. {
  319. const char *Start;
  320. const char *End;
  321. if (Section.Find(*I,Start,End) == false || End - Start >= (signed)sizeof(S))
  322. continue;
  323. /* Strip out any spaces from the text, this undoes dpkgs reformatting
  324. of certain fields. dpkg also has the rather interesting notion of
  325. reformatting depends operators < -> <= */
  326. char *J = S;
  327. for (; Start != End; ++Start)
  328. {
  329. if (isspace(*Start) != 0)
  330. continue;
  331. *J++ = tolower_ascii(*Start);
  332. if ((*Start == '<' || *Start == '>') && Start[1] != *Start && Start[1] != '=')
  333. *J++ = '=';
  334. }
  335. Result = AddCRC16(Result,S,J - S);
  336. }
  337. return Result;
  338. }
  339. /*}}}*/
  340. // StatusListParser::ParseStatus - Parse the status field /*{{{*/
  341. // ---------------------------------------------------------------------
  342. /* Status lines are of the form,
  343. Status: want flag status
  344. want = unknown, install, hold, deinstall, purge
  345. flag = ok, reinstreq
  346. status = not-installed, config-files, half-installed, unpacked,
  347. half-configured, triggers-awaited, triggers-pending, installed
  348. */
  349. bool debListParser::ParseStatus(pkgCache::PkgIterator &,
  350. pkgCache::VerIterator &)
  351. {
  352. return true;
  353. }
  354. bool debStatusListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
  355. pkgCache::VerIterator &Ver)
  356. {
  357. const char *Start;
  358. const char *Stop;
  359. if (Section.Find("Status",Start,Stop) == false)
  360. return true;
  361. // UsePackage() is responsible for setting the flag in the default case
  362. bool const static essential = _config->Find("pkgCacheGen::Essential", "") == "installed";
  363. if (essential == true &&
  364. Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false)
  365. return false;
  366. // Isolate the first word
  367. const char *I = Start;
  368. for(; I < Stop && *I != ' '; I++);
  369. if (I >= Stop || *I != ' ')
  370. return _error->Error("Malformed Status line");
  371. // Process the want field
  372. WordList WantList[] = {{"unknown",pkgCache::State::Unknown},
  373. {"install",pkgCache::State::Install},
  374. {"hold",pkgCache::State::Hold},
  375. {"deinstall",pkgCache::State::DeInstall},
  376. {"purge",pkgCache::State::Purge},
  377. {NULL, 0}};
  378. if (GrabWord(string(Start,I-Start),WantList,Pkg->SelectedState) == false)
  379. return _error->Error("Malformed 1st word in the Status line");
  380. // Isloate the next word
  381. I++;
  382. Start = I;
  383. for(; I < Stop && *I != ' '; I++);
  384. if (I >= Stop || *I != ' ')
  385. return _error->Error("Malformed status line, no 2nd word");
  386. // Process the flag field
  387. WordList FlagList[] = {{"ok",pkgCache::State::Ok},
  388. {"reinstreq",pkgCache::State::ReInstReq},
  389. {"hold",pkgCache::State::HoldInst},
  390. {"hold-reinstreq",pkgCache::State::HoldReInstReq},
  391. {NULL, 0}};
  392. if (GrabWord(string(Start,I-Start),FlagList,Pkg->InstState) == false)
  393. return _error->Error("Malformed 2nd word in the Status line");
  394. // Isloate the last word
  395. I++;
  396. Start = I;
  397. for(; I < Stop && *I != ' '; I++);
  398. if (I != Stop)
  399. return _error->Error("Malformed Status line, no 3rd word");
  400. // Process the flag field
  401. WordList StatusList[] = {{"not-installed",pkgCache::State::NotInstalled},
  402. {"config-files",pkgCache::State::ConfigFiles},
  403. {"half-installed",pkgCache::State::HalfInstalled},
  404. {"unpacked",pkgCache::State::UnPacked},
  405. {"half-configured",pkgCache::State::HalfConfigured},
  406. {"triggers-awaited",pkgCache::State::TriggersAwaited},
  407. {"triggers-pending",pkgCache::State::TriggersPending},
  408. {"installed",pkgCache::State::Installed},
  409. {NULL, 0}};
  410. if (GrabWord(string(Start,I-Start),StatusList,Pkg->CurrentState) == false)
  411. return _error->Error("Malformed 3rd word in the Status line");
  412. /* A Status line marks the package as indicating the current
  413. version as well. Only if it is actually installed.. Otherwise
  414. the interesting dpkg handling of the status file creates bogus
  415. entries. */
  416. if (!(Pkg->CurrentState == pkgCache::State::NotInstalled ||
  417. Pkg->CurrentState == pkgCache::State::ConfigFiles))
  418. {
  419. if (Ver.end() == true)
  420. _error->Warning("Encountered status field in a non-version description");
  421. else
  422. Pkg->CurrentVer = Ver.Index();
  423. }
  424. return true;
  425. }
  426. const char *debListParser::ConvertRelation(const char *I,unsigned int &Op)
  427. {
  428. // Determine the operator
  429. switch (*I)
  430. {
  431. case '<':
  432. I++;
  433. if (*I == '=')
  434. {
  435. I++;
  436. Op = pkgCache::Dep::LessEq;
  437. break;
  438. }
  439. if (*I == '<')
  440. {
  441. I++;
  442. Op = pkgCache::Dep::Less;
  443. break;
  444. }
  445. // < is the same as <= and << is really Cs < for some reason
  446. Op = pkgCache::Dep::LessEq;
  447. break;
  448. case '>':
  449. I++;
  450. if (*I == '=')
  451. {
  452. I++;
  453. Op = pkgCache::Dep::GreaterEq;
  454. break;
  455. }
  456. if (*I == '>')
  457. {
  458. I++;
  459. Op = pkgCache::Dep::Greater;
  460. break;
  461. }
  462. // > is the same as >= and >> is really Cs > for some reason
  463. Op = pkgCache::Dep::GreaterEq;
  464. break;
  465. case '=':
  466. Op = pkgCache::Dep::Equals;
  467. I++;
  468. break;
  469. // HACK around bad package definitions
  470. default:
  471. Op = pkgCache::Dep::Equals;
  472. break;
  473. }
  474. return I;
  475. }
  476. /*}}}*/
  477. // ListParser::ParseDepends - Parse a dependency element /*{{{*/
  478. // ---------------------------------------------------------------------
  479. /* This parses the dependency elements out of a standard string in place,
  480. bit by bit. */
  481. const char *debListParser::ParseDepends(const char *Start,const char *Stop,
  482. std::string &Package,std::string &Ver,unsigned int &Op)
  483. { return ParseDepends(Start, Stop, Package, Ver, Op, false, true, false); }
  484. const char *debListParser::ParseDepends(const char *Start,const char *Stop,
  485. std::string &Package,std::string &Ver,unsigned int &Op,
  486. bool const &ParseArchFlags)
  487. { return ParseDepends(Start, Stop, Package, Ver, Op, ParseArchFlags, true, false); }
  488. const char *debListParser::ParseDepends(const char *Start,const char *Stop,
  489. std::string &Package,std::string &Ver,unsigned int &Op,
  490. bool const &ParseArchFlags, bool const &StripMultiArch)
  491. { return ParseDepends(Start, Stop, Package, Ver, Op, ParseArchFlags, StripMultiArch, false); }
  492. const char *debListParser::ParseDepends(const char *Start,const char *Stop,
  493. string &Package,string &Ver,
  494. unsigned int &Op, bool const &ParseArchFlags,
  495. bool const &StripMultiArch,
  496. bool const &ParseRestrictionsList)
  497. {
  498. // Strip off leading space
  499. for (;Start != Stop && isspace(*Start) != 0; ++Start);
  500. // Parse off the package name
  501. const char *I = Start;
  502. for (;I != Stop && isspace(*I) == 0 && *I != '(' && *I != ')' &&
  503. *I != ',' && *I != '|' && *I != '[' && *I != ']' &&
  504. *I != '<' && *I != '>'; ++I);
  505. // Malformed, no '('
  506. if (I != Stop && *I == ')')
  507. return 0;
  508. if (I == Start)
  509. return 0;
  510. // Stash the package name
  511. Package.assign(Start,I - Start);
  512. // We don't want to confuse library users which can't handle MultiArch
  513. string const arch = _config->Find("APT::Architecture");
  514. if (StripMultiArch == true) {
  515. size_t const found = Package.rfind(':');
  516. if (found != string::npos &&
  517. (strcmp(Package.c_str() + found, ":any") == 0 ||
  518. strcmp(Package.c_str() + found, ":native") == 0 ||
  519. strcmp(Package.c_str() + found + 1, arch.c_str()) == 0))
  520. Package = Package.substr(0,found);
  521. }
  522. // Skip white space to the '('
  523. for (;I != Stop && isspace(*I) != 0 ; I++);
  524. // Parse a version
  525. if (I != Stop && *I == '(')
  526. {
  527. // Skip the '('
  528. for (I++; I != Stop && isspace(*I) != 0 ; I++);
  529. if (I + 3 >= Stop)
  530. return 0;
  531. I = ConvertRelation(I,Op);
  532. // Skip whitespace
  533. for (;I != Stop && isspace(*I) != 0; I++);
  534. Start = I;
  535. I = (const char*) memchr(I, ')', Stop - I);
  536. if (I == NULL || Start == I)
  537. return 0;
  538. // Skip trailing whitespace
  539. const char *End = I;
  540. for (; End > Start && isspace(End[-1]); End--);
  541. Ver.assign(Start,End-Start);
  542. I++;
  543. }
  544. else
  545. {
  546. Ver.clear();
  547. Op = pkgCache::Dep::NoOp;
  548. }
  549. // Skip whitespace
  550. for (;I != Stop && isspace(*I) != 0; I++);
  551. if (ParseArchFlags == true)
  552. {
  553. APT::CacheFilter::PackageArchitectureMatchesSpecification matchesArch(arch, false);
  554. // Parse an architecture
  555. if (I != Stop && *I == '[')
  556. {
  557. ++I;
  558. // malformed
  559. if (unlikely(I == Stop))
  560. return 0;
  561. const char *End = I;
  562. bool Found = false;
  563. bool NegArch = false;
  564. while (I != Stop)
  565. {
  566. // look for whitespace or ending ']'
  567. for (;End != Stop && !isspace(*End) && *End != ']'; ++End);
  568. if (unlikely(End == Stop))
  569. return 0;
  570. if (*I == '!')
  571. {
  572. NegArch = true;
  573. ++I;
  574. }
  575. std::string arch(I, End);
  576. if (arch.empty() == false && matchesArch(arch.c_str()) == true)
  577. {
  578. Found = true;
  579. if (I[-1] != '!')
  580. NegArch = false;
  581. // we found a match, so fast-forward to the end of the wildcards
  582. for (; End != Stop && *End != ']'; ++End);
  583. }
  584. if (*End++ == ']') {
  585. I = End;
  586. break;
  587. }
  588. I = End;
  589. for (;I != Stop && isspace(*I) != 0; I++);
  590. }
  591. if (NegArch == true)
  592. Found = !Found;
  593. if (Found == false)
  594. Package = ""; /* not for this arch */
  595. }
  596. // Skip whitespace
  597. for (;I != Stop && isspace(*I) != 0; I++);
  598. }
  599. if (ParseRestrictionsList == true)
  600. {
  601. // Parse a restrictions formula which is in disjunctive normal form:
  602. // (foo AND bar) OR (blub AND bla)
  603. std::vector<string> const profiles = APT::Configuration::getBuildProfiles();
  604. // if the next character is a restriction list, then by default the
  605. // dependency does not apply and the conditions have to be checked
  606. // if the next character is not a restriction list, then by default the
  607. // dependency applies
  608. bool applies1 = (*I != '<');
  609. while (I != Stop)
  610. {
  611. if (*I != '<')
  612. break;
  613. ++I;
  614. // malformed
  615. if (unlikely(I == Stop))
  616. return 0;
  617. const char *End = I;
  618. // if of the prior restriction list is already fulfilled, then
  619. // we can just skip to the end of the current list
  620. if (applies1) {
  621. for (;End != Stop && *End != '>'; ++End);
  622. I = ++End;
  623. // skip whitespace
  624. for (;I != Stop && isspace(*I) != 0; I++);
  625. } else {
  626. bool applies2 = true;
  627. // all the conditions inside a restriction list have to be
  628. // met so once we find one that is not met, we can skip to
  629. // the end of this list
  630. while (I != Stop)
  631. {
  632. // look for whitespace or ending '>'
  633. // End now points to the character after the current term
  634. for (;End != Stop && !isspace(*End) && *End != '>'; ++End);
  635. if (unlikely(End == Stop))
  636. return 0;
  637. bool NegRestriction = false;
  638. if (*I == '!')
  639. {
  640. NegRestriction = true;
  641. ++I;
  642. }
  643. std::string restriction(I, End);
  644. if (restriction.empty() == false && profiles.empty() == false &&
  645. std::find(profiles.begin(), profiles.end(), restriction) != profiles.end())
  646. {
  647. if (NegRestriction) {
  648. applies2 = false;
  649. // since one of the terms does not apply we don't have to check the others
  650. for (; End != Stop && *End != '>'; ++End);
  651. }
  652. } else {
  653. if (!NegRestriction) {
  654. applies2 = false;
  655. // since one of the terms does not apply we don't have to check the others
  656. for (; End != Stop && *End != '>'; ++End);
  657. }
  658. }
  659. if (*End++ == '>') {
  660. I = End;
  661. // skip whitespace
  662. for (;I != Stop && isspace(*I) != 0; I++);
  663. break;
  664. }
  665. I = End;
  666. // skip whitespace
  667. for (;I != Stop && isspace(*I) != 0; I++);
  668. }
  669. if (applies2) {
  670. applies1 = true;
  671. }
  672. }
  673. }
  674. if (applies1 == false) {
  675. Package = ""; //not for this restriction
  676. }
  677. }
  678. if (I != Stop && *I == '|')
  679. Op |= pkgCache::Dep::Or;
  680. if (I == Stop || *I == ',' || *I == '|')
  681. {
  682. if (I != Stop)
  683. for (I++; I != Stop && isspace(*I) != 0; I++);
  684. return I;
  685. }
  686. return 0;
  687. }
  688. /*}}}*/
  689. // ListParser::ParseDepends - Parse a dependency list /*{{{*/
  690. // ---------------------------------------------------------------------
  691. /* This is the higher level depends parser. It takes a tag and generates
  692. a complete depends tree for the given version. */
  693. bool debListParser::ParseDepends(pkgCache::VerIterator &Ver,
  694. const char *Tag,unsigned int Type)
  695. {
  696. const char *Start;
  697. const char *Stop;
  698. if (Section.Find(Tag,Start,Stop) == false)
  699. return true;
  700. string const pkgArch = Ver.Arch();
  701. while (1)
  702. {
  703. string Package;
  704. string Version;
  705. unsigned int Op;
  706. Start = ParseDepends(Start, Stop, Package, Version, Op, false, false, false);
  707. if (Start == 0)
  708. return _error->Error("Problem parsing dependency %s",Tag);
  709. size_t const found = Package.rfind(':');
  710. if (found == string::npos)
  711. {
  712. if (NewDepends(Ver,Package,pkgArch,Version,Op,Type) == false)
  713. return false;
  714. }
  715. else if (strcmp(Package.c_str() + found, ":any") == 0)
  716. {
  717. if (NewDepends(Ver,Package,"any",Version,Op,Type) == false)
  718. return false;
  719. }
  720. else
  721. {
  722. // Such dependencies are not supposed to be accepted …
  723. // … but this is probably the best thing to do anyway
  724. if (Package.substr(found + 1) == "native")
  725. Package = Package.substr(0, found) + ':' + Ver.Cache()->NativeArch();
  726. if (NewDepends(Ver, Package, "any", Version, Op | pkgCache::Dep::ArchSpecific, Type) == false)
  727. return false;
  728. }
  729. if (Start == Stop)
  730. break;
  731. }
  732. return true;
  733. }
  734. /*}}}*/
  735. // ListParser::ParseProvides - Parse the provides list /*{{{*/
  736. // ---------------------------------------------------------------------
  737. /* */
  738. bool debListParser::ParseProvides(pkgCache::VerIterator &Ver)
  739. {
  740. /* it is unlikely, but while parsing dependencies, we might have already
  741. picked up multi-arch implicit provides which we do not want to duplicate here */
  742. bool hasProvidesAlready = false;
  743. std::string const spzName = Ver.ParentPkg().FullName(false);
  744. {
  745. for (pkgCache::PrvIterator Prv = Ver.ProvidesList(); Prv.end() == false; ++Prv)
  746. {
  747. if (Prv.IsMultiArchImplicit() == false || (Prv->Flags & pkgCache::Flag::ArchSpecific) == 0)
  748. continue;
  749. if (spzName != Prv.OwnerPkg().FullName(false))
  750. continue;
  751. hasProvidesAlready = true;
  752. break;
  753. }
  754. }
  755. string const Arch = Ver.Arch();
  756. const char *Start;
  757. const char *Stop;
  758. if (Section.Find("Provides",Start,Stop) == true)
  759. {
  760. string Package;
  761. string Version;
  762. unsigned int Op;
  763. do
  764. {
  765. Start = ParseDepends(Start,Stop,Package,Version,Op, false, false, false);
  766. const size_t archfound = Package.rfind(':');
  767. if (Start == 0)
  768. return _error->Error("Problem parsing Provides line");
  769. if (Op != pkgCache::Dep::NoOp && Op != pkgCache::Dep::Equals) {
  770. _error->Warning("Ignoring Provides line with non-equal DepCompareOp for package %s", Package.c_str());
  771. } else if (archfound != string::npos) {
  772. std::string spzArch = Package.substr(archfound + 1);
  773. if (spzArch != "any")
  774. {
  775. if (NewProvides(Ver, Package.substr(0, archfound), spzArch, Version, pkgCache::Flag::MultiArchImplicit | pkgCache::Flag::ArchSpecific) == false)
  776. return false;
  777. }
  778. if (NewProvides(Ver, Package, "any", Version, pkgCache::Flag::ArchSpecific) == false)
  779. return false;
  780. } else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign) {
  781. if (APT::Configuration::checkArchitecture(Arch))
  782. if (NewProvidesAllArch(Ver, Package, Version, 0) == false)
  783. return false;
  784. } else {
  785. if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed)
  786. {
  787. if (NewProvides(Ver, Package + ":any", "any", Version, pkgCache::Flag::MultiArchImplicit) == false)
  788. return false;
  789. }
  790. if (NewProvides(Ver, Package, Arch, Version, 0) == false)
  791. return false;
  792. }
  793. if (archfound == std::string::npos)
  794. {
  795. std::string const spzName = Package + ':' + Ver.ParentPkg().Arch();
  796. pkgCache::PkgIterator const spzPkg = Ver.Cache()->FindPkg(spzName, "any");
  797. if (spzPkg.end() == false)
  798. {
  799. if (NewProvides(Ver, spzName, "any", Version, pkgCache::Flag::MultiArchImplicit | pkgCache::Flag::ArchSpecific) == false)
  800. return false;
  801. }
  802. }
  803. } while (Start != Stop);
  804. }
  805. if (APT::Configuration::checkArchitecture(Arch))
  806. {
  807. if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed)
  808. {
  809. string const Package = string(Ver.ParentPkg().Name()).append(":").append("any");
  810. if (NewProvides(Ver, Package, "any", Ver.VerStr(), pkgCache::Flag::MultiArchImplicit) == false)
  811. return false;
  812. }
  813. else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign)
  814. {
  815. if (NewProvidesAllArch(Ver, Ver.ParentPkg().Name(), Ver.VerStr(), pkgCache::Flag::MultiArchImplicit) == false)
  816. return false;
  817. }
  818. }
  819. if (hasProvidesAlready == false)
  820. {
  821. pkgCache::PkgIterator const spzPkg = Ver.Cache()->FindPkg(spzName, "any");
  822. if (spzPkg.end() == false)
  823. {
  824. if (NewProvides(Ver, spzName, "any", Ver.VerStr(), pkgCache::Flag::MultiArchImplicit | pkgCache::Flag::ArchSpecific) == false)
  825. return false;
  826. }
  827. }
  828. return true;
  829. }
  830. /*}}}*/
  831. // ListParser::GrabWord - Matches a word and returns /*{{{*/
  832. // ---------------------------------------------------------------------
  833. /* Looks for a word in a list of words - for ParseStatus */
  834. bool debListParser::GrabWord(string Word,WordList *List,unsigned char &Out)
  835. {
  836. for (unsigned int C = 0; List[C].Str != 0; C++)
  837. {
  838. if (strcasecmp(Word.c_str(),List[C].Str) == 0)
  839. {
  840. Out = List[C].Val;
  841. return true;
  842. }
  843. }
  844. return false;
  845. }
  846. /*}}}*/
  847. // ListParser::Step - Move to the next section in the file /*{{{*/
  848. // ---------------------------------------------------------------------
  849. /* This has to be careful to only process the correct architecture */
  850. bool debListParser::Step()
  851. {
  852. iOffset = Tags.Offset();
  853. return Tags.Step(Section);
  854. }
  855. /*}}}*/
  856. // ListParser::GetPrio - Convert the priority from a string /*{{{*/
  857. // ---------------------------------------------------------------------
  858. /* */
  859. unsigned char debListParser::GetPrio(string Str)
  860. {
  861. unsigned char Out;
  862. if (GrabWord(Str,PrioList,Out) == false)
  863. Out = pkgCache::State::Extra;
  864. return Out;
  865. }
  866. /*}}}*/
  867. bool debListParser::SameVersion(unsigned short const Hash, /*{{{*/
  868. pkgCache::VerIterator const &Ver)
  869. {
  870. if (pkgCacheListParser::SameVersion(Hash, Ver) == false)
  871. return false;
  872. // status file has no (Download)Size, but all others are fair game
  873. // status file is parsed last, so the first version we encounter is
  874. // probably also the version we have downloaded
  875. unsigned long long const Size = Section.FindULL("Size");
  876. if (Size != 0 && Size != Ver->Size)
  877. return false;
  878. // available everywhere, but easier to check here than to include in VersionHash
  879. unsigned char MultiArch = ParseMultiArch(false);
  880. if (MultiArch != Ver->MultiArch)
  881. return false;
  882. // for all practical proposes (we can check): same version
  883. return true;
  884. }
  885. /*}}}*/
  886. debDebFileParser::debDebFileParser(FileFd *File, std::string const &DebFile)
  887. : debListParser(File), DebFile(DebFile)
  888. {
  889. }
  890. bool debDebFileParser::UsePackage(pkgCache::PkgIterator &Pkg,
  891. pkgCache::VerIterator &Ver)
  892. {
  893. bool res = debListParser::UsePackage(Pkg, Ver);
  894. // we use the full file path as a provides so that the file is found
  895. // by its name
  896. if(NewProvides(Ver, DebFile, Pkg.Cache()->NativeArch(), Ver.VerStr(), 0) == false)
  897. return false;
  898. return res;
  899. }
  900. debListParser::~debListParser() {}