#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/indexfile.h>
-#include <apt-pkg/indexrecords.h>
#include <apt-pkg/init.h>
#include <apt-pkg/md5.h>
#include <apt-pkg/metaindex.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
-#include <sys/wait.h>
#include <unistd.h>
#include <pwd.h>
#include <grp.h>
// FindSrc - Find a source record /*{{{*/
// ---------------------------------------------------------------------
/* */
-#if APT_PKG_ABI >= 413
static pkgSrcRecords::Parser *FindSrc(const char *Name,
-#else
-static pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
-#endif
pkgSrcRecords &SrcRecs,string &Src,
CacheFile &CacheFile)
{
{
// the Version we have is possibly fuzzy or includes binUploads,
// so we use the Version of the SourcePkg (empty if same as package)
-#if APT_PKG_ABI >= 413
Src = Ver.SourcePkgName();
VerTag = Ver.SourceVerStr();
-#else
- pkgRecords::Parser &Parse = Recs.Lookup(VF);
- Src = Parse.SourcePkg();
- // no SourcePkg name, so it is the "binary" name
- if (Src.empty() == true)
- Src = TmpSrc;
- VerTag = Parse.SourceVer();
- if (VerTag.empty() == true)
- VerTag = Ver.VerStr();
-#endif
break;
}
}
pkgCache::VerIterator Ver = Cache->GetCandidateVer(Pkg);
if (Ver.end() == false)
{
-#if APT_PKG_ABI >= 413
if (strcmp(Ver.SourcePkgName(),Ver.ParentPkg().Name()) != 0)
Src = Ver.SourcePkgName();
if (VerTag.empty() == true && strcmp(Ver.SourceVerStr(),Ver.VerStr()) != 0)
VerTag = Ver.SourceVerStr();
-#else
- pkgRecords::Parser &Parse = Recs.Lookup(Ver.FileList());
- Src = Parse.SourcePkg();
- if (VerTag.empty() == true)
- VerTag = Parse.SourceVer();
-#endif
}
}
}
return true;
}
- // Disable drop-privs if "_apt" can not write to the target dir
- CheckDropPrivsMustBeDisabled(Fetcher);
-
if (_error->PendingError() == true || CheckAuth(Fetcher, false) == false)
return false;
pkgSourceList *List = Cache.GetSourceList();
// Create the text record parsers
-#if APT_PKG_ABI < 413
- pkgRecords Recs(Cache);
-#endif
pkgSrcRecords SrcRecs(*List);
if (_error->PendingError() == true)
return false;
AcqTextStatus Stat(std::cout, ScreenWidth,_config->FindI("quiet",0));
pkgAcquire Fetcher(&Stat);
- SPtrArray<DscFile> Dsc = new DscFile[CmdL.FileSize()];
+ std::unique_ptr<DscFile[]> Dsc(new DscFile[CmdL.FileSize()]);
// insert all downloaded uris into this set to avoid downloading them
// twice
for (const char **I = CmdL.FileList + 1; *I != 0; I++, J++)
{
string Src;
-#if APT_PKG_ABI >= 413
pkgSrcRecords::Parser *Last = FindSrc(*I,SrcRecs,Src,Cache);
-#else
- pkgSrcRecords::Parser *Last = FindSrc(*I,Recs,SrcRecs,Src,Cache);
-#endif
if (Last == 0) {
return _error->Error(_("Unable to find a source package for %s"),Src.c_str());
}
}
pos += vcs.length()+2;
string::size_type epos = srec.find("\n", pos);
- string uri = srec.substr(pos,epos-pos).c_str();
+ string const uri = srec.substr(pos,epos-pos);
ioprintf(c1out, _("NOTICE: '%s' packaging is maintained in "
"the '%s' version control system at:\n"
"%s\n"),
Src.c_str(), vcs.c_str(), uri.c_str());
- if(vcs == "Bzr")
- ioprintf(c1out,_("Please use:\n"
- "bzr branch %s\n"
- "to retrieve the latest (possibly unreleased) "
- "updates to the package.\n"),
- uri.c_str());
+ std::string vcscmd;
+ if (vcs == "Bzr")
+ vcscmd = "bzr branch " + uri;
+ else if (vcs == "Git")
+ vcscmd = "git clone " + uri;
+
+ if (vcscmd.empty() == false)
+ ioprintf(c1out,_("Please use:\n%s\n"
+ "to retrieve the latest (possibly unreleased) "
+ "updates to the package.\n"),
+ vcscmd.c_str());
break;
}
return true;
}
- // Disable drop-privs if "_apt" can not write to the target dir
- CheckDropPrivsMustBeDisabled(Fetcher);
-
// check authentication status of the source as well
if (UntrustedList.empty() == false && AuthPrompt(UntrustedList, false) == false)
return false;
_exit(0);
}
- // Wait for the subprocess
- int Status = 0;
- while (waitpid(Process,&Status,0) != Process)
- {
- if (errno == EINTR)
- continue;
- return _error->Errno("waitpid","Couldn't wait for subprocess");
- }
-
- if (WIFEXITED(Status) == 0 || WEXITSTATUS(Status) != 0)
- return _error->Error(_("Child process failed"));
-
- return true;
+ return ExecWait(Process, "dpkg-source");
}
/*}}}*/
// DoBuildDep - Install/removes packages to satisfy build dependencies /*{{{*/
CacheFile Cache;
_config->Set("APT::Install-Recommends", false);
+
+ bool WantLock = _config->FindB("APT::Get::Print-URIs", false) == false;
- if (Cache.Open(true) == false)
+ if (Cache.Open(WantLock) == false)
return false;
if (CmdL.FileSize() <= 1)
{
string Src;
pkgSrcRecords::Parser *Last = 0;
- SPtr<pkgSrcRecords::Parser> LastOwner;
+ std::unique_ptr<pkgSrcRecords::Parser> LastOwner;
// an unpacked debian source tree
using APT::String::Startswith;
std::string TypeName = "Debian control file";
pkgIndexFile::Type *Type = pkgIndexFile::Type::GetType(TypeName.c_str());
if(Type != NULL)
- LastOwner = Last = Type->CreateSrcPkgParser(*I);
+ LastOwner.reset(Last = Type->CreateSrcPkgParser(*I));
}
// if its a local file (e.g. .dsc) use this
else if (FileExists(*I))
string TypeName = "Debian " + flExtension(*I) + " file";
pkgIndexFile::Type *Type = pkgIndexFile::Type::GetType(TypeName.c_str());
if(Type != NULL)
- LastOwner = Last = Type->CreateSrcPkgParser(*I);
+ LastOwner.reset(Last = Type->CreateSrcPkgParser(*I));
} else {
// normal case, search the cache for the source file
-#if APT_PKG_ABI >= 413
Last = FindSrc(*I,SrcRecs,Src,Cache);
-#else
- Last = FindSrc(*I,Recs,SrcRecs,Src,Cache);
-#endif
}
if (Last == 0)
for (; Ver != verlist.end(); ++Ver)
{
forbidden.clear();
- if (Ver->MultiArch == pkgCache::Version::None || Ver->MultiArch == pkgCache::Version::All)
+ if (Ver->MultiArch == pkgCache::Version::No || Ver->MultiArch == pkgCache::Version::All)
{
if (colon == string::npos)
Pkg = Ver.ParentPkg().Group().FindPkg(hostArch);
else if (strcmp(D->Package.c_str() + colon, ":any") == 0)
- forbidden = "Multi-Arch: none";
+ forbidden = "Multi-Arch: no";
else if (strcmp(D->Package.c_str() + colon, ":native") == 0)
Pkg = Ver.ParentPkg().Group().FindPkg("native");
}
if (printOnly == false)
{
- // Disable drop-privs if "_apt" can not write to the target dir
- CheckDropPrivsMustBeDisabled(Fetcher);
- if (_error->PendingError() == true)
- return false;
-
bool Failed = false;
if (AcquireRun(Fetcher, 0, &Failed, NULL) == false || Failed == true)
return false;
<< "Description: " << T->Description << "\n"
<< "URI: " << T->URI << "\n"
<< "Filename: " << filename << "\n"
- << "Optional: " << (T->IsOptional ? "yes" : "no") << "\n";
+ << "Optional: " << (T->IsOptional ? "yes" : "no") << "\n"
+ << "KeepCompressed: " << (T->KeepCompressed ? "yes" : "no") << "\n";
for (std::map<std::string,std::string>::const_iterator O = AddOptions.begin(); O != AddOptions.end(); ++O)
stanza << format_key(O->first) << ": " << O->second << "\n";
for (std::map<std::string,std::string>::const_iterator O = T->Options.begin(); O != T->Options.end(); ++O)
- stanza << format_key(O->first) << ": " << O->second << "\n";
+ {
+ if (O->first == "PDIFFS")
+ stanza << "PDiffs: " << O->second << "\n";
+ else if (O->first == "COMPRESSIONTYPES")
+ stanza << "CompressionTypes: " << O->second << "\n";
+ else if (O->first == "DEFAULTENABLED")
+ stanza << "DefaultEnabled: " << O->second << "\n";
+ else
+ stanza << format_key(O->first) << ": " << O->second << "\n";
+ }
stanza << "\n";
if (Filtered)
{"remove",&DoInstall},
{"purge",&DoInstall},
{"autoremove",&DoInstall},
+ {"auto-remove",&DoInstall},
{"markauto",&DoMarkAuto},
{"unmarkauto",&DoMarkAuto},
{"dist-upgrade",&DoDistUpgrade},
+ {"full-upgrade",&DoDistUpgrade},
{"dselect-upgrade",&DoDSelectUpgrade},
{"build-dep",&DoBuildDep},
{"clean",&DoClean},
{"autoclean",&DoAutoClean},
+ {"auto-clean",&DoAutoClean},
{"check",&DoCheck},
{"source",&DoSource},
{"download",&DoDownload},