return true;
}
/*}}}*/
-
-
-// helper that can go wit hthe next ABI break
-#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13)
-static std::string MetaIndexFileNameOnDisk(metaIndex *metaindex)
-{
- // FIXME: this cast is the horror, the horror
- debReleaseIndex *r = (debReleaseIndex*)metaindex;
-
- // see if we have a InRelease file
- std::string PathInRelease = r->MetaIndexFile("InRelease");
- if (FileExists(PathInRelease))
- return PathInRelease;
-
- // and if not return the normal one
- if (FileExists(PathInRelease))
- return r->MetaIndexFile("Release");
-
- return "";
-}
-#endif
-
// GetReleaseForSourceRecord - Return Suite for the given srcrecord /*{{{*/
// ---------------------------------------------------------------------
/* */
{
if (&CurrentIndexFile == (*IF))
{
-#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13)
- std::string path = MetaIndexFileNameOnDisk(*S);
-#else
- std::string path = (*S)->LocalFileName();
-#endif
- if (path != "")
+ std::string const path = (*S)->LocalFileName();
+ if (path != "")
{
indexRecords records;
records.Load(path);
// 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)
{
(VF.File().Archive() != 0 && VF.File().Archive() == RelTag) ||
(VF.File().Codename() != 0 && VF.File().Codename() == RelTag))
{
- Src = Ver.SourcePkgName();
// the Version we have is possibly fuzzy or includes binUploads,
- // so we use the Version of the SourcePkg
+ // 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;
}
- bool const NoLocking = _config->FindB("Debug::NoLocking",false);
- // Lock the archive directory
- FileFd Lock;
- if (NoLocking == false)
- {
- int lock_fd = GetLock(archivedir + "lock");
- if (lock_fd < 0)
- return _error->Error(_("Unable to lock directory %s"), archivedir.c_str());
- Lock.Fd(lock_fd);
- }
-
pkgAcquire Fetcher;
+ Fetcher.GetLock(archivedir);
Fetcher.Clean(archivedir);
Fetcher.Clean(archivedir + "partial/");
- if (NoLocking == false)
- {
- Lock.Close();
- int lock_fd = GetLock(listsdir + "lock");
- if (lock_fd < 0)
- return _error->Error(_("Unable to lock directory %s"), listsdir.c_str());
- Lock.Fd(lock_fd);
- }
-
+ Fetcher.GetLock(listsdir);
Fetcher.Clean(listsdir + "partial/");
pkgCacheFile::RemoveCaches();
if (verset.empty() == true)
return false;
- AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet", 0));
+ AcqTextStatus Stat(std::cout, ScreenWidth,_config->FindI("quiet",0));
pkgAcquire Fetcher(&Stat);
pkgRecords Recs(Cache);
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;
// Create the download object
- AcqTextStatus Stat(ScreenWidth,_config->FindI("quiet",0));
+ AcqTextStatus Stat(std::cout, ScreenWidth,_config->FindI("quiet",0));
pkgAcquire Fetcher(&Stat);
SPtrArray<DscFile> Dsc = new DscFile[CmdL.FileSize()];
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());
}
}
// Back track
- vector<pkgSrcRecords::File> Lst;
- if (Last->Files(Lst) == false) {
+ vector<pkgSrcRecords::File2> Lst;
+ if (Last->Files2(Lst) == false) {
return false;
}
// Load them into the fetcher
- for (vector<pkgSrcRecords::File>::const_iterator I = Lst.begin();
+ for (vector<pkgSrcRecords::File2>::const_iterator I = Lst.begin();
I != Lst.end(); ++I)
{
// Try to guess what sort of file it is we are getting.
}
new pkgAcqFile(&Fetcher,Last->Index().ArchiveURI(I->Path),
- I->Hashes, I->Size, Last->Index().SourceInfo(*Last,*I), Src);
+ I->Hashes, I->FileSize, Last->Index().SourceInfo(*Last,*I), Src);
}
}
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;
Last = Type->CreateSrcPkgParser(*I);
} else {
// normal case, search the cache for the source file
- Last = FindSrc(*I,SrcRecs,Src,Cache);
+#if APT_PKG_ABI >= 413
+ Last = FindSrc(*I,SrcRecs,Src,Cache);
+#else
+ Last = FindSrc(*I,Recs,SrcRecs,Src,Cache);
+#endif
}
if (Last == 0)
pkgRecords Recs(Cache);
pkgRecords::Parser &rec=Recs.Lookup(Ver.FileList());
string path = flNotFile(rec.FileName());
+#if APT_PKG_ABI >= 413
path.append(Ver.SourcePkgName());
path.append("_");
path.append(StripEpoch(Ver.SourceVerStr()));
+#else
+ string srcpkg = rec.SourcePkg().empty() ? Ver.ParentPkg().Name() : rec.SourcePkg();
+ string ver = Ver.VerStr();
+ // if there is a source version it always wins
+ if (rec.SourceVer() != "")
+ ver = rec.SourceVer();
+ path += srcpkg + "_" + StripEpoch(ver);
+#endif
return path;
}
/*}}}*/
return Success;
}
- AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0));
+ AcqTextStatus Stat(std::cout, ScreenWidth,_config->FindI("quiet",0));
Fetcher.SetLog(&Stat);
bool const downOnly = _config->FindB("APT::Get::Download-Only", false);
/* */
static bool ShowHelp(CommandLine &)
{
- ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
- COMMON_ARCH,__DATE__,__TIME__);
-
+ ioprintf(cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH);
+
if (_config->FindB("version") == true)
{
cout << _("Supported modules:") << endl;
-
+
for (unsigned I = 0; I != pkgVersioningSystem::GlobalListLen; I++)
{
pkgVersioningSystem *VS = pkgVersioningSystem::GlobalList[I];
else
cout << ' ';
cout << "Ver: " << VS->Label << endl;
-
+
/* Print out all the packaging systems that will work with
this VS */
for (unsigned J = 0; J != pkgSystem::GlobalListLen; J++)
textdomain(PACKAGE);
// Parse the command line and initialize the package library
- CommandLine CmdL(Args.data(),_config);
- if (pkgInitConfig(*_config) == false ||
- CmdL.Parse(argc,argv) == false ||
- pkgInitSystem(*_config,_system) == false)
- {
- if (_config->FindB("version") == true)
- ShowHelp(CmdL);
-
- _error->DumpErrors();
- return 100;
- }
-
- // See if the help should be shown
- if (_config->FindB("help") == true ||
- _config->FindB("version") == true ||
- CmdL.FileSize() == 0)
- {
- ShowHelp(CmdL);
- return 0;
- }
+ CommandLine CmdL;
+ ParseCommandLine(CmdL, Cmds, Args.data(), &_config, &_system, argc, argv, ShowHelp);
// see if we are in simulate mode
CheckSimulateMode(CmdL);