Browse Source

* merged changes from the conference

Patches applied:

 * apt@arch.ubuntu.com/apt--experimental--0.6--base-0
   tag of apt@arch.ubuntu.com/apt--MAIN--0--patch-1190

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-1
   Creation of branch v0_6

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-2
   Creation of branch v0_6

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-3
   Creation of branch v0_6

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-4
   Creation of branch v0_6

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-5
   Creation of branch v0_6

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-6
   Creation of branch v0_6

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-7
   Merge working copy of v0.6

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-8
   0.6.0 is headed for experimental, not unstable

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-9
   Date

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-10
   Update LIB_APT_PKG_MAJOR

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-11
   - Fix a heap corruption bug in pkgSrcRecords::pkgSrcRec...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-12
   Resynch

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-13
   * Merge apt 0.5.17

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-14
   * Rearrange Release file authentication code to be more...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-15
   * Convert distribution "../project/experimental" to "ex...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-16
   Merge 1.11

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-17
   Merge 1.7

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-18
   Merge 1.10

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-19
   * Make a number of Release file errors into warnings; f...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-20
   * Add space between package names when multiple unauthe...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-21
   * Provide apt-key with a secret keyring and a trustdb, ...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-22
   * Fix typo in apt-key(8) (standard input is '-', not '/')

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-23
   0.6.2

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-24
   Resynch

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-25
   * Fix MetaIndexURI for flat ("foo/") sources

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-26
   0.6.3

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-27
   * Use the top-level Release file in LoadReleaseInfo, ra...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-28
   0.6.4

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-29
   Clarify

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-30
   * Move the authentication check into a separate functio...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-31
   * Fix display of unauthenticated packages when they are...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-32
   * Move the authentication check into a separate functio...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-33
   * Restore the ugly hack I removed from indexRecords::Lo...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-34
   0.6.6

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-35
   * Forgot to revert part of the changes to tagfile in 0....

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-36
   * Add a config option and corresponding command line option

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-37
   0.6.8

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-38
   hopefully avoid more segfaults

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-39
   XXX

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-40
   * Another tagfile workaround

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-41
   * Use "Codename" (woody, sarge, etc.) to supply the val...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-42
   * Support IMS requests of Release.gpg and Release

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-43
   * Have pkgAcquireIndex calculate an MD5 sum if one is n...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-44
   * Merge 0.5.18

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-45
   apt (0.6.13) experimental; urgency=low

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-46
   0.6.13

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-47
   Merge 0.5.20

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-48
   The source list works a bit differently in 0.6; fix the...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-49
   * s/Debug::Acquire::gpg/&v/

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-50
   * Honor the [vendor] syntax in sources.list again (thou...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-51
   * Don't ship vendors.list(5) since it isn't used yet

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-52
   * Revert change from 0.6.10; it was right in the first ...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-53
   * Fix some cases where the .gpg file could be left in p...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-54
   Print a warning if gnupg is not installed

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-55
   * Handle more IMS stuff correctly

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-56
   0.6.17

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-57
   * Merge 0.5.21

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-58
   * Add new Debian Archive Automatic Signing Key to the d...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-59
   0.6.18

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-60
   * Merge 0.5.22

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-61
   * Convert apt-key(8) to docbook XML

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-62
   Merge 0.5.23

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-63
   Remove bogus partial 0.5.22 changelog entry

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-64
   Make the auth warning a bit less redundant

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-65
   * Merge 0.5.24

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-66
   * Make the unauthenticated packages prompt more intuiti...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-67
   Merge 0.5.25

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-68
   * Remove obsolete pkgIterator::TargetVer() (Closes: #230159)

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-69
   * Reverse test in CheckAuth to match new prompt (Closes...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-70
   Update version

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-71
   Fix backwards sense of CheckAuth prompt

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-72
   0.6.24

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-73
   Close bug

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-74
   * Fix handling of two-part sources for sources.list deb...

 * apt@arch.ubuntu.com/apt--experimental--0.6--patch-75
   0.6.25

 * apt@packages.debian.org/apt--authentication--0--base-0
   tag of apt@arch.ubuntu.com/apt--experimental--0.6--patch-75

 * apt@packages.debian.org/apt--authentication--0--patch-1
   Michael Vogt's merge of apt--experimental--0 onto apt--main--0

 * apt@packages.debian.org/apt--authentication--0--patch-2
   Merge from apt--main--0

 * apt@packages.debian.org/apt--authentication--0--patch-3
   Merge from main

 * apt@packages.debian.org/apt--authentication--0--patch-4
   Merge from main

 * apt@packages.debian.org/apt--authentication--0--patch-5
   Update version number in configure.in

 * apt@packages.debian.org/apt--authentication--0--patch-6
   Merge from main

 * apt@packages.debian.org/apt--authentication--0--patch-7
   Merge from main

 * apt@packages.debian.org/apt--authentication--0--patch-8
   Merge from mvo's branch

 * apt@packages.debian.org/apt--authentication--0--patch-9
   Merge from mvo's tree

 * apt@packages.debian.org/apt--authentication--0--patch-10
   Merge from mvo

 * apt@packages.debian.org/apt--authentication--0--patch-11
   Fix permissions AGAIN

 * apt@packages.debian.org/apt--bzip2-debs--0--base-0
   tag of apt@packages.debian.org/apt--main--0--patch-30

 * apt@packages.debian.org/apt--bzip2-debs--0--patch-1
   Create baz branch

 * apt@packages.debian.org/apt--bzip2-debs--0--patch-2
   Implement data.tar.bz2 support

 * apt@packages.debian.org/apt--main--0--patch-30
   Fix changelog

 * apt@packages.debian.org/apt--main--0--patch-31
   Fix permissions again

 * apt@packages.debian.org/apt--main--0--patch-32
   Fix permissions again

 * apt@packages.debian.org/apt--main--0--patch-33
   Use baz instead of tla

 * apt@packages.debian.org/apt--main--0--patch-34
   Merge bzip2-debs branch

 * apt@packages.debian.org/apt--main--0--patch-35
   Fix changelog

 * apt@packages.debian.org/apt--main--0--patch-36
   untagged-source precious

 * apt@packages.debian.org/apt--main--0--patch-37
   Add .arch-inventory files

 * apt@packages.debian.org/apt--main--0--patch-38
   Fix permissions again

 * apt@packages.debian.org/apt--main--0--patch-39
   Merge apt--authentication--0

 * apt@packages.debian.org/apt--main--0--patch-40
   Merge misc-abi-changes

 * apt@packages.debian.org/apt--main--0--patch-41
   Merge from mvo

 * apt@packages.debian.org/apt--misc-abi-changes--0--base-0
   tag of apt@packages.debian.org/apt--main--0--patch-16

 * apt@packages.debian.org/apt--misc-abi-changes--0--patch-1
   Fix apt-get -s remove to not display the candidate version

 * apt@packages.debian.org/apt--misc-abi-changes--0--patch-2
   Merge from main

 * apt@packages.debian.org/apt--misc-abi-changes--0--patch-3
   Use pid_t throughout to hold process IDs

 * michael.vogt@canonical.com--2004--laptop/apt--authentication-mvo--0--base-0
   tag of michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-12

 * michael.vogt@canonical.com--2004--laptop/apt--authentication-mvo--0--patch-1
   * star-merged matt's changes (bz2 support for data-members in debs)

 * michael.vogt@canonical.com--2004--laptop/apt--authentication-mvo--0--patch-2
   * ignore errors when a Packages.bz2/Sources.bz2 can't be found and try with Packages.gz/Sources.gz again

 * michael.vogt@canonical.com--2004--laptop/apt--mvo--0--base-0
   tag of apt@packages.debian.org/apt--main--0--patch-34

 * michael.vogt@canonical.com--2004--laptop/apt--mvo--0--patch-1
   * merged matt's tree (with all those apt-authentication changes)

 * michael.vogt@canonical.com--2004--laptop/apt--mvo--0--patch-2
   don't display a error if a bzip2 package can not be downloaded, just ignore (Ign) it

 * michael.vogt@canonical.com--2004--laptop/apt--mvo--0--patch-3
   * "chmod 755 cmdline/apt-key", changed version to 0.6.27ubuntu1

 * michael.vogt@canonical.com--2004--laptop/apt--mvo--0--patch-4
   * fix for a stupid merge error (from 0.5->0.6)

 * michael.vogt@canonical.com--2004--laptop/apt--mvo--0--patch-5
   * unstable should really be hoary

 * michael.vogt@canonical.com--2004--laptop/apt--mvo--0--patch-6
   * stronger dependencies for libapt-pkg-dev (depends on the source version of apt and apt-watch now)

 * michael.vogt@canonical.com--2004--laptop/apt--mvo--0--patch-7
   * distro really should be hoary, not unstable :/

 * michael.vogt@canonical.com--2004--laptop/apt--mvo--0--patch-8
   * documented the "--allow-unauthenticated" switch

 * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-1
   tag of apt@packages.debian.org/apt--authentication--0--base-0

 * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-2
   merged "tla apply-delta -A foo@ apt@arch.ubuntu.com/apt--MAIN--0--patch-1190 apt@arch.ubuntu.com/apt--MAIN--0--patch-1343" and cleaned up conflicts

 * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-3
   * missing bits from the merge added

 * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-4
   * star-merged with apt@packages.debian.org/apt--main--0

 * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-5
   * tree-synced to the apt--authentication tree

 * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-6
   * use the ubuntu-key in this version

 * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-7
   * imported the patches from mdz

 * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-8
   * apt-get update --print-uris works now as before (fallback to 0.5.x behaviour)

 * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-9
   * fix for the "if any source unauthenticated, all other sources are unauthenticated too" problem

 * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-10
   * reworked the "--print-uris" patch. it no longer uses: "APT::Get::Print-URIs" in the library

 * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-11
   * version of the library set to 3.6

 * michael.vogt@canonical.com--2004/apt--authentication-mvo--0--patch-12
   * changelog finallized, will upload to people.ubuntulinux.org/~mvo/apt-authentication

 * michael.vogt@canonical.com--2004/apt--main-authentication--0--base-0
   tag of apt@packages.debian.org/apt--main--0--patch-22

 * michael.vogt@canonical.com--2004/apt--main-authentication--0--patch-1
   * star-merge from apt--experimental--0.6

 * michael.vogt@canonical.com--2004/apt--main-authentication--0--patch-2
   * compile failure fix for methods/http.cc, po-file fixes
debian/1.8.y
Michael Vogt 18 years ago
parent
commit
b3d44315ee
  1. 2
      apt-inst/contrib/arfile.cc
  2. 14
      apt-inst/contrib/extracttar.cc
  3. 3
      apt-inst/contrib/extracttar.h
  4. 35
      apt-inst/deb/debfile.cc
  5. 4
      apt-inst/deb/dpkgdb.cc
  6. 2
      apt-inst/dirstream.cc
  7. 2
      apt-inst/extract.cc
  8. 2
      apt-inst/filelist.cc
  9. 2
      apt-inst/makefile
  10. 463
      apt-pkg/acquire-item.cc
  11. 76
      apt-pkg/acquire-item.h
  12. 8
      apt-pkg/acquire-method.cc
  13. 3
      apt-pkg/acquire-method.h
  14. 2
      apt-pkg/acquire.cc
  15. 4
      apt-pkg/acquire.h
  16. 25
      apt-pkg/algorithms.cc
  17. 4
      apt-pkg/algorithms.h
  18. 3
      apt-pkg/cacheiterators.h
  19. 4
      apt-pkg/contrib/fileutl.cc
  20. 4
      apt-pkg/contrib/fileutl.h
  21. 77
      apt-pkg/deb/debindexfile.cc
  22. 16
      apt-pkg/deb/debindexfile.h
  23. 6
      apt-pkg/deb/deblistparser.cc
  24. 269
      apt-pkg/deb/debmetaindex.cc
  25. 48
      apt-pkg/deb/debmetaindex.h
  26. 10
      apt-pkg/indexfile.cc
  27. 9
      apt-pkg/indexfile.h
  28. 151
      apt-pkg/indexrecords.cc
  29. 52
      apt-pkg/indexrecords.h
  30. 4
      apt-pkg/init.h
  31. 12
      apt-pkg/makefile
  32. 48
      apt-pkg/metaindex.h
  33. 15
      apt-pkg/pkgcachegen.cc
  34. 139
      apt-pkg/sourcelist.cc
  35. 35
      apt-pkg/sourcelist.h
  36. 44
      apt-pkg/srcrecords.cc
  37. 6
      apt-pkg/srcrecords.h
  38. 6
      apt-pkg/tagfile.cc
  39. 39
      apt-pkg/vendor.cc
  40. 37
      apt-pkg/vendor.h
  41. 144
      apt-pkg/vendorlist.cc
  42. 52
      apt-pkg/vendorlist.h
  43. 5
      buildlib/environment.mak.in
  44. 15
      cmdline/apt-cache.cc
  45. 2
      cmdline/apt-extracttemplates.cc
  46. 66
      cmdline/apt-get.cc
  47. 60
      cmdline/apt-key
  48. 2
      cmdline/indexcopy.cc
  49. 6
      cmdline/makefile
  50. 5
      configure.in
  51. 4
      debian/apt.manpages
  52. 42
      debian/apt.postinst
  53. 44
      debian/changelog
  54. 4
      debian/control
  55. 26
      debian/rules
  56. 11
      doc/apt-get.8.xml
  57. 87
      doc/apt-key.8.xml
  58. 3
      doc/es/makefile
  59. 3
      doc/fr/makefile
  60. 4
      doc/makefile
  61. 115
      doc/vendors.list.5.xml
  62. 2
      ftparchive/apt-ftparchive.cc
  63. 11
      ftparchive/contents.cc
  64. 8
      ftparchive/multicompress.cc
  65. 6
      ftparchive/multicompress.h
  66. 2
      ftparchive/writer.cc
  67. 2
      ftparchive/writer.h
  68. 2
      methods/cdrom.cc
  69. 2
      methods/connect.cc
  70. 2
      methods/copy.cc
  71. 2
      methods/file.cc
  72. 2
      methods/ftp.cc
  73. 261
      methods/gpgv.cc
  74. 4
      methods/gzip.cc
  75. 9
      methods/makefile
  76. 2
      methods/rsh.cc
  77. 2
      methods/rsh.h
  78. 322
      po/apt-all.pot
  79. 1
      po/da.po
  80. 21
      po/el.po
  81. 1
      po/en_GB.po
  82. 1
      po/es.po
  83. 2
      po/fr.po
  84. 1
      po/it.po
  85. 1
      po/nb.po
  86. 32
      po/nn.po
  87. 1
      po/pt_BR.po
  88. BIN
      share/debian-archive.gpg
  89. BIN
      share/ubuntu-archive.gpg

2
apt-inst/contrib/arfile.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: arfile.cc,v 1.7 2004/01/07 20:39:37 mdz Exp $
// $Id: arfile.cc,v 1.6.2.1 2004/01/16 18:58:50 mdz Exp $
/* ######################################################################
AR File - Handle an 'AR' archive

14
apt-inst/contrib/extracttar.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: extracttar.cc,v 1.9 2004/01/07 20:39:37 mdz Exp $
// $Id: extracttar.cc,v 1.8.2.1 2004/01/16 18:58:50 mdz Exp $
/* ######################################################################
Extract a Tar - Tar Extractor
@ -58,8 +58,8 @@ struct ExtractTar::TarHeader
// ExtractTar::ExtractTar - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
ExtractTar::ExtractTar(FileFd &Fd,unsigned long Max) : File(Fd),
MaxInSize(Max)
ExtractTar::ExtractTar(FileFd &Fd,unsigned long Max,string DecompressionProgram) : File(Fd),
MaxInSize(Max), DecompressProg(DecompressionProgram)
{
GZPid = -1;
@ -93,7 +93,8 @@ bool ExtractTar::Done(bool Force)
// Make sure we clean it up!
kill(GZPid,SIGINT);
if (ExecWait(GZPid,_config->Find("dir::bin::gzip","/bin/gzip").c_str(),
string confvar = string("dir::bin::") + DecompressProg;
if (ExecWait(GZPid,_config->Find(confvar.c_str(),DecompressProg.c_str()).c_str(),
Force) == false)
{
GZPid = -1;
@ -134,10 +135,11 @@ bool ExtractTar::StartGzip()
SetCloseExec(STDERR_FILENO,false);
const char *Args[3];
Args[0] = _config->Find("dir::bin::gzip","/bin/gzip").c_str();
string confvar = string("dir::bin::") + DecompressProg;
Args[0] = _config->Find(confvar.c_str(),DecompressProg.c_str()).c_str();
Args[1] = "-d";
Args[2] = 0;
execv(Args[0],(char **)Args);
execvp(Args[0],(char **)Args);
cerr << _("Failed to exec gzip ") << Args[0] << endl;
_exit(100);
}

3
apt-inst/contrib/extracttar.h

@ -38,6 +38,7 @@ class ExtractTar
int GZPid;
FileFd InFd;
bool Eof;
string DecompressProg;
// Fork and reap gzip
bool StartGzip();
@ -47,7 +48,7 @@ class ExtractTar
bool Go(pkgDirStream &Stream);
ExtractTar(FileFd &Fd,unsigned long Max);
ExtractTar(FileFd &Fd,unsigned long Max,string DecompressionProgram);
virtual ~ExtractTar();
};

35
apt-inst/deb/debfile.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: debfile.cc,v 1.4 2004/01/07 20:39:37 mdz Exp $
// $Id: debfile.cc,v 1.3.2.1 2004/01/16 18:58:50 mdz Exp $
/* ######################################################################
Debian Archive File (.deb)
@ -37,12 +37,21 @@ debDebFile::debDebFile(FileFd &File) : File(File), AR(File)
{
if (_error->PendingError() == true)
return;
// Check the members for validity
if (CheckMember("debian-binary") == false ||
CheckMember("control.tar.gz") == false ||
CheckMember("data.tar.gz") == false)
if (!CheckMember("debian-binary")) {
_error->Error(_("This is not a valid DEB archive, missing '%s' member"), "debian-binary");
return;
}
if (!CheckMember("control.tar.gz")) {
_error->Error(_("This is not a valid DEB archive, missing '%s' member"), "control.tar.gz");
return;
}
if (!CheckMember("data.tar.gz") && !CheckMember("data.tar.bz2")) {
_error->Error(_("This is not a valid DEB archive, it has no '%s' or '%s' member"), "data.tar.gz", "data.tar.bz2");
return;
}
}
/*}}}*/
// DebFile::CheckMember - Check if a named member is in the archive /*{{{*/
@ -52,7 +61,7 @@ debDebFile::debDebFile(FileFd &File) : File(File), AR(File)
bool debDebFile::CheckMember(const char *Name)
{
if (AR.FindMember(Name) == 0)
return _error->Error(_("This is not a valid DEB archive, missing '%s' member"),Name);
return false;
return true;
}
/*}}}*/
@ -69,7 +78,6 @@ const ARArchive::Member *debDebFile::GotoMember(const char *Name)
const ARArchive::Member *Member = AR.FindMember(Name);
if (Member == 0)
{
_error->Error(_("Internal Error, could not locate member %s"),Name);
return 0;
}
if (File.Seek(Member->Start) == false)
@ -91,7 +99,7 @@ bool debDebFile::ExtractControl(pkgDataBase &DB)
// Prepare Tar
ControlExtract Extract;
ExtractTar Tar(File,Member->Size);
ExtractTar Tar(File,Member->Size,"gzip");
if (_error->PendingError() == true)
return false;
@ -121,13 +129,18 @@ bool debDebFile::ExtractArchive(pkgDirStream &Stream)
{
// Get the archive member and positition the file
const ARArchive::Member *Member = AR.FindMember("data.tar.gz");
const char *Compressor = "gzip";
if (Member == 0) {
Member = AR.FindMember("data.tar.bz2");
Compressor = "bzip2";
}
if (Member == 0)
return _error->Error(_("Internal Error, could not locate member"));
if (File.Seek(Member->Start) == false)
return false;
// Prepare Tar
ExtractTar Tar(File,Member->Size);
ExtractTar Tar(File,Member->Size,Compressor);
if (_error->PendingError() == true)
return false;
return Tar.Go(Stream);
@ -230,7 +243,7 @@ bool debDebFile::MemControlExtract::Read(debDebFile &Deb)
return false;
// Extract it.
ExtractTar Tar(Deb.GetFile(),Member->Size);
ExtractTar Tar(Deb.GetFile(),Member->Size,"gzip");
if (Tar.Go(*this) == false)
return false;

4
apt-inst/deb/dpkgdb.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: dpkgdb.cc,v 1.8 2004/01/07 20:39:37 mdz Exp $
// $Id: dpkgdb.cc,v 1.7.2.1 2004/01/16 18:58:50 mdz Exp $
/* ######################################################################
DPKGv1 Database Implemenation
@ -61,7 +61,7 @@ static bool EraseDir(const char *Dir)
return _error->Errno("rmdir",_("Failed to remove %s"),Dir);
// Purge it using rm
int Pid = ExecFork();
pid_t Pid = ExecFork();
// Spawn the subprocess
if (Pid == 0)

2
apt-inst/dirstream.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: dirstream.cc,v 1.4 2004/01/07 20:39:37 mdz Exp $
// $Id: dirstream.cc,v 1.3.2.1 2004/01/16 18:58:50 mdz Exp $
/* ######################################################################
Directory Stream

2
apt-inst/extract.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: extract.cc,v 1.7 2004/01/07 20:39:37 mdz Exp $
// $Id: extract.cc,v 1.6.2.1 2004/01/16 18:58:50 mdz Exp $
/* ######################################################################
Archive Extraction Directory Stream

2
apt-inst/filelist.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: filelist.cc,v 1.5 2004/01/07 20:39:37 mdz Exp $
// $Id: filelist.cc,v 1.4.2.1 2004/01/16 18:58:50 mdz Exp $
/* ######################################################################
File Listing - Manages a Cache of File -> Package names.

2
apt-inst/makefile

@ -12,7 +12,7 @@ include ../buildlib/defaults.mak
# The library name
LIBRARY=apt-inst
LIBEXT=$(GLIBC_VER)$(LIBSTDCPP_VER)
MAJOR=1.0
MAJOR=1.1
MINOR=0
SLIBS=$(PTHREADLIB) -lapt-pkg
APT_DOMAIN:=libapt-inst$(MAJOR)

463
apt-pkg/acquire-item.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: acquire-item.cc,v 1.46 2003/02/02 22:19:17 jgg Exp $
// $Id: acquire-item.cc,v 1.46.2.9 2004/01/16 18:51:11 mdz Exp $
/* ######################################################################
Acquire Item - Item to acquire
@ -19,9 +19,11 @@
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/sourcelist.h>
#include <apt-pkg/vendorlist.h>
#include <apt-pkg/error.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/md5.h>
#include <apti18n.h>
@ -32,7 +34,7 @@
#include <stdio.h>
/*}}}*/
using std::string;
using namespace std;
// Acquire::Item::Item - Constructor /*{{{*/
// ---------------------------------------------------------------------
@ -134,8 +136,9 @@ void pkgAcquire::Item::Rename(string From,string To)
/* The package file is added to the queue and a second class is
instantiated to fetch the revision file */
pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner,
string URI,string URIDesc,string ShortDesc) :
Item(Owner), RealURI(URI)
string URI,string URIDesc,string ShortDesc,
string ExpectedMD5, string comprExt) :
Item(Owner), RealURI(URI), ExpectedMD5(ExpectedMD5)
{
Decompression = false;
Erase = false;
@ -143,11 +146,17 @@ pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner,
DestFile = _config->FindDir("Dir::State::lists") + "partial/";
DestFile += URItoFileName(URI);
// Create the item
if(FileExists("/usr/bin/bzip2"))
Desc.URI = URI + ".bz2";
else
Desc.URI = URI + ".gz";
if(comprExt.empty())
{
// autoselect
if(FileExists("/usr/bin/bzip2"))
Desc.URI = URI + ".bz2";
else
Desc.URI = URI + ".gz";
} else {
Desc.URI = URI + comprExt;
}
Desc.Description = URIDesc;
Desc.Owner = this;
Desc.ShortDesc = ShortDesc;
@ -176,7 +185,13 @@ void pkgAcqIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
// no .bz2 found, retry with .gz
if(Desc.URI.substr(Desc.URI.size()-3,Desc.URI.size()-1) == "bz2") {
Desc.URI = Desc.URI.substr(0,Desc.URI.size()-3) + "gz";
QueueURI(Desc);
// retry with a gzip one
new pkgAcqIndex(Owner, RealURI, Desc.Description,Desc.ShortDesc,
ExpectedMD5, string(".gz"));
Status = StatDone;
Complete = false;
Dequeue();
return;
}
@ -199,6 +214,28 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5,
if (Decompression == true)
{
if (_config->FindB("Debug::pkgAcquire::Auth", false))
{
std::cerr << std::endl << RealURI << ": Computed MD5: " << MD5;
std::cerr << " Expected MD5: " << ExpectedMD5 << std::endl;
}
if (MD5.empty())
{
MD5Summation sum;
FileFd Fd(DestFile, FileFd::ReadOnly);
sum.AddFD(Fd.Fd(), Fd.Size());
Fd.Close();
MD5 = (string)sum.Result();
}
if (!ExpectedMD5.empty() && MD5 != ExpectedMD5)
{
Status = StatAuthError;
ErrorText = _("MD5Sum mismatch");
Rename(DestFile,DestFile + ".FAILED");
return;
}
// Done, move it into position
string FinalFile = _config->FindDir("Dir::State::lists");
FinalFile += URItoFileName(RealURI);
@ -226,7 +263,7 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5,
// The files timestamp matches
if (StringToBool(LookupTag(Message,"Alt-IMS-Hit"),false) == true)
return;
Decompression = true;
Local = true;
DestFile += ".decomp";
@ -269,31 +306,45 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5,
QueueURI(Desc);
Mode = decompProg;
}
/*}}}*/
// AcqIndexRel::pkgAcqIndexRel - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* The Release file is added to the queue */
pkgAcqIndexRel::pkgAcqIndexRel(pkgAcquire *Owner,
string URI,string URIDesc,string ShortDesc) :
Item(Owner), RealURI(URI)
pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire *Owner,
string URI,string URIDesc,string ShortDesc,
string MetaIndexURI, string MetaIndexURIDesc,
string MetaIndexShortDesc,
const vector<IndexTarget*>* IndexTargets,
indexRecords* MetaIndexParser) :
Item(Owner), RealURI(URI), MetaIndexURI(MetaIndexURI),
MetaIndexURIDesc(MetaIndexURIDesc), MetaIndexShortDesc(MetaIndexShortDesc)
{
this->MetaIndexParser = MetaIndexParser;
this->IndexTargets = IndexTargets;
DestFile = _config->FindDir("Dir::State::lists") + "partial/";
DestFile += URItoFileName(URI);
// Create the item
Desc.URI = URI;
Desc.Description = URIDesc;
Desc.ShortDesc = ShortDesc;
Desc.Owner = this;
Desc.ShortDesc = ShortDesc;
Desc.URI = URI;
string Final = _config->FindDir("Dir::State::lists");
Final += URItoFileName(RealURI);
struct stat Buf;
if (stat(Final.c_str(),&Buf) == 0)
{
// File was already in place. It needs to be re-verified
// because Release might have changed, so Move it into partial
Rename(Final,DestFile);
}
QueueURI(Desc);
}
/*}}}*/
// AcqIndexRel::Custom600Headers - Insert custom request headers /*{{{*/
// pkgAcqMetaSig::Custom600Headers - Insert custom request headers /*{{{*/
// ---------------------------------------------------------------------
/* The only header we use is the last-modified header. */
string pkgAcqIndexRel::Custom600Headers()
string pkgAcqMetaSig::Custom600Headers()
{
string Final = _config->FindDir("Dir::State::lists");
Final += URItoFileName(RealURI);
@ -304,14 +355,9 @@ string pkgAcqIndexRel::Custom600Headers()
return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime);
}
/*}}}*/
// AcqIndexRel::Done - Item downloaded OK /*{{{*/
// ---------------------------------------------------------------------
/* The release file was not placed into the download directory then
a copy URI is generated and it is copied there otherwise the file
in the partial directory is moved into .. and the URI is finished. */
void pkgAcqIndexRel::Done(string Message,unsigned long Size,string MD5,
pkgAcquire::MethodConfig *Cfg)
void pkgAcqMetaSig::Done(string Message,unsigned long Size,string MD5,
pkgAcquire::MethodConfig *Cfg)
{
Item::Done(Message,Size,MD5,Cfg);
@ -323,34 +369,34 @@ void pkgAcqIndexRel::Done(string Message,unsigned long Size,string MD5,
return;
}
Complete = true;
// The files timestamp matches
if (StringToBool(LookupTag(Message,"IMS-Hit"),false) == true)
return;
// We have to copy it into place
if (FileName != DestFile)
{
// We have to copy it into place
Local = true;
Desc.URI = "copy:" + FileName;
QueueURI(Desc);
return;
}
// Done, move it into position
string FinalFile = _config->FindDir("Dir::State::lists");
FinalFile += URItoFileName(RealURI);
Rename(DestFile,FinalFile);
chmod(FinalFile.c_str(),0644);
Complete = true;
// queue a pkgAcqMetaIndex to be verified against the sig we just retrieved
new pkgAcqMetaIndex(Owner, MetaIndexURI, MetaIndexURIDesc, MetaIndexShortDesc,
DestFile, IndexTargets, MetaIndexParser);
}
/*}}}*/
// AcqIndexRel::Failed - Silence failure messages for missing rel files /*{{{*/
// ---------------------------------------------------------------------
/* */
void pkgAcqIndexRel::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
void pkgAcqMetaSig::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
{
// Delete any existing sigfile, so that this source isn't
// mistakenly trusted
string Final = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI);
unlink(Final.c_str());
// queue a pkgAcqMetaIndex with no sigfile
new pkgAcqMetaIndex(Owner, MetaIndexURI, MetaIndexURIDesc, MetaIndexShortDesc,
"", IndexTargets, MetaIndexParser);
if (Cnf->LocalOnly == true ||
StringToBool(LookupTag(Message,"Transient-Failure"),false) == false)
{
@ -363,6 +409,284 @@ void pkgAcqIndexRel::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
Item::Failed(Message,Cnf);
}
pkgAcqMetaIndex::pkgAcqMetaIndex(pkgAcquire *Owner,
string URI,string URIDesc,string ShortDesc,
string SigFile,
const vector<struct IndexTarget*>* IndexTargets,
indexRecords* MetaIndexParser) :
Item(Owner), RealURI(URI), SigFile(SigFile)
{
this->AuthPass = false;
this->MetaIndexParser = MetaIndexParser;
this->IndexTargets = IndexTargets;
DestFile = _config->FindDir("Dir::State::lists") + "partial/";
DestFile += URItoFileName(URI);
// Create the item
Desc.Description = URIDesc;
Desc.Owner = this;
Desc.ShortDesc = ShortDesc;
Desc.URI = URI;
QueueURI(Desc);
}
/*}}}*/
// pkgAcqMetaIndex::Custom600Headers - Insert custom request headers /*{{{*/
// ---------------------------------------------------------------------
/* The only header we use is the last-modified header. */
string pkgAcqMetaIndex::Custom600Headers()
{
string Final = _config->FindDir("Dir::State::lists");
Final += URItoFileName(RealURI);
struct stat Buf;
if (stat(Final.c_str(),&Buf) != 0)
return "\nIndex-File: true";
return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime);
}
void pkgAcqMetaIndex::Done(string Message,unsigned long Size,string MD5,
pkgAcquire::MethodConfig *Cfg)
{
Item::Done(Message,Size,MD5,Cfg);
// MetaIndexes are done in two passes: one to download the
// metaindex with an appropriate method, and a second to verify it
// with the gpgv method
if (AuthPass == true)
{
AuthDone(Message);
}
else
{
RetrievalDone(Message);
if (!Complete)
// Still more retrieving to do
return;
if (SigFile == "")
{
// There was no signature file, so we are finished. Download
// the indexes without verification.
QueueIndexes(false);
}
else
{
// There was a signature file, so pass it to gpgv for
// verification
if (_config->FindB("Debug::pkgAcquire::Auth", false))
std::cerr << "Metaindex acquired, queueing gpg verification ("
<< SigFile << "," << DestFile << ")\n";
AuthPass = true;
Desc.URI = "gpgv:" + SigFile;
QueueURI(Desc);
Mode = "gpgv";
}
}
}
void pkgAcqMetaIndex::RetrievalDone(string Message)
{
// We have just finished downloading a Release file (it is not
// verified yet)
string FileName = LookupTag(Message,"Filename");
if (FileName.empty() == true)
{
Status = StatError;
ErrorText = "Method gave a blank filename";
return;
}
if (FileName != DestFile)
{
Local = true;
Desc.URI = "copy:" + FileName;
QueueURI(Desc);
return;
}
Complete = true;
string FinalFile = _config->FindDir("Dir::State::lists");
FinalFile += URItoFileName(RealURI);
// The files timestamp matches
if (StringToBool(LookupTag(Message,"IMS-Hit"),false) == false)
{
// Move it into position
Rename(DestFile,FinalFile);
}
DestFile = FinalFile;
}
void pkgAcqMetaIndex::AuthDone(string Message)
{
// At this point, the gpgv method has succeeded, so there is a
// valid signature from a key in the trusted keyring. We
// perform additional verification of its contents, and use them
// to verify the indexes we are about to download
if (!MetaIndexParser->Load(DestFile))
{
Status = StatAuthError;
ErrorText = MetaIndexParser->ErrorText;
return;
}
if (!VerifyVendor())
{
return;
}
if (_config->FindB("Debug::pkgAcquire::Auth", false))
std::cerr << "Signature verification succeeded: "
<< DestFile << std::endl;
// Download further indexes with verification
QueueIndexes(true);
// Done, move signature file into position
string VerifiedSigFile = _config->FindDir("Dir::State::lists") +
URItoFileName(RealURI) + ".gpg";
Rename(SigFile,VerifiedSigFile);
chmod(VerifiedSigFile.c_str(),0644);
}
void pkgAcqMetaIndex::QueueIndexes(bool verify)
{
for (vector <struct IndexTarget*>::const_iterator Target = IndexTargets->begin();
Target != IndexTargets->end();
Target++)
{
string ExpectedIndexMD5;
if (verify)
{
const indexRecords::checkSum *Record = MetaIndexParser->Lookup((*Target)->MetaKey);
if (!Record)
{
Status = StatAuthError;
ErrorText = "Unable to find expected entry "
+ (*Target)->MetaKey + " in Meta-index file (malformed Release file?)";
return;
}
ExpectedIndexMD5 = Record->MD5Hash;
if (_config->FindB("Debug::pkgAcquire::Auth", false))
{
std::cerr << "Queueing: " << (*Target)->URI << std::endl;
std::cerr << "Expected MD5: " << ExpectedIndexMD5 << std::endl;
}
if (ExpectedIndexMD5.empty())
{
Status = StatAuthError;
ErrorText = "Unable to find MD5 sum for "
+ (*Target)->MetaKey + " in Meta-index file";
return;
}
}
// Queue Packages file
new pkgAcqIndex(Owner, (*Target)->URI, (*Target)->Description,
(*Target)->ShortDesc, ExpectedIndexMD5);
}
}
bool pkgAcqMetaIndex::VerifyVendor()
{
// // Maybe this should be made available from above so we don't have
// // to read and parse it every time?
// pkgVendorList List;
// List.ReadMainList();
// const Vendor* Vndr = NULL;
// for (std::vector<string>::const_iterator I = GPGVOutput.begin(); I != GPGVOutput.end(); I++)
// {
// string::size_type pos = (*I).find("VALIDSIG ");
// if (_config->FindB("Debug::Vendor", false))
// std::cerr << "Looking for VALIDSIG in \"" << (*I) << "\": pos " << pos
// << std::endl;
// if (pos != std::string::npos)
// {
// string Fingerprint = (*I).substr(pos+sizeof("VALIDSIG"));
// if (_config->FindB("Debug::Vendor", false))
// std::cerr << "Looking for \"" << Fingerprint << "\" in vendor..." <<
// std::endl;
// Vndr = List.FindVendor(Fingerprint) != "";
// if (Vndr != NULL);
// break;
// }
// }
string Transformed = MetaIndexParser->GetExpectedDist();
if (Transformed == "../project/experimental")
{
Transformed = "experimental";
}
string::size_type pos = Transformed.rfind('/');
if (pos != string::npos)
{
Transformed = Transformed.substr(0, pos);
}
if (Transformed == ".")
{
Transformed = "";
}
if (_config->FindB("Debug::pkgAcquire::Auth", false))
{
std::cerr << "Got Codename: " << MetaIndexParser->GetDist() << std::endl;
std::cerr << "Expecting Dist: " << MetaIndexParser->GetExpectedDist() << std::endl;
std::cerr << "Transformed Dist: " << Transformed << std::endl;
}
if (MetaIndexParser->CheckDist(Transformed) == false)
{
// This might become fatal one day
// Status = StatAuthError;
// ErrorText = "Conflicting distribution; expected "
// + MetaIndexParser->GetExpectedDist() + " but got "
// + MetaIndexParser->GetDist();
// return false;
if (!Transformed.empty())
{
_error->Warning("Conflicting distribution: %s (expected %s but got %s)",
Desc.Description.c_str(),
Transformed.c_str(),
MetaIndexParser->GetDist().c_str());
}
}
return true;
}
/*}}}*/
// pkgAcqMetaIndex::Failed - no Release file present or no signature
// file present /*{{{*/
// ---------------------------------------------------------------------
/* */
void pkgAcqMetaIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
{
if (AuthPass == true)
{
// gpgv method failed
_error->Warning("GPG error: %s: %s",
Desc.Description.c_str(),
LookupTag(Message,"Message").c_str());
}
// No Release file was present, or verification failed, so fall
// back to queueing Packages files without verification
QueueIndexes(false);
}
/*}}}*/
// AcqArchive::AcqArchive - Constructor /*{{{*/
@ -373,7 +697,8 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
pkgRecords *Recs,pkgCache::VerIterator const &Version,
string &StoreFilename) :
Item(Owner), Version(Version), Sources(Sources), Recs(Recs),
StoreFilename(StoreFilename), Vf(Version.FileList())
StoreFilename(StoreFilename), Vf(Version.FileList()),
Trusted(false)
{
Retries = _config->FindI("Acquire::Retries",0);
@ -411,7 +736,25 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
QuoteString(Version.Arch(),"_:.") +
"." + flExtension(Parse.FileName());
}
// check if we have one trusted source for the package. if so, switch
// to "TrustedOnly" mode
for (pkgCache::VerFileIterator i = Version.FileList(); i.end() == false; i++)
{
pkgIndexFile *Index;
if (Sources->FindIndex(i.File(),Index) == false)
continue;
if (_config->FindB("Debug::pkgAcquire::Auth", false))
{
std::cerr << "Checking index: " << Index->Describe()
<< "(Trusted=" << Index->IsTrusted() << ")\n";
}
if (Index->IsTrusted()) {
Trusted = true;
break;
}
}
// Select a source
if (QueueNext() == false && _error->PendingError() == false)
_error->Error(_("I wasn't able to locate file for the %s package. "
@ -437,6 +780,11 @@ bool pkgAcqArchive::QueueNext()
if (Sources->FindIndex(Vf.File(),Index) == false)
continue;
// only try to get a trusted package from another source if that source
// is also trusted
if(Trusted && !Index->IsTrusted())
continue;
// Grab the text package record
pkgRecords::Parser &Parse = Recs->Lookup(Vf);
if (_error->PendingError() == true)
@ -449,6 +797,11 @@ bool pkgAcqArchive::QueueNext()
"field for package %s."),
Version.ParentPkg().Name());
Desc.URI = Index->ArchiveURI(PkgFile);
Desc.Description = Index->ArchiveInfo(Version);
Desc.Owner = this;
Desc.ShortDesc = Version.ParentPkg().Name();
// See if we already have the file. (Legacy filenames)
FileSize = Version->Size;
string FinalFile = _config->FindDir("Dir::Cache::Archives") + flNotDir(PkgFile);
@ -609,6 +962,14 @@ void pkgAcqArchive::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
}
}
/*}}}*/
// AcqArchive::IsTrusted - Determine whether this archive comes from a
// trusted source /*{{{*/
// ---------------------------------------------------------------------
bool pkgAcqArchive::IsTrusted()
{
return Trusted;
}
// AcqArchive::Finished - Fetching has finished, tidy up /*{{{*/
// ---------------------------------------------------------------------
/* */

76
apt-pkg/acquire-item.h

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: acquire-item.h,v 1.26 2003/02/02 03:13:13 doogie Exp $
// $Id: acquire-item.h,v 1.26.2.3 2004/01/02 18:51:00 mdz Exp $
/* ######################################################################
Acquire Item - Item to acquire
@ -22,7 +22,10 @@
#include <apt-pkg/acquire.h>
#include <apt-pkg/indexfile.h>
#include <apt-pkg/vendor.h>
#include <apt-pkg/sourcelist.h>
#include <apt-pkg/pkgrecords.h>
#include <apt-pkg/indexrecords.h>
#ifdef __GNUG__
#pragma interface "apt-pkg/acquire-item.h"
@ -45,7 +48,7 @@ class pkgAcquire::Item
public:
// State of the item
enum {StatIdle, StatFetching, StatDone, StatError} Status;
enum {StatIdle, StatFetching, StatDone, StatError, StatAuthError} Status;
string ErrorText;
unsigned long FileSize;
unsigned long PartialSize;
@ -67,11 +70,13 @@ class pkgAcquire::Item
virtual void Start(string Message,unsigned long Size);
virtual string Custom600Headers() {return string();};
virtual string DescURI() = 0;
virtual string ShortDesc() {return DescURI();}
virtual void Finished() {};
// Inquire functions
virtual string MD5Sum() {return string();};
pkgAcquire *GetOwner() {return Owner;};
virtual bool IsTrusted() {return false;};
Item(pkgAcquire *Owner);
virtual ~Item();
@ -86,6 +91,7 @@ class pkgAcqIndex : public pkgAcquire::Item
bool Erase;
pkgAcquire::ItemDesc Desc;
string RealURI;
string ExpectedMD5;
public:
@ -97,28 +103,73 @@ class pkgAcqIndex : public pkgAcquire::Item
virtual string DescURI() {return RealURI + ".gz";};
pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc,
string ShortDesct);
string ShortDesct, string ExpectedMD5, string compressExt="");
};
// Item class for index files
class pkgAcqIndexRel : public pkgAcquire::Item
struct IndexTarget
{
string URI;
string Description;
string ShortDesc;
string MetaKey;
};
// Item class for index signatures
class pkgAcqMetaSig : public pkgAcquire::Item
{
protected:
pkgAcquire::ItemDesc Desc;
string RealURI;
string RealURI,MetaIndexURI,MetaIndexURIDesc,MetaIndexShortDesc;
indexRecords* MetaIndexParser;
const vector<struct IndexTarget*>* IndexTargets;
public:
// Specialized action members
virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
virtual void Done(string Message,unsigned long Size,string Md5Hash,
pkgAcquire::MethodConfig *Cnf);
pkgAcquire::MethodConfig *Cnf);
virtual string Custom600Headers();
virtual string DescURI() {return RealURI;};
virtual string DescURI() {return RealURI; };
pkgAcqMetaSig(pkgAcquire *Owner,string URI,string URIDesc, string ShortDesc,
string MetaIndexURI, string MetaIndexURIDesc, string MetaIndexShortDesc,
const vector<struct IndexTarget*>* IndexTargets,
indexRecords* MetaIndexParser);
};
// Item class for index signatures
class pkgAcqMetaIndex : public pkgAcquire::Item
{
protected:
pkgAcquire::ItemDesc Desc;
string RealURI; // FIXME: is this redundant w/ Desc.URI?
string SigFile;
const vector<struct IndexTarget*>* IndexTargets;
indexRecords* MetaIndexParser;
bool AuthPass;
bool VerifyVendor();
void RetrievalDone(string Message);
void AuthDone(string Message);
void QueueIndexes(bool verify);
public:
pkgAcqIndexRel(pkgAcquire *Owner,string URI,string URIDesc,
string ShortDesct);
// Specialized action members
virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
virtual void Done(string Message,unsigned long Size,string Md5Hash,
pkgAcquire::MethodConfig *Cnf);
virtual string Custom600Headers();
virtual string DescURI() {return RealURI; };
pkgAcqMetaIndex(pkgAcquire *Owner,
string URI,string URIDesc, string ShortDesc,
string SigFile,
const vector<struct IndexTarget*>* IndexTargets,
indexRecords* MetaIndexParser);
};
// Item class for archive files
@ -135,6 +186,7 @@ class pkgAcqArchive : public pkgAcquire::Item
string &StoreFilename;
pkgCache::VerFileIterator Vf;
unsigned int Retries;
bool Trusted;
// Queue the next available file for download.
bool QueueNext();
@ -147,7 +199,9 @@ class pkgAcqArchive : public pkgAcquire::Item
pkgAcquire::MethodConfig *Cnf);
virtual string MD5Sum() {return MD5;};
virtual string DescURI() {return Desc.URI;};
virtual string ShortDesc() {return Desc.ShortDesc;};
virtual void Finished();
virtual bool IsTrusted();
pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
pkgRecords *Recs,pkgCache::VerIterator const &Version,

8
apt-pkg/acquire-method.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: acquire-method.cc,v 1.27 2001/05/22 04:27:11 jgg Exp $
// $Id: acquire-method.cc,v 1.27.2.1 2003/12/24 23:09:17 mdz Exp $
/* ######################################################################
Acquire Method
@ -29,6 +29,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/signal.h>
/*}}}*/
using namespace std;
@ -181,6 +182,11 @@ void pkgAcqMethod::URIDone(FetchResult &Res, FetchResult *Alt)
End += snprintf(End,sizeof(S)-50 - (End - S),"MD5-Hash: %s\n",Res.MD5Sum.c_str());
if (Res.SHA1Sum.empty() == false)
End += snprintf(End,sizeof(S)-50 - (End - S),"SHA1-Hash: %s\n",Res.SHA1Sum.c_str());
if (Res.GPGVOutput.size() > 0)
End += snprintf(End,sizeof(S)-50 - (End - S),"GPGVOutput:\n");
for (vector<string>::iterator I = Res.GPGVOutput.begin();
I != Res.GPGVOutput.end(); I++)
End += snprintf(End,sizeof(S)-50 - (End - S), " %s\n", (*I).c_str());
if (Res.ResumePoint != 0)
End += snprintf(End,sizeof(S)-50 - (End - S),"Resume-Point: %lu\n",

3
apt-pkg/acquire-method.h

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: acquire-method.h,v 1.15 2001/03/13 06:51:46 jgg Exp $
// $Id: acquire-method.h,v 1.15.2.1 2003/12/24 23:09:17 mdz Exp $
/* ######################################################################
Acquire Method - Method helper class + functions
@ -39,6 +39,7 @@ class pkgAcqMethod
{
string MD5Sum;
string SHA1Sum;
vector<string> GPGVOutput;
time_t LastModified;
bool IMSHit;
string Filename;

2
apt-pkg/acquire.cc

@ -481,7 +481,7 @@ double pkgAcquire::PartialPresent()
Total += (*I)->PartialSize;
return Total;
}
/*}}}*/
// Acquire::UriBegin - Start iterator for the uri list /*{{{*/
// ---------------------------------------------------------------------
/* */

4
apt-pkg/acquire.h

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: acquire.h,v 1.29 2001/05/22 04:17:18 jgg Exp $
// $Id: acquire.h,v 1.29.2.1 2003/12/24 23:09:17 mdz Exp $
/* ######################################################################
Acquire - File Acquiration
@ -121,7 +121,7 @@ class pkgAcquire
double TotalNeeded();
double FetchNeeded();
double PartialPresent();
pkgAcquire(pkgAcquireStatus *Log = 0);
virtual ~pkgAcquire();
};

25
apt-pkg/algorithms.cc

@ -50,26 +50,29 @@ pkgSimulate::pkgSimulate(pkgDepCache *Cache) : pkgPackageManager(Cache),
/*}}}*/
// Simulate::Describe - Describe a package /*{{{*/
// ---------------------------------------------------------------------
/* Parameter Now == true gives both current and available varsion,
Parameter Now == false gives only the available package version */
void pkgSimulate::Describe(PkgIterator Pkg,ostream &out,bool Now)
/* Parameter Current == true displays the current package version,
Parameter Candidate == true displays the candidate package version */
void pkgSimulate::Describe(PkgIterator Pkg,ostream &out,bool Current,bool Candidate)
{
VerIterator Ver(Sim);
out << Pkg.Name();
if (Now == true)
if (Current == true)
{
Ver = Pkg.CurrentVer();
if (Ver.end() == false)
out << " [" << Ver.VerStr() << ']';
}
Ver = Sim[Pkg].CandidateVerIter(Sim);
if (Ver.end() == true)
return;
if (Candidate == true)
{
Ver = Sim[Pkg].CandidateVerIter(Sim);
if (Ver.end() == true)
return;
out << " (" << Ver.VerStr() << ' ' << Ver.RelStr() << ')';
out << " (" << Ver.VerStr() << ' ' << Ver.RelStr() << ')';
}
}
/*}}}*/
// Simulate::Install - Simulate unpacking of a package /*{{{*/
@ -82,7 +85,7 @@ bool pkgSimulate::Install(PkgIterator iPkg,string /*File*/)
Flags[Pkg->ID] = 1;
cout << "Inst ";
Describe(Pkg,cout,true);
Describe(Pkg,cout,true,true);
Sim.MarkInstall(Pkg,false);
// Look for broken conflicts+predepends.
@ -156,7 +159,7 @@ bool pkgSimulate::Configure(PkgIterator iPkg)
else
{
cout << "Conf ";
Describe(Pkg,cout,false);
Describe(Pkg,cout,false,true);
}
if (Sim.BrokenCount() != 0)
@ -181,7 +184,7 @@ bool pkgSimulate::Remove(PkgIterator iPkg,bool Purge)
cout << "Purg ";
else
cout << "Remv ";
Describe(Pkg,cout,false);
Describe(Pkg,cout,true,false);
if (Sim.BrokenCount() != 0)
ShortBreaks();

4
apt-pkg/algorithms.h

@ -67,8 +67,10 @@ class pkgSimulate : public pkgPackageManager
virtual bool Install(PkgIterator Pkg,string File);
virtual bool Configure(PkgIterator Pkg);
virtual bool Remove(PkgIterator Pkg,bool Purge);
private:
void ShortBreaks();
void Describe(PkgIterator iPkg,ostream &out,bool Now);
void Describe(PkgIterator iPkg,ostream &out,bool Current,bool Candidate);
public:

3
apt-pkg/cacheiterators.h

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: cacheiterators.h,v 1.18 2003/10/09 23:15:25 mdz Exp $
// $Id: cacheiterators.h,v 1.18.2.1 2004/05/08 22:44:27 mdz Exp $
/* ######################################################################
Cache Iterators - Iterators for navigating the cache structure
@ -78,7 +78,6 @@ class pkgCache::PkgIterator
inline bool Purge() const {return Pkg->CurrentState == pkgCache::State::Purge ||
(Pkg->CurrentVer == 0 && Pkg->CurrentState == pkgCache::State::NotInstalled);};
inline VerIterator VersionList() const;
inline VerIterator TargetVer() const;
inline VerIterator CurrentVer() const;
inline DepIterator RevDependsList() const;
inline PrvIterator ProvidesList() const;

4
apt-pkg/contrib/fileutl.cc

@ -306,7 +306,7 @@ bool WaitFd(int Fd,bool write,unsigned long timeout)
/* This is used if you want to cleanse the environment for the forked
child, it fixes up the important signals and nukes all of the fds,
otherwise acts like normal fork. */
int ExecFork()
pid_t ExecFork()
{
// Fork off the process
pid_t Process = fork();
@ -340,7 +340,7 @@ int ExecFork()
/* Waits for the given sub process. If Reap is set then no errors are
generated. Otherwise a failed subprocess will generate a proper descriptive
message */
bool ExecWait(int Pid,const char *Name,bool Reap)
bool ExecWait(pid_t Pid,const char *Name,bool Reap)
{
if (Pid <= 1)
return true;

4
apt-pkg/contrib/fileutl.h

@ -87,8 +87,8 @@ string SafeGetCWD();
void SetCloseExec(int Fd,bool Close);
void SetNonBlock(int Fd,bool Block);
bool WaitFd(int Fd,bool write = false,unsigned long timeout = 0);
int ExecFork();
bool ExecWait(int Pid,const char *Name,bool Reap = false);
pid_t ExecFork();
bool ExecWait(pid_t Pid,const char *Name,bool Reap = false);
// File string manipulators
string flNotDir(string File);

77
apt-pkg/deb/debindexfile.cc

@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: debindexfile.cc,v 1.6 2004/01/04 07:41:30 mdz Exp $
// $Id: debindexfile.cc,v 1.5.2.3 2004/01/04 19:11:00 mdz Exp $
/* ######################################################################
Debian Specific sources.list types and the three sorts of Debian
@ -23,6 +23,7 @@
#include <apt-pkg/error.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/debmetaindex.h>
#include <sys/stat.h>
/*}}}*/
@ -30,8 +31,8 @@
// SourcesIndex::debSourcesIndex - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
debSourcesIndex::debSourcesIndex(string URI,string Dist,string Section) :
URI(URI), Dist(Dist), Section(Section)
debSourcesIndex::debSourcesIndex(string URI,string Dist,string Section,bool Trusted) :
pkgIndexFile(Trusted), URI(URI), Dist(Dist), Section(Section)
{
}
/*}}}*/
@ -129,16 +130,6 @@ string debSourcesIndex::IndexURI(const char *Type) const
return Res;
}
/*}}}*/
// SourcesIndex::GetIndexes - Fetch the index files /*{{{*/
// ---------------------------------------------------------------------
/* */
bool debSourcesIndex::GetIndexes(pkgAcquire *Owner) const
{
new pkgAcqIndex(Owner,IndexURI("Sources"),Info("Sources"),"Sources");
new pkgAcqIndexRel(Owner,IndexURI("Release"),Info("Release"),"Release");
return true;
}
/*}}}*/
// SourcesIndex::Exists - Check if the index is available /*{{{*/
// ---------------------------------------------------------------------
/* */
@ -162,8 +153,8 @@ unsigned long debSourcesIndex::Size() const
// PackagesIndex::debPackagesIndex - Contructor /*{{{*/
// ---------------------------------------------------------------------
/* */
debPackagesIndex::debPackagesIndex(string URI,string Dist,string Section) :
URI(URI), Dist(Dist), Section(Section)
debPackagesIndex::debPackagesIndex(string URI,string Dist,string Section,bool Trusted) :
pkgIndexFile(Trusted), URI(URI), Dist(Dist), Section(Section)
{
}
/*}}}*/
@ -246,16 +237,6 @@ string debPackagesIndex::IndexURI(const char *Type) const
return Res;
}
/*}}}*/
// PackagesIndex::GetIndexes - Fetch the index files /*{{{*/
// ---------------------------------------------------------------------
/* */
bool debPackagesIndex::GetIndexes(pkgAcquire *Owner) const
{
new pkgAcqIndex(Owner,IndexURI("Packages"),Info("Packages"),"Packages");
new pkgAcqIndexRel(Owner,IndexURI("Release"),Info("Release"),"Release");
return true;
}
/*}}}*/
// PackagesIndex::Exists - Check if the index is available /*{{{*/
// ---------------------------------------------------------------------
/* */
@ -303,7 +284,7 @@ bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const
return _error->Error("Problem with MergeList %s",PackageFile.c_str());
// Check the release file
string ReleaseFile = IndexFile("Release");
string ReleaseFile = debReleaseIndex(URI,Dist).MetaIndexFile("Release");
if (FileExists(ReleaseFile) == true)
{
FileFd Rel(ReleaseFile,FileFd::ReadOnly);
@ -342,7 +323,7 @@ pkgCache::PkgFileIterator debPackagesIndex::FindInCache(pkgCache &Cache) const
// StatusIndex::debStatusIndex - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
debStatusIndex::debStatusIndex(string File) : File(File)
debStatusIndex::debStatusIndex(string File) : pkgIndexFile(true), File(File)
{
}
/*}}}*/
@ -418,48 +399,6 @@ bool debStatusIndex::Exists() const
}
/*}}}*/
// Source List types for Debian /*{{{*/
class debSLTypeDeb : public pkgSourceList::Type
{
public:
bool CreateItem(vector<pkgIndexFile *> &List,string URI,
string Dist,string Section,
pkgSourceList::Vendor const *Vendor) const
{
List.push_back(new debPackagesIndex(URI,Dist,Section));
return true;
};
debSLTypeDeb()
{
Name = "deb";
Label = "Standard Debian binary tree";
}
};
class debSLTypeDebSrc : public pkgSourceList::Type
{
public:
bool CreateItem(vector<pkgIndexFile *> &List,string URI,
string Dist,string Section,
pkgSourceList::Vendor const *Vendor) const
{
List.push_back(new debSourcesIndex(URI,Dist,Section));
return true;
};
debSLTypeDebSrc()
{
Name = "deb-src";
Label = "Standard Debian source tree";
}
};
debSLTypeDeb _apt_DebType;