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.

apt-cache.cc 60 KiB

[ Martin Pitt ] * debian/rules: - Make DEB_BUILD_OPTIONS=noopt actually work by passing the right CXXFLAGS. * apt-pkg/contrib/fileutl.{h,cc}: - Add support for reading of gzipped files with the new "ReadOnlyGzip" OpenMode. (Closes: #188407) - Link against zlib (in apt-pkg/makefile) and add zlib build dependency. - [ABI BREAK] This adds a new private member to FileFd, but its initialization is in the public header file. * configure.in: - Check for zlib library and headers. * apt-pkg/acquire-item.cc, apt-pkg/deb/debindexfile.cc, apt-pkg/deb/debrecords.cc, apt-pkg/deb/debsrcrecords.h, cmdline/apt-cache.cc: - Open Packages, Sources, and Translations indexes in "ReadOnlyGzip" mode. * apt-pkg/deb/debindexfile.cc: - If we do not find uncompressed package/source/translation indexes, look for gzip compressed ones. * apt-pkg/acquire-item.cc: - If the Acquire::GzipIndexes option is true and we download a gzipped index file, keep it as it is (and rename to .gz) instead of uncompressing it. * doc/apt.conf.5.xml: - Document the new Acquire::GzipIndexes option. * doc/po/apt-doc.pot, doc/po/de.po: - German translation of new Acquire::GzipIndexes option. * Add test/test-indexes.sh: - Test behaviour of index retrieval and usage, in particular with uncompressed and gzip compressed indexes. * methods/gzip.cc: With FileFd now being able to read gzipped files, there is no need for the gzip method any more to spawn an external gzip process. Rewrite it to use FileFd directly, which makes the code a lot simpler, and also using less memory and overhead.
11 years ago
* updated with mainline Patches applied: * andrelop@debian.org/apt--translation--0--base-0 tag of apt@packages.debian.org/apt--main--0--patch-79 * andrelop@debian.org/apt--translation--0--patch-1 Sync with Matt version. * andrelop@debian.org/apt--translation--0--patch-2 Update pt_BR translation * andrelop@debian.org/apt--translation--0--patch-3 Sync with bubulle's branch. * apt@packages.debian.org/apt--main--0--patch-88 Change debian/bugscript to use #!/bin/bash (Closes: #313402) * apt@packages.debian.org/apt--main--0--patch-89 Branch for Debian * apt@packages.debian.org/apt--main--0--patch-90 Update version in configure * apt@packages.debian.org/apt--main--0--patch-91 Fix French man page build * apt@packages.debian.org/apt--main--0--patch-92 Add the current Debian archive signing key * apt@packages.debian.org/apt--main--0--patch-93 Merge with mvo * apt@packages.debian.org/apt--main--0--patch-94 Update changelog * apt@packages.debian.org/apt--main--0--patch-95 Merge Christian's branch * apt@packages.debian.org/apt--main--0--patch-96 Update changelog * apt@packages.debian.org/apt--main--0--patch-97 Update priority of apt-utils to important, to match the override file * apt@packages.debian.org/apt--main--0--patch-98 Install only one keyring on each branch (Closes: #316119) * apt@packages.debian.org/apt--main--0--patch-99 Finalize 0.6.39 * apt@packages.debian.org/apt--main--0--patch-100 Use debian.org address in mainline * apt@packages.debian.org/apt--main--0--patch-101 Update pot file * apt@packages.debian.org/apt--main--0--patch-102 Open 0.6.40 * apt@packages.debian.org/apt--main--0--patch-103 Patch from Jordi Mallach to mark some additional strings for translation * apt@packages.debian.org/apt--main--0--patch-104 Updated Catalan translation from Jordi Mallach * apt@packages.debian.org/apt--main--0--patch-105 Merge from bubulle@debian.org--2005/apt--main--0 * apt@packages.debian.org/apt--main--0--patch-106 Restore lost changelog entries * apt@packages.debian.org/apt--main--0--patch-107 Merge michael.vogt@ubuntu.com--2005/apt--progress-reporting--0 * apt@packages.debian.org/apt--main--0--patch-108 Merge michael.vogt@ubuntu.com--2005/apt--progress-reporting--0 * apt@packages.debian.org/apt--main--0--patch-109 Merge michael.vogt@ubuntu.com--2005/apt--progress-reporting--0 * apt@packages.debian.org/apt--main--0--patch-110 Merge michael.vogt@ubuntu.com--2005/apt--progress-reporting--0 * bubulle@debian.org--2005/apt--main--0--patch-82 Fix permissions * bubulle@debian.org--2005/apt--main--0--patch-83 French translation spellchecked * bubulle@debian.org--2005/apt--main--0--patch-84 Spell corrections in German translations * bubulle@debian.org--2005/apt--main--0--patch-85 Correct some file permissions * bubulle@debian.org--2005/apt--main--0--patch-86 Correct Hebrew translation * bubulle@debian.org--2005/apt--main--0--patch-87 Sync Portuguese translation with the POT file * bubulle@debian.org--2005/apt--main--0--patch-88 Updated Danish translation (not yet complete) * bubulle@debian.org--2005/apt--main--0--patch-89 Sync with Andre Luis Lopes and Otavio branches * bubulle@debian.org--2005/apt--main--0--patch-90 Merge with Matt * bubulle@debian.org--2005/apt--main--0--patch-91 Updated Slovak translation * bubulle@debian.org--2005/apt--main--0--patch-92 Add apt-key French man page * bubulle@debian.org--2005/apt--main--0--patch-93 Update Greek translations * bubulle@debian.org--2005/apt--main--0--patch-94 Merge with Matt * bubulle@debian.org--2005/apt--main--0--patch-95 Sync PO files with the POT file/French translation update * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-5 * merged with apt--main--0 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-6 * build fix for apt--main--0 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-22 * added myself to uploaders, changelog is signed with mvo@debian.org and in sync with the debian/experimental upload * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-23 * apt-cache show <virtual-pkg> shows all virtual packages instead of nothing (thanks to otavio) * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-24 * changelog updated * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-25 * make pinning on component work again (we just use the section, as apt-0.6 don't use per-section Release files anymore) * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-27 * updated the changelog * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-28 * merged with my apt--fixes--0 branch * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-29 * added a missing OpProgress::Done() in depCache::Init(), removed the show-virtual-packages patch in apt-cache because matt does not like him :/ * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-30 * fix a stupid bug in the depcache::Init() code * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-31 * merged/removed conflicts with apt--main--0 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-32 * merged apt--main and make sure that the po files come from apt--main (because they are more recent) * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--base-0 tag of apt@packages.debian.org/apt--main--0--patch-85 * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-1 * inital proof of concept code, understands what dpkg tells it already * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-2 * progress reporting works now * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-3 * added "APT::Status-Fd" variable * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-4 * do i18n now too * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-5 * define N_(x) if it is not defined already * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-6 * PackageManager::DoInstall(int status_fd) added (does not break the ABI) * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-7 * merged with apt--fixes--0 to make it build again * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-8 * added support for "error" and "conffile-prompt" messages from dpkg * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-9 merge with main * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-10 * use sizeof() for all snprintf() uses; fix a potential line break problem in the status reading code; changed the N_() to _() calls * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-11 * added APT::KeepFDs configuration list for file descriptors that apt should leave open (needed for various frontends like debconf, synaptic) * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-12 * fixed a API breakage * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-13 * doc added, should be releasable now * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-14 * merged with apt--main--0 * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-15 * more source comments, added Debug::DpkgPM debug code to inspect the dpkg<->apt communication, broke the abi (ok with matt) * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-16 * the progress reporting has it's own "Debug::pkgDPkgProgressReporting" debug variable now * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-17 * merged PackageOps and TranslatedPackageOps into a single Map with the new DpkgState struct * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-18 * clear the APT::Keep-Fds configuration when it's no longer needed * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-19 * rewrote the reading from dpkg so that it never blocks * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-20 * merged the two status arrays into one * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-21 * added support for download progress reporting too (for Kamion and base-config) * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-22 * ABI break; added Configuration::Clear(string List, {int,string} value) added (to remove a single Value from a list); test/conf_clear.cc added * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-23 * remvoed a debug string * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-24 * soname changed, fixed a bug in the parsing code when dpkg send the same state more than once (at the end) * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-25 * merged with apt@packages.debian.org/apt--main--0, added changelog entry for the 0.6.40.1 upload * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-26 * fix a bug when out-of-order states are send from dpkg * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-27 * changelog update * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-28 * a real changelog entry now * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-29 * changelog finalized * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-30 * propper (and sane) support for pmerror and pmconffile added
16 years ago
* updated with mainline Patches applied: * andrelop@debian.org/apt--translation--0--base-0 tag of apt@packages.debian.org/apt--main--0--patch-79 * andrelop@debian.org/apt--translation--0--patch-1 Sync with Matt version. * andrelop@debian.org/apt--translation--0--patch-2 Update pt_BR translation * andrelop@debian.org/apt--translation--0--patch-3 Sync with bubulle's branch. * apt@packages.debian.org/apt--main--0--patch-88 Change debian/bugscript to use #!/bin/bash (Closes: #313402) * apt@packages.debian.org/apt--main--0--patch-89 Branch for Debian * apt@packages.debian.org/apt--main--0--patch-90 Update version in configure * apt@packages.debian.org/apt--main--0--patch-91 Fix French man page build * apt@packages.debian.org/apt--main--0--patch-92 Add the current Debian archive signing key * apt@packages.debian.org/apt--main--0--patch-93 Merge with mvo * apt@packages.debian.org/apt--main--0--patch-94 Update changelog * apt@packages.debian.org/apt--main--0--patch-95 Merge Christian's branch * apt@packages.debian.org/apt--main--0--patch-96 Update changelog * apt@packages.debian.org/apt--main--0--patch-97 Update priority of apt-utils to important, to match the override file * apt@packages.debian.org/apt--main--0--patch-98 Install only one keyring on each branch (Closes: #316119) * apt@packages.debian.org/apt--main--0--patch-99 Finalize 0.6.39 * apt@packages.debian.org/apt--main--0--patch-100 Use debian.org address in mainline * apt@packages.debian.org/apt--main--0--patch-101 Update pot file * apt@packages.debian.org/apt--main--0--patch-102 Open 0.6.40 * apt@packages.debian.org/apt--main--0--patch-103 Patch from Jordi Mallach to mark some additional strings for translation * apt@packages.debian.org/apt--main--0--patch-104 Updated Catalan translation from Jordi Mallach * apt@packages.debian.org/apt--main--0--patch-105 Merge from bubulle@debian.org--2005/apt--main--0 * apt@packages.debian.org/apt--main--0--patch-106 Restore lost changelog entries * apt@packages.debian.org/apt--main--0--patch-107 Merge michael.vogt@ubuntu.com--2005/apt--progress-reporting--0 * apt@packages.debian.org/apt--main--0--patch-108 Merge michael.vogt@ubuntu.com--2005/apt--progress-reporting--0 * apt@packages.debian.org/apt--main--0--patch-109 Merge michael.vogt@ubuntu.com--2005/apt--progress-reporting--0 * apt@packages.debian.org/apt--main--0--patch-110 Merge michael.vogt@ubuntu.com--2005/apt--progress-reporting--0 * bubulle@debian.org--2005/apt--main--0--patch-82 Fix permissions * bubulle@debian.org--2005/apt--main--0--patch-83 French translation spellchecked * bubulle@debian.org--2005/apt--main--0--patch-84 Spell corrections in German translations * bubulle@debian.org--2005/apt--main--0--patch-85 Correct some file permissions * bubulle@debian.org--2005/apt--main--0--patch-86 Correct Hebrew translation * bubulle@debian.org--2005/apt--main--0--patch-87 Sync Portuguese translation with the POT file * bubulle@debian.org--2005/apt--main--0--patch-88 Updated Danish translation (not yet complete) * bubulle@debian.org--2005/apt--main--0--patch-89 Sync with Andre Luis Lopes and Otavio branches * bubulle@debian.org--2005/apt--main--0--patch-90 Merge with Matt * bubulle@debian.org--2005/apt--main--0--patch-91 Updated Slovak translation * bubulle@debian.org--2005/apt--main--0--patch-92 Add apt-key French man page * bubulle@debian.org--2005/apt--main--0--patch-93 Update Greek translations * bubulle@debian.org--2005/apt--main--0--patch-94 Merge with Matt * bubulle@debian.org--2005/apt--main--0--patch-95 Sync PO files with the POT file/French translation update * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-5 * merged with apt--main--0 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-6 * build fix for apt--main--0 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-22 * added myself to uploaders, changelog is signed with mvo@debian.org and in sync with the debian/experimental upload * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-23 * apt-cache show <virtual-pkg> shows all virtual packages instead of nothing (thanks to otavio) * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-24 * changelog updated * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-25 * make pinning on component work again (we just use the section, as apt-0.6 don't use per-section Release files anymore) * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-27 * updated the changelog * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-28 * merged with my apt--fixes--0 branch * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-29 * added a missing OpProgress::Done() in depCache::Init(), removed the show-virtual-packages patch in apt-cache because matt does not like him :/ * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-30 * fix a stupid bug in the depcache::Init() code * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-31 * merged/removed conflicts with apt--main--0 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-32 * merged apt--main and make sure that the po files come from apt--main (because they are more recent) * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--base-0 tag of apt@packages.debian.org/apt--main--0--patch-85 * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-1 * inital proof of concept code, understands what dpkg tells it already * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-2 * progress reporting works now * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-3 * added "APT::Status-Fd" variable * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-4 * do i18n now too * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-5 * define N_(x) if it is not defined already * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-6 * PackageManager::DoInstall(int status_fd) added (does not break the ABI) * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-7 * merged with apt--fixes--0 to make it build again * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-8 * added support for "error" and "conffile-prompt" messages from dpkg * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-9 merge with main * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-10 * use sizeof() for all snprintf() uses; fix a potential line break problem in the status reading code; changed the N_() to _() calls * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-11 * added APT::KeepFDs configuration list for file descriptors that apt should leave open (needed for various frontends like debconf, synaptic) * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-12 * fixed a API breakage * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-13 * doc added, should be releasable now * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-14 * merged with apt--main--0 * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-15 * more source comments, added Debug::DpkgPM debug code to inspect the dpkg<->apt communication, broke the abi (ok with matt) * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-16 * the progress reporting has it's own "Debug::pkgDPkgProgressReporting" debug variable now * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-17 * merged PackageOps and TranslatedPackageOps into a single Map with the new DpkgState struct * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-18 * clear the APT::Keep-Fds configuration when it's no longer needed * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-19 * rewrote the reading from dpkg so that it never blocks * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-20 * merged the two status arrays into one * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-21 * added support for download progress reporting too (for Kamion and base-config) * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-22 * ABI break; added Configuration::Clear(string List, {int,string} value) added (to remove a single Value from a list); test/conf_clear.cc added * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-23 * remvoed a debug string * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-24 * soname changed, fixed a bug in the parsing code when dpkg send the same state more than once (at the end) * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-25 * merged with apt@packages.debian.org/apt--main--0, added changelog entry for the 0.6.40.1 upload * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-26 * fix a bug when out-of-order states are send from dpkg * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-27 * changelog update * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-28 * a real changelog entry now * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-29 * changelog finalized * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-30 * propper (and sane) support for pmerror and pmconffile added
16 years ago
* updated with mainline Patches applied: * andrelop@debian.org/apt--translation--0--base-0 tag of apt@packages.debian.org/apt--main--0--patch-79 * andrelop@debian.org/apt--translation--0--patch-1 Sync with Matt version. * andrelop@debian.org/apt--translation--0--patch-2 Update pt_BR translation * andrelop@debian.org/apt--translation--0--patch-3 Sync with bubulle's branch. * apt@packages.debian.org/apt--main--0--patch-88 Change debian/bugscript to use #!/bin/bash (Closes: #313402) * apt@packages.debian.org/apt--main--0--patch-89 Branch for Debian * apt@packages.debian.org/apt--main--0--patch-90 Update version in configure * apt@packages.debian.org/apt--main--0--patch-91 Fix French man page build * apt@packages.debian.org/apt--main--0--patch-92 Add the current Debian archive signing key * apt@packages.debian.org/apt--main--0--patch-93 Merge with mvo * apt@packages.debian.org/apt--main--0--patch-94 Update changelog * apt@packages.debian.org/apt--main--0--patch-95 Merge Christian's branch * apt@packages.debian.org/apt--main--0--patch-96 Update changelog * apt@packages.debian.org/apt--main--0--patch-97 Update priority of apt-utils to important, to match the override file * apt@packages.debian.org/apt--main--0--patch-98 Install only one keyring on each branch (Closes: #316119) * apt@packages.debian.org/apt--main--0--patch-99 Finalize 0.6.39 * apt@packages.debian.org/apt--main--0--patch-100 Use debian.org address in mainline * apt@packages.debian.org/apt--main--0--patch-101 Update pot file * apt@packages.debian.org/apt--main--0--patch-102 Open 0.6.40 * apt@packages.debian.org/apt--main--0--patch-103 Patch from Jordi Mallach to mark some additional strings for translation * apt@packages.debian.org/apt--main--0--patch-104 Updated Catalan translation from Jordi Mallach * apt@packages.debian.org/apt--main--0--patch-105 Merge from bubulle@debian.org--2005/apt--main--0 * apt@packages.debian.org/apt--main--0--patch-106 Restore lost changelog entries * apt@packages.debian.org/apt--main--0--patch-107 Merge michael.vogt@ubuntu.com--2005/apt--progress-reporting--0 * apt@packages.debian.org/apt--main--0--patch-108 Merge michael.vogt@ubuntu.com--2005/apt--progress-reporting--0 * apt@packages.debian.org/apt--main--0--patch-109 Merge michael.vogt@ubuntu.com--2005/apt--progress-reporting--0 * apt@packages.debian.org/apt--main--0--patch-110 Merge michael.vogt@ubuntu.com--2005/apt--progress-reporting--0 * bubulle@debian.org--2005/apt--main--0--patch-82 Fix permissions * bubulle@debian.org--2005/apt--main--0--patch-83 French translation spellchecked * bubulle@debian.org--2005/apt--main--0--patch-84 Spell corrections in German translations * bubulle@debian.org--2005/apt--main--0--patch-85 Correct some file permissions * bubulle@debian.org--2005/apt--main--0--patch-86 Correct Hebrew translation * bubulle@debian.org--2005/apt--main--0--patch-87 Sync Portuguese translation with the POT file * bubulle@debian.org--2005/apt--main--0--patch-88 Updated Danish translation (not yet complete) * bubulle@debian.org--2005/apt--main--0--patch-89 Sync with Andre Luis Lopes and Otavio branches * bubulle@debian.org--2005/apt--main--0--patch-90 Merge with Matt * bubulle@debian.org--2005/apt--main--0--patch-91 Updated Slovak translation * bubulle@debian.org--2005/apt--main--0--patch-92 Add apt-key French man page * bubulle@debian.org--2005/apt--main--0--patch-93 Update Greek translations * bubulle@debian.org--2005/apt--main--0--patch-94 Merge with Matt * bubulle@debian.org--2005/apt--main--0--patch-95 Sync PO files with the POT file/French translation update * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-5 * merged with apt--main--0 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-6 * build fix for apt--main--0 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-22 * added myself to uploaders, changelog is signed with mvo@debian.org and in sync with the debian/experimental upload * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-23 * apt-cache show <virtual-pkg> shows all virtual packages instead of nothing (thanks to otavio) * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-24 * changelog updated * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-25 * make pinning on component work again (we just use the section, as apt-0.6 don't use per-section Release files anymore) * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-27 * updated the changelog * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-28 * merged with my apt--fixes--0 branch * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-29 * added a missing OpProgress::Done() in depCache::Init(), removed the show-virtual-packages patch in apt-cache because matt does not like him :/ * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-30 * fix a stupid bug in the depcache::Init() code * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-31 * merged/removed conflicts with apt--main--0 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-32 * merged apt--main and make sure that the po files come from apt--main (because they are more recent) * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--base-0 tag of apt@packages.debian.org/apt--main--0--patch-85 * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-1 * inital proof of concept code, understands what dpkg tells it already * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-2 * progress reporting works now * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-3 * added "APT::Status-Fd" variable * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-4 * do i18n now too * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-5 * define N_(x) if it is not defined already * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-6 * PackageManager::DoInstall(int status_fd) added (does not break the ABI) * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-7 * merged with apt--fixes--0 to make it build again * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-8 * added support for "error" and "conffile-prompt" messages from dpkg * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-9 merge with main * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-10 * use sizeof() for all snprintf() uses; fix a potential line break problem in the status reading code; changed the N_() to _() calls * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-11 * added APT::KeepFDs configuration list for file descriptors that apt should leave open (needed for various frontends like debconf, synaptic) * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-12 * fixed a API breakage * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-13 * doc added, should be releasable now * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-14 * merged with apt--main--0 * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-15 * more source comments, added Debug::DpkgPM debug code to inspect the dpkg<->apt communication, broke the abi (ok with matt) * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-16 * the progress reporting has it's own "Debug::pkgDPkgProgressReporting" debug variable now * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-17 * merged PackageOps and TranslatedPackageOps into a single Map with the new DpkgState struct * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-18 * clear the APT::Keep-Fds configuration when it's no longer needed * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-19 * rewrote the reading from dpkg so that it never blocks * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-20 * merged the two status arrays into one * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-21 * added support for download progress reporting too (for Kamion and base-config) * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-22 * ABI break; added Configuration::Clear(string List, {int,string} value) added (to remove a single Value from a list); test/conf_clear.cc added * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-23 * remvoed a debug string * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-24 * soname changed, fixed a bug in the parsing code when dpkg send the same state more than once (at the end) * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-25 * merged with apt@packages.debian.org/apt--main--0, added changelog entry for the 0.6.40.1 upload * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-26 * fix a bug when out-of-order states are send from dpkg * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-27 * changelog update * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-28 * a real changelog entry now * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-29 * changelog finalized * michael.vogt@ubuntu.com--2005/apt--progress-reporting--0--patch-30 * propper (and sane) support for pmerror and pmconffile added
16 years ago
Merge apt--authentication--0 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 * 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/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
Merge apt--authentication--0 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 * 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/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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: apt-cache.cc,v 1.72 2004/04/30 04:34:03 mdz Exp $
  4. /* ######################################################################
  5. apt-cache - Manages the cache files
  6. apt-cache provides some functions fo manipulating the cache files.
  7. It uses the command line interface common to all the APT tools.
  8. Returns 100 on failure, 0 on success.
  9. ##################################################################### */
  10. /*}}}*/
  11. // Include Files /*{{{*/
  12. #include <apt-pkg/error.h>
  13. #include <cassert>
  14. #include <apt-pkg/pkgcachegen.h>
  15. #include <apt-pkg/cachefile.h>
  16. #include <apt-pkg/cacheset.h>
  17. #include <apt-pkg/init.h>
  18. #include <apt-pkg/progress.h>
  19. #include <apt-pkg/sourcelist.h>
  20. #include <apt-pkg/cmndline.h>
  21. #include <apt-pkg/strutl.h>
  22. #include <apt-pkg/pkgrecords.h>
  23. #include <apt-pkg/srcrecords.h>
  24. #include <apt-pkg/version.h>
  25. #include <apt-pkg/policy.h>
  26. #include <apt-pkg/tagfile.h>
  27. #include <apt-pkg/algorithms.h>
  28. #include <apt-pkg/sptr.h>
  29. #include <config.h>
  30. #include <apti18n.h>
  31. #include <locale.h>
  32. #include <iostream>
  33. #include <unistd.h>
  34. #include <errno.h>
  35. #include <regex.h>
  36. #include <stdio.h>
  37. #include <iomanip>
  38. /*}}}*/
  39. using namespace std;
  40. // LocalitySort - Sort a version list by package file locality /*{{{*/
  41. // ---------------------------------------------------------------------
  42. /* */
  43. int LocalityCompare(const void *a, const void *b)
  44. {
  45. pkgCache::VerFile *A = *(pkgCache::VerFile **)a;
  46. pkgCache::VerFile *B = *(pkgCache::VerFile **)b;
  47. if (A == 0 && B == 0)
  48. return 0;
  49. if (A == 0)
  50. return 1;
  51. if (B == 0)
  52. return -1;
  53. if (A->File == B->File)
  54. return A->Offset - B->Offset;
  55. return A->File - B->File;
  56. }
  57. void LocalitySort(pkgCache::VerFile **begin,
  58. unsigned long Count,size_t Size)
  59. {
  60. qsort(begin,Count,Size,LocalityCompare);
  61. }
  62. void LocalitySort(pkgCache::DescFile **begin,
  63. unsigned long Count,size_t Size)
  64. {
  65. qsort(begin,Count,Size,LocalityCompare);
  66. }
  67. /*}}}*/
  68. // UnMet - Show unmet dependencies /*{{{*/
  69. // ---------------------------------------------------------------------
  70. /* */
  71. bool ShowUnMet(pkgCache::VerIterator const &V, bool const &Important)
  72. {
  73. bool Header = false;
  74. for (pkgCache::DepIterator D = V.DependsList(); D.end() == false;)
  75. {
  76. // Collect or groups
  77. pkgCache::DepIterator Start;
  78. pkgCache::DepIterator End;
  79. D.GlobOr(Start,End);
  80. // Important deps only
  81. if (Important == true)
  82. if (End->Type != pkgCache::Dep::PreDepends &&
  83. End->Type != pkgCache::Dep::Depends)
  84. continue;
  85. // Skip conflicts and replaces
  86. if (End->Type == pkgCache::Dep::DpkgBreaks ||
  87. End->Type == pkgCache::Dep::Replaces ||
  88. End->Type == pkgCache::Dep::Conflicts)
  89. continue;
  90. // Verify the or group
  91. bool OK = false;
  92. pkgCache::DepIterator RealStart = Start;
  93. do
  94. {
  95. // See if this dep is Ok
  96. pkgCache::Version **VList = Start.AllTargets();
  97. if (*VList != 0)
  98. {
  99. OK = true;
  100. delete [] VList;
  101. break;
  102. }
  103. delete [] VList;
  104. if (Start == End)
  105. break;
  106. Start++;
  107. }
  108. while (1);
  109. // The group is OK
  110. if (OK == true)
  111. continue;
  112. // Oops, it failed..
  113. if (Header == false)
  114. ioprintf(cout,_("Package %s version %s has an unmet dep:\n"),
  115. V.ParentPkg().FullName(true).c_str(),V.VerStr());
  116. Header = true;
  117. // Print out the dep type
  118. cout << " " << End.DepType() << ": ";
  119. // Show the group
  120. Start = RealStart;
  121. do
  122. {
  123. cout << Start.TargetPkg().FullName(true);
  124. if (Start.TargetVer() != 0)
  125. cout << " (" << Start.CompType() << " " << Start.TargetVer() <<
  126. ")";
  127. if (Start == End)
  128. break;
  129. cout << " | ";
  130. Start++;
  131. }
  132. while (1);
  133. cout << endl;
  134. }
  135. return true;
  136. }
  137. bool UnMet(CommandLine &CmdL)
  138. {
  139. bool const Important = _config->FindB("APT::Cache::Important",false);
  140. pkgCacheFile CacheFile;
  141. if (unlikely(CacheFile.GetPkgCache() == NULL))
  142. return false;
  143. if (CmdL.FileSize() <= 1)
  144. {
  145. for (pkgCache::PkgIterator P = CacheFile.GetPkgCache()->PkgBegin(); P.end() == false; P++)
  146. for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; ++V)
  147. if (ShowUnMet(V, Important) == false)
  148. return false;
  149. }
  150. else
  151. {
  152. APT::VersionSet verset = APT::VersionSet::FromCommandLine(CacheFile, CmdL.FileList + 1);
  153. for (APT::VersionSet::iterator V = verset.begin(); V != verset.end(); ++V)
  154. if (ShowUnMet(V, Important) == false)
  155. return false;
  156. }
  157. return true;
  158. }
  159. /*}}}*/
  160. // DumpPackage - Show a dump of a package record /*{{{*/
  161. // ---------------------------------------------------------------------
  162. /* */
  163. bool DumpPackage(CommandLine &CmdL)
  164. {
  165. pkgCacheFile CacheFile;
  166. APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1);
  167. for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
  168. {
  169. cout << "Package: " << Pkg.FullName(true) << endl;
  170. cout << "Versions: " << endl;
  171. for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; Cur++)
  172. {
  173. cout << Cur.VerStr();
  174. for (pkgCache::VerFileIterator Vf = Cur.FileList(); Vf.end() == false; Vf++)
  175. cout << " (" << Vf.File().FileName() << ")";
  176. cout << endl;
  177. for (pkgCache::DescIterator D = Cur.DescriptionList(); D.end() == false; D++)
  178. {
  179. cout << " Description Language: " << D.LanguageCode() << endl
  180. << " File: " << D.FileList().File().FileName() << endl
  181. << " MD5: " << D.md5() << endl;
  182. }
  183. cout << endl;
  184. }
  185. cout << endl;
  186. cout << "Reverse Depends: " << endl;
  187. for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() != true; D++)
  188. {
  189. cout << " " << D.ParentPkg().FullName(true) << ',' << D.TargetPkg().FullName(true);
  190. if (D->Version != 0)
  191. cout << ' ' << DeNull(D.TargetVer()) << endl;
  192. else
  193. cout << endl;
  194. }
  195. cout << "Dependencies: " << endl;
  196. for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; Cur++)
  197. {
  198. cout << Cur.VerStr() << " - ";
  199. for (pkgCache::DepIterator Dep = Cur.DependsList(); Dep.end() != true; Dep++)
  200. cout << Dep.TargetPkg().FullName(true) << " (" << (int)Dep->CompareOp << " " << DeNull(Dep.TargetVer()) << ") ";
  201. cout << endl;
  202. }
  203. cout << "Provides: " << endl;
  204. for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; Cur++)
  205. {
  206. cout << Cur.VerStr() << " - ";
  207. for (pkgCache::PrvIterator Prv = Cur.ProvidesList(); Prv.end() != true; Prv++)
  208. cout << Prv.ParentPkg().FullName(true) << " ";
  209. cout << endl;
  210. }
  211. cout << "Reverse Provides: " << endl;
  212. for (pkgCache::PrvIterator Prv = Pkg.ProvidesList(); Prv.end() != true; Prv++)
  213. cout << Prv.OwnerPkg().FullName(true) << " " << Prv.OwnerVer().VerStr() << endl;
  214. }
  215. return true;
  216. }
  217. /*}}}*/
  218. // Stats - Dump some nice statistics /*{{{*/
  219. // ---------------------------------------------------------------------
  220. /* */
  221. bool Stats(CommandLine &Cmd)
  222. {
  223. pkgCacheFile CacheFile;
  224. pkgCache *Cache = CacheFile.GetPkgCache();
  225. if (unlikely(Cache == NULL))
  226. return false;
  227. cout << _("Total package names: ") << Cache->Head().GroupCount << " (" <<
  228. SizeToStr(Cache->Head().GroupCount*Cache->Head().GroupSz) << ')' << endl
  229. << _("Total package structures: ") << Cache->Head().PackageCount << " (" <<
  230. SizeToStr(Cache->Head().PackageCount*Cache->Head().PackageSz) << ')' << endl;
  231. int Normal = 0;
  232. int Virtual = 0;
  233. int NVirt = 0;
  234. int DVirt = 0;
  235. int Missing = 0;
  236. pkgCache::PkgIterator I = Cache->PkgBegin();
  237. for (;I.end() != true; I++)
  238. {
  239. if (I->VersionList != 0 && I->ProvidesList == 0)
  240. {
  241. Normal++;
  242. continue;
  243. }
  244. if (I->VersionList != 0 && I->ProvidesList != 0)
  245. {
  246. NVirt++;
  247. continue;
  248. }
  249. if (I->VersionList == 0 && I->ProvidesList != 0)
  250. {
  251. // Only 1 provides
  252. if (I.ProvidesList()->NextProvides == 0)
  253. {
  254. DVirt++;
  255. }
  256. else
  257. Virtual++;
  258. continue;
  259. }
  260. if (I->VersionList == 0 && I->ProvidesList == 0)
  261. {
  262. Missing++;
  263. continue;
  264. }
  265. }
  266. cout << _(" Normal packages: ") << Normal << endl;
  267. cout << _(" Pure virtual packages: ") << Virtual << endl;
  268. cout << _(" Single virtual packages: ") << DVirt << endl;
  269. cout << _(" Mixed virtual packages: ") << NVirt << endl;
  270. cout << _(" Missing: ") << Missing << endl;
  271. cout << _("Total distinct versions: ") << Cache->Head().VersionCount << " (" <<
  272. SizeToStr(Cache->Head().VersionCount*Cache->Head().VersionSz) << ')' << endl;
  273. cout << _("Total distinct descriptions: ") << Cache->Head().DescriptionCount << " (" <<
  274. SizeToStr(Cache->Head().DescriptionCount*Cache->Head().DescriptionSz) << ')' << endl;
  275. cout << _("Total dependencies: ") << Cache->Head().DependsCount << " (" <<
  276. SizeToStr(Cache->Head().DependsCount*Cache->Head().DependencySz) << ')' << endl;
  277. cout << _("Total ver/file relations: ") << Cache->Head().VerFileCount << " (" <<
  278. SizeToStr(Cache->Head().VerFileCount*Cache->Head().VerFileSz) << ')' << endl;
  279. cout << _("Total Desc/File relations: ") << Cache->Head().DescFileCount << " (" <<
  280. SizeToStr(Cache->Head().DescFileCount*Cache->Head().DescFileSz) << ')' << endl;
  281. cout << _("Total Provides mappings: ") << Cache->Head().ProvidesCount << " (" <<
  282. SizeToStr(Cache->Head().ProvidesCount*Cache->Head().ProvidesSz) << ')' << endl;
  283. // String list stats
  284. unsigned long Size = 0;
  285. unsigned long Count = 0;
  286. for (pkgCache::StringItem *I = Cache->StringItemP + Cache->Head().StringList;
  287. I!= Cache->StringItemP; I = Cache->StringItemP + I->NextItem)
  288. {
  289. Count++;
  290. Size += strlen(Cache->StrP + I->String) + 1;
  291. }
  292. cout << _("Total globbed strings: ") << Count << " (" << SizeToStr(Size) << ')' << endl;
  293. unsigned long DepVerSize = 0;
  294. for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; P++)
  295. {
  296. for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; V++)
  297. {
  298. for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; D++)
  299. {
  300. if (D->Version != 0)
  301. DepVerSize += strlen(D.TargetVer()) + 1;
  302. }
  303. }
  304. }
  305. cout << _("Total dependency version space: ") << SizeToStr(DepVerSize) << endl;
  306. unsigned long Slack = 0;
  307. for (int I = 0; I != 7; I++)
  308. Slack += Cache->Head().Pools[I].ItemSize*Cache->Head().Pools[I].Count;
  309. cout << _("Total slack space: ") << SizeToStr(Slack) << endl;
  310. unsigned long Total = 0;
  311. Total = Slack + Size + Cache->Head().DependsCount*Cache->Head().DependencySz +
  312. Cache->Head().VersionCount*Cache->Head().VersionSz +
  313. Cache->Head().PackageCount*Cache->Head().PackageSz +
  314. Cache->Head().VerFileCount*Cache->Head().VerFileSz +
  315. Cache->Head().ProvidesCount*Cache->Head().ProvidesSz;
  316. cout << _("Total space accounted for: ") << SizeToStr(Total) << endl;
  317. return true;
  318. }
  319. /*}}}*/
  320. // Dump - show everything /*{{{*/
  321. // ---------------------------------------------------------------------
  322. /* This is worthless except fer debugging things */
  323. bool Dump(CommandLine &Cmd)
  324. {
  325. pkgCacheFile CacheFile;
  326. pkgCache *Cache = CacheFile.GetPkgCache();
  327. if (unlikely(Cache == NULL))
  328. return false;
  329. cout << "Using Versioning System: " << Cache->VS->Label << endl;
  330. for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; P++)
  331. {
  332. cout << "Package: " << P.FullName(true) << endl;
  333. for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; V++)
  334. {
  335. cout << " Version: " << V.VerStr() << endl;
  336. cout << " File: " << V.FileList().File().FileName() << endl;
  337. for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; D++)
  338. cout << " Depends: " << D.TargetPkg().FullName(true) << ' ' <<
  339. DeNull(D.TargetVer()) << endl;
  340. for (pkgCache::DescIterator D = V.DescriptionList(); D.end() == false; D++)
  341. {
  342. cout << " Description Language: " << D.LanguageCode() << endl
  343. << " File: " << D.FileList().File().FileName() << endl
  344. << " MD5: " << D.md5() << endl;
  345. }
  346. }
  347. }
  348. for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F.end() == false; F++)
  349. {
  350. cout << "File: " << F.FileName() << endl;
  351. cout << " Type: " << F.IndexType() << endl;
  352. cout << " Size: " << F->Size << endl;
  353. cout << " ID: " << F->ID << endl;
  354. cout << " Flags: " << F->Flags << endl;
  355. cout << " Time: " << TimeRFC1123(F->mtime) << endl;
  356. cout << " Archive: " << DeNull(F.Archive()) << endl;
  357. cout << " Component: " << DeNull(F.Component()) << endl;
  358. cout << " Version: " << DeNull(F.Version()) << endl;
  359. cout << " Origin: " << DeNull(F.Origin()) << endl;
  360. cout << " Site: " << DeNull(F.Site()) << endl;
  361. cout << " Label: " << DeNull(F.Label()) << endl;
  362. cout << " Architecture: " << DeNull(F.Architecture()) << endl;
  363. }
  364. return true;
  365. }
  366. /*}}}*/
  367. // DumpAvail - Print out the available list /*{{{*/
  368. // ---------------------------------------------------------------------
  369. /* This is needed to make dpkg --merge happy.. I spent a bit of time to
  370. make this run really fast, perhaps I went a little overboard.. */
  371. bool DumpAvail(CommandLine &Cmd)
  372. {
  373. pkgCacheFile CacheFile;
  374. pkgCache *Cache = CacheFile.GetPkgCache();
  375. if (unlikely(Cache == NULL || CacheFile.BuildPolicy() == false))
  376. return false;
  377. unsigned long Count = Cache->HeaderP->PackageCount+1;
  378. pkgCache::VerFile **VFList = new pkgCache::VerFile *[Count];
  379. memset(VFList,0,sizeof(*VFList)*Count);
  380. // Map versions that we want to write out onto the VerList array.
  381. for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; P++)
  382. {
  383. if (P->VersionList == 0)
  384. continue;
  385. /* Find the proper version to use. If the policy says there are no
  386. possible selections we return the installed version, if available..
  387. This prevents dselect from making it obsolete. */
  388. pkgCache::VerIterator V = CacheFile.GetPolicy()->GetCandidateVer(P);
  389. if (V.end() == true)
  390. {
  391. if (P->CurrentVer == 0)
  392. continue;
  393. V = P.CurrentVer();
  394. }
  395. pkgCache::VerFileIterator VF = V.FileList();
  396. for (; VF.end() == false ; VF++)
  397. if ((VF.File()->Flags & pkgCache::Flag::NotSource) == 0)
  398. break;
  399. /* Okay, here we have a bit of a problem.. The policy has selected the
  400. currently installed package - however it only exists in the
  401. status file.. We need to write out something or dselect will mark
  402. the package as obsolete! Thus we emit the status file entry, but
  403. below we remove the status line to make it valid for the
  404. available file. However! We only do this if their do exist *any*
  405. non-source versions of the package - that way the dselect obsolete
  406. handling works OK. */
  407. if (VF.end() == true)
  408. {
  409. for (pkgCache::VerIterator Cur = P.VersionList(); Cur.end() != true; Cur++)
  410. {
  411. for (VF = Cur.FileList(); VF.end() == false; VF++)
  412. {
  413. if ((VF.File()->Flags & pkgCache::Flag::NotSource) == 0)
  414. {
  415. VF = V.FileList();
  416. break;
  417. }
  418. }
  419. if (VF.end() == false)
  420. break;
  421. }
  422. }
  423. VFList[P->ID] = VF;
  424. }
  425. LocalitySort(VFList,Count,sizeof(*VFList));
  426. // Iterate over all the package files and write them out.
  427. char *Buffer = new char[Cache->HeaderP->MaxVerFileSize+10];
  428. for (pkgCache::VerFile **J = VFList; *J != 0;)
  429. {
  430. pkgCache::PkgFileIterator File(*Cache,(*J)->File + Cache->PkgFileP);
  431. if (File.IsOk() == false)
  432. {
  433. _error->Error(_("Package file %s is out of sync."),File.FileName());
  434. break;
  435. }
  436. FileFd PkgF(File.FileName(),FileFd::ReadOnly);
  437. if (_error->PendingError() == true)
  438. break;
  439. /* Write all of the records from this package file, since we
  440. already did locality sorting we can now just seek through the
  441. file in read order. We apply 1 more optimization here, since often
  442. there will be < 1 byte gaps between records (for the \n) we read that
  443. into the next buffer and offset a bit.. */
  444. unsigned long Pos = 0;
  445. for (; *J != 0; J++)
  446. {
  447. if ((*J)->File + Cache->PkgFileP != File)
  448. break;
  449. const pkgCache::VerFile &VF = **J;
  450. // Read the record and then write it out again.
  451. unsigned long Jitter = VF.Offset - Pos;
  452. if (Jitter > 8)
  453. {
  454. if (PkgF.Seek(VF.Offset) == false)
  455. break;
  456. Jitter = 0;
  457. }
  458. if (PkgF.Read(Buffer,VF.Size + Jitter) == false)
  459. break;
  460. Buffer[VF.Size + Jitter] = '\n';
  461. // See above..
  462. if ((File->Flags & pkgCache::Flag::NotSource) == pkgCache::Flag::NotSource)
  463. {
  464. pkgTagSection Tags;
  465. TFRewriteData RW[] = {{"Status",0},{"Config-Version",0},{}};
  466. const char *Zero = 0;
  467. if (Tags.Scan(Buffer+Jitter,VF.Size+1) == false ||
  468. TFRewrite(stdout,Tags,&Zero,RW) == false)
  469. {
  470. _error->Error("Internal Error, Unable to parse a package record");
  471. break;
  472. }
  473. fputc('\n',stdout);
  474. }
  475. else
  476. {
  477. if (fwrite(Buffer+Jitter,VF.Size+1,1,stdout) != 1)
  478. break;
  479. }
  480. Pos = VF.Offset + VF.Size;
  481. }
  482. fflush(stdout);
  483. if (_error->PendingError() == true)
  484. break;
  485. }
  486. delete [] Buffer;
  487. delete [] VFList;
  488. return !_error->PendingError();
  489. }
  490. /*}}}*/
  491. // ShowDepends - Helper for printing out a dependency tree /*{{{*/
  492. class CacheSetHelperDepends: public APT::CacheSetHelper {
  493. public:
  494. APT::PackageSet virtualPkgs;
  495. virtual pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) {
  496. virtualPkgs.insert(Pkg);
  497. return pkgCache::VerIterator(Cache, 0);
  498. }
  499. virtual pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) {
  500. virtualPkgs.insert(Pkg);
  501. return pkgCache::VerIterator(Cache, 0);
  502. }
  503. CacheSetHelperDepends() : CacheSetHelper(false) {}
  504. };
  505. bool ShowDepends(CommandLine &CmdL, bool const RevDepends)
  506. {
  507. pkgCacheFile CacheFile;
  508. pkgCache *Cache = CacheFile.GetPkgCache();
  509. if (unlikely(Cache == NULL))
  510. return false;
  511. CacheSetHelperDepends helper;
  512. APT::VersionSet verset = APT::VersionSet::FromCommandLine(CacheFile, CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper);
  513. if (verset.empty() == true && helper.virtualPkgs.empty() == true)
  514. return false;
  515. std::vector<bool> Shown(Cache->Head().PackageCount);
  516. bool const Recurse = _config->FindB("APT::Cache::RecurseDepends", false);
  517. bool const Installed = _config->FindB("APT::Cache::Installed", false);
  518. bool const Important = _config->FindB("APT::Cache::Important", false);
  519. bool const ShowDepType = _config->FindB("APT::Cache::ShowDependencyType", RevDepends == false);
  520. bool const ShowPreDepends = _config->FindB("APT::Cache::ShowPre-Depends", true);
  521. bool const ShowDepends = _config->FindB("APT::Cache::ShowDepends", true);
  522. bool const ShowRecommends = _config->FindB("APT::Cache::ShowRecommends", Important == false);
  523. bool const ShowSuggests = _config->FindB("APT::Cache::ShowSuggests", Important == false);
  524. bool const ShowReplaces = _config->FindB("APT::Cache::ShowReplaces", Important == false);
  525. bool const ShowConflicts = _config->FindB("APT::Cache::ShowConflicts", Important == false);
  526. bool const ShowBreaks = _config->FindB("APT::Cache::ShowBreaks", Important == false);
  527. bool const ShowEnhances = _config->FindB("APT::Cache::ShowEnhances", Important == false);
  528. bool const ShowOnlyFirstOr = _config->FindB("APT::Cache::ShowOnlyFirstOr", false);
  529. while (verset.empty() != true)
  530. {
  531. pkgCache::VerIterator Ver = *verset.begin();
  532. verset.erase(verset.begin());
  533. pkgCache::PkgIterator Pkg = Ver.ParentPkg();
  534. Shown[Pkg->ID] = true;
  535. cout << Pkg.FullName(true) << endl;
  536. if (RevDepends == true)
  537. cout << "Reverse Depends:" << endl;
  538. for (pkgCache::DepIterator D = RevDepends ? Pkg.RevDependsList() : Ver.DependsList();
  539. D.end() == false; D++)
  540. {
  541. switch (D->Type) {
  542. case pkgCache::Dep::PreDepends: if (!ShowPreDepends) continue; break;
  543. case pkgCache::Dep::Depends: if (!ShowDepends) continue; break;
  544. case pkgCache::Dep::Recommends: if (!ShowRecommends) continue; break;
  545. case pkgCache::Dep::Suggests: if (!ShowSuggests) continue; break;
  546. case pkgCache::Dep::Replaces: if (!ShowReplaces) continue; break;
  547. case pkgCache::Dep::Conflicts: if (!ShowConflicts) continue; break;
  548. case pkgCache::Dep::DpkgBreaks: if (!ShowBreaks) continue; break;
  549. case pkgCache::Dep::Enhances: if (!ShowEnhances) continue; break;
  550. }
  551. pkgCache::PkgIterator Trg = RevDepends ? D.ParentPkg() : D.TargetPkg();
  552. if((Installed && Trg->CurrentVer != 0) || !Installed)
  553. {
  554. if ((D->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or && ShowOnlyFirstOr == false)
  555. cout << " |";
  556. else
  557. cout << " ";
  558. // Show the package
  559. if (ShowDepType == true)
  560. cout << D.DepType() << ": ";
  561. if (Trg->VersionList == 0)
  562. cout << "<" << Trg.FullName(true) << ">" << endl;
  563. else
  564. cout << Trg.FullName(true) << endl;
  565. if (Recurse == true && Shown[Trg->ID] == false)
  566. {
  567. Shown[Trg->ID] = true;
  568. verset.insert(APT::VersionSet::FromPackage(CacheFile, Trg, APT::VersionSet::CANDIDATE, helper));
  569. }
  570. }
  571. // Display all solutions
  572. SPtrArray<pkgCache::Version *> List = D.AllTargets();
  573. pkgPrioSortList(*Cache,List);
  574. for (pkgCache::Version **I = List; *I != 0; I++)
  575. {
  576. pkgCache::VerIterator V(*Cache,*I);
  577. if (V != Cache->VerP + V.ParentPkg()->VersionList ||
  578. V->ParentPkg == D->Package)
  579. continue;
  580. cout << " " << V.ParentPkg().FullName(true) << endl;
  581. if (Recurse == true && Shown[V.ParentPkg()->ID] == false)
  582. {
  583. Shown[V.ParentPkg()->ID] = true;
  584. verset.insert(APT::VersionSet::FromPackage(CacheFile, V.ParentPkg(), APT::VersionSet::CANDIDATE, helper));
  585. }
  586. }
  587. if (ShowOnlyFirstOr == true)
  588. while ((D->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or) ++D;
  589. }
  590. }
  591. for (APT::PackageSet::const_iterator Pkg = helper.virtualPkgs.begin();
  592. Pkg != helper.virtualPkgs.end(); ++Pkg)
  593. cout << '<' << Pkg.FullName(true) << '>' << endl;
  594. return true;
  595. }
  596. /*}}}*/
  597. // Depends - Print out a dependency tree /*{{{*/
  598. // ---------------------------------------------------------------------
  599. /* */
  600. bool Depends(CommandLine &CmdL)
  601. {
  602. return ShowDepends(CmdL, false);
  603. }
  604. /*}}}*/
  605. // RDepends - Print out a reverse dependency tree /*{{{*/
  606. // ---------------------------------------------------------------------
  607. /* */
  608. bool RDepends(CommandLine &CmdL)
  609. {
  610. return ShowDepends(CmdL, true);
  611. }
  612. /*}}}*/
  613. // xvcg - Generate a graph for xvcg /*{{{*/
  614. // ---------------------------------------------------------------------
  615. // Code contributed from Junichi Uekawa <dancer@debian.org> on 20 June 2002.
  616. bool XVcg(CommandLine &CmdL)
  617. {
  618. pkgCacheFile CacheFile;
  619. pkgCache *Cache = CacheFile.GetPkgCache();
  620. if (unlikely(Cache == NULL))
  621. return false;
  622. bool GivenOnly = _config->FindB("APT::Cache::GivenOnly",false);
  623. /* Normal packages are boxes
  624. Pure Provides are triangles
  625. Mixed are diamonds
  626. rhomb are missing packages*/
  627. const char *Shapes[] = {"ellipse","triangle","box","rhomb"};
  628. /* Initialize the list of packages to show.
  629. 1 = To Show
  630. 2 = To Show no recurse
  631. 3 = Emitted no recurse
  632. 4 = Emitted
  633. 0 = None */
  634. enum States {None=0, ToShow, ToShowNR, DoneNR, Done};
  635. enum TheFlags {ForceNR=(1<<0)};
  636. unsigned char *Show = new unsigned char[Cache->Head().PackageCount];
  637. unsigned char *Flags = new unsigned char[Cache->Head().PackageCount];
  638. unsigned char *ShapeMap = new unsigned char[Cache->Head().PackageCount];
  639. // Show everything if no arguments given
  640. if (CmdL.FileList[1] == 0)
  641. for (unsigned long I = 0; I != Cache->Head().PackageCount; I++)
  642. Show[I] = ToShow;
  643. else
  644. for (unsigned long I = 0; I != Cache->Head().PackageCount; I++)
  645. Show[I] = None;
  646. memset(Flags,0,sizeof(*Flags)*Cache->Head().PackageCount);
  647. // Map the shapes
  648. for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
  649. {
  650. if (Pkg->VersionList == 0)
  651. {
  652. // Missing
  653. if (Pkg->ProvidesList == 0)
  654. ShapeMap[Pkg->ID] = 0;
  655. else
  656. ShapeMap[Pkg->ID] = 1;
  657. }
  658. else
  659. {
  660. // Normal
  661. if (Pkg->ProvidesList == 0)
  662. ShapeMap[Pkg->ID] = 2;
  663. else
  664. ShapeMap[Pkg->ID] = 3;
  665. }
  666. }
  667. // Load the list of packages from the command line into the show list
  668. std::list<APT::PackageSet::Modifier> mods;
  669. mods.push_back(APT::PackageSet::Modifier(0, ",", APT::PackageSet::Modifier::POSTFIX));
  670. mods.push_back(APT::PackageSet::Modifier(1, "^", APT::PackageSet::Modifier::POSTFIX));
  671. std::map<unsigned short, APT::PackageSet> pkgsets =
  672. APT::PackageSet::GroupedFromCommandLine(CacheFile, CmdL.FileList + 1, mods, 0);
  673. for (APT::PackageSet::const_iterator Pkg = pkgsets[0].begin();
  674. Pkg != pkgsets[0].end(); ++Pkg)
  675. Show[Pkg->ID] = ToShow;
  676. for (APT::PackageSet::const_iterator Pkg = pkgsets[1].begin();
  677. Pkg != pkgsets[1].end(); ++Pkg)
  678. {
  679. Show[Pkg->ID] = ToShow;
  680. Flags[Pkg->ID] |= ForceNR;
  681. }
  682. // Little header
  683. cout << "graph: { title: \"packages\"" << endl <<
  684. "xmax: 700 ymax: 700 x: 30 y: 30" << endl <<
  685. "layout_downfactor: 8" << endl;
  686. bool Act = true;
  687. while (Act == true)
  688. {
  689. Act = false;
  690. for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
  691. {
  692. // See we need to show this package
  693. if (Show[Pkg->ID] == None || Show[Pkg->ID] >= DoneNR)
  694. continue;
  695. //printf ("node: { title: \"%s\" label: \"%s\" }\n", Pkg.Name(), Pkg.Name());
  696. // Colour as done
  697. if (Show[Pkg->ID] == ToShowNR || (Flags[Pkg->ID] & ForceNR) == ForceNR)
  698. {
  699. // Pure Provides and missing packages have no deps!
  700. if (ShapeMap[Pkg->ID] == 0 || ShapeMap[Pkg->ID] == 1)
  701. Show[Pkg->ID] = Done;
  702. else
  703. Show[Pkg->ID] = DoneNR;
  704. }
  705. else
  706. Show[Pkg->ID] = Done;
  707. Act = true;
  708. // No deps to map out
  709. if (Pkg->VersionList == 0 || Show[Pkg->ID] == DoneNR)
  710. continue;
  711. pkgCache::VerIterator Ver = Pkg.VersionList();
  712. for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++)
  713. {
  714. // See if anything can meet this dep
  715. // Walk along the actual package providing versions
  716. bool Hit = false;
  717. pkgCache::PkgIterator DPkg = D.TargetPkg();
  718. for (pkgCache::VerIterator I = DPkg.VersionList();
  719. I.end() == false && Hit == false; I++)
  720. {
  721. if (Cache->VS->CheckDep(I.VerStr(),D->CompareOp,D.TargetVer()) == true)
  722. Hit = true;
  723. }
  724. // Follow all provides
  725. for (pkgCache::PrvIterator I = DPkg.ProvidesList();
  726. I.end() == false && Hit == false; I++)
  727. {
  728. if (Cache->VS->CheckDep(I.ProvideVersion(),D->CompareOp,D.TargetVer()) == false)
  729. Hit = true;
  730. }
  731. // Only graph critical deps
  732. if (D.IsCritical() == true)
  733. {
  734. printf ("edge: { sourcename: \"%s\" targetname: \"%s\" class: 2 ",Pkg.FullName(true).c_str(), D.TargetPkg().FullName(true).c_str() );
  735. // Colour the node for recursion
  736. if (Show[D.TargetPkg()->ID] <= DoneNR)
  737. {
  738. /* If a conflicts does not meet anything in the database
  739. then show the relation but do not recurse */
  740. if (Hit == false &&
  741. (D->Type == pkgCache::Dep::Conflicts ||
  742. D->Type == pkgCache::Dep::DpkgBreaks ||
  743. D->Type == pkgCache::Dep::Obsoletes))
  744. {
  745. if (Show[D.TargetPkg()->ID] == None &&
  746. Show[D.TargetPkg()->ID] != ToShow)
  747. Show[D.TargetPkg()->ID] = ToShowNR;
  748. }
  749. else
  750. {
  751. if (GivenOnly == true && Show[D.TargetPkg()->ID] != ToShow)
  752. Show[D.TargetPkg()->ID] = ToShowNR;
  753. else
  754. Show[D.TargetPkg()->ID] = ToShow;
  755. }
  756. }
  757. // Edge colour
  758. switch(D->Type)
  759. {
  760. case pkgCache::Dep::Conflicts:
  761. printf("label: \"conflicts\" color: lightgreen }\n");
  762. break;
  763. case pkgCache::Dep::DpkgBreaks:
  764. printf("label: \"breaks\" color: lightgreen }\n");
  765. break;
  766. case pkgCache::Dep::Obsoletes:
  767. printf("label: \"obsoletes\" color: lightgreen }\n");
  768. break;
  769. case pkgCache::Dep::PreDepends:
  770. printf("label: \"predepends\" color: blue }\n");
  771. break;
  772. default:
  773. printf("}\n");
  774. break;
  775. }
  776. }
  777. }
  778. }
  779. }
  780. /* Draw the box colours after the fact since we can not tell what colour
  781. they should be until everything is finished drawing */
  782. for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
  783. {
  784. if (Show[Pkg->ID] < DoneNR)
  785. continue;
  786. if (Show[Pkg->ID] == DoneNR)
  787. printf("node: { title: \"%s\" label: \"%s\" color: orange shape: %s }\n", Pkg.FullName(true).c_str(), Pkg.FullName(true).c_str(),
  788. Shapes[ShapeMap[Pkg->ID]]);
  789. else
  790. printf("node: { title: \"%s\" label: \"%s\" shape: %s }\n", Pkg.FullName(true).c_str(), Pkg.FullName(true).c_str(),
  791. Shapes[ShapeMap[Pkg->ID]]);
  792. }
  793. delete[] Show;
  794. delete[] Flags;
  795. delete[] ShapeMap;
  796. printf("}\n");
  797. return true;
  798. }
  799. /*}}}*/
  800. // Dotty - Generate a graph for Dotty /*{{{*/
  801. // ---------------------------------------------------------------------
  802. /* Dotty is the graphvis program for generating graphs. It is a fairly
  803. simple queuing algorithm that just writes dependencies and nodes.
  804. http://www.research.att.com/sw/tools/graphviz/ */
  805. bool Dotty(CommandLine &CmdL)
  806. {
  807. pkgCacheFile CacheFile;
  808. pkgCache *Cache = CacheFile.GetPkgCache();
  809. if (unlikely(Cache == NULL))
  810. return false;
  811. bool GivenOnly = _config->FindB("APT::Cache::GivenOnly",false);
  812. /* Normal packages are boxes
  813. Pure Provides are triangles
  814. Mixed are diamonds
  815. Hexagons are missing packages*/
  816. const char *Shapes[] = {"hexagon","triangle","box","diamond"};
  817. /* Initialize the list of packages to show.
  818. 1 = To Show
  819. 2 = To Show no recurse
  820. 3 = Emitted no recurse
  821. 4 = Emitted
  822. 0 = None */
  823. enum States {None=0, ToShow, ToShowNR, DoneNR, Done};
  824. enum TheFlags {ForceNR=(1<<0)};
  825. unsigned char *Show = new unsigned char[Cache->Head().PackageCount];
  826. unsigned char *Flags = new unsigned char[Cache->Head().PackageCount];
  827. unsigned char *ShapeMap = new unsigned char[Cache->Head().PackageCount];
  828. // Show everything if no arguments given
  829. if (CmdL.FileList[1] == 0)
  830. for (unsigned long I = 0; I != Cache->Head().PackageCount; I++)
  831. Show[I] = ToShow;
  832. else
  833. for (unsigned long I = 0; I != Cache->Head().PackageCount; I++)
  834. Show[I] = None;
  835. memset(Flags,0,sizeof(*Flags)*Cache->Head().PackageCount);
  836. // Map the shapes
  837. for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
  838. {
  839. if (Pkg->VersionList == 0)
  840. {
  841. // Missing
  842. if (Pkg->ProvidesList == 0)
  843. ShapeMap[Pkg->ID] = 0;
  844. else
  845. ShapeMap[Pkg->ID] = 1;
  846. }
  847. else
  848. {
  849. // Normal
  850. if (Pkg->ProvidesList == 0)
  851. ShapeMap[Pkg->ID] = 2;
  852. else
  853. ShapeMap[Pkg->ID] = 3;
  854. }
  855. }
  856. // Load the list of packages from the command line into the show list
  857. std::list<APT::PackageSet::Modifier> mods;
  858. mods.push_back(APT::PackageSet::Modifier(0, ",", APT::PackageSet::Modifier::POSTFIX));
  859. mods.push_back(APT::PackageSet::Modifier(1, "^", APT::PackageSet::Modifier::POSTFIX));
  860. std::map<unsigned short, APT::PackageSet> pkgsets =
  861. APT::PackageSet::GroupedFromCommandLine(CacheFile, CmdL.FileList + 1, mods, 0);
  862. for (APT::PackageSet::const_iterator Pkg = pkgsets[0].begin();
  863. Pkg != pkgsets[0].end(); ++Pkg)
  864. Show[Pkg->ID] = ToShow;
  865. for (APT::PackageSet::const_iterator Pkg = pkgsets[1].begin();
  866. Pkg != pkgsets[1].end(); ++Pkg)
  867. {
  868. Show[Pkg->ID] = ToShow;
  869. Flags[Pkg->ID] |= ForceNR;
  870. }
  871. // Little header
  872. printf("digraph packages {\n");
  873. printf("concentrate=true;\n");
  874. printf("size=\"30,40\";\n");
  875. bool Act = true;
  876. while (Act == true)
  877. {
  878. Act = false;
  879. for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
  880. {
  881. // See we need to show this package
  882. if (Show[Pkg->ID] == None || Show[Pkg->ID] >= DoneNR)
  883. continue;
  884. // Colour as done
  885. if (Show[Pkg->ID] == ToShowNR || (Flags[Pkg->ID] & ForceNR) == ForceNR)
  886. {
  887. // Pure Provides and missing packages have no deps!
  888. if (ShapeMap[Pkg->ID] == 0 || ShapeMap[Pkg->ID] == 1)
  889. Show[Pkg->ID] = Done;
  890. else
  891. Show[Pkg->ID] = DoneNR;
  892. }
  893. else
  894. Show[Pkg->ID] = Done;
  895. Act = true;
  896. // No deps to map out
  897. if (Pkg->VersionList == 0 || Show[Pkg->ID] == DoneNR)
  898. continue;
  899. pkgCache::VerIterator Ver = Pkg.VersionList();
  900. for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++)
  901. {
  902. // See if anything can meet this dep
  903. // Walk along the actual package providing versions
  904. bool Hit = false;
  905. pkgCache::PkgIterator DPkg = D.TargetPkg();
  906. for (pkgCache::VerIterator I = DPkg.VersionList();
  907. I.end() == false && Hit == false; I++)
  908. {
  909. if (Cache->VS->CheckDep(I.VerStr(),D->CompareOp,D.TargetVer()) == true)
  910. Hit = true;
  911. }
  912. // Follow all provides
  913. for (pkgCache::PrvIterator I = DPkg.ProvidesList();
  914. I.end() == false && Hit == false; I++)
  915. {
  916. if (Cache->VS->CheckDep(I.ProvideVersion(),D->CompareOp,D.TargetVer()) == false)
  917. Hit = true;
  918. }
  919. // Only graph critical deps
  920. if (D.IsCritical() == true)
  921. {
  922. printf("\"%s\" -> \"%s\"",Pkg.FullName(true).c_str(),D.TargetPkg().FullName(true).c_str());
  923. // Colour the node for recursion
  924. if (Show[D.TargetPkg()->ID] <= DoneNR)
  925. {
  926. /* If a conflicts does not meet anything in the database
  927. then show the relation but do not recurse */
  928. if (Hit == false &&
  929. (D->Type == pkgCache::Dep::Conflicts ||
  930. D->Type == pkgCache::Dep::Obsoletes))
  931. {
  932. if (Show[D.TargetPkg()->ID] == None &&
  933. Show[D.TargetPkg()->ID] != ToShow)
  934. Show[D.TargetPkg()->ID] = ToShowNR;
  935. }
  936. else
  937. {
  938. if (GivenOnly == true && Show[D.TargetPkg()->ID] != ToShow)
  939. Show[D.TargetPkg()->ID] = ToShowNR;
  940. else
  941. Show[D.TargetPkg()->ID] = ToShow;
  942. }
  943. }
  944. // Edge colour
  945. switch(D->Type)
  946. {
  947. case pkgCache::Dep::Conflicts:
  948. case pkgCache::Dep::Obsoletes:
  949. printf("[color=springgreen];\n");
  950. break;
  951. case pkgCache::Dep::PreDepends:
  952. printf("[color=blue];\n");
  953. break;
  954. default:
  955. printf(";\n");
  956. break;
  957. }
  958. }
  959. }
  960. }
  961. }
  962. /* Draw the box colours after the fact since we can not tell what colour
  963. they should be until everything is finished drawing */
  964. for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
  965. {
  966. if (Show[Pkg->ID] < DoneNR)
  967. continue;
  968. // Orange box for early recursion stoppage
  969. if (Show[Pkg->ID] == DoneNR)
  970. printf("\"%s\" [color=orange,shape=%s];\n",Pkg.FullName(true).c_str(),
  971. Shapes[ShapeMap[Pkg->ID]]);
  972. else
  973. printf("\"%s\" [shape=%s];\n",Pkg.FullName(true).c_str(),
  974. Shapes[ShapeMap[Pkg->ID]]);
  975. }
  976. printf("}\n");
  977. return true;
  978. }
  979. /*}}}*/
  980. // DoAdd - Perform an adding operation /*{{{*/
  981. // ---------------------------------------------------------------------
  982. /* */
  983. bool DoAdd(CommandLine &CmdL)
  984. {
  985. return _error->Error("Unimplemented");
  986. #if 0
  987. // Make sure there is at least one argument
  988. if (CmdL.FileSize() <= 1)
  989. return _error->Error("You must give at least one file name");
  990. // Open the cache
  991. FileFd CacheF(_config->FindFile("Dir::Cache::pkgcache"),FileFd::WriteAny);
  992. if (_error->PendingError() == true)
  993. return false;
  994. DynamicMMap Map(CacheF,MMap::Public);
  995. if (_error->PendingError() == true)
  996. return false;
  997. OpTextProgress Progress(*_config);
  998. pkgCacheGenerator Gen(Map,Progress);
  999. if (_error->PendingError() == true)
  1000. return false;
  1001. unsigned long Length = CmdL.FileSize() - 1;
  1002. for (const char **I = CmdL.FileList + 1; *I != 0; I++)
  1003. {
  1004. Progress.OverallProgress(I - CmdL.FileList,Length,1,"Generating cache");
  1005. Progress.SubProgress(Length);
  1006. // Do the merge
  1007. FileFd TagF(*I,FileFd::ReadOnly);
  1008. debListParser Parser(TagF);
  1009. if (_error->PendingError() == true)
  1010. return _error->Error("Problem opening %s",*I);
  1011. if (Gen.SelectFile(*I,"") == false)
  1012. return _error->Error("Problem with SelectFile");
  1013. if (Gen.MergeList(Parser) == false)
  1014. return _error->Error("Problem with MergeList");
  1015. }
  1016. Progress.Done();
  1017. GCache = &Gen.GetCache();
  1018. Stats(CmdL);
  1019. return true;
  1020. #endif
  1021. }
  1022. /*}}}*/
  1023. // DisplayRecord - Displays the complete record for the package /*{{{*/
  1024. // ---------------------------------------------------------------------
  1025. /* This displays the package record from the proper package index file.
  1026. It is not used by DumpAvail for performance reasons. */
  1027. bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V)
  1028. {
  1029. pkgCache *Cache = CacheFile.GetPkgCache();
  1030. if (unlikely(Cache == NULL))
  1031. return false;
  1032. // Find an appropriate file
  1033. pkgCache::VerFileIterator Vf = V.FileList();
  1034. for (; Vf.end() == false; Vf++)
  1035. if ((Vf.File()->Flags & pkgCache::Flag::NotSource) == 0)
  1036. break;
  1037. if (Vf.end() == true)
  1038. Vf = V.FileList();
  1039. // Check and load the package list file
  1040. pkgCache::PkgFileIterator I = Vf.File();
  1041. if (I.IsOk() == false)
  1042. return _error->Error(_("Package file %s is out of sync."),I.FileName());
  1043. FileFd PkgF;
  1044. if (PkgF.Open(I.FileName(), FileFd::ReadOnlyGzip) == false)
  1045. return false;
  1046. // Read the record
  1047. unsigned char *Buffer = new unsigned char[Cache->HeaderP->MaxVerFileSize+1];
  1048. Buffer[V.FileList()->Size] = '\n';
  1049. if (PkgF.Seek(V.FileList()->Offset) == false ||
  1050. PkgF.Read(Buffer,V.FileList()->Size) == false)
  1051. {
  1052. delete [] Buffer;
  1053. return false;
  1054. }
  1055. // Get a pointer to start of Description field
  1056. const unsigned char *DescP = (unsigned char*)strstr((char*)Buffer, "Description:");
  1057. // Write all but Description
  1058. if (fwrite(Buffer,1,DescP - Buffer,stdout) < (size_t)(DescP - Buffer))
  1059. {
  1060. delete [] Buffer;
  1061. return false;
  1062. }
  1063. // Show the right description
  1064. pkgRecords Recs(*Cache);
  1065. pkgCache::DescIterator Desc = V.TranslatedDescription();
  1066. pkgRecords::Parser &P = Recs.Lookup(Desc.FileList());
  1067. cout << "Description" << ( (strcmp(Desc.LanguageCode(),"") != 0) ? "-" : "" ) << Desc.LanguageCode() << ": " << P.LongDesc();
  1068. // Find the first field after the description (if there is any)
  1069. for(DescP++;DescP != &Buffer[V.FileList()->Size];DescP++)
  1070. {
  1071. if(*DescP == '\n' && *(DescP+1) != ' ')
  1072. {
  1073. // write the rest of the buffer
  1074. const unsigned char *end=&Buffer[V.FileList()->Size];
  1075. if (fwrite(DescP,1,end-DescP,stdout) < (size_t)(end-DescP))
  1076. {
  1077. delete [] Buffer;
  1078. return false;
  1079. }
  1080. break;
  1081. }
  1082. }
  1083. // write a final newline (after the description)
  1084. cout<<endl;
  1085. delete [] Buffer;
  1086. return true;
  1087. }
  1088. /*}}}*/
  1089. struct ExDescFile
  1090. {
  1091. pkgCache::DescFile *Df;
  1092. bool NameMatch;
  1093. };
  1094. // Search - Perform a search /*{{{*/
  1095. // ---------------------------------------------------------------------
  1096. /* This searches the package names and package descriptions for a pattern */
  1097. bool Search(CommandLine &CmdL)
  1098. {
  1099. bool const ShowFull = _config->FindB("APT::Cache::ShowFull",false);
  1100. bool const NamesOnly = _config->FindB("APT::Cache::NamesOnly",false);
  1101. unsigned int const NumPatterns = CmdL.FileSize() -1;
  1102. pkgCacheFile CacheFile;
  1103. pkgCache *Cache = CacheFile.GetPkgCache();
  1104. pkgDepCache::Policy *Plcy = CacheFile.GetPolicy();
  1105. if (unlikely(Cache == NULL || Plcy == NULL))
  1106. return false;
  1107. // Make sure there is at least one argument
  1108. if (NumPatterns < 1)
  1109. return _error->Error(_("You must give at least one search pattern"));
  1110. // Compile the regex pattern
  1111. regex_t *Patterns = new regex_t[NumPatterns];
  1112. memset(Patterns,0,sizeof(*Patterns)*NumPatterns);
  1113. for (unsigned I = 0; I != NumPatterns; I++)
  1114. {
  1115. if (regcomp(&Patterns[I],CmdL.FileList[I+1],REG_EXTENDED | REG_ICASE |
  1116. REG_NOSUB) != 0)
  1117. {
  1118. for (; I != 0; I--)
  1119. regfree(&Patterns[I]);
  1120. return _error->Error("Regex compilation error");
  1121. }
  1122. }
  1123. if (_error->PendingError() == true)
  1124. {
  1125. for (unsigned I = 0; I != NumPatterns; I++)
  1126. regfree(&Patterns[I]);
  1127. return false;
  1128. }
  1129. ExDescFile *DFList = new ExDescFile[Cache->HeaderP->GroupCount+1];
  1130. memset(DFList,0,sizeof(*DFList)*Cache->HeaderP->GroupCount+1);
  1131. // Map versions that we want to write out onto the VerList array.
  1132. for (pkgCache::GrpIterator G = Cache->GrpBegin(); G.end() == false; ++G)
  1133. {
  1134. if (DFList[G->ID].NameMatch == true)
  1135. continue;
  1136. DFList[G->ID].NameMatch = true;
  1137. for (unsigned I = 0; I != NumPatterns; I++)
  1138. {
  1139. if (regexec(&Patterns[I],G.Name(),0,0,0) == 0)
  1140. continue;
  1141. DFList[G->ID].NameMatch = false;
  1142. break;
  1143. }
  1144. // Doing names only, drop any that dont match..
  1145. if (NamesOnly == true && DFList[G->ID].NameMatch == false)
  1146. continue;
  1147. // Find the proper version to use
  1148. pkgCache::PkgIterator P = G.FindPreferredPkg();
  1149. if (P.end() == true)
  1150. continue;
  1151. pkgCache::VerIterator V = Plcy->GetCandidateVer(P);
  1152. if (V.end() == false)
  1153. DFList[G->ID].Df = V.DescriptionList().FileList();
  1154. if (DFList[G->ID].NameMatch == false)
  1155. continue;
  1156. // Include all the packages that provide matching names too
  1157. for (pkgCache::PrvIterator Prv = P.ProvidesList() ; Prv.end() == false; Prv++)
  1158. {
  1159. pkgCache::VerIterator V = Plcy->GetCandidateVer(Prv.OwnerPkg());
  1160. if (V.end() == true)
  1161. continue;
  1162. unsigned long id = Prv.OwnerPkg().Group()->ID;
  1163. DFList[id].Df = V.DescriptionList().FileList();
  1164. DFList[id].NameMatch = true;
  1165. }
  1166. }
  1167. LocalitySort(&DFList->Df,Cache->HeaderP->GroupCount,sizeof(*DFList));
  1168. // Create the text record parser
  1169. pkgRecords Recs(*Cache);
  1170. // Iterate over all the version records and check them
  1171. for (ExDescFile *J = DFList; J->Df != 0; J++)
  1172. {
  1173. pkgRecords::Parser &P = Recs.Lookup(pkgCache::DescFileIterator(*Cache,J->Df));
  1174. if (J->NameMatch == false && NamesOnly == false)
  1175. {
  1176. string const LongDesc = P.LongDesc();
  1177. J->NameMatch = true;
  1178. for (unsigned I = 0; I != NumPatterns; I++)
  1179. {
  1180. if (regexec(&Patterns[I],LongDesc.c_str(),0,0,0) == 0)
  1181. continue;
  1182. J->NameMatch = false;
  1183. break;
  1184. }
  1185. }
  1186. if (J->NameMatch == true)
  1187. {
  1188. if (ShowFull == true)
  1189. {
  1190. const char *Start;
  1191. const char *End;
  1192. P.GetRec(Start,End);
  1193. fwrite(Start,End-Start,1,stdout);
  1194. putc('\n',stdout);
  1195. }
  1196. else
  1197. printf("%s - %s\n",P.Name().c_str(),P.ShortDesc().c_str());
  1198. }
  1199. }
  1200. delete [] DFList;
  1201. for (unsigned I = 0; I != NumPatterns; I++)
  1202. regfree(&Patterns[I]);
  1203. if (ferror(stdout))
  1204. return _error->Error("Write to stdout failed");
  1205. return true;
  1206. }
  1207. /* show automatically installed packages (sorted) */
  1208. bool ShowAuto(CommandLine &CmdL)
  1209. {
  1210. pkgCacheFile CacheFile;
  1211. pkgCache *Cache = CacheFile.GetPkgCache();
  1212. pkgDepCache *DepCache = CacheFile.GetDepCache();
  1213. if (unlikely(Cache == NULL || DepCache == NULL))
  1214. return false;
  1215. std::vector<string> packages;
  1216. packages.reserve(Cache->HeaderP->PackageCount / 3);
  1217. for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; P++)
  1218. if ((*DepCache)[P].Flags & pkgCache::Flag::Auto)
  1219. packages.push_back(P.Name());
  1220. std::sort(packages.begin(), packages.end());
  1221. for (vector<string>::iterator I = packages.begin(); I != packages.end(); I++)
  1222. cout << *I << "\n";
  1223. return true;
  1224. }
  1225. /*}}}*/
  1226. // ShowPackage - Dump the package record to the screen /*{{{*/
  1227. // ---------------------------------------------------------------------
  1228. /* */
  1229. bool ShowPackage(CommandLine &CmdL)
  1230. {
  1231. pkgCacheFile CacheFile;
  1232. APT::VersionSet::Version const select = _config->FindB("APT::Cache::AllVersions", true) ?
  1233. APT::VersionSet::ALL : APT::VersionSet::CANDIDATE;
  1234. APT::VersionSet const verset = APT::VersionSet::FromCommandLine(CacheFile, CmdL.FileList + 1, select);
  1235. for (APT::VersionSet::const_iterator Ver = verset.begin(); Ver != verset.end(); ++Ver)
  1236. if (DisplayRecord(CacheFile, Ver) == false)
  1237. return false;
  1238. if (verset.empty() == false)
  1239. return true;
  1240. return _error->Error(_("No packages found"));
  1241. }
  1242. /*}}}*/
  1243. // ShowPkgNames - Show package names /*{{{*/
  1244. // ---------------------------------------------------------------------
  1245. /* This does a prefix match on the first argument */
  1246. bool ShowPkgNames(CommandLine &CmdL)
  1247. {
  1248. pkgCacheFile CacheFile;
  1249. if (unlikely(CacheFile.BuildCaches(NULL, false) == false))
  1250. return false;
  1251. pkgCache::GrpIterator I = CacheFile.GetPkgCache()->GrpBegin();
  1252. bool const All = _config->FindB("APT::Cache::AllNames","false");
  1253. if (CmdL.FileList[1] != 0)
  1254. {
  1255. for (;I.end() != true; I++)
  1256. {
  1257. if (All == false && I->FirstPackage == 0)
  1258. continue;
  1259. if (I.FindPkg("any")->VersionList == 0)
  1260. continue;
  1261. if (strncmp(I.Name(),CmdL.FileList[1],strlen(CmdL.FileList[1])) == 0)
  1262. cout << I.Name() << endl;
  1263. }
  1264. return true;
  1265. }
  1266. // Show all pkgs
  1267. for (;I.end() != true; I++)
  1268. {
  1269. if (All == false && I->FirstPackage == 0)
  1270. continue;
  1271. if (I.FindPkg("any")->VersionList == 0)
  1272. continue;
  1273. cout << I.Name() << endl;
  1274. }
  1275. return true;
  1276. }
  1277. /*}}}*/
  1278. // ShowSrcPackage - Show source package records /*{{{*/
  1279. // ---------------------------------------------------------------------
  1280. /* */
  1281. bool ShowSrcPackage(CommandLine &CmdL)
  1282. {
  1283. pkgCacheFile CacheFile;
  1284. pkgSourceList *List = CacheFile.GetSourceList();
  1285. if (unlikely(List == NULL))
  1286. return false;
  1287. // Create the text record parsers
  1288. pkgSrcRecords SrcRecs(*List);
  1289. if (_error->PendingError() == true)
  1290. return false;
  1291. unsigned found = 0;
  1292. for (const char **I = CmdL.FileList + 1; *I != 0; I++)
  1293. {
  1294. SrcRecs.Restart();
  1295. pkgSrcRecords::Parser *Parse;
  1296. unsigned found_this = 0;
  1297. while ((Parse = SrcRecs.Find(*I,false)) != 0) {
  1298. cout << Parse->AsStr() << endl;;
  1299. found++;
  1300. found_this++;
  1301. }
  1302. if (found_this == 0) {
  1303. _error->Warning(_("Unable to locate package %s"),*I);
  1304. continue;
  1305. }
  1306. }
  1307. if (found > 0)
  1308. return true;
  1309. return _error->Error(_("No packages found"));
  1310. }
  1311. /*}}}*/
  1312. // Policy - Show the results of the preferences file /*{{{*/
  1313. // ---------------------------------------------------------------------
  1314. /* */
  1315. bool Policy(CommandLine &CmdL)
  1316. {
  1317. pkgCacheFile CacheFile;
  1318. pkgCache *Cache = CacheFile.GetPkgCache();
  1319. pkgPolicy *Plcy = CacheFile.GetPolicy();
  1320. pkgSourceList *SrcList = CacheFile.GetSourceList();
  1321. if (unlikely(Cache == NULL || Plcy == NULL || SrcList == NULL))
  1322. return false;
  1323. /* Should the MultiArchKiller be run to see which pseudo packages for an
  1324. arch all package are currently installed? Activating it gives a speed
  1325. penality for no real gain beside enhanced debugging, so in general no. */
  1326. if (_config->FindB("APT::Cache::Policy::DepCache", false) == true)
  1327. CacheFile.GetDepCache();
  1328. // Print out all of the package files
  1329. if (CmdL.FileList[1] == 0)
  1330. {
  1331. cout << _("Package files:") << endl;
  1332. for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F.end() == false; F++)
  1333. {
  1334. // Locate the associated index files so we can derive a description
  1335. pkgIndexFile *Indx;
  1336. if (SrcList->FindIndex(F,Indx) == false &&
  1337. _system->FindIndex(F,Indx) == false)
  1338. return _error->Error(_("Cache is out of sync, can't x-ref a package file"));
  1339. printf("%4i %s\n",
  1340. Plcy->GetPriority(F),Indx->Describe(true).c_str());
  1341. // Print the reference information for the package
  1342. string Str = F.RelStr();
  1343. if (Str.empty() == false)
  1344. printf(" release %s\n",F.RelStr().c_str());
  1345. if (F.Site() != 0 && F.Site()[0] != 0)
  1346. printf(" origin %s\n",F.Site());
  1347. }
  1348. // Show any packages have explicit pins
  1349. cout << _("Pinned packages:") << endl;
  1350. pkgCache::PkgIterator I = Cache->PkgBegin();
  1351. for (;I.end() != true; I++)
  1352. {
  1353. if (Plcy->GetPriority(I) == 0)
  1354. continue;
  1355. // Print the package name and the version we are forcing to
  1356. cout << " " << I.FullName(true) << " -> ";
  1357. pkgCache::VerIterator V = Plcy->GetMatch(I);
  1358. if (V.end() == true)
  1359. cout << _("(not found)") << endl;
  1360. else
  1361. cout << V.VerStr() << endl;
  1362. }
  1363. return true;
  1364. }
  1365. string const myArch = _config->Find("APT::Architecture");
  1366. char const * const msgInstalled = _(" Installed: ");
  1367. char const * const msgCandidate = _(" Candidate: ");
  1368. short const InstalledLessCandidate =
  1369. mbstowcs(NULL, msgInstalled, 0) - mbstowcs(NULL, msgCandidate, 0);
  1370. short const deepInstalled =
  1371. (InstalledLessCandidate < 0 ? (InstalledLessCandidate*-1) : 0) - 1;
  1372. short const deepCandidate =
  1373. (InstalledLessCandidate > 0 ? (InstalledLessCandidate) : 0) - 1;
  1374. // Print out detailed information for each package
  1375. APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1);
  1376. for (APT::PackageSet::const_iterator I = pkgset.begin(); I != pkgset.end(); ++I)
  1377. {
  1378. pkgCache::PkgIterator Pkg = I.Group().FindPkg("any");
  1379. for (; Pkg.end() != true; Pkg = I.Group().NextPkg(Pkg)) {
  1380. if (strcmp(Pkg.Arch(),"all") == 0)
  1381. continue;
  1382. cout << Pkg.FullName(true) << ":" << endl;
  1383. // Installed version
  1384. cout << msgInstalled << OutputInDepth(deepInstalled, " ");
  1385. if (Pkg->CurrentVer == 0)
  1386. cout << _("(none)") << endl;
  1387. else
  1388. cout << Pkg.CurrentVer().VerStr() << endl;
  1389. // Candidate Version
  1390. cout << msgCandidate << OutputInDepth(deepCandidate, " ");
  1391. pkgCache::VerIterator V = Plcy->GetCandidateVer(Pkg);
  1392. if (V.end() == true)
  1393. cout << _("(none)") << endl;
  1394. else
  1395. cout << V.VerStr() << endl;
  1396. // Pinned version
  1397. if (Plcy->GetPriority(Pkg) != 0)
  1398. {
  1399. cout << _(" Package pin: ");
  1400. V = Plcy->GetMatch(Pkg);
  1401. if (V.end() == true)
  1402. cout << _("(not found)") << endl;
  1403. else
  1404. cout << V.VerStr() << endl;
  1405. }
  1406. // Show the priority tables
  1407. cout << _(" Version table:") << endl;
  1408. for (V = Pkg.VersionList(); V.end() == false; V++)
  1409. {
  1410. if (Pkg.CurrentVer() == V)
  1411. cout << " *** " << V.VerStr();
  1412. else
  1413. cout << " " << V.VerStr();
  1414. cout << " " << Plcy->GetPriority(Pkg) << endl;
  1415. for (pkgCache::VerFileIterator VF = V.FileList(); VF.end() == false; VF++)
  1416. {
  1417. // Locate the associated index files so we can derive a description
  1418. pkgIndexFile *Indx;
  1419. if (SrcList->FindIndex(VF.File(),Indx) == false &&
  1420. _system->FindIndex(VF.File(),Indx) == false)
  1421. return _error->Error(_("Cache is out of sync, can't x-ref a package file"));
  1422. printf(" %4i %s\n",Plcy->GetPriority(VF.File()),
  1423. Indx->Describe(true).c_str());
  1424. }
  1425. }
  1426. }
  1427. }
  1428. return true;
  1429. }
  1430. /*}}}*/
  1431. // Madison - Look a bit like katie's madison /*{{{*/
  1432. // ---------------------------------------------------------------------
  1433. /* */
  1434. bool Madison(CommandLine &CmdL)
  1435. {
  1436. pkgCacheFile CacheFile;
  1437. pkgSourceList *SrcList = CacheFile.GetSourceList();
  1438. if (SrcList == 0)
  1439. return false;
  1440. // Create the src text record parsers and ignore errors about missing
  1441. // deb-src lines that are generated from pkgSrcRecords::pkgSrcRecords
  1442. pkgSrcRecords SrcRecs(*SrcList);
  1443. if (_error->PendingError() == true)
  1444. _error->Discard();
  1445. APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1);
  1446. for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
  1447. {
  1448. if (Pkg.end() == false)
  1449. {
  1450. for (pkgCache::VerIterator V = Pkg.VersionList(); V.end() == false; V++)
  1451. {
  1452. for (pkgCache::VerFileIterator VF = V.FileList(); VF.end() == false; VF++)
  1453. {
  1454. // This might be nice, but wouldn't uniquely identify the source -mdz
  1455. // if (VF.File().Archive() != 0)
  1456. // {
  1457. // cout << setw(10) << Pkg.Name() << " | " << setw(10) << V.VerStr() << " | "
  1458. // << VF.File().Archive() << endl;
  1459. // }
  1460. // Locate the associated index files so we can derive a description
  1461. for (pkgSourceList::const_iterator S = SrcList->begin(); S != SrcList->end(); S++)
  1462. {
  1463. vector<pkgIndexFile *> *Indexes = (*S)->GetIndexFiles();
  1464. for (vector<pkgIndexFile *>::const_iterator IF = Indexes->begin();
  1465. IF != Indexes->end(); IF++)
  1466. {
  1467. if ((*IF)->FindInCache(*(VF.File().Cache())) == VF.File())
  1468. {
  1469. cout << setw(10) << Pkg.FullName(true) << " | " << setw(10) << V.VerStr() << " | "
  1470. << (*IF)->Describe(true) << endl;
  1471. }
  1472. }
  1473. }
  1474. }
  1475. }
  1476. }
  1477. SrcRecs.Restart();
  1478. pkgSrcRecords::Parser *SrcParser;
  1479. while ((SrcParser = SrcRecs.Find(Pkg.Name(),false)) != 0)
  1480. {
  1481. // Maybe support Release info here too eventually
  1482. cout << setw(10) << SrcParser->Package() << " | "
  1483. << setw(10) << SrcParser->Version() << " | "
  1484. << SrcParser->Index().Describe(true) << endl;
  1485. }
  1486. }
  1487. return true;
  1488. }
  1489. /*}}}*/
  1490. // GenCaches - Call the main cache generator /*{{{*/
  1491. // ---------------------------------------------------------------------
  1492. /* */
  1493. bool GenCaches(CommandLine &Cmd)
  1494. {
  1495. OpTextProgress Progress(*_config);
  1496. pkgCacheFile CacheFile;
  1497. return CacheFile.BuildCaches(&Progress, true);
  1498. }
  1499. /*}}}*/
  1500. // ShowHelp - Show a help screen /*{{{*/
  1501. // ---------------------------------------------------------------------
  1502. /* */
  1503. bool ShowHelp(CommandLine &Cmd)
  1504. {
  1505. ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION,
  1506. COMMON_ARCH,__DATE__,__TIME__);
  1507. if (_config->FindB("version") == true)
  1508. return true;
  1509. cout <<
  1510. _("Usage: apt-cache [options] command\n"
  1511. " apt-cache [options] add file1 [file2 ...]\n"
  1512. " apt-cache [options] showpkg pkg1 [pkg2 ...]\n"
  1513. " apt-cache [options] showsrc pkg1 [pkg2 ...]\n"
  1514. "\n"
  1515. "apt-cache is a low-level tool used to manipulate APT's binary\n"
  1516. "cache files, and query information from them\n"
  1517. "\n"
  1518. "Commands:\n"
  1519. " add - Add a package file to the source cache\n"
  1520. " gencaches - Build both the package and source cache\n"
  1521. " showpkg - Show some general information for a single package\n"
  1522. " showsrc - Show source records\n"
  1523. " stats - Show some basic statistics\n"
  1524. " dump - Show the entire file in a terse form\n"
  1525. " dumpavail - Print an available file to stdout\n"
  1526. " unmet - Show unmet dependencies\n"
  1527. " search - Search the package list for a regex pattern\n"
  1528. " show - Show a readable record for the package\n"
  1529. " showauto - Display a list of automatically installed packages\n"
  1530. " depends - Show raw dependency information for a package\n"
  1531. " rdepends - Show reverse dependency information for a package\n"
  1532. " pkgnames - List the names of all packages in the system\n"
  1533. " dotty - Generate package graphs for GraphViz\n"
  1534. " xvcg - Generate package graphs for xvcg\n"
  1535. " policy - Show policy settings\n"
  1536. "\n"
  1537. "Options:\n"
  1538. " -h This help text.\n"
  1539. " -p=? The package cache.\n"
  1540. " -s=? The source cache.\n"
  1541. " -q Disable progress indicator.\n"
  1542. " -i Show only important deps for the unmet command.\n"
  1543. " -c=? Read this configuration file\n"
  1544. " -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n"
  1545. "See the apt-cache(8) and apt.conf(5) manual pages for more information.\n");
  1546. return true;
  1547. }
  1548. /*}}}*/
  1549. // CacheInitialize - Initialize things for apt-cache /*{{{*/
  1550. // ---------------------------------------------------------------------
  1551. /* */
  1552. void CacheInitialize()
  1553. {
  1554. _config->Set("quiet",0);
  1555. _config->Set("help",false);
  1556. }
  1557. /*}}}*/
  1558. int main(int argc,const char *argv[]) /*{{{*/
  1559. {
  1560. CommandLine::Args Args[] = {
  1561. {'h',"help","help",0},
  1562. {'v',"version","version",0},
  1563. {'p',"pkg-cache","Dir::Cache::pkgcache",CommandLine::HasArg},
  1564. {'s',"src-cache","Dir::Cache::srcpkgcache",CommandLine::HasArg},
  1565. {'q',"quiet","quiet",CommandLine::IntLevel},
  1566. {'i',"important","APT::Cache::Important",0},
  1567. {'f',"full","APT::Cache::ShowFull",0},
  1568. {'g',"generate","APT::Cache::Generate",0},
  1569. {'a',"all-versions","APT::Cache::AllVersions",0},
  1570. {'n',"names-only","APT::Cache::NamesOnly",0},
  1571. {0,"all-names","APT::Cache::AllNames",0},
  1572. {0,"recurse","APT::Cache::RecurseDepends",0},
  1573. {'t',"target-release","APT::Default-Release",CommandLine::HasArg},
  1574. {'t',"default-release","APT::Default-Release",CommandLine::HasArg},
  1575. {'c',"config-file",0,CommandLine::ConfigFile},
  1576. {'o',"option",0,CommandLine::ArbItem},
  1577. {0,"installed","APT::Cache::Installed",0},
  1578. {0,"pre-depends","APT::Cache::ShowPreDepends",0},
  1579. {0,"depends","APT::Cache::ShowDepends",0},
  1580. {0,"recommends","APT::Cache::ShowRecommends",0},
  1581. {0,"suggests","APT::Cache::ShowSuggests",0},
  1582. {0,"replaces","APT::Cache::ShowReplaces",0},
  1583. {0,"breaks","APT::Cache::ShowBreaks",0},
  1584. {0,"conflicts","APT::Cache::ShowConflicts",0},
  1585. {0,"enhances","APT::Cache::ShowEnhances",0},
  1586. {0,0,0,0}};
  1587. CommandLine::Dispatch CmdsA[] = {{"help",&ShowHelp},
  1588. {"add",&DoAdd},
  1589. {"gencaches",&GenCaches},
  1590. {"showsrc",&ShowSrcPackage},
  1591. {0,0}};
  1592. CommandLine::Dispatch CmdsB[] = {{"showpkg",&DumpPackage},
  1593. {"stats",&Stats},
  1594. {"dump",&Dump},
  1595. {"dumpavail",&DumpAvail},
  1596. {"unmet",&UnMet},
  1597. {"search",&Search},
  1598. {"depends",&Depends},
  1599. {"rdepends",&RDepends},
  1600. {"dotty",&Dotty},
  1601. {"xvcg",&XVcg},
  1602. {"show",&ShowPackage},
  1603. {"pkgnames",&ShowPkgNames},
  1604. {"showauto",&ShowAuto},
  1605. {"policy",&Policy},
  1606. {"madison",&Madison},
  1607. {0,0}};
  1608. CacheInitialize();
  1609. // Set up gettext support
  1610. setlocale(LC_ALL,"");
  1611. textdomain(PACKAGE);
  1612. // Parse the command line and initialize the package library
  1613. CommandLine CmdL(Args,_config);
  1614. if (pkgInitConfig(*_config) == false ||
  1615. CmdL.Parse(argc,argv) == false ||
  1616. pkgInitSystem(*_config,_system) == false)
  1617. {
  1618. _error->DumpErrors();
  1619. return 100;
  1620. }
  1621. // See if the help should be shown
  1622. if (_config->FindB("help") == true ||
  1623. CmdL.FileSize() == 0)
  1624. {
  1625. ShowHelp(CmdL);
  1626. return 0;
  1627. }
  1628. // Deal with stdout not being a tty
  1629. if (!isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1)
  1630. _config->Set("quiet","1");
  1631. if (_config->Exists("APT::Cache::Generate") == true)
  1632. _config->Set("pkgCacheFile::Generate", _config->FindB("APT::Cache::Generate", true));
  1633. if (CmdL.DispatchArg(CmdsA,false) == false && _error->PendingError() == false)
  1634. CmdL.DispatchArg(CmdsB);
  1635. // Print any errors or warnings found during parsing
  1636. bool const Errors = _error->PendingError();
  1637. if (_config->FindI("quiet",0) > 0)
  1638. _error->DumpErrors();
  1639. else
  1640. _error->DumpErrors(GlobalError::DEBUG);
  1641. return Errors == true ? 100 : 0;
  1642. }
  1643. /*}}}*/