// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: apt-ftparchive.cc,v 1.4 2001/06/26 02:50:27 jgg Exp $
+// $Id: apt-ftparchive.cc,v 1.8.2.3 2004/01/02 22:01:48 mdz Exp $
/* ######################################################################
apt-scanpackages - Efficient work-alike for dpkg-scanpackages
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
-#ifdef __GNUG__
-#pragma implementation "apt-ftparchive.h"
-#endif
-
#include "apt-ftparchive.h"
#include <apt-pkg/error.h>
#include <apti18n.h>
#include <algorithm>
+#include <climits>
#include <sys/time.h>
#include <regex.h>
string BinCacheDB;
string BinOverride;
string ExtraOverride;
+
+ // We generate for this given arch
+ string Arch;
// Stuff for the Source File
string SrcFile;
// Create a package writer object.
PackagesWriter Packages(flCombine(CacheDir,BinCacheDB),
flCombine(OverrideDir,BinOverride),
- flCombine(OverrideDir,ExtraOverride));
+ flCombine(OverrideDir,ExtraOverride),
+ Arch);
if (PkgExt.empty() == false && Packages.SetExts(PkgExt) == false)
- return _error->Error("Package extension list is too long");
+ return _error->Error(_("Package extension list is too long"));
if (_error->PendingError() == true)
- return _error->Error("Error Processing directory %s",BaseDir.c_str());
+ return _error->Error(_("Error processing directory %s"),BaseDir.c_str());
Packages.PathPrefix = PathPrefix;
Packages.DirStrip = ArchiveDir;
PkgCompress,Permissions);
Packages.Output = Comp.Input;
if (_error->PendingError() == true)
- return _error->Error("Error Processing directory %s",BaseDir.c_str());
+ return _error->Error(_("Error processing directory %s"),BaseDir.c_str());
c0out << ' ' << BaseDir << ":" << flush;
if (Comp.Finalize(Size) == false)
{
c0out << endl;
- return _error->Error("Error Processing directory %s",BaseDir.c_str());
+ return _error->Error(_("Error processing directory %s"),BaseDir.c_str());
}
if (Size != 0)
return !_error->PendingError();
}
+
/*}}}*/
// PackageMap::GenSources - Actually generate a Source file /*{{{*/
// ---------------------------------------------------------------------
flCombine(OverrideDir,SrcOverride),
flCombine(OverrideDir,SrcExtraOverride));
if (SrcExt.empty() == false && Sources.SetExts(SrcExt) == false)
- return _error->Error("Source extension list is too long");
+ return _error->Error(_("Source extension list is too long"));
if (_error->PendingError() == true)
- return _error->Error("Error Processing directory %s",BaseDir.c_str());
+ return _error->Error(_("Error processing directory %s"),BaseDir.c_str());
Sources.PathPrefix = PathPrefix;
Sources.DirStrip = ArchiveDir;
SrcCompress,Permissions);
Sources.Output = Comp.Input;
if (_error->PendingError() == true)
- return _error->Error("Error Processing directory %s",BaseDir.c_str());
+ return _error->Error(_("Error processing directory %s"),BaseDir.c_str());
c0out << ' ' << BaseDir << ":" << flush;
if (Comp.Finalize(Size) == false)
{
c0out << endl;
- return _error->Error("Error Processing directory %s",BaseDir.c_str());
+ return _error->Error(_("Error processing directory %s"),BaseDir.c_str());
}
if (Size != 0)
// Create a package writer object.
ContentsWriter Contents("");
if (PkgExt.empty() == false && Contents.SetExts(PkgExt) == false)
- return _error->Error("Package extension list is too long");
+ return _error->Error(_("Package extension list is too long"));
if (_error->PendingError() == true)
return false;
return false;
if (fwrite(Buf,1,ToRead,Comp.Input) != ToRead)
- return _error->Errno("fwrite","Error writing header to contents file");
+ return _error->Errno("fwrite",_("Error writing header to contents file"));
Size -= ToRead;
}
if (Comp.Finalize(Size) == false || _error->PendingError() == true)
{
c0out << endl;
- return _error->Error("Error Processing Contents %s",
+ return _error->Error(_("Error processing contents %s"),
this->Contents.c_str());
}
Itm.BaseDir = SubstVar(Block.Find("Directory",DDir.c_str()),Vars);
Itm.PkgFile = SubstVar(Block.Find("Packages",DPkg.c_str()),Vars);
Itm.Tag = SubstVar("$(DIST)/$(SECTION)/$(ARCH)",Vars);
+ Itm.Arch = Arch;
Itm.Contents = SubstVar(Block.Find("Contents",DContents.c_str()),Vars);
Itm.ContentsHead = SubstVar(Block.Find("Contents::Header",DContentsH.c_str()),Vars);
Itm.FLFile = SubstVar(Block.Find("FileList",DFLFile.c_str()),Vars);
/* */
bool ShowHelp(CommandLine &CmdL)
{
- ioprintf(cout,_("%s %s for %s %s compiled on %s %s\n"),PACKAGE,VERSION,
- COMMON_OS,COMMON_CPU,__DATE__,__TIME__);
+ ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION,
+ COMMON_ARCH,__DATE__,__TIME__);
if (_config->FindB("version") == true)
return true;
cout <<
- "Usage: apt-ftparchive [options] command\n"
- "Commands: packges binarypath [overridefile [pathprefix]]\n"
+ _("Usage: apt-ftparchive [options] command\n"
+ "Commands: packages binarypath [overridefile [pathprefix]]\n"
" sources srcpath [overridefile [pathprefix]]\n"
" contents path\n"
+ " release path\n"
" generate config [groups]\n"
" clean config\n"
"\n"
"\n"
"The 'packages' and 'sources' command should be run in the root of the\n"
"tree. BinaryPath should point to the base of the recursive search and \n"
- "override file should contian the override flags. Pathprefix is\n"
+ "override file should contain the override flags. Pathprefix is\n"
"appended to the filename fields if present. Example usage from the \n"
- "debian archive:\n"
+ "Debian archive:\n"
" apt-ftparchive packages dists/potato/main/binary-i386/ > \\\n"
" dists/potato/main/binary-i386/Packages\n"
"\n"
" --no-delink Enable delinking debug mode\n"
" --contents Control contents file generation\n"
" -c=? Read this configuration file\n"
- " -o=? Set an arbitary configuration option" << endl;
+ " -o=? Set an arbitrary configuration option") << endl;
return true;
}
return true;
}
+ /*}}}*/
+// SimpleGenRelease - Generate a Release file for a directory tree /*{{{*/
+// ---------------------------------------------------------------------
+bool SimpleGenRelease(CommandLine &CmdL)
+{
+ if (CmdL.FileSize() < 2)
+ return ShowHelp(CmdL);
+
+ string Dir = CmdL.FileList[1];
+
+ ReleaseWriter Release("");
+ Release.DirStrip = Dir;
+
+ if (_error->PendingError() == true)
+ return false;
+
+ if (Release.RecursiveScan(Dir) == false)
+ return false;
+
+ Release.Finish();
+
+ return true;
+}
+
/*}}}*/
// Generate - Full generate, using a config file /*{{{*/
// ---------------------------------------------------------------------
if (RegexChoice(List,CmdL.FileList + 2,CmdL.FileList + CmdL.FileSize()) == 0)
{
delete [] List;
- return _error->Error("No selections matched");
+ return _error->Error(_("No selections matched"));
}
_error->DumpErrors();
{
if (MultiCompress::GetStat(flCombine(ArchiveDir,I->PkgFile),I->PkgCompress,B) == false)
{
- _error->Warning("Some files are missing in the package file group `%s'",I->PkgFile.c_str());
+ _error->Warning(_("Some files are missing in the package file group `%s'"),I->PkgFile.c_str());
continue;
}
CommandLine::Dispatch Cmds[] = {{"packages",&SimpleGenPackages},
{"contents",&SimpleGenContents},
{"sources",&SimpleGenSources},
+ {"release",&SimpleGenRelease},
{"generate",&Generate},
{"clean",&Clean},
{"help",&ShowHelp},
}
// Setup the output streams
- c0out.rdbuf(cout.rdbuf());
- c1out.rdbuf(cout.rdbuf());
- c2out.rdbuf(cout.rdbuf());
+ c0out.rdbuf(clog.rdbuf());
+ c1out.rdbuf(clog.rdbuf());
+ c2out.rdbuf(clog.rdbuf());
Quiet = _config->FindI("quiet",0);
if (Quiet > 0)
c0out.rdbuf(devnull.rdbuf());