summaryrefslogtreecommitdiff
path: root/apt-inst
diff options
context:
space:
mode:
Diffstat (limited to 'apt-inst')
-rw-r--r--apt-inst/contrib/arfile.cc2
-rw-r--r--apt-inst/contrib/extracttar.cc14
-rw-r--r--apt-inst/contrib/extracttar.h3
-rw-r--r--apt-inst/deb/debfile.cc35
-rw-r--r--apt-inst/deb/dpkgdb.cc4
-rw-r--r--apt-inst/dirstream.cc2
-rw-r--r--apt-inst/extract.cc2
-rw-r--r--apt-inst/filelist.cc2
-rw-r--r--apt-inst/makefile2
9 files changed, 41 insertions, 25 deletions
diff --git a/apt-inst/contrib/arfile.cc b/apt-inst/contrib/arfile.cc
index eb708271e..54d90bf3a 100644
--- a/apt-inst/contrib/arfile.cc
+++ b/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
diff --git a/apt-inst/contrib/extracttar.cc b/apt-inst/contrib/extracttar.cc
index 63bb2ba80..4c29757ab 100644
--- a/apt-inst/contrib/extracttar.cc
+++ b/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);
}
diff --git a/apt-inst/contrib/extracttar.h b/apt-inst/contrib/extracttar.h
index aaca987f2..ec930ca22 100644
--- a/apt-inst/contrib/extracttar.h
+++ b/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();
};
diff --git a/apt-inst/deb/debfile.cc b/apt-inst/deb/debfile.cc
index d3a39911d..fe2130677 100644
--- a/apt-inst/deb/debfile.cc
+++ b/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;
diff --git a/apt-inst/deb/dpkgdb.cc b/apt-inst/deb/dpkgdb.cc
index d06ff6353..7da5a26aa 100644
--- a/apt-inst/deb/dpkgdb.cc
+++ b/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)
diff --git a/apt-inst/dirstream.cc b/apt-inst/dirstream.cc
index 3821156e2..a8a4d9c0d 100644
--- a/apt-inst/dirstream.cc
+++ b/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
diff --git a/apt-inst/extract.cc b/apt-inst/extract.cc
index d06cd57f5..2568ed99f 100644
--- a/apt-inst/extract.cc
+++ b/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
diff --git a/apt-inst/filelist.cc b/apt-inst/filelist.cc
index ee8cbbf73..442dcdf06 100644
--- a/apt-inst/filelist.cc
+++ b/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.
diff --git a/apt-inst/makefile b/apt-inst/makefile
index 0b02d4c79..cc61841b9 100644
--- a/apt-inst/makefile
+++ b/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)