0.5.15cnc6-alt1

- Updated to 0.5.15cnc6
- New:
  + apt-0.5.15cnc6-alt-rpm-order (fix RPM::Order default value)
- Updated:
  + apt-0.5.15cnc6-alt-fixes
  + apt-0.5.15cnc6-alt-defaults
  + apt-0.5.15cnc6-alt-rpm-fancypercent
  + apt-0.5.15cnc6-alt-virtual_scores
- Merged upstream:
  + apt-0.5.15cnc6-alt-install_virtual
This commit is contained in:
Kachalov Anton 2004-05-13 12:23:54 +00:00 committed by Dmitry V. Levin
parent 4938f612f8
commit 6e5c25c245
82 changed files with 4062 additions and 2125 deletions

View File

@ -1,40 +0,0 @@
diff -uprk.orig apt-0.5.15cnc5.orig/apt-pkg/rpm/rpmpackagedata.cc apt-0.5.15cnc5/apt-pkg/rpm/rpmpackagedata.cc
--- apt-0.5.15cnc5.orig/apt-pkg/rpm/rpmpackagedata.cc 2003-12-23 23:19:36 +0300
+++ apt-0.5.15cnc5/apt-pkg/rpm/rpmpackagedata.cc 2004-01-16 15:14:46 +0300
@@ -21,7 +21,7 @@ RPMPackageData::RPMPackageData()
#endif
{
// Populate priorities
- string FileName = _config->FindFile("Dir::Etc::rpmpriorities");
+ string FileName = _config->FindFile("Dir::Etc") + "pkgpriorities";
FileFd F(FileName, FileFd::ReadOnly);
if (_error->PendingError())
{
diff -uprk.orig apt-0.5.15cnc5.orig/apt-pkg/rpm/rpmpm.cc apt-0.5.15cnc5/apt-pkg/rpm/rpmpm.cc
--- apt-0.5.15cnc5.orig/apt-pkg/rpm/rpmpm.cc 2003-12-23 23:19:20 +0300
+++ apt-0.5.15cnc5/apt-pkg/rpm/rpmpm.cc 2004-01-16 15:14:33 +0300
@@ -493,7 +493,7 @@ bool pkgRPMExtPM::ExecRPM(Item::RPMOps o
}
}
- if (_config->FindB("RPM::Order",false) == false)
+ if (_config->FindB("RPM::Order",true) == false)
Args[n++] = "--noorder";
bool FilesInArgs = true;
diff -uprk.orig apt-0.5.15cnc5.orig/buildlib/archtable apt-0.5.15cnc5/buildlib/archtable
--- apt-0.5.15cnc5.orig/buildlib/archtable 2003-12-23 23:15:23 +0300
+++ apt-0.5.15cnc5/buildlib/archtable 2004-01-16 15:14:33 +0300
@@ -5,8 +5,10 @@
# The left side is a regex for awk
-i.86 i386
-pentium i386
+i[34]86 i386
+i.86 i586
+pentium.* i586
+athlon i586
sparc sparc
sparc64 sparc
alpha.* alpha

View File

@ -1,130 +0,0 @@
diff -uprk.orig apt-0.5.15cnc5.orig/apt-pkg/pkgsystem.h apt-0.5.15cnc5/apt-pkg/pkgsystem.h
--- apt-0.5.15cnc5.orig/apt-pkg/pkgsystem.h 2003-12-23 23:23:22 +0300
+++ apt-0.5.15cnc5/apt-pkg/pkgsystem.h 2004-01-16 14:33:07 +0300
@@ -90,7 +90,7 @@ class pkgSystem
// Return a list of system index files..
virtual bool AddStatusFiles(std::vector<pkgIndexFile *> &List) = 0;
// CNC:2003-11-21
- virtual bool AddSourceFiles(std::vector<pkgIndexFile *> &List) {};
+ virtual void AddSourceFiles(std::vector<pkgIndexFile *> &List) {};
virtual bool FindIndex(pkgCache::PkgFileIterator File,
pkgIndexFile *&Found) const = 0;
diff -uprk.orig apt-0.5.15cnc5.orig/apt-pkg/rpm/rpmhandler.cc apt-0.5.15cnc5/apt-pkg/rpm/rpmhandler.cc
--- apt-0.5.15cnc5.orig/apt-pkg/rpm/rpmhandler.cc 2003-12-23 23:19:22 +0300
+++ apt-0.5.15cnc5/apt-pkg/rpm/rpmhandler.cc 2004-01-16 14:30:11 +0300
@@ -87,7 +87,7 @@ bool RPMFileHandler::Jump(unsigned Offse
{
if (FD == NULL)
return false;
- if (lseek(Fileno(FD),Offset,SEEK_SET) != Offset)
+ if (lseek(Fileno(FD),Offset,SEEK_SET) != (off_t)Offset)
return false;
return Skip();
}
diff -uprk.orig apt-0.5.15cnc5.orig/apt-pkg/rpm/rpmpm.cc apt-0.5.15cnc5/apt-pkg/rpm/rpmpm.cc
--- apt-0.5.15cnc5.orig/apt-pkg/rpm/rpmpm.cc 2003-12-23 23:19:20 +0300
+++ apt-0.5.15cnc5/apt-pkg/rpm/rpmpm.cc 2004-01-16 14:29:19 +0300
@@ -392,7 +392,7 @@ bool pkgRPMExtPM::ExecRPM(Item::RPMOps o
Args[n++] = _config->Find("Dir::Bin::rpm","rpm").c_str();
- bool nodeps;
+ bool nodeps = false;
switch (op)
{
@@ -415,6 +415,8 @@ bool pkgRPMExtPM::ExecRPM(Item::RPMOps o
operation = "-e";
nodeps = true;
break;
+ default:
+ return false;
}
Args[n++] = operation;
@@ -654,8 +656,7 @@ pkgRPMLibPM::~pkgRPMLibPM()
bool pkgRPMLibPM::AddToTransaction(Item::RPMOps op, vector<const char*> &files)
{
- int debug = _config->FindB("Debug::pkgRPMPM", false);
- int n = 0, rc, xx;
+ int rc;
FD_t fd;
rpmHeader hdr;
@@ -735,7 +736,6 @@ bool pkgRPMLibPM::Process(vector<const c
{
int rc = 0;
bool Success = false;
- int debug = _config->FindB("Debug::pkgRPMPM", false);
string Dir = _config->Find("RPM::RootDir");
rpmReadConfigFiles(NULL, NULL);
diff -uprk.orig apt-0.5.15cnc5.orig/apt-pkg/rpm/rpmsystem.cc apt-0.5.15cnc5/apt-pkg/rpm/rpmsystem.cc
--- apt-0.5.15cnc5.orig/apt-pkg/rpm/rpmsystem.cc 2003-12-23 23:19:32 +0300
+++ apt-0.5.15cnc5/apt-pkg/rpm/rpmsystem.cc 2004-01-16 14:33:07 +0300
@@ -249,7 +249,7 @@ bool rpmSystem::AddStatusFiles(vector<pk
// System::AddSourceFiles - Register aditional source files /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool rpmSystem::AddSourceFiles(vector<pkgIndexFile *> &List)
+void rpmSystem::AddSourceFiles(vector<pkgIndexFile *> &List)
{
const Configuration::Item *Top;
Top = _config->Tree("APT::Arguments");
@@ -266,7 +266,6 @@ bool rpmSystem::AddSourceFiles(vector<pk
}
}
}
- return true;
}
/*}}}*/
#ifdef OLD_FILEDEPS
diff -uprk.orig apt-0.5.15cnc5.orig/apt-pkg/rpm/rpmsystem.h apt-0.5.15cnc5/apt-pkg/rpm/rpmsystem.h
--- apt-0.5.15cnc5.orig/apt-pkg/rpm/rpmsystem.h 2003-12-23 23:19:37 +0300
+++ apt-0.5.15cnc5/apt-pkg/rpm/rpmsystem.h 2004-01-16 14:33:07 +0300
@@ -60,7 +60,7 @@ class rpmSystem : public pkgSystem
virtual bool ArchiveSupported(const char *Type);
virtual signed Score(Configuration const &Cnf);
virtual bool AddStatusFiles(vector<pkgIndexFile *> &List);
- virtual bool AddSourceFiles(vector<pkgIndexFile *> &List);
+ virtual void AddSourceFiles(vector<pkgIndexFile *> &List);
virtual bool FindIndex(pkgCache::PkgFileIterator File,
pkgIndexFile *&Found) const;
virtual bool ProcessCache(pkgDepCache &Cache,pkgProblemResolver &Fix);
diff -uprk.orig apt-0.5.15cnc5.orig/cmdline/apt-get.cc apt-0.5.15cnc5/cmdline/apt-get.cc
--- apt-0.5.15cnc5.orig/cmdline/apt-get.cc 2003-12-23 23:30:50 +0300
+++ apt-0.5.15cnc5/cmdline/apt-get.cc 2004-01-16 21:55:48 +0300
@@ -3078,6 +3078,15 @@ int main(int argc,const char *argv[])
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;
+ }
+
// CNC:2003-11-21
if (CmdL.FileSize() != 1)
{
@@ -3102,15 +3111,6 @@ int main(int argc,const char *argv[])
_config->Set("APT::Arguments::", *I);
}
- // See if the help should be shown
- if (_config->FindB("help") == true ||
- _config->FindB("version") == true ||
- CmdL.FileSize() == 0)
- {
- ShowHelp(CmdL);
- return 0;
- }
-
// Deal with stdout not being a tty
if (ttyname(STDOUT_FILENO) == 0 && _config->FindI("quiet",0) < 1)
_config->Set("quiet","1");

View File

@ -1,48 +0,0 @@
2004-01-16 Dmitry V. Levin <ldv@altlinux.org>
* cmdline/apt-get.cc (TryToInstall):
Optimize pure virtual packages install.
Add APT::Install::Virtual support.
--- apt-0.5.15cnc5/cmdline/apt-get.cc.orig 2003-12-23 23:30:50 +0300
+++ apt-0.5.15cnc5/cmdline/apt-get.cc 2004-01-16 15:06:11 +0300
@@ -1208,14 +1208,24 @@ bool TryToInstall(pkgCache::PkgIterator
{
/* This is a pure virtual package and there is a single available
provides */
- if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0 &&
- Pkg.ProvidesList()->NextProvides == 0)
+ if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0)
{
- pkgCache::PkgIterator Tmp = Pkg.ProvidesList().OwnerPkg();
- // CNC:2003-11-21 - Check if the current candidate is really
- // providing that dependency
- ioprintf(c1out,_("Selecting %s for '%s'\n"),
- Tmp.Name(),Pkg.Name());
+ if (!Remove)
+ for (pkgCache::PrvIterator pv = Pkg.ProvidesList(); pv.end() == false; pv++)
+ {
+ pkgCache::PkgIterator Tmp = pv.OwnerPkg();
+ // Just marked for install?
+ if (Cache[Tmp].Install() && Cache[Tmp].NewInstall())
+ return true;
+ }
+
+ if ((Pkg.ProvidesList()->NextProvides == 0 ||
+ (!Remove && _config->FindB("APT::Install::Virtual", false))))
+ {
+ pkgCache::PkgIterator Tmp = Pkg.ProvidesList().OwnerPkg();
+ ioprintf(c1out,_("Note, selecting %s instead of %s\n"),
+ Tmp.Name(),Pkg.Name());
+
pkgCache::VerIterator Ver = Cache[Tmp].CandidateVerIter(Cache);
pkgCache::PrvIterator Prv = Ver.ProvidesList();
bool Found = false;
@@ -1249,6 +1259,7 @@ bool TryToInstall(pkgCache::PkgIterator
}
}
Pkg = Tmp;
+ }
}
// Handle the no-upgrade case

View File

@ -0,0 +1,28 @@
diff -upr apt-0.5.15cnc6.orig/apt-pkg/rpm/rpmpackagedata.cc apt-0.5.15cnc6/apt-pkg/rpm/rpmpackagedata.cc
--- apt-0.5.15cnc6.orig/apt-pkg/rpm/rpmpackagedata.cc 2004-03-09 04:44:08 +1200
+++ apt-0.5.15cnc6/apt-pkg/rpm/rpmpackagedata.cc 2004-04-13 19:47:27 +1300
@@ -21,7 +21,7 @@ RPMPackageData::RPMPackageData()
#endif
{
// Populate priorities
- string FileName = _config->FindFile("Dir::Etc::rpmpriorities");
+ string FileName = _config->FindFile("Dir::Etc") + "pkgpriorities";
FileFd F(FileName, FileFd::ReadOnly);
if (_error->PendingError())
{
diff -upr apt-0.5.15cnc6.orig/buildlib/archtable apt-0.5.15cnc6/buildlib/archtable
--- apt-0.5.15cnc6.orig/buildlib/archtable 2003-04-15 06:15:31 +1300
+++ apt-0.5.15cnc6/buildlib/archtable 2004-04-13 19:50:20 +1300
@@ -5,8 +5,10 @@
# The left side is a regex for awk
-i.86 i386
-pentium i386
+i[34]86 i386
+i.86 i586
+pentium.* i586
+athlon i586
sparc sparc
sparc64 sparc
alpha.* alpha

View File

@ -0,0 +1,95 @@
diff -uprN apt-0.5.15cnc6.orig/apt-pkg/pkgsystem.h apt-0.5.15cnc6/apt-pkg/pkgsystem.h
--- apt-0.5.15cnc6.orig/apt-pkg/pkgsystem.h 2003-11-25 04:55:37 +1200
+++ apt-0.5.15cnc6/apt-pkg/pkgsystem.h 2004-04-13 19:35:39 +1300
@@ -90,7 +90,7 @@ class pkgSystem
// Return a list of system index files..
virtual bool AddStatusFiles(std::vector<pkgIndexFile *> &List) = 0;
// CNC:2003-11-21
- virtual bool AddSourceFiles(std::vector<pkgIndexFile *> &List) {};
+ virtual void AddSourceFiles(std::vector<pkgIndexFile *> &List) {};
virtual bool FindIndex(pkgCache::PkgFileIterator File,
pkgIndexFile *&Found) const = 0;
diff -uprN apt-0.5.15cnc6.orig/apt-pkg/rpm/rpmhandler.cc apt-0.5.15cnc6/apt-pkg/rpm/rpmhandler.cc
--- apt-0.5.15cnc6.orig/apt-pkg/rpm/rpmhandler.cc 2004-03-05 23:29:09 +1200
+++ apt-0.5.15cnc6/apt-pkg/rpm/rpmhandler.cc 2004-04-13 19:36:15 +1300
@@ -87,7 +87,7 @@ bool RPMFileHandler::Jump(unsigned Offse
{
if (FD == NULL)
return false;
- if (lseek(Fileno(FD),Offset,SEEK_SET) != Offset)
+ if (lseek(Fileno(FD),Offset,SEEK_SET) != (off_t)Offset)
return false;
return Skip();
}
diff -uprN apt-0.5.15cnc6.orig/apt-pkg/rpm/rpmpm.cc apt-0.5.15cnc6/apt-pkg/rpm/rpmpm.cc
--- apt-0.5.15cnc6.orig/apt-pkg/rpm/rpmpm.cc 2004-03-16 10:10:41 +1200
+++ apt-0.5.15cnc6/apt-pkg/rpm/rpmpm.cc 2004-04-13 19:39:29 +1300
@@ -393,7 +393,7 @@ bool pkgRPMExtPM::ExecRPM(Item::RPMOps o
Args[n++] = _config->Find("Dir::Bin::rpm","rpm").c_str();
- bool nodeps;
+ bool nodeps = false;
switch (op)
{
@@ -416,6 +416,8 @@ bool pkgRPMExtPM::ExecRPM(Item::RPMOps o
operation = "-e";
nodeps = true;
break;
+ default:
+ return false;
}
Args[n++] = operation;
@@ -657,8 +659,7 @@ pkgRPMLibPM::~pkgRPMLibPM()
bool pkgRPMLibPM::AddToTransaction(Item::RPMOps op, vector<const char*> &files)
{
- int debug = _config->FindB("Debug::pkgRPMPM", false);
- int n = 0, rc, xx;
+ int rc;
FD_t fd;
rpmHeader hdr;
@@ -739,7 +740,6 @@ bool pkgRPMLibPM::Process(vector<const c
int rc = 0;
bool Success = false;
bool Interactive = _config->FindB("RPM::Interactive",true);
- int debug = _config->FindB("Debug::pkgRPMPM", false);
string Dir = _config->Find("RPM::RootDir");
rpmReadConfigFiles(NULL, NULL);
diff -uprN apt-0.5.15cnc6.orig/apt-pkg/rpm/rpmsystem.cc apt-0.5.15cnc6/apt-pkg/rpm/rpmsystem.cc
--- apt-0.5.15cnc6.orig/apt-pkg/rpm/rpmsystem.cc 2004-03-23 04:51:38 +1200
+++ apt-0.5.15cnc6/apt-pkg/rpm/rpmsystem.cc 2004-04-13 19:40:14 +1300
@@ -251,7 +251,7 @@ bool rpmSystem::AddStatusFiles(vector<pk
// System::AddSourceFiles - Register aditional source files /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool rpmSystem::AddSourceFiles(vector<pkgIndexFile *> &List)
+void rpmSystem::AddSourceFiles(vector<pkgIndexFile *> &List)
{
const Configuration::Item *Top;
Top = _config->Tree("APT::Arguments");
@@ -268,7 +268,6 @@ bool rpmSystem::AddSourceFiles(vector<pk
}
}
}
- return true;
}
/*}}}*/
#ifdef OLD_FILEDEPS
diff -uprN apt-0.5.15cnc6.orig/apt-pkg/rpm/rpmsystem.h apt-0.5.15cnc6/apt-pkg/rpm/rpmsystem.h
--- apt-0.5.15cnc6.orig/apt-pkg/rpm/rpmsystem.h 2003-11-25 04:55:37 +1200
+++ apt-0.5.15cnc6/apt-pkg/rpm/rpmsystem.h 2004-04-13 19:40:53 +1300
@@ -60,7 +60,7 @@ class rpmSystem : public pkgSystem
virtual bool ArchiveSupported(const char *Type);
virtual signed Score(Configuration const &Cnf);
virtual bool AddStatusFiles(vector<pkgIndexFile *> &List);
- virtual bool AddSourceFiles(vector<pkgIndexFile *> &List);
+ virtual void AddSourceFiles(vector<pkgIndexFile *> &List);
virtual bool FindIndex(pkgCache::PkgFileIterator File,
pkgIndexFile *&Found) const;
virtual bool ProcessCache(pkgDepCache &Cache,pkgProblemResolver &Fix);

View File

@ -4,9 +4,9 @@
Honor "quiet" config option.
Pass "fancypercent" option.
--- apt-0.5.15cnc5/apt-pkg/rpm/rpmpm.cc.orig 2004-01-16 14:56:02 +0300
+++ apt-0.5.15cnc5/apt-pkg/rpm/rpmpm.cc 2004-01-16 14:58:37 +0300
@@ -389,6 +389,7 @@ bool pkgRPMExtPM::ExecRPM(Item::RPMOps o
--- apt-0.5.15cnc5/apt-pkg/rpm/rpmpm.cc.orig 2004-05-11 15:08:07 +0400
+++ apt-0.5.15cnc5/apt-pkg/rpm/rpmpm.cc 2004-05-11 15:19:12 +0400
@@ -390,6 +390,7 @@
const char *operation;
unsigned int n = 0;
bool Interactive = _config->FindB("RPM::Interactive",true);
@ -14,7 +14,7 @@
Args[n++] = _config->Find("Dir::Bin::rpm","rpm").c_str();
@@ -397,18 +398,12 @@ bool pkgRPMExtPM::ExecRPM(Item::RPMOps o
@@ -398,18 +399,12 @@
switch (op)
{
case Item::RPMInstall:
@ -35,7 +35,7 @@
break;
case Item::RPMErase:
@@ -420,8 +415,22 @@ bool pkgRPMExtPM::ExecRPM(Item::RPMOps o
@@ -421,8 +416,22 @@
}
Args[n++] = operation;
@ -60,7 +60,7 @@
string rootdir = _config->Find("RPM::RootDir", "");
if (!rootdir.empty())
@@ -550,6 +559,7 @@ bool pkgRPMExtPM::ExecRPM(Item::RPMOps o
@@ -551,6 +560,7 @@
return true;
}
@ -68,49 +68,50 @@
cout << _("Executing RPM (")<<cmd<<")..." << endl;
cout << flush;
@@ -629,6 +639,7 @@ bool pkgRPMExtPM::ExecRPM(Item::RPMOps o
@@ -631,7 +641,7 @@
return _error->Error(_("Sub-process %s exited unexpectedly"),Args[0]);
}
- if (Interactive == true)
+ if (quiet <= 2)
cout << _("Done.") << endl;
cout << _("Done.") << endl;
return true;
@@ -745,6 +756,7 @@ bool pkgRPMLibPM::Process(vector<const c
int rc = 0;
@@ -749,6 +759,7 @@
bool Success = false;
bool Interactive = _config->FindB("RPM::Interactive",true);
string Dir = _config->Find("RPM::RootDir");
+ int quiet = _config->FindI("quiet",0);
rpmReadConfigFiles(NULL, NULL);
int probFilter = 0;
@@ -791,10 +803,21 @@ bool pkgRPMLibPM::Process(vector<const c
@@ -795,10 +806,21 @@
probFilter |= RPMPROB_FILTER_REPLACENEWFILES;
}
- if (_config->FindB("RPM::Interactive", true))
- if (Interactive == true)
- notifyFlags |= INSTALL_LABEL | INSTALL_HASH;
- else
- notifyFlags |= INSTALL_LABEL | INSTALL_PERCENT;
+ if (quiet <= 2)
+ notifyFlags |= INSTALL_LABEL;
+ if (quiet <= 2)
+ notifyFlags |= INSTALL_LABEL;
+
+ if (quiet <= 1)
+ if (quiet <= 1)
+ {
+ if (Interactive == true)
+ {
+ if (_config->FindB("RPM::Interactive", true))
+ {
+ notifyFlags |= INSTALL_HASH;
+ extern int fancyPercents;
+ fancyPercents = (quiet <= 0) ? 1 : 0;
+ } else
+ {
+ notifyFlags |= INSTALL_PERCENT;
+ }
+ notifyFlags |= INSTALL_HASH;
+ extern int fancyPercents;
+ fancyPercents = (quiet <= 0) ? 1 : 0;
+ } else
+ {
+ notifyFlags |= INSTALL_PERCENT;
+ }
+ }
if (uninstall.empty() == false)
AddToTransaction(Item::RPMErase, uninstall);
@@ -848,6 +871,7 @@ bool pkgRPMLibPM::Process(vector<const c
@@ -854,6 +877,7 @@
goto exit;
}
@ -118,11 +119,12 @@
cout << _("Committing changes...") << endl << flush;
#if RPM_VERSION >= 0x040100
@@ -872,6 +896,7 @@ bool pkgRPMLibPM::Process(vector<const c
@@ -877,7 +901,7 @@
Success = true;
if (rc < 0)
_error->Warning(_("Some errors occurred while running transaction"));
else
+ if (quiet <= 2)
- else if (Interactive == true)
+ else if (quiet <= 2)
cout << _("Done.") << endl;
}
rpmpsFree(probs);

View File

@ -0,0 +1,25 @@
diff -upr apt-0.5.15cnc6.orig/apt-pkg/rpm/rpmpm.cc apt-0.5.15cnc6/apt-pkg/rpm/rpmpm.cc
--- apt-0.5.15cnc6/apt-pkg/rpm/rpmpm.cc.orig 2004-05-11 18:13:51 +0400
+++ apt-0.5.15cnc6/apt-pkg/rpm/rpmpm.cc 2004-05-13 16:06:47 +0400
@@ -496,7 +496,7 @@ bool pkgRPMExtPM::ExecRPM(Item::RPMOps o
}
}
- if (_config->FindB("RPM::Order", false) == false)
+ if (_config->FindB("RPM::Order", true) == false)
Args[n++] = "--noorder";
bool FilesInArgs = true;
@@ -864,10 +864,10 @@
rc = 0;
#if RPM_VERSION >= 0x040100
- if (_config->FindB("RPM::Order", false) == true)
+ if (_config->FindB("RPM::Order", true) == true)
rc = rpmtsOrder(TS);
#else
- if (_config->FindB("RPM::Order", false) == true)
+ if (_config->FindB("RPM::Order", true) == true)
rc = rpmdepOrder(TS);
#endif

View File

@ -1,6 +1,6 @@
diff -uprk.orig apt-0.5.5cnc4.1.orig/apt-pkg/algorithms.cc apt-0.5.5cnc4.1/apt-pkg/algorithms.cc
--- apt-0.5.5cnc4.1.orig/apt-pkg/algorithms.cc 2003-09-29 17:21:22 +0400
+++ apt-0.5.5cnc4.1/apt-pkg/algorithms.cc 2003-09-29 17:29:26 +0400
--- apt-0.5.5cnc6.orig/apt-pkg/algorithms.cc 2003-09-29 17:21:22 +0400
+++ apt-0.5.5cnc6/apt-pkg/algorithms.cc 2003-09-29 17:29:26 +0400
@@ -540,6 +540,9 @@ int pkgProblemResolver::ScoreSort(const
// ProblemResolver::MakeScores - Make the score table /*{{{*/
// ---------------------------------------------------------------------
@ -71,8 +71,8 @@ diff -uprk.orig apt-0.5.5cnc4.1.orig/apt-pkg/algorithms.h apt-0.5.5cnc4.1/apt-pk
bool pkgDistUpgrade(pkgDepCache &Cache);
diff -uprk.orig apt-0.5.15cnc5/apt-pkg/rpm/rpmpackagedata.h.orig apt-0.5.15cnc5/apt-pkg/rpm/rpmpackagedata.h
--- apt-0.5.15cnc5/apt-pkg/rpm/rpmpackagedata.h.orig 2003-12-23 23:19:39 +0300
+++ apt-0.5.15cnc5/apt-pkg/rpm/rpmpackagedata.h 2004-01-12 18:27:13 +0300
--- apt-0.5.15cnc6/apt-pkg/rpm/rpmpackagedata.h.orig 2003-12-23 23:19:39 +0300
+++ apt-0.5.15cnc6/apt-pkg/rpm/rpmpackagedata.h 2004-01-12 18:27:13 +0300
@@ -70,7 +70,7 @@
{
if (Priorities.find(Package) != Priorities.end())
@ -82,25 +82,52 @@ diff -uprk.orig apt-0.5.15cnc5/apt-pkg/rpm/rpmpackagedata.h.orig apt-0.5.15cnc5/
};
inline pkgCache::Flag::PkgFlags PkgFlags(string Package)
{return Flags[Package];};
diff -uprk.orig apt-0.5.5cnc4.1.orig/cmdline/apt-get.cc apt-0.5.5cnc4.1/cmdline/apt-get.cc
--- apt-0.5.5cnc4.1.orig/cmdline/apt-get.cc 2003-09-29 17:21:22 +0400
+++ apt-0.5.5cnc4.1/cmdline/apt-get.cc 2003-09-29 17:27:28 +0400
@@ -1222,7 +1222,17 @@ bool TryToInstall(pkgCache::PkgIterator
if ((Pkg.ProvidesList()->NextProvides == 0 ||
(!Remove && _config->FindB("APT::Install::Virtual", false))))
{
- pkgCache::PkgIterator Tmp = Pkg.ProvidesList().OwnerPkg();
+ unsigned long Size = 0;
+ for (pkgCache::PrvIterator I = Pkg.ProvidesList(); I.end() == false; I++)
+ Size++;
+ SPtrArray<pkgCache::Package *> PList = new pkgCache::Package *[Size];
+ pkgCache::Package **PEnd = PList;
+ for (pkgCache::PrvIterator I = Pkg.ProvidesList(); I.end() == false; I++)
+ *PEnd++ = I.OwnerPkg();
+ Fix.MakeScores();
+ qsort(PList,PEnd - PList,sizeof(*PList),&(Fix.ScoreSort));
+ pkgCache::PkgIterator Tmp = pkgCache::PkgIterator(*Pkg.Cache(), *PList);
+
ioprintf(c1out,_("Note, selecting %s instead of %s\n"),
Tmp.Name(),Pkg.Name());
diff -uprk.orig apt-0.5.15cnc6.orig/cmdline/apt-get.cc apt-0.5.15cnc6/cmdline/apt-get.cc
--- apt-0.5.15cnc6.orig/cmdline/apt-get.cc 2003-09-29 17:21:22 +0400
+++ apt-0.5.15cnc6/cmdline/apt-get.cc 2004-05-11 17:27:28 +0400
@@ -1216,10 +1216,24 @@
if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0)
{
vector<pkgCache::Package *> GoodSolutions;
+ unsigned long Size = 0;
for (pkgCache::PrvIterator Prv = Pkg.ProvidesList();
Prv.end() == false; Prv++)
- {
- pkgCache::PkgIterator PrvPkg = Prv.OwnerPkg();
+ Size++;
+ SPtrArray<pkgCache::Package *> PList = new pkgCache::Package *[Size];
+ pkgCache::Package **PEnd = PList;
+ for (pkgCache::PrvIterator Prv = Pkg.ProvidesList(); Prv.end() == false; Prv++)
+ *PEnd++ = Prv.OwnerPkg();
+ Fix.MakeScores();
+ qsort(PList,PEnd - PList,sizeof(*PList),&(Fix.ScoreSort));
+
+ for (unsigned int p=0; p<Size; ++p)
+ {
+ bool instVirtual = _config->FindB("APT::Install::Virtual", false);
+ pkgCache::PkgIterator PrvPkg = pkgCache::PkgIterator(*Pkg.Cache(), PList[p]);
+ pkgCache::PrvIterator Prv = Pkg.ProvidesList();
+ for (; Prv.end() == false && Prv.OwnerPkg() != PrvPkg; Prv++)
+ ;
// Check if it's a different version of a package already
// considered as a good solution.
bool AlreadySeen = false;
@@ -1241,6 +1255,8 @@
// the user might try to install something he already has
// without being aware.
GoodSolutions.push_back(PrvPkg);
+ if (instVirtual)
+ break;
continue;
}
pkgCache::VerIterator PrvPkgCandVer =
@@ -1255,6 +1271,8 @@
{
// Yes, it is. This is a good solution.
GoodSolutions.push_back(PrvPkg);
+ if (instVirtual)
+ break;
continue;
}
}

View File

@ -1,8 +1,8 @@
# hey Emacs, its -*- mode: rpm-spec; coding: cyrillic-cp1251; -*-
Name: apt
Version: 0.5.15cnc5
Release: alt4
Version: 0.5.15cnc6
Release: alt1
Summary: Debian's Advanced Packaging Tool with RPM support
Summary(ru_RU.CP1251): Debian APT - Óñîâåðøåíñòâîâàííîå ñðåäñòâî óïðàâëåíèÿ ïàêåòàìè ñ ïîääåðæêîé RPM
@ -19,27 +19,27 @@ Source4: apt.ru.po
Source5: ChangeLog-rpm.old
Patch10: apt-0.5.15cnc5-alt-libtool.patch
Patch11: apt-0.5.15cnc5-alt-fixes.patch
Patch11: apt-0.5.15cnc6-alt-fixes.patch
Patch12: apt-0.5.15cnc5-alt-tinfo.patch
Patch13: apt-0.5.15cnc5-alt-rpm-build.patch
Patch14: apt-0.5.15cnc5-alt-distro.patch
Patch15: apt-0.5.15cnc5-alt-debsystem.patch
Patch16: apt-0.5.15cnc5-alt-defaults.patch
Patch16: apt-0.5.15cnc6-alt-defaults.patch
Patch17: apt-0.5.5cnc5-alt-rsync.patch
Patch18: apt-0.5.15cnc5-alt-getsrc.patch
Patch19: apt-0.5.15cnc5-alt-parseargs.patch
Patch20: apt-0.5.15cnc5-alt-rpm_cmd.patch
Patch21: apt-0.5.15cnc5-alt-rpm-fancypercent.patch
Patch21: apt-0.5.15cnc6-alt-rpm-fancypercent.patch
Patch22: apt-0.5.15cnc5-alt-methods_gpg_homedir.patch
Patch23: apt-0.5.15cnc5-alt-md5hash-debug.patch
Patch24: apt-0.5.15cnc5-alt-packagemanager-CheckRConflicts.patch
Patch25: apt-0.5.5cnc4.1-alt-fixpriorsort.patch
Patch26: apt-0.5.4cnc9-alt-pkgorderlist_score.patch
Patch27: apt-0.5.15cnc5-alt-install_virtual.patch
Patch28: apt-0.5.15cnc5-alt-virtual_scores.patch
Patch29: apt-0.5.15cnc5-alt-system-lua5.patch
Patch30: apt-0.5.15cnc5-alt-findrepos.patch
Patch31: apt-0.5.15cnc5-alt-gettext.patch
Patch27: apt-0.5.15cnc6-alt-virtual_scores.patch
Patch28: apt-0.5.15cnc5-alt-system-lua5.patch
Patch29: apt-0.5.15cnc5-alt-findrepos.patch
Patch30: apt-0.5.15cnc5-alt-gettext.patch
Patch31: apt-0.5.15cnc6-alt-rpm-order.patch
# Normally not applied, but useful.
Patch101: apt-0.5.4cnc9-alt-getsrc-debug.patch
@ -330,6 +330,18 @@ fi
# Probably %%doc with README.rsync?
%changelog
* Thu May 13 2004 Kachalov Anton <mouse@altlinux.ru> 0.5.15cnc6-alt1
- Updated to 0.5.15cnc6
- New:
+ apt-0.5.15cnc6-alt-rpm-order (fix RPM::Order default value)
- Updated:
+ apt-0.5.15cnc6-alt-fixes
+ apt-0.5.15cnc6-alt-defaults
+ apt-0.5.15cnc6-alt-rpm-fancypercent
+ apt-0.5.15cnc6-alt-virtual_scores
- Merged upstream:
+ apt-0.5.15cnc6-alt-install_virtual
* Fri Feb 27 2004 Dmitry V. Levin <ldv@altlinux.org> 0.5.15cnc5-alt4
- Fixed build with fresh autotools.

View File

@ -54,6 +54,8 @@ COMPILE_APTSHELL_FALSE = @COMPILE_APTSHELL_FALSE@
COMPILE_APTSHELL_TRUE = @COMPILE_APTSHELL_TRUE@
COMPILE_MANPAGES_FALSE = @COMPILE_MANPAGES_FALSE@
COMPILE_MANPAGES_TRUE = @COMPILE_MANPAGES_TRUE@
COMPILE_STATIC_FALSE = @COMPILE_STATIC_FALSE@
COMPILE_STATIC_TRUE = @COMPILE_STATIC_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@

View File

@ -55,6 +55,8 @@ COMPILE_APTSHELL_FALSE = @COMPILE_APTSHELL_FALSE@
COMPILE_APTSHELL_TRUE = @COMPILE_APTSHELL_TRUE@
COMPILE_MANPAGES_FALSE = @COMPILE_MANPAGES_FALSE@
COMPILE_MANPAGES_TRUE = @COMPILE_MANPAGES_TRUE@
COMPILE_STATIC_FALSE = @COMPILE_STATIC_FALSE@
COMPILE_STATIC_TRUE = @COMPILE_STATIC_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@

View File

@ -792,7 +792,7 @@ static void ScriptsAcquireDone(const char *ConfKey,
_lua->SetGlobal("acquire_filename", StoreFilename.c_str());
_lua->SetGlobal("acquire_error", (const char *)NULL);
_lua->RunScripts(ConfKey, true);
const char *Error = _lua->GetGlobal("acquire_error");
const char *Error = _lua->GetGlobalStr("acquire_error");
if (Error != NULL && *Error != 0) {
Status = pkgAcquire::Item::StatError;
ErrorText = Error;

View File

@ -13,6 +13,11 @@
#ifdef __GNUG__
#pragma implementation "apt-pkg/cdromutl.h"
#endif
// CNC:2004-03-19
#include <config.h>
#include <apt-pkg/luaiface.h>
#include <apt-pkg/cdromutl.h>
#include <apt-pkg/error.h>
#include <apt-pkg/md5.h>
@ -65,6 +70,16 @@ bool IsMounted(string &Path)
leave /etc/mtab inconsitant. We drop all messages this produces. */
bool UnmountCdrom(string Path)
{
// CNC:2004-03-19
#ifdef WITH_LUA
if (_lua->HasScripts("Scripts::Cdrom::Umount")) {
_lua->SetGlobal("done", false);
_lua->RunScripts("Scripts::Cdrom::Umount");
if (_lua->GetGlobalBool("done") == true)
return true;
}
#endif
if (IsMounted(Path) == false)
return true;
@ -103,6 +118,16 @@ bool UnmountCdrom(string Path)
/* We fork mount and drop all messages */
bool MountCdrom(string Path)
{
// CNC:2004-03-19
#ifdef WITH_LUA
if (_lua->HasScripts("Scripts::Cdrom::Mount")) {
_lua->SetGlobal("done", false);
_lua->RunScripts("Scripts::Cdrom::Mount");
if (_lua->GetGlobalBool("done") == true)
return true;
}
#endif
if (IsMounted(Path) == true)
return true;
@ -202,3 +227,4 @@ bool IdentCdrom(string CD,string &Res,unsigned int Version)
return true;
}
/*}}}*/
// vim:sts=3:sw=3

View File

@ -161,7 +161,7 @@ bool pkgInitSystem(Configuration &Cnf,pkgSystem *&Sys)
// CNC:2003-03-15
bool Ret = Sys->Initialize(Cnf);
#ifdef WITH_LUA
_lua->RunScripts("Scripts::Init", false);
_lua->RunScripts("Scripts::Init");
#endif
return Ret;
}

View File

@ -23,15 +23,6 @@ extern "C" {
#include "lposix.h"
#include "lrexlib.h"
#include "linit.h"
// For the interactive interpreter.
#define main lua_c_main
#define readline lua_c_readline
#define L lua_c_L
#include "../lua/lua/lua.c"
#undef main
#undef readline
#undef L
}
#include <apt-pkg/depcache.h>
@ -50,6 +41,7 @@ extern "C" {
#include <limits.h>
#include <unistd.h>
#include <sys/types.h>
#include <assert.h>
#define pushudata(ctype, value) \
do { \
@ -76,7 +68,10 @@ Lua *_GetLuaObj()
static int luaopen_apt(lua_State *L);
const double Lua::NoGlobalI = INT_MIN;
static int AptLua_vercomp(lua_State *L);
static int AptLua_pkgcomp(lua_State *L);
#define CACHE_KEY "ChunkCache"
Lua::Lua()
: DepCache(0), Cache(0), CacheControl(0), Fix(0), DontFix(0)
@ -104,8 +99,17 @@ Lua::Lua()
lua_settop(L, 0); /* discard any results */
}
luaL_newmetatable(L, "pkgCache::Package*");
lua_pushstring(L, "__eq");
lua_pushcfunction(L, AptLua_pkgcomp);
lua_settable(L, -3);
luaL_newmetatable(L, "pkgCache::Version*");
lua_pushstring(L, "__eq");
lua_pushcfunction(L, AptLua_vercomp);
lua_settable(L, -3);
lua_pop(L, 2);
lua_pushstring(L, CACHE_KEY);
lua_newtable(L);
lua_rawset(L, LUA_REGISTRYINDEX);
}
Lua::~Lua()
@ -125,30 +129,35 @@ bool Lua::HasScripts(const char *ConfListKey)
bool Lua::RunScripts(const char *ConfListKey, bool CacheChunks)
{
lua_pushstring(L, "script_slot");
lua_pushstring(L, ConfListKey);
lua_rawset(L, LUA_GLOBALSINDEX);
lua_pushstring(L, CACHE_KEY);
lua_rawget(L, LUA_REGISTRYINDEX);
assert(lua_istable(L, -1));
CacheData Data;
if (ChunkCache.find(ConfListKey) == ChunkCache.end()) {
int CacheIndex = lua_gettop(L);
lua_pushstring(L, ConfListKey);
lua_rawget(L, CacheIndex);
if (lua_isnil(L, -1)) {
string File, Dir = _config->FindDir("Dir::Bin::scripts", "");
Data.Begin = lua_gettop(L)+1;
lua_pop(L, 1);
lua_newtable(L);
int Count = 0;
const Configuration::Item *Top = _config->Tree(ConfListKey);
for (Top = (Top == 0?0:Top->Child); Top != 0; Top = Top->Next) {
const string &Value = Top->Value;
if (Value.empty() == true)
continue;
if (Value == "interactive") {
lua_pushstring(L, "script_filename");
lua_pushstring(L, "<interactive>");
lua_pushstring(L, "script_slot");
lua_pushstring(L, ConfListKey);
lua_rawset(L, LUA_GLOBALSINDEX);
RunInteractive(ConfListKey);
lua_pushstring(L, "script_slot");
lua_pushnil(L);
lua_rawset(L, LUA_GLOBALSINDEX);
cout << endl
<< "APT Interactive " << LUA_VERSION << " Interpreter"
<< endl << "[" << ConfListKey << "]" << endl;
int OldTop = lua_gettop(L);
lua_c_L = L;
manual_input();
lua_settop(L, OldTop);
continue;
}
if (Value[0] == '.' || Value[0] == '/') {
@ -161,36 +170,173 @@ bool Lua::RunScripts(const char *ConfListKey, bool CacheChunks)
if (FileExists(File) == false)
continue;
}
lua_pushstring(L, "script_filename");
lua_pushstring(L, File.c_str());
lua_rawset(L, LUA_GLOBALSINDEX);
if (luaL_loadfile(L, File.c_str()) != 0) {
_error->Warning(_("Error loading script: %s"),
lua_tostring(L, -1));
lua_pop(L, 1);
}
lua_rawseti(L, -2, ++Count);
}
if (Count == 0) {
lua_pop(L, 2); // Script table and cache table.
return false;
}
if (CacheChunks == true) {
lua_pushstring(L, ConfListKey);
lua_pushvalue(L, -2);
lua_rawset(L, CacheIndex);
}
}
lua_pushstring(L, "script_slot");
lua_pushstring(L, ConfListKey);
lua_rawset(L, LUA_GLOBALSINDEX);
InternalRunScript();
lua_pushstring(L, "script_slot");
lua_pushnil(L);
lua_rawset(L, LUA_GLOBALSINDEX);
lua_pop(L, 1);
return true;
}
bool Lua::RunScript(const char *Script, const char *ChunkCacheKey)
{
lua_pushstring(L, CACHE_KEY);
lua_rawget(L, LUA_REGISTRYINDEX);
assert(lua_istable(L, -1));
int CacheIndex = lua_gettop(L);
if (Script == NULL || *Script == '\0')
return false;
bool Cached = false;
if (ChunkCacheKey) {
lua_pushstring(L, ChunkCacheKey);
lua_rawget(L, 1);
if (!lua_isnil(L, -1))
Cached = true;
else
lua_pop(L, 1);
}
if (Cached == false) {
if (luaL_loadbuffer(L, Script, strlen(Script), "<lua>") != 0) {
_error->Warning(_("Error loading script: %s"),
lua_tostring(L, -1));
lua_pop(L, 2); // Error and cache table
assert(lua_gettop(L) == 0);
return false;
}
if (ChunkCacheKey) {
lua_pushstring(L, ChunkCacheKey);
lua_pushvalue(L, -2);
lua_rawset(L, CacheIndex);
}
}
InternalRunScript();
lua_pop(L, 1);
return true;
}
void Lua::InternalRunScript()
{
// Script or script list must be at the top, and will be poped.
if (lua_istable(L, -1)) {
int t = lua_gettop(L);
lua_pushnil(L);
while (lua_next(L, t)) {
if (lua_pcall(L, 0, 0, 0) != 0) {
_error->Warning(_("Error running script: %s"),
lua_tostring(L, -1));
lua_remove(L, -1);
}
}
Data.End = lua_gettop(L)+1;
if (Data.Begin == Data.End)
return false;
if (CacheChunks == true)
ChunkCache[ConfListKey] = Data;
lua_pop(L, 1);
} else {
Data = ChunkCache[ConfListKey];
}
for (int i = Data.Begin; i != Data.End; i++) {
lua_pushvalue(L, i);
if (lua_pcall(L, 0, 0, 0) != 0) {
_error->Warning(_("Error running script: %s"),
lua_tostring(L, -1));
lua_remove(L, -1);
}
}
if (CacheChunks == false) {
for (int i = Data.Begin; i != Data.End; i++)
lua_remove(L, Data.Begin);
}
/* From lua.c */
static int AptAux_readline(lua_State *l, const char *prompt) {
static char buffer[1024];
if (prompt) {
fputs(prompt, stdout);
fflush(stdout);
}
return true;
if (fgets(buffer, sizeof(buffer), stdin) == NULL) {
return 0; /* read fails */
} else {
lua_pushstring(l, buffer);
return 1;
}
}
/* Based on lua.c */
void Lua::RunInteractive(const char *PlaceHint)
{
cout << endl
<< "APT Interactive " << LUA_VERSION << " Interpreter" << endl;
if (PlaceHint)
cout << "[" << PlaceHint << "]" << endl;
for (;;) {
if (AptAux_readline(L, "> ") == 0)
break;
if (lua_tostring(L, -1)[0] == '=') {
lua_pushfstring(L, "print(%s)", lua_tostring(L, -1)+1);
lua_remove(L, -2);
}
int rc = 0;
for (;;) {
rc = luaL_loadbuffer(L, lua_tostring(L, -1),
lua_strlen(L, -1), "<lua>");
if (rc == LUA_ERRSYNTAX &&
strstr(lua_tostring(L, -1), "near `<eof>'") != NULL) {
if (AptAux_readline(L, ">> ") == 0)
break;
lua_remove(L, -2); // Remove error
lua_concat(L, 2);
continue;
}
break;
}
if (rc == 0)
rc = lua_pcall(L, 0, 0, 0);
if (rc != 0) {
fprintf(stderr, "%s\n", lua_tostring(L, -1));
lua_pop(L, 1);
}
lua_pop(L, 1); // Remove line
}
fputs("\n", stdout);
}
void Lua::ResetScript(const char *ChunkCacheKey)
{
lua_pushstring(L, ChunkCacheKey);
lua_pushnil(L);
lua_rawset(L, 1);
}
void Lua::SetGlobal(const char *Name)
{
lua_pushstring(L, Name);
lua_pushnil(L);
lua_rawset(L, LUA_GLOBALSINDEX);
Globals.push_back(Name);
}
void Lua::SetGlobal(const char *Name, const char *Value)
@ -203,6 +349,16 @@ void Lua::SetGlobal(const char *Name, const char *Value)
Globals.push_back(Name);
}
void Lua::SetGlobal(const char *Name, pkgCache::Package *Value)
{
if (Value != NULL) {
lua_pushstring(L, Name);
pushudata(pkgCache::Package*, Value);
lua_rawset(L, LUA_GLOBALSINDEX);
}
Globals.push_back(Name);
}
void Lua::SetGlobal(const char *Name, const char **Value, int Total)
{
lua_pushstring(L, Name);
@ -262,6 +418,14 @@ void Lua::SetGlobal(const char *Name, vector<pkgCache::Package*> &Value,
Globals.push_back(Name);
}
void Lua::SetGlobal(const char *Name, bool Value)
{
lua_pushstring(L, Name);
lua_pushboolean(L, Value);
lua_rawset(L, LUA_GLOBALSINDEX);
Globals.push_back(Name);
}
void Lua::SetGlobal(const char *Name, double Value)
{
lua_pushstring(L, Name);
@ -301,7 +465,7 @@ void Lua::ResetGlobals()
}
}
const char *Lua::GetGlobal(const char *Name)
const char *Lua::GetGlobalStr(const char *Name)
{
lua_pushstring(L, Name);
lua_rawget(L, LUA_GLOBALSINDEX);
@ -312,18 +476,45 @@ const char *Lua::GetGlobal(const char *Name)
return Ret;
}
double Lua::GetGlobalI(const char *Name)
vector<string> Lua::GetGlobalStrList(const char *Name)
{
vector<string> Ret;
lua_pushstring(L, Name);
lua_rawget(L, LUA_GLOBALSINDEX);
int t = lua_gettop(L);
if (lua_istable(L, t)) {
lua_pushnil(L);
while (lua_next(L, t) != 0) {
if (lua_isstring(L, -1))
Ret.push_back(lua_tostring(L, -1));
lua_pop(L, 1);
}
}
lua_remove(L, -1);
return Ret;
}
double Lua::GetGlobalNum(const char *Name)
{
lua_pushstring(L, Name);
lua_rawget(L, LUA_GLOBALSINDEX);
double Ret = NoGlobalI;
double Ret = 0;
if (lua_isnumber(L, -1))
Ret = lua_tonumber(L, -1);
lua_remove(L, -1);
return Ret;
}
void *Lua::GetGlobalP(const char *Name)
bool Lua::GetGlobalBool(const char *Name)
{
lua_pushstring(L, Name);
lua_rawget(L, LUA_GLOBALSINDEX);
bool Ret = lua_toboolean(L, -1);
lua_remove(L, -1);
return Ret;
}
void *Lua::GetGlobalPtr(const char *Name)
{
lua_pushstring(L, Name);
lua_rawget(L, LUA_GLOBALSINDEX);
@ -334,20 +525,34 @@ void *Lua::GetGlobalP(const char *Name)
return Ret;
}
void Lua::GetGlobalVS(const char *Name, vector<string> &VS)
pkgCache::Package *Lua::GetGlobalPkg(const char *Name)
{
lua_pushstring(L, Name);
lua_rawget(L, LUA_GLOBALSINDEX);
pkgCache::Package *Ret;
checkudata(pkgCache::Package*, Ret, -1);
lua_remove(L, -1);
return Ret;
}
vector<pkgCache::Package*> Lua::GetGlobalPkgList(const char *Name)
{
vector<pkgCache::Package*> Ret;
lua_pushstring(L, Name);
lua_rawget(L, LUA_GLOBALSINDEX);
int t = lua_gettop(L);
if (lua_istable(L, t)) {
lua_pushnil(L);
while (lua_next(L, t) != 0) {
if (lua_isstring(L, -1))
VS.push_back(lua_tostring(L, -1));
pkgCache::Package *Pkg;
checkudata(pkgCache::Package*, Pkg, -1);
if (Pkg)
Ret.push_back(Pkg);
lua_pop(L, 1);
}
}
lua_remove(L, -1);
return Ret;
}
void Lua::SetDepCache(pkgDepCache *DepCache_)
@ -628,6 +833,15 @@ static int AptLua_pkgname(lua_State *L)
return AptAux_PushCacheString(L, Pkg->Name);
}
static int AptLua_pkgid(lua_State *L)
{
pkgCache::Package *Pkg = AptAux_ToPackage(L, 1);
if (Pkg == NULL)
return 0;
lua_pushnumber(L, Pkg->ID);
return 1;
}
static int AptLua_pkgsummary(lua_State *L)
{
SPtr<pkgCache::PkgIterator> PkgI = AptAux_ToPkgIterator(L, 1);
@ -659,8 +873,7 @@ static int AptLua_pkgdescr(lua_State *L)
if (Cache == NULL)
return 0;
pkgRecords Recs(*Cache);
pkgRecords::Parser &Parse =
Recs.Lookup(PkgI->VersionList().FileList());
pkgRecords::Parser &Parse = Recs.Lookup(PkgI->VersionList().FileList());
lua_pushstring(L, Parse.LongDesc().c_str());
}
return 1;
@ -732,22 +945,47 @@ static int AptLua_pkgverlist(lua_State *L)
return 1;
}
static int AptLua_verpkg(lua_State *L)
{
pkgCache::VerIterator *VerI = AptAux_ToVerIterator(L, 1);
if (VerI == NULL)
return 0;
pushudata(pkgCache::Package*, VerI->ParentPkg());
return 1;
}
static int AptLua_verstr(lua_State *L)
{
pkgCache::Version *Ver = AptAux_ToVersion(L, 1);
if (Ver == NULL)
return 0;
return AptAux_PushCacheString(L, Ver->VerStr);
}
static int AptLua_verarch(lua_State *L)
{
pkgCache::Version *Ver = AptAux_ToVersion(L, 1);
if (Ver == NULL)
return 0;
return AptAux_PushCacheString(L, Ver->Arch);
}
static int AptLua_verid(lua_State *L)
{
pkgCache::Version *Ver = AptAux_ToVersion(L, 1);
if (Ver == NULL)
return 0;
lua_pushnumber(L, Ver->ID);
return 1;
}
static int AptLua_verisonline(lua_State *L)
{
pkgCache::VerIterator *VerI = AptAux_ToVerIterator(L, 1);
if (VerI == NULL)
return 0;
return AptAux_PushBool(L, VerI->Downloadable());
}
@ -759,18 +997,71 @@ static int AptLua_verprovlist(lua_State *L)
pkgCache::PrvIterator PrvI = VerI->ProvidesList();
lua_newtable(L);
int i = 1;
for (; PrvI.end() == false; PrvI++)
{
for (; PrvI.end() == false; PrvI++) {
lua_newtable(L);
lua_pushstring(L, "name");
lua_pushstring(L, PrvI.Name());
lua_settable(L, -3);
#ifndef DEAD
lua_pushstring(L, "version");
if (PrvI.ProvideVersion())
lua_pushstring(L, PrvI.ProvideVersion());
else
lua_pushstring(L, "");
lua_settable(L, -3);
#endif
lua_pushstring(L, "verstr");
if (PrvI.ProvideVersion())
lua_pushstring(L, PrvI.ProvideVersion());
else
lua_pushstring(L, "");
lua_settable(L, -3);
lua_rawseti(L, -2, i++);
}
return 1;
}
static int AptLua_verdeplist(lua_State *L)
{
const char *TypeStr[] = {
"", "depends", "predepends", "suggests", "recommends",
"conflicts", "replaces", "obsoletes"
};
pkgCache::VerIterator *VerI = AptAux_ToVerIterator(L, 1);
if (VerI == NULL)
return 0;
pkgCache::DepIterator DepI = VerI->DependsList();
lua_newtable(L);
int i = 1;
for (; DepI.end() == false; DepI++) {
lua_newtable(L);
lua_pushstring(L, "pkg");
pushudata(pkgCache::Package*, DepI.TargetPkg());
lua_settable(L, -3);
lua_pushstring(L, "name");
lua_pushstring(L, DepI.TargetPkg().Name());
lua_settable(L, -3);
lua_pushstring(L, "verstr");
if (DepI.TargetVer())
lua_pushstring(L, DepI.TargetVer());
else
lua_pushstring(L, "");
lua_settable(L, -3);
lua_pushstring(L, "operator");
lua_pushstring(L, DepI.CompType());
lua_settable(L, -3);
lua_pushstring(L, "type");
lua_pushstring(L, TypeStr[DepI->Type]);
lua_settable(L, -3);
lua_pushstring(L, "verlist");
lua_newtable(L);
pkgCache::Version **VerList = DepI.AllTargets();
for (int j = 0; VerList[j]; j++) {
pushudata(pkgCache::Version*, VerList[j]);
lua_rawseti(L, -2, j+1);
}
delete[] VerList;
lua_settable(L, -3);
lua_rawseti(L, -2, i++);
}
return 1;
@ -1012,6 +1303,22 @@ static int AptLua_aptwarning(lua_State *L)
return 0;
}
static int AptLua_gettext(lua_State *L)
{
const char *str = luaL_checkstring(L, 1);
if (str != NULL) {
lua_pushliteral(L, "TEXTDOMAIN");
lua_rawget(L, LUA_GLOBALSINDEX);
if (lua_isstring(L, -1))
lua_pushstring(L, dgettext(lua_tostring(L, -1), str));
else
lua_pushstring(L, gettext(str));
lua_remove(L, -2);
return 1;
}
return 0;
}
static const luaL_reg aptlib[] = {
{"confget", AptLua_confget},
{"confgetlist", AptLua_confgetlist},
@ -1021,6 +1328,7 @@ static const luaL_reg aptlib[] = {
{"pkgfind", AptLua_pkgfind},
{"pkglist", AptLua_pkglist},
{"pkgname", AptLua_pkgname},
{"pkgid", AptLua_pkgid},
{"pkgsummary", AptLua_pkgsummary},
{"pkgdescr", AptLua_pkgdescr},
{"pkgisvirtual", AptLua_pkgisvirtual},
@ -1028,10 +1336,13 @@ static const luaL_reg aptlib[] = {
{"pkgverinst", AptLua_pkgverinst},
{"pkgvercand", AptLua_pkgvercand},
{"pkgverlist", AptLua_pkgverlist},
{"verpkg", AptLua_verpkg},
{"verstr", AptLua_verstr},
{"verarch", AptLua_verarch},
{"verid", AptLua_verid},
{"verisonline", AptLua_verisonline},
{"verprovlist", AptLua_verprovlist},
{"verdeplist", AptLua_verdeplist},
{"verstrcmp", AptLua_verstrcmp},
{"markkeep", AptLua_markkeep},
{"markinstall", AptLua_markinstall},
@ -1050,13 +1361,34 @@ static const luaL_reg aptlib[] = {
{"statstr", AptLua_statstr},
{"apterror", AptLua_apterror},
{"aptwarning", AptLua_aptwarning},
{"_", AptLua_gettext},
{NULL, NULL}
};
static int AptLua_vercomp(lua_State *L)
{
pkgCache::Version *v1, *v2;
checkudata(pkgCache::Version*, v1, 1);
checkudata(pkgCache::Version*, v2, 2);
lua_pushboolean(L, (!v1 || v1 != v2) ? 0 : 1);
return 1;
}
static int AptLua_pkgcomp(lua_State *L)
{
pkgCache::Package *p1, *p2;
checkudata(pkgCache::Package*, p1, 1);
checkudata(pkgCache::Package*, p2, 2);
lua_pushboolean(L, (!p1 || p1 != p2) ? 0 : 1);
return 1;
}
static int luaopen_apt(lua_State *L)
{
lua_pushvalue(L, LUA_GLOBALSINDEX);
luaL_openlib(L, NULL, aptlib, 0);
return 0;
}
pkgDepCache *LuaCacheControl::Open()

View File

@ -11,9 +11,10 @@
#include <map>
#include <vector>
#include <apt-pkg/pkgcache.h>
using namespace std;
class pkgCache;
class pkgDepCache;
class pkgProblemResolver;
class lua_State;
@ -30,15 +31,10 @@ class LuaCacheControl {
};
class Lua {
protected:
struct CacheData {
int Begin;
int End;
};
lua_State *L;
map<string,CacheData> ChunkCache;
vector<string> Globals;
@ -50,20 +46,36 @@ class Lua {
pkgProblemResolver *Fix;
bool DontFix;
void InternalRunScript();
public:
bool RunScripts(const char *ConfListKey, bool CacheChunks);
bool HasScripts(const char *ConfListKey);
void RunInteractive(const char *PlaceHint=NULL);
void RunInteractive(const string &PlaceHint)
{ RunInteractive(PlaceHint.c_str()); };
bool RunScript(const string &Script, const string &ChunkCacheKey="")
{ RunScript(Script.c_str(), (ChunkCacheKey.length() == 0) ?
NULL : ChunkCacheKey.c_str()); };
bool RunScript(const char *Script, const char *ChunkCacheKey=NULL);
bool RunScripts(const char *ConfListKey, bool CacheChunks=false);
bool HasScripts(const char *ConfListKey);
void ResetScript(const string &ChunkCacheKey)
{ ResetScript(ChunkCacheKey.c_str()); };
void ResetScript(const char *ChunkCacheKey);
void SetGlobal(const char *Name);
void SetGlobal(const char *Name, const char *Value);
void SetGlobal(const char *Name, bool Value);
void SetGlobal(const char *Name, double Value);
void SetGlobal(const char *Name, void *Value);
void SetGlobal(const char *Name, string Value)
void SetGlobal(const char *Name, const string &Value)
{ SetGlobal(Name, Value.c_str()); };
void SetGlobal(const char *Name, int Value)
{ SetGlobal(Name, (double)Value); };
void SetGlobal(const char *Name, lua_CFunction Value);
void SetGlobal(const char *Name, const char **Value, int Total=-1);
void SetGlobal(const char *Name, pkgCache::Package *Value);
void SetGlobal(const char *Name, vector<const char *> &Value,
int Total=-1);
void SetGlobal(const char *Name, vector<string> &Value,
@ -72,12 +84,13 @@ class Lua {
int Total=-1);
void ResetGlobals();
const char *GetGlobal(const char *Name);
double GetGlobalI(const char *Name);
void *GetGlobalP(const char *Name);
void GetGlobalVS(const char *Name, vector<string> &VS);
static const double NoGlobalI;
const char *GetGlobalStr(const char *Name);
vector<string> GetGlobalStrList(const char *Name);
double GetGlobalNum(const char *Name);
bool GetGlobalBool(const char *Name);
void *GetGlobalPtr(const char *Name);
pkgCache::Package *GetGlobalPkg(const char *Name);
vector<pkgCache::Package*> GetGlobalPkgList(const char *Name);
void SetDepCache(pkgDepCache *DepCache_);
void SetCache(pkgCache *Cache_) { Cache = Cache_; };

View File

@ -343,9 +343,13 @@ string RPMDirHandler::MD5Sum()
RPMDBHandler::RPMDBHandler(bool WriteLock)
: WriteLock(WriteLock)
: WriteLock(WriteLock), Handler(0)
{
#if RPM_VERSION >= 0x040000
RpmIter = NULL;
#endif
string Dir = _config->Find("RPM::RootDir");
rpmReadConfigFiles(NULL, NULL);
ID = DataPath(false);
@ -359,14 +363,10 @@ RPMDBHandler::RPMDBHandler(bool WriteLock)
stat(DataPath(false).c_str(), &St);
DbFileMtime = St.st_mtime;
#if RPM_VERSION >= 0x040000
RpmIter = NULL;
#endif
#if RPM_VERSION >= 0x040100
Handler = rpmtsCreate();
rpmtsSetVSFlags(Handler, (rpmVSFlags_e)-1);
if (!Dir.empty())
rpmtsSetRootDir(Handler, Dir.c_str());
rpmtsSetRootDir(Handler, Dir.c_str());
if (rpmtsOpenDB(Handler, WriteLock?O_RDWR:O_RDONLY) != 0)
{
_error->Error(_("could not open RPM database"));
@ -396,7 +396,7 @@ RPMDBHandler::RPMDBHandler(bool WriteLock)
iSize = 0;
rpmdbMatchIterator countIt;
countIt = rpmxxInitIterator(Handler, RPMDBI_PACKAGES, NULL, 0);
while(rpmdbNextIterator(countIt) != NULL)
while (rpmdbNextIterator(countIt) != NULL)
iSize++;
rpmdbFreeIterator(countIt);
#else
@ -415,20 +415,20 @@ RPMDBHandler::RPMDBHandler(bool WriteLock)
RPMDBHandler::~RPMDBHandler()
{
#if RPM_VERSION >= 0x040000
if (RpmIter == NULL)
return;
rpmdbFreeIterator(RpmIter);
RpmIter = NULL;
if (RpmIter != NULL)
rpmdbFreeIterator(RpmIter);
#else
if (HeaderP != NULL)
headerFree(HeaderP);
#endif
if (Handler != NULL) {
#if RPM_VERSION >= 0x040100
rpmtsFree(Handler);
rpmtsFree(Handler);
#else
rpmdbClose(Handler);
rpmdbClose(Handler);
#endif
}
// Restore just after opening the database, and just after closing.
if (WriteLock) {

View File

@ -401,7 +401,7 @@ bool rpmPkgListIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const
delete Handler;
// Check the release file
string RelFile = IndexFile("release");
string RelFile = ReleasePath();
if (FileExists(RelFile) == true)
{
FileFd Rel(RelFile,FileFd::ReadOnly);
@ -464,11 +464,19 @@ pkgCache::PkgFileIterator rpmPkgListIndex::FindInCache(pkgCache &Cache) const
// PkgDirIndex::Index* - Return the URI to the index files /*{{{*/
// ---------------------------------------------------------------------
/* */
inline string rpmPkgDirIndex::IndexPath() const
string rpmPkgDirIndex::IndexPath() const
{
return ::URI(ArchiveURI("")).Path;
}
/*}}}*/
// PkgDirIndex::Release* - Return the URI to the index files /*{{{*/
// ---------------------------------------------------------------------
/* */
string rpmPkgDirIndex::ReleasePath() const
{
return ::URI(IndexURI("release")).Path;
}
/*}}}*/
// PkgDirIndex::Size - Return the size of the index /*{{{*/
// ---------------------------------------------------------------------
/* This is really only used for progress reporting. */
@ -485,7 +493,7 @@ unsigned long rpmPkgDirIndex::Size() const
// SrcDirIndex::Index* - Return the URI to the index files /*{{{*/
// ---------------------------------------------------------------------
/* */
inline string rpmSrcDirIndex::IndexPath() const
string rpmSrcDirIndex::IndexPath() const
{
return ::URI(ArchiveURI("")).Path;
}

View File

@ -82,6 +82,7 @@ class rpmListIndex : public rpmIndexFile
virtual string MainType() const = 0;
virtual string IndexPath() const {return IndexFile(MainType());};
virtual string ReleasePath() const {return IndexFile("release");};
public:
@ -174,6 +175,7 @@ class rpmPkgDirIndex : public rpmPkgListIndex
virtual string MainType() const {return "pkgdir";}
virtual string IndexPath() const;
virtual string ReleasePath() const;
public:

View File

@ -271,8 +271,14 @@ bool rpmListParser::UsePackage(pkgCache::PkgIterator Pkg,
Pkg->Section = UniqFindTagWrite(RPMTAG_GROUP);
if (_error->PendingError())
return false;
Ver->Priority = RpmData->VerPriority(Pkg.Name());
Pkg->Flags |= RpmData->PkgFlags(Pkg.Name());
string PkgName = Pkg.Name();
string::size_type HashPos = PkgName.find('#');
if (HashPos != string::npos)
PkgName = PkgName.substr(0, HashPos);
Ver->Priority = RpmData->VerPriority(PkgName);
Pkg->Flags |= RpmData->PkgFlags(PkgName);
if (HashPos != string::npos && (Pkg->Flags & pkgCache::Flag::Essential))
Pkg->Flags = pkgCache::Flag::Important;
if (ParseStatus(Pkg,Ver) == false)
return false;
return true;
@ -313,10 +319,10 @@ unsigned short rpmListParser::VersionHash()
int Len;
int type, count;
int res;
char **strings;
char **strings = NULL;
res = headerGetEntry(header, *sec, &type, (void **)&strings, &count);
if (res != 1 || count == 0)
if (res != 1)
continue;
switch (type)
@ -335,6 +341,7 @@ unsigned short rpmListParser::VersionHash()
Result = AddCRC16(Result,Str,Len);
}
free(strings);
break;
case RPM_STRING_TYPE:
@ -490,6 +497,9 @@ bool rpmListParser::ParseDepends(pkgCache::VerIterator Ver,
}
ParseDepends(Ver, namel, verl, flagl, count, Type);
free(namel);
free(verl);
return true;
}
@ -520,6 +530,7 @@ bool rpmListParser::CollectFileProvides(pkgCache &Cache,
{
const char **names = NULL;
int_32 count = 0;
bool ret = true;
rpmHeaderGetEntry(header, RPMTAG_OLDFILENAMES,
NULL, (void **) &names, &count);
while (count--)
@ -536,12 +547,14 @@ bool rpmListParser::CollectFileProvides(pkgCache &Cache,
break;
}
}
if (Found == false && NewProvides(Ver, FileName, "") == false)
return false;
if (Found == false && NewProvides(Ver, FileName, "") == false) {
ret = false;
break;
}
}
}
return true;
free(names);
return ret;
}
// ListParser::ParseProvides - Parse the provides list /*{{{*/
@ -554,13 +567,6 @@ bool rpmListParser::ParseProvides(pkgCache::VerIterator Ver)
char **verl = NULL;
int res;
if (Duplicated == true)
{
char *name;
headerGetEntry(header, RPMTAG_NAME, &type, (void **)&name, &count);
NewProvides(Ver, string(name), Version());
}
res = headerGetEntry(header, RPMTAG_PROVIDENAME, &type,
(void **)&namel, &count);
if (res != 1)
@ -576,21 +582,29 @@ bool rpmListParser::ParseProvides(pkgCache::VerIterator Ver)
if (res != 1)
verl = NULL;
bool ret = true;
for (int i = 0; i < count; i++)
{
if (verl && *verl[i])
{
if (NewProvides(Ver,namel[i],verl[i]) == false)
return false;
if (NewProvides(Ver,namel[i],verl[i]) == false) {
ret = false;
break;
}
}
else
{
if (NewProvides(Ver,namel[i],"") == false)
return false;
if (NewProvides(Ver,namel[i],"") == false) {
ret = false;
break;
}
}
}
free(namel);
free(verl);
return true;
return ret;
}
/*}}}*/
// ListParser::Step - Move to the next section in the file /*{{{*/

View File

@ -276,7 +276,7 @@ int RPMPackageData::RpmArchScore(const char *Arch)
return 0;
}
bool RPMPackageData::IsDupPackage(string Name)
bool RPMPackageData::IsDupPackage(const string &Name)
{
if (DuplicatedPackages.find(Name) != DuplicatedPackages.end())
return true;

View File

@ -66,17 +66,17 @@ class RPMPackageData
public:
inline pkgCache::State::VerPriority VerPriority(string Package)
inline pkgCache::State::VerPriority VerPriority(const string &Package)
{
if (Priorities.find(Package) != Priorities.end())
return Priorities[Package];
return pkgCache::State::Standard;
};
inline pkgCache::Flag::PkgFlags PkgFlags(string Package)
inline pkgCache::Flag::PkgFlags PkgFlags(const string &Package)
{return Flags[Package];};
bool HoldPackage(const char *name);
bool IgnorePackage(string Name)
bool IgnorePackage(const string &Name)
{return IgnorePackages.find(Name) != IgnorePackages.end();};
bool IgnoreDep(pkgVersioningSystem &VS,pkgCache::DepIterator &Dep);
@ -107,9 +107,9 @@ class RPMPackageData
}
void InitMinArchScore();
void SetDupPackage(string Name)
void SetDupPackage(const string &Name)
{DuplicatedPackages[Name] = 1;};
bool IsDupPackage(string Name);
bool IsDupPackage(const string &Name);
static RPMPackageData *Singleton();

View File

@ -319,7 +319,7 @@ bool pkgRPMPM::Go()
_lua->SetGlobal("pkgs_install", pkgs_install);
_lua->SetGlobal("pkgs_remove", pkgs_uninstall);
_lua->SetDepCache(&Cache);
_lua->RunScripts("Scripts::PM::Pre", false);
_lua->RunScripts("Scripts::PM::Pre");
_lua->ResetCaches();
_lua->ResetGlobals();
if (_error->PendingError() == true) {
@ -338,8 +338,9 @@ bool pkgRPMPM::Go()
_lua->SetGlobal("names_remove", uninstall);
_lua->SetGlobal("pkgs_install", pkgs_install);
_lua->SetGlobal("pkgs_remove", pkgs_uninstall);
_lua->SetGlobal("transaction_success", Ret);
_lua->SetDepCache(&Cache);
_lua->RunScripts("Scripts::PM::Post", false);
_lua->RunScripts("Scripts::PM::Post");
_lua->ResetCaches();
_lua->ResetGlobals();
if (_error->PendingError() == true) {
@ -493,7 +494,7 @@ bool pkgRPMExtPM::ExecRPM(Item::RPMOps op, vector<const char*> &files)
}
}
if (_config->FindB("RPM::Order",false) == false)
if (_config->FindB("RPM::Order", false) == false)
Args[n++] = "--noorder";
bool FilesInArgs = true;
@ -619,7 +620,9 @@ bool pkgRPMExtPM::ExecRPM(Item::RPMOps op, vector<const char*> &files)
return _error->Error(_("Sub-process %s exited unexpectedly"),Args[0]);
}
cout << _("Done.") << endl;
if (Interactive == true)
cout << _("Done.") << endl;
return true;
}
@ -735,6 +738,7 @@ bool pkgRPMLibPM::Process(vector<const char*> &install,
{
int rc = 0;
bool Success = false;
bool Interactive = _config->FindB("RPM::Interactive",true);
int debug = _config->FindB("Debug::pkgRPMPM", false);
string Dir = _config->Find("RPM::RootDir");
rpmReadConfigFiles(NULL, NULL);
@ -783,7 +787,7 @@ bool pkgRPMLibPM::Process(vector<const char*> &install,
probFilter |= RPMPROB_FILTER_REPLACENEWFILES;
}
if (_config->FindB("RPM::Interactive", true))
if (Interactive == true)
notifyFlags |= INSTALL_LABEL | INSTALL_HASH;
else
notifyFlags |= INSTALL_LABEL | INSTALL_PERCENT;
@ -799,13 +803,15 @@ bool pkgRPMLibPM::Process(vector<const char*> &install,
packagesTotal = install.size()+upgrade.size();
#if RPM_VERSION >= 0x040100
rc = rpmtsCheck(TS);
probs = rpmtsProblems(TS);
if (rc || probs->numProblems > 0) {
rpmpsPrint(NULL, probs);
rpmpsFree(probs);
_error->Error(_("Transaction set check failed"));
goto exit;
if (_config->FindB("RPM::NoDeps", false) == false) {
rc = rpmtsCheck(TS);
probs = rpmtsProblems(TS);
if (rc || probs->numProblems > 0) {
rpmpsPrint(NULL, probs);
rpmpsFree(probs);
_error->Error(_("Transaction set check failed"));
goto exit;
}
}
#else
#if RPM_VERSION < 0x040000
@ -813,25 +819,25 @@ bool pkgRPMLibPM::Process(vector<const char*> &install,
#else
rpmDependencyConflict conflicts;
#endif
int numConflicts;
if (_config->FindB("RPM::NoDeps", false) == false &&
rpmdepCheck(TS, &conflicts, &numConflicts))
{
_error->Error(_("Transaction set check failed"));
if (conflicts) {
printDepProblems(stderr, conflicts, numConflicts);
rpmdepFreeConflicts(conflicts, numConflicts);
if (_config->FindB("RPM::NoDeps", false) == false) {
int numConflicts;
if (rpmdepCheck(TS, &conflicts, &numConflicts)) {
_error->Error(_("Transaction set check failed"));
if (conflicts) {
printDepProblems(stderr, conflicts, numConflicts);
rpmdepFreeConflicts(conflicts, numConflicts);
}
goto exit;
}
goto exit;
}
#endif
rc = 0;
#if RPM_VERSION >= 0x040100
if (_config->FindB("RPM::Order", true) == true)
if (_config->FindB("RPM::Order", false) == true)
rc = rpmtsOrder(TS);
#else
if (_config->FindB("RPM::Order", true) == true)
if (_config->FindB("RPM::Order", false) == true)
rc = rpmdepOrder(TS);
#endif
@ -863,7 +869,7 @@ bool pkgRPMLibPM::Process(vector<const char*> &install,
Success = true;
if (rc < 0)
_error->Warning(_("Some errors occurred while running transaction"));
else
else if (Interactive == true)
cout << _("Done.") << endl;
}
rpmpsFree(probs);
@ -902,6 +908,8 @@ bool pkgRPMLibPM::ParseRpmOpts(const char *Cnf, int *tsFlags, int *probFilter)
*tsFlags |= RPMTRANS_FLAG_ALLFILES;
else if (Opts->Value == "--justdb")
*tsFlags |= RPMTRANS_FLAG_JUSTDB;
else if (Opts->Value == "--test")
*tsFlags |= RPMTRANS_FLAG_TEST;
#if RPM_VERSION >= 0x040000
else if (Opts->Value == "--nomd5")
*tsFlags |= RPMTRANS_FLAG_NOMD5;

View File

@ -277,6 +277,7 @@ void rpmRecordParser::BufCatDescr(const char *descr)
// ---------------------------------------------------------------------
void rpmRecordParser::GetRec(const char *&Start,const char *&Stop)
{
// FIXME: This method is leaking memory from headerGetEntry().
int type, type2, type3, count;
char *str;
char **strv;
@ -439,6 +440,7 @@ bool rpmRecordParser::HasFile(const char *File)
if (strcmp(name, File) == 0)
return true;
}
free(names);
return false;
}

View File

@ -288,6 +288,7 @@ void rpmSrcRecordParser::BufCatDescr(char *descr)
// -----------------------------------------------
string rpmSrcRecordParser::AsStr()
{
// FIXME: This method is leaking memory from headerGetEntry().
int type, type2, type3, count;
char *str;
char **strv;
@ -404,6 +405,7 @@ string rpmSrcRecordParser::AsStr()
bool rpmSrcRecordParser::BuildDepends(vector<pkgSrcRecords::Parser::BuildDepRec> &BuildDeps,
bool ArchOnly)
{
// FIXME: This method is leaking memory from headerGetEntry().
int RpmTypeTag[] = {RPMTAG_REQUIRENAME,
RPMTAG_REQUIREVERSION,
RPMTAG_REQUIREFLAGS,

View File

@ -71,6 +71,8 @@ RPMDBHandler *rpmSystem::GetDBHandler()
bool rpmSystem::LockRead()
{
GetDBHandler();
if (_error->PendingError() == true)
return false;
return true;
}
@ -173,7 +175,7 @@ bool rpmSystem::Initialize(Configuration &Cnf)
if (Cnf.FindB("RPM::Force",false))
Cnf.Set("RPM::Options::", "--force");
}
if (Cnf.Exists("RPM::Force"))
if (Cnf.Exists("RPM::NoDeps"))
{
_error->Warning("RPM::NoDeps is obsoleted. Add \"--nodeps\" to RPM::Options and RPM::Erase-Options instead.");
if (Cnf.FindB("RPM::NoDeps",false))
@ -189,10 +191,10 @@ bool rpmSystem::Initialize(Configuration &Cnf)
NULL,
};
int NoPromote = 1;
const char *Opt = *RPMOptions;
const char **Opt = RPMOptions;
while (*Opt && NoPromote)
{
Top = _config->Tree(Opt);
Top = _config->Tree(*Opt);
if (Top != 0)
{
for (Top = Top->Child; Top != 0; Top = Top->Next)
@ -516,12 +518,20 @@ static void HashOptionTree(unsigned long &Hash, const char *Name)
for (Top = Top->Child; Top != 0; Top = Top->Next)
HashString(Hash, Top->Value.c_str());
}
static void HashOptionFile(unsigned long &Hash, const char *Name)
{
string FileName = _config->FindFile(Name);
struct stat st;
stat(FileName.c_str(), &st);
Hash += st.st_mtime;
}
unsigned long rpmSystem::OptionsHash() const
{
unsigned long Hash = 0;
HashOption(Hash, "RPM::Architecture");
HashOptionTree(Hash, "RPM::Allow-Duplicated");
HashOptionTree(Hash, "RPM::Ignore");
HashOptionFile(Hash, "Dir::Etc::rpmpriorities");
return Hash;
}
/*}}}*/

View File

@ -201,8 +201,10 @@ bool rpmVersioningSystem::CheckDep(const char *PkgVer,
#if RPM_VERSION >= 0x040100
rpmds pds = rpmdsSingle(RPMTAG_PROVIDENAME, "", PkgVer, PkgFlags);
rpmds dds = rpmdsSingle(RPMTAG_REQUIRENAME, "", DepVer, DepFlags);
#if RPM_VERSION >= 0x040201
rpmdsSetNoPromote(pds, _rpmds_nopromote);
rpmdsSetNoPromote(dds, _rpmds_nopromote);
#endif
rc = rpmdsCompare(pds, dds);
rpmdsFree(pds);
rpmdsFree(dds);

View File

@ -57,6 +57,8 @@ COMPILE_APTSHELL_FALSE = @COMPILE_APTSHELL_FALSE@
COMPILE_APTSHELL_TRUE = @COMPILE_APTSHELL_TRUE@
COMPILE_MANPAGES_FALSE = @COMPILE_MANPAGES_FALSE@
COMPILE_MANPAGES_TRUE = @COMPILE_MANPAGES_TRUE@
COMPILE_STATIC_FALSE = @COMPILE_STATIC_FALSE@
COMPILE_STATIC_TRUE = @COMPILE_STATIC_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@

View File

@ -1,17 +1,28 @@
bin_PROGRAMS = apt-get apt-cache apt-cdrom apt-config
EXTRA_DIST = indexcopy.cc indexcopy.h
bin_PROGRAMS = apt-get apt-cache apt-cdrom apt-config
if COMPILE_APTSHELL
bin_PROGRAMS += apt-shell
endif
if COMPILE_STATIC
bin_PROGRAMS += apt-get-static apt-cache-static apt-cdrom-static
endif
LDADD = ../apt-pkg/libapt-pkg.la $(RPMLIBS)
apt_cache_SOURCES = apt-cache.cc
apt_get_SOURCES = apt-get.cc acqprogress.cc acqprogress.h
apt_cache_SOURCES = apt-cache.cc
apt_shell_SOURCES = apt-shell.cc acqprogress.cc acqprogress.h
apt_shell_LDADD = $(LDADD) -lreadline -lncurses
apt_config_SOURCES = apt-config.cc
apt_cdrom_SOURCES = apt-cdrom.cc rpmindexcopy.cc rpmindexcopy.h
apt_get_static_SOURCES = $(apt_get_SOURCES)
apt_get_static_LDFLAGS = -all-static
apt_cache_static_SOURCES = $(apt_cache_SOURCES)
apt_cache_static_LDFLAGS = -all-static
apt_cdrom_static_SOURCES = $(apt_cdrom_SOURCES)
apt_cdrom_static_LDFLAGS = -all-static

View File

@ -37,6 +37,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
host_triplet = @host@
@COMPILE_APTSHELL_TRUE@am__append_1 = apt-shell
@COMPILE_STATIC_TRUE@am__append_2 = apt-get-static apt-cache-static apt-cdrom-static
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
@ -55,6 +56,8 @@ COMPILE_APTSHELL_FALSE = @COMPILE_APTSHELL_FALSE@
COMPILE_APTSHELL_TRUE = @COMPILE_APTSHELL_TRUE@
COMPILE_MANPAGES_FALSE = @COMPILE_MANPAGES_FALSE@
COMPILE_MANPAGES_TRUE = @COMPILE_MANPAGES_TRUE@
COMPILE_STATIC_FALSE = @COMPILE_STATIC_FALSE@
COMPILE_STATIC_TRUE = @COMPILE_STATIC_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
@ -172,29 +175,58 @@ sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
bin_PROGRAMS = apt-get apt-cache apt-cdrom apt-config $(am__append_1)
EXTRA_DIST = indexcopy.cc indexcopy.h
bin_PROGRAMS = apt-get apt-cache apt-cdrom apt-config $(am__append_1) $(am__append_2)
LDADD = ../apt-pkg/libapt-pkg.la $(RPMLIBS)
apt_cache_SOURCES = apt-cache.cc
apt_get_SOURCES = apt-get.cc acqprogress.cc acqprogress.h
apt_cache_SOURCES = apt-cache.cc
apt_shell_SOURCES = apt-shell.cc acqprogress.cc acqprogress.h
apt_shell_LDADD = $(LDADD) -lreadline -lncurses
apt_config_SOURCES = apt-config.cc
apt_cdrom_SOURCES = apt-cdrom.cc rpmindexcopy.cc rpmindexcopy.h
apt_get_static_SOURCES = $(apt_get_SOURCES)
apt_get_static_LDFLAGS = -all-static
apt_cache_static_SOURCES = $(apt_cache_SOURCES)
apt_cache_static_LDFLAGS = -all-static
apt_cdrom_static_SOURCES = $(apt_cdrom_SOURCES)
apt_cdrom_static_LDFLAGS = -all-static
subdir = cmdline
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/buildlib/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
@COMPILE_APTSHELL_TRUE@bin_PROGRAMS = apt-get$(EXEEXT) \
@COMPILE_APTSHELL_TRUE@ apt-cache$(EXEEXT) apt-cdrom$(EXEEXT) \
@COMPILE_APTSHELL_TRUE@ apt-config$(EXEEXT) apt-shell$(EXEEXT)
@COMPILE_APTSHELL_FALSE@bin_PROGRAMS = apt-get$(EXEEXT) \
@COMPILE_APTSHELL_FALSE@ apt-cache$(EXEEXT) apt-cdrom$(EXEEXT) \
@COMPILE_APTSHELL_FALSE@ apt-config$(EXEEXT)
@COMPILE_APTSHELL_FALSE@@COMPILE_STATIC_TRUE@bin_PROGRAMS = \
@COMPILE_APTSHELL_FALSE@@COMPILE_STATIC_TRUE@ apt-get$(EXEEXT) \
@COMPILE_APTSHELL_FALSE@@COMPILE_STATIC_TRUE@ apt-cache$(EXEEXT) \
@COMPILE_APTSHELL_FALSE@@COMPILE_STATIC_TRUE@ apt-cdrom$(EXEEXT) \
@COMPILE_APTSHELL_FALSE@@COMPILE_STATIC_TRUE@ apt-config$(EXEEXT) \
@COMPILE_APTSHELL_FALSE@@COMPILE_STATIC_TRUE@ apt-get-static$(EXEEXT) \
@COMPILE_APTSHELL_FALSE@@COMPILE_STATIC_TRUE@ apt-cache-static$(EXEEXT) \
@COMPILE_APTSHELL_FALSE@@COMPILE_STATIC_TRUE@ apt-cdrom-static$(EXEEXT)
@COMPILE_APTSHELL_FALSE@@COMPILE_STATIC_FALSE@bin_PROGRAMS = \
@COMPILE_APTSHELL_FALSE@@COMPILE_STATIC_FALSE@ apt-get$(EXEEXT) \
@COMPILE_APTSHELL_FALSE@@COMPILE_STATIC_FALSE@ apt-cache$(EXEEXT) \
@COMPILE_APTSHELL_FALSE@@COMPILE_STATIC_FALSE@ apt-cdrom$(EXEEXT) \
@COMPILE_APTSHELL_FALSE@@COMPILE_STATIC_FALSE@ apt-config$(EXEEXT)
@COMPILE_APTSHELL_TRUE@@COMPILE_STATIC_TRUE@bin_PROGRAMS = \
@COMPILE_APTSHELL_TRUE@@COMPILE_STATIC_TRUE@ apt-get$(EXEEXT) \
@COMPILE_APTSHELL_TRUE@@COMPILE_STATIC_TRUE@ apt-cache$(EXEEXT) \
@COMPILE_APTSHELL_TRUE@@COMPILE_STATIC_TRUE@ apt-cdrom$(EXEEXT) \
@COMPILE_APTSHELL_TRUE@@COMPILE_STATIC_TRUE@ apt-config$(EXEEXT) \
@COMPILE_APTSHELL_TRUE@@COMPILE_STATIC_TRUE@ apt-shell$(EXEEXT) \
@COMPILE_APTSHELL_TRUE@@COMPILE_STATIC_TRUE@ apt-get-static$(EXEEXT) \
@COMPILE_APTSHELL_TRUE@@COMPILE_STATIC_TRUE@ apt-cache-static$(EXEEXT) \
@COMPILE_APTSHELL_TRUE@@COMPILE_STATIC_TRUE@ apt-cdrom-static$(EXEEXT)
@COMPILE_APTSHELL_TRUE@@COMPILE_STATIC_FALSE@bin_PROGRAMS = \
@COMPILE_APTSHELL_TRUE@@COMPILE_STATIC_FALSE@ apt-get$(EXEEXT) \
@COMPILE_APTSHELL_TRUE@@COMPILE_STATIC_FALSE@ apt-cache$(EXEEXT) \
@COMPILE_APTSHELL_TRUE@@COMPILE_STATIC_FALSE@ apt-cdrom$(EXEEXT) \
@COMPILE_APTSHELL_TRUE@@COMPILE_STATIC_FALSE@ apt-config$(EXEEXT) \
@COMPILE_APTSHELL_TRUE@@COMPILE_STATIC_FALSE@ apt-shell$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
am_apt_cache_OBJECTS = apt-cache.$(OBJEXT)
@ -202,11 +234,21 @@ apt_cache_OBJECTS = $(am_apt_cache_OBJECTS)
apt_cache_LDADD = $(LDADD)
apt_cache_DEPENDENCIES = ../apt-pkg/libapt-pkg.la
apt_cache_LDFLAGS =
am__objects_1 = apt-cache.$(OBJEXT)
am_apt_cache_static_OBJECTS = $(am__objects_1)
apt_cache_static_OBJECTS = $(am_apt_cache_static_OBJECTS)
apt_cache_static_LDADD = $(LDADD)
apt_cache_static_DEPENDENCIES = ../apt-pkg/libapt-pkg.la
am_apt_cdrom_OBJECTS = apt-cdrom.$(OBJEXT) rpmindexcopy.$(OBJEXT)
apt_cdrom_OBJECTS = $(am_apt_cdrom_OBJECTS)
apt_cdrom_LDADD = $(LDADD)
apt_cdrom_DEPENDENCIES = ../apt-pkg/libapt-pkg.la
apt_cdrom_LDFLAGS =
am__objects_2 = apt-cdrom.$(OBJEXT) rpmindexcopy.$(OBJEXT)
am_apt_cdrom_static_OBJECTS = $(am__objects_2)
apt_cdrom_static_OBJECTS = $(am_apt_cdrom_static_OBJECTS)
apt_cdrom_static_LDADD = $(LDADD)
apt_cdrom_static_DEPENDENCIES = ../apt-pkg/libapt-pkg.la
am_apt_config_OBJECTS = apt-config.$(OBJEXT)
apt_config_OBJECTS = $(am_apt_config_OBJECTS)
apt_config_LDADD = $(LDADD)
@ -217,6 +259,11 @@ apt_get_OBJECTS = $(am_apt_get_OBJECTS)
apt_get_LDADD = $(LDADD)
apt_get_DEPENDENCIES = ../apt-pkg/libapt-pkg.la
apt_get_LDFLAGS =
am__objects_3 = apt-get.$(OBJEXT) acqprogress.$(OBJEXT)
am_apt_get_static_OBJECTS = $(am__objects_3)
apt_get_static_OBJECTS = $(am_apt_get_static_OBJECTS)
apt_get_static_LDADD = $(LDADD)
apt_get_static_DEPENDENCIES = ../apt-pkg/libapt-pkg.la
am_apt_shell_OBJECTS = apt-shell.$(OBJEXT) acqprogress.$(OBJEXT)
apt_shell_OBJECTS = $(am_apt_shell_OBJECTS)
apt_shell_DEPENDENCIES = ../apt-pkg/libapt-pkg.la
@ -245,10 +292,12 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(apt_cache_SOURCES) $(apt_cdrom_SOURCES) \
$(apt_config_SOURCES) $(apt_get_SOURCES) $(apt_shell_SOURCES)
DIST_SOURCES = $(apt_cache_SOURCES) $(apt_cache_static_SOURCES) \
$(apt_cdrom_SOURCES) $(apt_cdrom_static_SOURCES) \
$(apt_config_SOURCES) $(apt_get_SOURCES) \
$(apt_get_static_SOURCES) $(apt_shell_SOURCES)
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
SOURCES = $(apt_cache_SOURCES) $(apt_cdrom_SOURCES) $(apt_config_SOURCES) $(apt_get_SOURCES) $(apt_shell_SOURCES)
SOURCES = $(apt_cache_SOURCES) $(apt_cache_static_SOURCES) $(apt_cdrom_SOURCES) $(apt_cdrom_static_SOURCES) $(apt_config_SOURCES) $(apt_get_SOURCES) $(apt_get_static_SOURCES) $(apt_shell_SOURCES)
all: all-am
@ -291,15 +340,24 @@ clean-binPROGRAMS:
apt-cache$(EXEEXT): $(apt_cache_OBJECTS) $(apt_cache_DEPENDENCIES)
@rm -f apt-cache$(EXEEXT)
$(CXXLINK) $(apt_cache_LDFLAGS) $(apt_cache_OBJECTS) $(apt_cache_LDADD) $(LIBS)
apt-cache-static$(EXEEXT): $(apt_cache_static_OBJECTS) $(apt_cache_static_DEPENDENCIES)
@rm -f apt-cache-static$(EXEEXT)
$(CXXLINK) $(apt_cache_static_LDFLAGS) $(apt_cache_static_OBJECTS) $(apt_cache_static_LDADD) $(LIBS)
apt-cdrom$(EXEEXT): $(apt_cdrom_OBJECTS) $(apt_cdrom_DEPENDENCIES)
@rm -f apt-cdrom$(EXEEXT)
$(CXXLINK) $(apt_cdrom_LDFLAGS) $(apt_cdrom_OBJECTS) $(apt_cdrom_LDADD) $(LIBS)
apt-cdrom-static$(EXEEXT): $(apt_cdrom_static_OBJECTS) $(apt_cdrom_static_DEPENDENCIES)
@rm -f apt-cdrom-static$(EXEEXT)
$(CXXLINK) $(apt_cdrom_static_LDFLAGS) $(apt_cdrom_static_OBJECTS) $(apt_cdrom_static_LDADD) $(LIBS)
apt-config$(EXEEXT): $(apt_config_OBJECTS) $(apt_config_DEPENDENCIES)
@rm -f apt-config$(EXEEXT)
$(CXXLINK) $(apt_config_LDFLAGS) $(apt_config_OBJECTS) $(apt_config_LDADD) $(LIBS)
apt-get$(EXEEXT): $(apt_get_OBJECTS) $(apt_get_DEPENDENCIES)
@rm -f apt-get$(EXEEXT)
$(CXXLINK) $(apt_get_LDFLAGS) $(apt_get_OBJECTS) $(apt_get_LDADD) $(LIBS)
apt-get-static$(EXEEXT): $(apt_get_static_OBJECTS) $(apt_get_static_DEPENDENCIES)
@rm -f apt-get-static$(EXEEXT)
$(CXXLINK) $(apt_get_static_LDFLAGS) $(apt_get_static_OBJECTS) $(apt_get_static_LDADD) $(LIBS)
apt-shell$(EXEEXT): $(apt_shell_OBJECTS) $(apt_shell_DEPENDENCIES)
@rm -f apt-shell$(EXEEXT)
$(CXXLINK) $(apt_shell_LDFLAGS) $(apt_shell_OBJECTS) $(apt_shell_LDADD) $(LIBS)

View File

@ -87,7 +87,7 @@ bool Script(CommandLine &CmdL)
_config->Set("Scripts::AptCache::Script::", *I);
_lua->SetCache(GCache);
_lua->RunScripts("Scripts::AptCache::Script", false);
_lua->RunScripts("Scripts::AptCache::Script");
_lua->ResetGlobals();
return true;
@ -1877,6 +1877,12 @@ bool ShowHelp(CommandLine &Cmd)
" dotty - Generate package graphs for GraphVis\n"
" xvcg - Generate package graphs for xvcg\n"
" policy - Show policy settings\n"
// CNC:2003-03-16
);
#ifdef WITH_LUA
_lua->RunScripts("Scripts::AptCache::Help::Command");
#endif
cout << _(
"\n"
"Options:\n"
" -h This help text.\n"
@ -1972,6 +1978,14 @@ int main(int argc,const char *argv[])
if (ttyname(STDOUT_FILENO) == 0 && _config->FindI("quiet",0) < 1)
_config->Set("quiet","1");
// CNC:2004-02-18
if (_system->LockRead() == false)
{
bool Errors = _error->PendingError();
_error->DumpErrors();
return Errors == true?100:0;
}
if (CmdL.DispatchArg(CmdsA,false) == false && _error->PendingError() == false)
{
MMap *Map = 0;
@ -2004,8 +2018,8 @@ int main(int argc,const char *argv[])
{
_lua->SetGlobal("command_args", CmdL.FileList);
_lua->SetGlobal("command_consume", 0.0);
_lua->RunScripts("Scripts::AptCache::Command", false);
Consume = _lua->GetGlobalI("command_consume");
_lua->RunScripts("Scripts::AptCache::Command");
Consume = _lua->GetGlobalNum("command_consume");
_lua->ResetGlobals();
_lua->ResetCaches();
}

View File

@ -105,7 +105,9 @@ class CacheFile : public pkgCacheFile
};
bool OpenForInstall()
{
if (_config->FindB("APT::Get::Print-URIs") == true)
// CNC:2004-03-07 - dont take lock if in download mode
if (_config->FindB("APT::Get::Print-URIs") == true ||
_config->FindB("APT::Get::Download-only") == true)
return Open(false);
else
return Open(true);
@ -462,7 +464,8 @@ void ShowDel(ostream &out,CacheFile &Cache)
List += string(I.Name()) + " ";
}
VersionsList += string(Cache[I].CandVersion)+ "\n";
// CNC:2004-03-09
VersionsList += string(I.CurrentVer().VerStr())+ "\n";
}
}
@ -1029,10 +1032,13 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
return true;
}
// CNC:2004-03-07 - lock not taken in download mode in the first place
#if 0
/* Unlock the dpkg lock if we are not going to be doing an install
after. */
if (_config->FindB("APT::Get::Download-Only",false) == true)
_system->UnLock();
#endif
// CNC:2003-02-24
bool Ret = true;
@ -1206,49 +1212,117 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
pkgProblemResolver &Fix,bool Remove,bool BrokenFix,
unsigned int &ExpectedInst,bool AllowFail = true)
{
/* This is a pure virtual package and there is a single available
provides */
if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0 &&
Pkg.ProvidesList()->NextProvides == 0)
// CNC:2004-03-03 - Improved virtual package handling.
if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0)
{
pkgCache::PkgIterator Tmp = Pkg.ProvidesList().OwnerPkg();
// CNC:2003-11-21 - Check if the current candidate is really
// providing that dependency
ioprintf(c1out,_("Selecting %s for '%s'\n"),
Tmp.Name(),Pkg.Name());
pkgCache::VerIterator Ver = Cache[Tmp].CandidateVerIter(Cache);
pkgCache::PrvIterator Prv = Ver.ProvidesList();
bool Found = false;
for (; Prv.end() == false; Prv++) {
if (strcmp(Prv.Name(), Pkg.Name()) == 0) {
Found = true;
break;
}
}
if (Found == false) {
// The current candidate doesn't provide the needed dependency.
// Look for one that does.
Ver = Tmp.VersionList();
for (; Ver.end() == false; Ver++) {
Prv = Ver.ProvidesList();
Found = false;
for (; Prv.end() == false; Prv++) {
if (strcmp(Prv.Name(), Pkg.Name()) == 0) {
Found = true;
break;
}
}
if (Found) {
Cache.SetCandidateVersion(Ver);
vector<pkgCache::Package *> GoodSolutions;
for (pkgCache::PrvIterator Prv = Pkg.ProvidesList();
Prv.end() == false; Prv++)
{
pkgCache::PkgIterator PrvPkg = Prv.OwnerPkg();
// Check if it's a different version of a package already
// considered as a good solution.
bool AlreadySeen = false;
for (int i = 0; i != GoodSolutions.size(); i++)
{
pkgCache::PkgIterator GoodPkg(Cache, GoodSolutions[i]);
if (PrvPkg == GoodPkg)
{
AlreadySeen = true;
break;
}
}
if (Found == false) {
ioprintf(c1out,_("Internal error. Package %s doesn't provide %s\n"),Tmp.Name(),Pkg.Name());
return false;
if (AlreadySeen)
continue;
// Is the current version the provides owner?
if (PrvPkg.CurrentVer() == Prv.OwnerVer())
{
// Already installed packages are good solutions, since
// the user might try to install something he already has
// without being aware.
GoodSolutions.push_back(PrvPkg);
continue;
}
pkgCache::VerIterator PrvPkgCandVer =
Cache[PrvPkg].CandidateVerIter(Cache);
if (PrvPkgCandVer.end() == true)
{
// Packages without a candidate version are not good solutions.
continue;
}
// Is the provides pointing to the candidate version?
if (PrvPkgCandVer == Prv.OwnerVer())
{
// Yes, it is. This is a good solution.
GoodSolutions.push_back(PrvPkg);
continue;
}
}
Pkg = Tmp;
vector<string> GoodSolutionNames;
for (int i = 0; i != GoodSolutions.size(); i++)
{
pkgCache::PkgIterator GoodPkg(Cache, GoodSolutions[i]);
GoodSolutionNames.push_back(GoodPkg.Name());
}
#ifdef WITH_LUA
if (GoodSolutions.size() > 1)
{
vector<string> VS;
_lua->SetDepCache(&Cache);
_lua->SetDontFix();
_lua->SetGlobal("virtualname", Pkg.Name());
_lua->SetGlobal("packages", GoodSolutions);
_lua->SetGlobal("packagenames", GoodSolutionNames);
_lua->SetGlobal("selected");
_lua->RunScripts("Scripts::AptGet::Install::SelectPackage");
pkgCache::Package *selected = _lua->GetGlobalPkg("selected");
if (selected) {
GoodSolutions.clear();
GoodSolutions.push_back(selected);
}
else
{
vector<string> Tmp = _lua->GetGlobalStrList("packagenames");
if (Tmp.size() == GoodSolutions.size())
GoodSolutionNames = Tmp;
}
_lua->ResetGlobals();
_lua->ResetCaches();
}
#endif
if (GoodSolutions.size() == 1)
{
pkgCache::PkgIterator GoodPkg(Cache, GoodSolutions[0]);
ioprintf(c1out,_("Selecting %s for '%s'\n"),
GoodPkg.Name(), Pkg.Name());
Pkg = GoodPkg;
}
else if (GoodSolutions.size() == 0)
{
_error->Error(_("Package %s is a virtual package with no "
"good providers.\n"), Pkg.Name());
return false;
}
else
{
ioprintf(c1out,_("Package %s is a virtual package provided by:\n"),
Pkg.Name());
for (int i = 0; i != GoodSolutions.size(); i++)
{
pkgCache::PkgIterator GoodPkg(Cache, GoodSolutions[i]);
if (GoodPkg.CurrentVer().end() == false)
c1out << " " << GoodSolutionNames[i]
<< " " << Cache[GoodPkg].CandVersion
<< _(" [Installed]") << endl;
else
c1out << " " << GoodSolutionNames[i]
<< " " << Cache[GoodPkg].CandVersion << endl;
}
c1out << _("You should explicitly select one to install.") << endl;
_error->Error(_("Package %s is a virtual package with multiple "
"good providers.\n"), Pkg.Name());
return false;
}
}
// Handle the no-upgrade case
@ -1283,6 +1357,8 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
if (AllowFail == false)
return false;
// CNC:2004-03-03 - Improved virtual package handling.
#if 0
if (Pkg->ProvidesList != 0)
{
ioprintf(c1out,_("Package %s is a virtual package provided by:\n"),
@ -1305,6 +1381,7 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
c1out << _("You should explicitly select one to install.") << endl;
}
else
#endif
{
ioprintf(c1out,
_("Package %s has no available version, but exists in the database.\n"
@ -1578,7 +1655,7 @@ bool DoUpdate(CommandLine &CmdL)
// CNC:2003-03-19
#ifdef WITH_LUA
if (_lua->HasScripts("Scripts::AptGet::Update::Pre")) {
_lua->RunScripts("Scripts::AptGet::Update::Pre", false);
_lua->RunScripts("Scripts::AptGet::Update::Pre");
LuaCacheControl *LuaCache = _lua->GetCacheControl();
LuaCache->Close();
}
@ -1658,7 +1735,7 @@ bool DoUpdate(CommandLine &CmdL)
return false;
#ifdef WITH_LUA
_lua->RunScripts("Scripts::AptGet::Update::Post", false);
_lua->RunScripts("Scripts::AptGet::Update::Post");
#endif
#endif
@ -1688,7 +1765,7 @@ bool DoUpgrade(CommandLine &CmdL)
// CNC:2003-03-19
#ifdef WITH_LUA
_lua->SetDepCache(Cache);
_lua->RunScripts("Scripts::AptGet::Upgrade", false);
_lua->RunScripts("Scripts::AptGet::Upgrade");
_lua->ResetCaches();
#endif
@ -1721,6 +1798,9 @@ bool DoInstall(CommandLine &CmdL)
bool DefRemove = false;
if (strcasecmp(CmdL.FileList[0],"remove") == 0)
DefRemove = true;
// CNC:2004-03-22
else if (strcasecmp(CmdL.FileList[0],"reinstall") == 0)
_config->Set("APT::Get::ReInstall", true);
for (const char **I = CmdL.FileList + 1; *I != 0; I++)
{
@ -1856,12 +1936,12 @@ bool DoInstall(CommandLine &CmdL)
_lua->SetDontFix();
_lua->SetGlobal("argument", OrigS);
_lua->SetGlobal("translated", VS);
_lua->RunScripts("Scripts::AptGet::Install::TranslateArg", false);
const char *name = _lua->GetGlobal("translated");
_lua->RunScripts("Scripts::AptGet::Install::TranslateArg");
const char *name = _lua->GetGlobalStr("translated");
if (name != NULL) {
VS.push_back(name);
} else {
_lua->GetGlobalVS("translated", VS);
VS = _lua->GetGlobalStrList("translated");
}
_lua->ResetGlobals();
_lua->ResetCaches();
@ -1944,7 +2024,7 @@ bool DoInstall(CommandLine &CmdL)
#ifdef WITH_LUA
_lua->SetDepCache(Cache);
_lua->SetDontFix();
_lua->RunScripts("Scripts::AptGet::Install::PreResolve", false);
_lua->RunScripts("Scripts::AptGet::Install::PreResolve");
_lua->ResetCaches();
#endif
@ -1973,7 +2053,7 @@ bool DoInstall(CommandLine &CmdL)
if (Cache->BrokenCount() == 0) {
_lua->SetDepCache(Cache);
_lua->SetProblemResolver(&Fix);
_lua->RunScripts("Scripts::AptGet::Install::PostResolve", false);
_lua->RunScripts("Scripts::AptGet::Install::PostResolve");
_lua->ResetCaches();
}
#endif
@ -2140,7 +2220,7 @@ bool DoDistUpgrade(CommandLine &CmdL)
// CNC:2003-03-19
#ifdef WITH_LUA
_lua->SetDepCache(Cache);
_lua->RunScripts("Scripts::AptGet::DistUpgrade", false);
_lua->RunScripts("Scripts::AptGet::DistUpgrade");
_lua->ResetCaches();
#endif
@ -2474,8 +2554,9 @@ bool DoSource(CommandLine &CmdL)
if (_config->FindB("APT::Get::Compile",false) == true)
{
char S[500];
snprintf(S,sizeof(S),"%s %s",
snprintf(S,sizeof(S),"%s %s %s",
_config->Find("RPM::Source::Build-Command","rpm --rebuild").c_str(),
_config->Find("RPM::Source::Build-Options","").c_str(),
Dsc[I].Dsc.c_str());
if (system(S) != 0)
{
@ -2855,8 +2936,8 @@ bool DoScript(CommandLine &CmdL)
_config->Set("Scripts::AptGet::Script::", *I);
_lua->SetGlobal("commit_ask", 1);
_lua->RunScripts("Scripts::AptGet::Script", false);
double Ask = _lua->GetGlobalI("commit_ask");
_lua->RunScripts("Scripts::AptGet::Script");
double Ask = _lua->GetGlobalNum("commit_ask");
_lua->ResetGlobals();
AptGetLuaCache *LuaCache = (AptGetLuaCache*) _lua->GetCacheControl();
@ -2946,6 +3027,12 @@ bool ShowHelp(CommandLine &CmdL)
" clean - Erase downloaded archive files\n"
" autoclean - Erase old downloaded archive files\n"
" check - Verify that there are no broken dependencies\n"
// CNC:2003-03-16
);
#ifdef WITH_LUA
_lua->RunScripts("Scripts::AptGet::Help::Command");
#endif
cout << _(
"\n"
"Options:\n"
" -h This help text.\n"
@ -3045,6 +3132,8 @@ int main(int argc,const char *argv[])
CommandLine::Dispatch Cmds[] = {{"update",&DoUpdate},
{"upgrade",&DoUpgrade},
{"install",&DoInstall},
// CNC:2004-03-22
{"reinstall",&DoInstall},
{"remove",&DoInstall},
{"dist-upgrade",&DoDistUpgrade},
{"dselect-upgrade",&DoDSelectUpgrade},
@ -3078,8 +3167,17 @@ int main(int argc,const char *argv[])
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;
}
// CNC:2003-11-21
if (CmdL.FileSize() != 1)
if (CmdL.FileSize() > 1)
{
// CNC:2003-11-23
vector<string> URLLst;
@ -3102,15 +3200,6 @@ int main(int argc,const char *argv[])
_config->Set("APT::Arguments::", *I);
}
// See if the help should be shown
if (_config->FindB("help") == true ||
_config->FindB("version") == true ||
CmdL.FileSize() == 0)
{
ShowHelp(CmdL);
return 0;
}
// Deal with stdout not being a tty
if (ttyname(STDOUT_FILENO) == 0 && _config->FindI("quiet",0) < 1)
_config->Set("quiet","1");
@ -3140,9 +3229,9 @@ int main(int argc,const char *argv[])
_lua->SetGlobal("commit_ask", 1);
_lua->SetGlobal("command_args", CmdL.FileList);
_lua->SetGlobal("command_consume", 0.0);
_lua->RunScripts("Scripts::AptGet::Command", false);
Consume = _lua->GetGlobalI("command_consume");
double Ask = _lua->GetGlobalI("commit_ask");
_lua->RunScripts("Scripts::AptGet::Command");
Consume = _lua->GetGlobalNum("command_consume");
double Ask = _lua->GetGlobalNum("commit_ask");
_lua->ResetGlobals();
_lua->ResetCaches();

View File

@ -488,7 +488,8 @@ void ShowDel(ostream &out,CacheFile &Cache,pkgDepCache::State *State=NULL)
List += string(I.Name()) + " ";
}
VersionsList += string(Cache[I].CandVersion)+ "\n";
// CNC:2004-03-09
VersionsList += string(I.CurrentVer().VerStr())+ "\n";
}
}
@ -1280,49 +1281,117 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
pkgProblemResolver &Fix,int Mode,bool BrokenFix,
unsigned int &ExpectedInst,bool AllowFail = true)
{
/* This is a pure virtual package and there is a single available
provides */
if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0 &&
Pkg.ProvidesList()->NextProvides == 0)
// CNC:2004-03-03 - Improved virtual package handling.
if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0)
{
pkgCache::PkgIterator Tmp = Pkg.ProvidesList().OwnerPkg();
// CNC:2003-11-21 - Check if the current candidate is really
// providing that dependency
ioprintf(c1out,_("Selecting %s for '%s'\n"),
Tmp.Name(),Pkg.Name());
pkgCache::VerIterator Ver = Cache[Tmp].CandidateVerIter(Cache);
pkgCache::PrvIterator Prv = Ver.ProvidesList();
bool Found = false;
for (; Prv.end() == false; Prv++) {
if (strcmp(Prv.Name(), Pkg.Name()) == 0) {
Found = true;
break;
}
}
if (Found == false) {
// The current candidate doesn't provide the needed dependency.
// Look for one that does.
Ver = Tmp.VersionList();
for (; Ver.end() == false; Ver++) {
Prv = Ver.ProvidesList();
Found = false;
for (; Prv.end() == false; Prv++) {
if (strcmp(Prv.Name(), Pkg.Name()) == 0) {
Found = true;
break;
}
}
if (Found) {
Cache.SetCandidateVersion(Ver);
vector<pkgCache::Package *> GoodSolutions;
for (pkgCache::PrvIterator Prv = Pkg.ProvidesList();
Prv.end() == false; Prv++)
{
pkgCache::PkgIterator PrvPkg = Prv.OwnerPkg();
// Check if it's a different version of a package already
// considered as a good solution.
bool AlreadySeen = false;
for (int i = 0; i != GoodSolutions.size(); i++)
{
pkgCache::PkgIterator GoodPkg(Cache, GoodSolutions[i]);
if (PrvPkg == GoodPkg)
{
AlreadySeen = true;
break;
}
}
if (Found == false) {
ioprintf(c1out,_("Internal error. Package %s doesn't provide %s\n"),Tmp.Name(),Pkg.Name());
return false;
if (AlreadySeen)
continue;
// Is the current version the provides owner?
if (PrvPkg.CurrentVer() == Prv.OwnerVer())
{
// Already installed packages are good solutions, since
// the user might try to install something he already has
// without being aware.
GoodSolutions.push_back(PrvPkg);
continue;
}
pkgCache::VerIterator PrvPkgCandVer =
Cache[PrvPkg].CandidateVerIter(Cache);
if (PrvPkgCandVer.end() == true)
{
// Packages without a candidate version are not good solutions.
continue;
}
// Is the provides pointing to the candidate version?
if (PrvPkgCandVer == Prv.OwnerVer())
{
// Yes, it is. This is a good solution.
GoodSolutions.push_back(PrvPkg);
continue;
}
}
Pkg = Tmp;
vector<string> GoodSolutionNames;
for (int i = 0; i != GoodSolutionNames.size(); i++)
{
pkgCache::PkgIterator GoodPkg(Cache, GoodSolutions[0]);
GoodSolutionNames.push_back(GoodPkg.Name());
}
#ifdef WITH_LUA
if (GoodSolutions.size() > 1)
{
vector<string> VS;
_lua->SetDepCache(&Cache);
_lua->SetDontFix();
_lua->SetGlobal("packages", GoodSolutions);
_lua->SetGlobal("packagenames", GoodSolutionNames);
_lua->SetGlobal("selected");
_lua->RunScripts("Scripts::AptGet::Install::SelectPackage");
pkgCache::Package *selected = _lua->GetGlobalPkg("selected");
if (selected)
{
GoodSolutions.clear();
GoodSolutions.push_back(selected);
}
else
{
vector<string> Tmp = _lua->GetGlobalStrList("packagenames");
if (Tmp.size() == GoodSolutions.size())
GoodSolutionNames = Tmp;
}
_lua->ResetGlobals();
_lua->ResetCaches();
}
#endif
if (GoodSolutions.size() == 1)
{
pkgCache::PkgIterator GoodPkg(Cache, GoodSolutions[0]);
ioprintf(c1out,_("Selecting %s for '%s'\n"),
GoodPkg.Name(), Pkg.Name());
Pkg = GoodPkg;
}
else if (GoodSolutions.size() == 0)
{
_error->Error(_("Package %s is a virtual package with no "
"good providers.\n"), Pkg.Name());
return false;
}
else
{
ioprintf(c1out,_("Package %s is a virtual package provided by:\n"),
Pkg.Name());
for (int i = 0; i != GoodSolutions.size(); i++)
{
pkgCache::PkgIterator GoodPkg(Cache, GoodSolutions[i]);
if (GoodPkg.CurrentVer().end() == false)
c1out << " " << GoodSolutionNames[i]
<< " " << Cache[GoodPkg].CandVersion
<< _(" [Installed]") << endl;
else
c1out << " " << GoodSolutionNames[i]
<< " " << Cache[GoodPkg].CandVersion << endl;
}
c1out << _("You should explicitly select one to install.") << endl;
_error->Error(_("Package %s is a virtual package with multiple "
"good providers.\n"), Pkg.Name());
return false;
}
}
// Handle the no-upgrade case
@ -1357,6 +1426,8 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
if (AllowFail == false)
return false;
// CNC:2004-03-03 - Improved virtual package handling.
#if 0
if (Pkg->ProvidesList != 0)
{
ioprintf(c1out,_("Package %s is a virtual package provided by:\n"),
@ -1379,6 +1450,7 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
c1out << _("You should explicitly select one to install.") << endl;
}
else
#endif
{
ioprintf(c1out,
_("Package %s has no available version, but exists in the database.\n"
@ -1650,7 +1722,7 @@ bool DoUpdate(CommandLine &CmdL)
// CNC:2003-03-19
#ifdef WITH_LUA
_lua->SetDepCache(*GCache);
_lua->RunScripts("Scripts::AptGet::Update::Pre", false);
_lua->RunScripts("Scripts::AptGet::Update::Pre");
_lua->ResetCaches();
#endif
@ -1722,7 +1794,7 @@ bool DoUpdate(CommandLine &CmdL)
// CNC:2003-03-19
#ifdef WITH_LUA
_lua->SetDepCache(*GCache);
_lua->RunScripts("Scripts::AptGet::Update::Post", false);
_lua->RunScripts("Scripts::AptGet::Update::Post");
_lua->ResetCaches();
#endif
@ -1762,7 +1834,7 @@ bool DoUpgrade(CommandLine &CmdL)
// CNC:2003-03-19
#ifdef WITH_LUA
_lua->SetDepCache(Cache);
_lua->RunScripts("Scripts::AptGet::Upgrade", false);
_lua->RunScripts("Scripts::AptGet::Upgrade");
_lua->ResetCaches();
#endif
@ -1936,12 +2008,12 @@ bool DoInstall(CommandLine &CmdL)
_lua->SetDontFix();
_lua->SetGlobal("argument", OrigS);
_lua->SetGlobal("translated", VS);
_lua->RunScripts("Scripts::AptGet::Install::TranslateArg", false);
const char *name = _lua->GetGlobal("translated");
_lua->RunScripts("Scripts::AptGet::Install::TranslateArg");
const char *name = _lua->GetGlobalStr("translated");
if (name != NULL) {
VS.push_back(name);
} else {
_lua->GetGlobalVS("translated", VS);
VS = _lua->GetGlobalStrList("translated");
}
_lua->ResetGlobals();
_lua->ResetCaches();
@ -2026,7 +2098,7 @@ bool DoInstall(CommandLine &CmdL)
#ifdef WITH_LUA
_lua->SetDepCache(Cache);
_lua->SetDontFix();
_lua->RunScripts("Scripts::AptGet::Install::PreResolve", false);
_lua->RunScripts("Scripts::AptGet::Install::PreResolve");
_lua->ResetCaches();
#endif
@ -2061,7 +2133,7 @@ bool DoInstall(CommandLine &CmdL)
if (Cache->BrokenCount() == 0) {
_lua->SetDepCache(Cache);
_lua->SetProblemResolver(&Fix);
_lua->RunScripts("Scripts::AptGet::Install::PostResolve", false);
_lua->RunScripts("Scripts::AptGet::Install::PostResolve");
_lua->ResetCaches();
}
#endif
@ -2126,7 +2198,7 @@ bool DoDistUpgrade(CommandLine &CmdL)
// CNC:2003-03-19
#ifdef WITH_LUA
_lua->SetDepCache(Cache);
_lua->RunScripts("Scripts::AptGet::DistUpgrade", false);
_lua->RunScripts("Scripts::AptGet::DistUpgrade");
_lua->ResetCaches();
#endif
@ -2604,9 +2676,9 @@ bool DoScript(CommandLine &CmdL)
// CNC:2003-03-19
#ifdef WITH_LUA
_lua->SetDepCache(Cache);
_lua->RunScripts("Scripts::AptShell::Script", false);
_lua->RunScripts("Scripts::AptGet::Script", true);
_lua->RunScripts("Scripts::AptCache::Script", true);
_lua->RunScripts("Scripts::AptShell::Script");
_lua->RunScripts("Scripts::AptGet::Script");
_lua->RunScripts("Scripts::AptCache::Script");
_lua->ResetCaches();
#endif
@ -4336,6 +4408,15 @@ int main(int argc,const char *argv[])
// Prepare the cache
GCache = new CacheFile();
GCache->Open();
// CNC:2004-02-18
if (_error->empty() == false)
{
bool Errors = _error->PendingError();
_error->DumpErrors();
return Errors == true?100:0;
}
if (GCache->CheckDeps(true) == false) {
c1out << _("There are broken packages. ")
<< _("Run `check' to see them.") << endl;
@ -4352,7 +4433,7 @@ int main(int argc,const char *argv[])
// CNC:2003-03-19
#ifdef WITH_LUA
_lua->SetDepCache(*GCache);
_lua->RunScripts("Scripts::AptShell::Init", false);
_lua->RunScripts("Scripts::AptShell::Init");
_lua->ResetCaches();
bool HasCmdScripts = (_lua->HasScripts("Scripts::AptGet::Command") ||
_lua->HasScripts("Scripts::AptCache::Command"));
@ -4371,8 +4452,10 @@ int main(int argc,const char *argv[])
}
line = readline(_config->Find("APT::Shell::Prompt", "apt> ").c_str());
if (!line || !*line)
if (!line || !*line) {
free(line);
continue;
}
add_history(line);
largc = 1; // CommandLine.Parse() ignores the first option.
@ -4443,7 +4526,7 @@ int main(int argc,const char *argv[])
_lua->SetGlobal("command_consume", 0.0);
_lua->RunScripts("Scripts::AptGet::Command", true);
_lua->RunScripts("Scripts::AptCache::Command", true);
double Consume = _lua->GetGlobalI("command_consume");
double Consume = _lua->GetGlobalNum("command_consume");
_lua->ResetGlobals();
_lua->ResetCaches();
if (Consume == 1) {

67
apt/configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.58 for apt 0.5.15cnc5.
# Generated by GNU Autoconf 2.58 for apt 0.5.15cnc6.
#
# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
@ -426,8 +426,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='apt'
PACKAGE_TARNAME='apt'
PACKAGE_VERSION='0.5.15cnc5'
PACKAGE_STRING='apt 0.5.15cnc5'
PACKAGE_VERSION='0.5.15cnc6'
PACKAGE_STRING='apt 0.5.15cnc6'
PACKAGE_BUGREPORT=''
ac_unique_file="configure.in"
@ -468,7 +468,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LN_S ECHO RANLIB ac_ct_RANLIB CPP EGREP LIBTOOL CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE SOCKETLIBS PTHREADLIB RPM_PATH RPMLIBS WITH_LUA_TRUE WITH_LUA_FALSE COMPILE_APTSHELL_TRUE COMPILE_APTSHELL_FALSE NEED_INTTYPES_H_TRUE NEED_INTTYPES_H_FALSE NEED_STATVFS_H_TRUE NEED_STATVFS_H_FALSE HAVE_TIMEGM NEED_SOCKLEN_T_DEFINE NEED_NETDB_H_TRUE NEED_NETDB_H_FALSE DOCBOOK2MAN COMPILE_MANPAGES_TRUE COMPILE_MANPAGES_FALSE MKINSTALLDIRS MSGFMT GMSGFMT XGETTEXT MSGMERGE ALLOCA GLIBC21 LIBICONV LTLIBICONV INTLBISON USE_NLS BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT INTLOBJS DATADIRNAME INSTOBJEXT GENCAT INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB GLIBC_VER LIBSTDCPP_VER LIBOBJS LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LN_S ECHO RANLIB ac_ct_RANLIB CPP EGREP LIBTOOL CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE SOCKETLIBS PTHREADLIB RPM_PATH RPMLIBS WITH_LUA_TRUE WITH_LUA_FALSE COMPILE_STATIC_TRUE COMPILE_STATIC_FALSE COMPILE_APTSHELL_TRUE COMPILE_APTSHELL_FALSE NEED_INTTYPES_H_TRUE NEED_INTTYPES_H_FALSE NEED_STATVFS_H_TRUE NEED_STATVFS_H_FALSE HAVE_TIMEGM NEED_SOCKLEN_T_DEFINE NEED_NETDB_H_TRUE NEED_NETDB_H_FALSE DOCBOOK2MAN COMPILE_MANPAGES_TRUE COMPILE_MANPAGES_FALSE MKINSTALLDIRS MSGFMT GMSGFMT XGETTEXT MSGMERGE ALLOCA GLIBC21 LIBICONV LTLIBICONV INTLBISON USE_NLS BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT INTLOBJS DATADIRNAME INSTOBJEXT GENCAT INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB GLIBC_VER LIBSTDCPP_VER LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@ -945,7 +945,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures apt 0.5.15cnc5 to adapt to many kinds of systems.
\`configure' configures apt 0.5.15cnc6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1011,7 +1011,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of apt 0.5.15cnc5:";;
short | recursive ) echo "Configuration of apt 0.5.15cnc6:";;
esac
cat <<\_ACEOF
@ -1027,6 +1027,7 @@ Optional Features:
--enable-dependency-tracking Do not reject slow dependency extractors
--disable-libtool-lock avoid locking (might break parallel builds)
--disable-scripts disable the extension system
--enable-static-progs Build completely static (standalone) binaries.
--disable-docs do not compile documentation
--disable-rpath do not hardcode runtime library paths
--disable-nls do not use Native Language Support
@ -1148,7 +1149,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
apt configure 0.5.15cnc5
apt configure 0.5.15cnc6
generated by GNU Autoconf 2.58
Copyright (C) 2003 Free Software Foundation, Inc.
@ -1162,7 +1163,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by apt $as_me 0.5.15cnc5, which was
It was created by apt $as_me 0.5.15cnc6, which was
generated by GNU Autoconf 2.58. Invocation command line was
$ $0 $@
@ -1828,7 +1829,7 @@ fi
# Define the identity of the package.
PACKAGE='apt'
VERSION='0.5.15cnc5'
VERSION='0.5.15cnc6'
cat >>confdefs.h <<_ACEOF
@ -4752,7 +4753,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
case $host in
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 4755 "configure"' > conftest.$ac_ext
echo '#line 4756 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -5310,7 +5311,7 @@ chmod -w .
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
compiler_c_o=no
if { (eval echo configure:5313: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
if { (eval echo configure:5314: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s out/conftest.err; then
@ -7236,7 +7237,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 7239 "configure"
#line 7240 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -7334,7 +7335,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 7337 "configure"
#line 7338 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -10757,6 +10758,33 @@ else
fi
echo "$as_me:$LINENO: checking for --enable-static-progs" >&5
echo $ECHO_N "checking for --enable-static-progs... $ECHO_C" >&6
# Check whether --enable-static-progs or --disable-static-progs was given.
if test "${enable_static_progs+set}" = set; then
enableval="$enable_static_progs"
enable_static_progs="$enableval"
else
enable_static_progs="no"
fi;
if test "$enable_static_progs" = "yes"; then
COMPILE_STATIC_TRUE=
COMPILE_STATIC_FALSE='#'
else
COMPILE_STATIC_TRUE='#'
COMPILE_STATIC_FALSE=
fi
if test "$enable_static_progs" = "yes" ; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
echo "$as_me:$LINENO: checking for tputs in -lncurses" >&5
echo $ECHO_N "checking for tputs in -lncurses... $ECHO_C" >&6
if test "${ac_cv_lib_ncurses_tputs+set}" = set; then
@ -17469,6 +17497,13 @@ echo "$as_me: error: conditional \"WITH_LUA\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
if test -z "${COMPILE_STATIC_TRUE}" && test -z "${COMPILE_STATIC_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"COMPILE_STATIC\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
echo "$as_me: error: conditional \"COMPILE_STATIC\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
if test -z "${COMPILE_APTSHELL_TRUE}" && test -z "${COMPILE_APTSHELL_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"COMPILE_APTSHELL\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@ -17775,7 +17810,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
This file was extended by apt $as_me 0.5.15cnc5, which was
This file was extended by apt $as_me 0.5.15cnc6, which was
generated by GNU Autoconf 2.58. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -17838,7 +17873,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
apt config.status 0.5.15cnc5
apt config.status 0.5.15cnc6
configured by $0, generated by GNU Autoconf 2.58,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
@ -18120,6 +18155,8 @@ s,@RPM_PATH@,$RPM_PATH,;t t
s,@RPMLIBS@,$RPMLIBS,;t t
s,@WITH_LUA_TRUE@,$WITH_LUA_TRUE,;t t
s,@WITH_LUA_FALSE@,$WITH_LUA_FALSE,;t t
s,@COMPILE_STATIC_TRUE@,$COMPILE_STATIC_TRUE,;t t
s,@COMPILE_STATIC_FALSE@,$COMPILE_STATIC_FALSE,;t t
s,@COMPILE_APTSHELL_TRUE@,$COMPILE_APTSHELL_TRUE,;t t
s,@COMPILE_APTSHELL_FALSE@,$COMPILE_APTSHELL_FALSE,;t t
s,@NEED_INTTYPES_H_TRUE@,$NEED_INTTYPES_H_TRUE,;t t

View File

@ -1,7 +1,7 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.54)
AC_INIT([apt],[0.5.15cnc5])
AC_INIT([apt],[0.5.15cnc6])
dnl Check the archs, we want the target type.
AC_CONFIG_AUX_DIR([buildlib])
AC_CANONICAL_HOST
@ -120,6 +120,19 @@ else
fi
AM_CONDITIONAL(WITH_LUA, test "$enable_scripts" != "no")
dnl Before configuring libtool check for --enable-static-progs option
AC_MSG_CHECKING(for --enable-static-progs)
AC_ARG_ENABLE(static-progs,
AC_HELP_STRING([--enable-static-progs],
[Build completely static (standalone) binaries.]),
[enable_static_progs="$enableval"],[enable_static_progs="no"])
AM_CONDITIONAL(COMPILE_STATIC, test "$enable_static_progs" = "yes")
if test "$enable_static_progs" = "yes" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl Check for apt-shell dependencies
AC_CHECK_LIB(ncurses,tputs,
[AC_CHECK_HEADER(readline/readline.h,

View File

@ -0,0 +1,28 @@
This script will handle Allow-Duplicated packages when more
than one is available during an install operation, and will
also upgrade these packages in a dist-upgrade operation.
For the dist-upgrade operation, only those packages matching
a regular expression in the RPM::Allow-Duplicated-Upgrade
option will be affected.
For example, suppose that the following packages are
available:
kernel26#2.6.2-48393cl 2.6.2-48393cl [Installed]
kernel26#2.6.0-41929cl 2.6.0-41929cl [Installed]
kernel26#2.6.1-44677cl 2.6.1-44677cl [Installed]
kernel26#2.6.3-50659cl 2.6.3-50659cl
If you try to install the package "kernel26", you'll usually
get a message that these packages are available, and you must
select one of them.
With this script plugged into the necessary slots, the 2.6.3
version will be correctly selected for installation in
the "install kernel26" operation is performed. It will also
be selected for installation if you perform a dist-upgrade
operation with something like this in your configuration:
RPM::Allow-Duplicated-Upgrade:: "kernel.*";

View File

@ -0,0 +1,3 @@
Scripts::AptGet::Install::SelectPackage:: "allow-duplicated.lua";
Scripts::AptGet::DistUpgrade:: "allow-duplicated.lua";
Scripts::Synaptic::DistUpgrade:: "allow-duplicated.lua";

View File

@ -0,0 +1,153 @@
-- This script will handle Allow-Duplicated packages when more
-- than one is available during an install operation, and will
-- also upgrade these packages in a dist-upgrade operation (if
-- they match a regex in RPM::Allow-Duplicated-Upgrade).
--
-- This script must be plugged in the following slots:
--
-- Scripts::AptGet::Install::SelectPackage
-- Scripts::AptGet::DistUpgrade
-- Scripts::Synaptic::DistUpgrade
--
-- Author: Gustavo Niemeyer <niemeyer@conectiva.com>
function realname(name)
local s, e, name = string.find(name, "(.+)#")
return name
end
if script_slot == "Scripts::AptGet::Install::SelectPackage" then
-- Automatically select the newest package if multiple
-- Allow-Duplicated packages are available.
local goodpkg = packages[1]
local goodpkgname = realname(pkgname(goodpkg))
if goodpkgname then
-- Check if every package has the same real name, and
-- leave only the one with the greatest version, if
-- that's the case.
for i = 2, table.getn(packages) do
local nextpkg = packages[i]
local nextpkgname = realname(pkgname(nextpkg))
if nextpkgname ~= goodpkgname then
goodpkg = nil
break
end
if not pkgvercand(goodpkg)
or pkgvercand(nextpkg) and
verstrcmp(verstr(pkgvercand(goodpkg)),
verstr(pkgvercand(nextpkg))) == -1 then
goodpkg = nextpkg
end
end
if goodpkg and pkgvercand(goodpkg) then
selected = goodpkg
end
end
if not selected then
-- Strip #... from package names if we can't find a good solution.
for i, name in ipairs(packagenames) do
local name = realname(name)
if name and name ~= virtualname then
packagenames[i] = name
end
end
end
end
if script_slot == "Scripts::AptGet::DistUpgrade" or
script_slot == "Scripts::Synaptic::DistUpgrade" then
-- Automatically install newer versions of all packages which
-- are registered in the Allow-Duplicated scheme and are matched
-- by the regular expressions in RPM::Allow-Duplicated-Upgrade.
-- Compile expressions with package names which should
-- be considered for upgrade.
local updatelist = confgetlist("RPM::Allow-Duplicated-Upgrade")
for i, expr in ipairs(updatelist) do
updatelist[i] = rex.new(expr)
end
if table.getn(updatelist) ~= 0 then
-- Gather information about Allow-Duplicated packges.
local canddups = {}
local curdups = {}
for i, pkg in pairs(pkglist()) do
local name = realname(pkgname(pkg))
if name then
if pkgvercur(pkg) then
if not curdups[name] then
curdups[name] = {}
end
table.insert(curdups[name],
verstr(pkgvercur(pkg)))
elseif pkgvercand(pkg) then
if not canddups[name] then
canddups[name] = {}
end
table.insert(canddups[name],
verstr(pkgvercand(pkg)))
end
end
end
-- Compile expressions with package names which should be hold.
local holdlist = confgetlist("RPM::Hold")
for i, expr in ipairs(holdlist) do
holdlist[i] = rex.new(expr)
end
-- Remove packages without any matches in updatelist, or with
-- any matches in holdlist.
for name, _ in pairs(curdups) do
local found = false
for i, expr in ipairs(updatelist) do
if expr:match(name) then
found = true
break
end
end
if found then
for i, expr in ipairs(holdlist) do
if expr:match(name) then
found = false
break
end
end
end
if not found then
curdups[name] = nil
end
end
-- Mark the newest packages for installation.
for name, _ in pairs(curdups) do
if canddups[name] then
-- Check the best candidate version.
local bestver = nil
for i, ver in ipairs(canddups[name]) do
if not bestver or
verstrcmp(ver, bestver) == -1 then
bestver = ver
end
end
-- Now check if it's newer than all installed
-- versions.
for i, ver in ipairs(curdups[name]) do
if verstrcmp(ver, bestver) == 1 then
bestver = nil
break
end
end
-- Finally, mark it for installation.
if bestver then
markinstall(name.."#"..bestver)
end
end
end
end
end
-- vim:ts=4:sw=4:et

View File

@ -6,6 +6,11 @@ def main():
if len(sys.argv) == 1:
sys.exit("Usage: convert.py <hdlist file|rpms dir> ...")
if not hasattr(rpm, "headerFromPackage"):
ts = rpm.TransactionSet()
else:
ts = None
for entry in sys.argv[1:]:
if os.path.isfile(entry):
for header in rpm.readHeaderListFromFile(entry):
@ -17,7 +22,10 @@ def main():
if filename.endswith(".rpm"):
filepath = os.path.join(entry, filename)
file = open(filepath)
header = rpm.headerFromPackage(file.fileno())[0]
if ts:
header = ts.hdrFromFdno(file.fileno())
else:
header = rpm.headerFromPackage(file.fileno())[0]
name = header[rpm.RPMTAG_NAME]
for filename in header[rpm.RPMTAG_FILENAMES]:
print filename, name

View File

@ -5,6 +5,8 @@ This script must be plugged into the following APT script slots:
Scripts::AptGet::Command
Scripts::AptCache::Command
Scripts::AptGet::Help::Command
Scripts::AptCache::Help::Command
Usage:
apt-cache showgroups - show all known groups

View File

@ -1,2 +1,4 @@
Scripts::AptGet::Command:: "apt-groupinstall.lua";
Scripts::AptCache::Command:: "apt-groupinstall.lua";
Scripts::AptCache::Help::Command:: "apt-groupinstall.lua";
Scripts::AptGet::Help::Command:: "apt-groupinstall.lua";

View File

@ -6,7 +6,13 @@
helper = confget("Dir::Bin::scripts/f").."/apt-groupinstall.py"
if script_slot == "Scripts::AptCache::Command" then
if script_slot == "Scripts::AptCache::Help::Command" then
print(_(" showgroups - Show available groups"))
print(_(" showgroup <group> - Show group contents"))
elseif script_slot == "Scripts::AptGet::Help::Command" then
print(_(" groupinstall <group> - Install packages in <group>"))
print(_(" groupremove <group> - Remove packages in <group>"))
elseif script_slot == "Scripts::AptCache::Command" then
if command_args[1] == "showgroups" then
command_consume = 1
os.execute(helper.." showgroups")
@ -14,7 +20,7 @@ if script_slot == "Scripts::AptCache::Command" then
command_consume=1
group = command_args[2]
if not group then
apterror("No groupname given.")
apterror(_("No groupname given."))
return
end
os.execute(helper.." showgroup "..group)
@ -32,10 +38,10 @@ elseif script_slot == "Scripts::AptGet::Command" then
end
group = command_args[2]
if not group then
apterror("No groupname given.")
apterror(_("No groupname given."))
return
end
print("Finding packages belonging to group "..group.."...")
print(_("Finding packages belonging to group "..group.."..."))
pkgs = io.popen(helper.." grouppkgs "..group)
for name in pkgs:lines() do
pkg = pkgfind(name)

View File

@ -1,165 +0,0 @@
function usage
{
( echo "$SHORTHELP"
echo "See $PRGNAME --help for extended help."
) >&2
}
function help
{
cat << EOF >&1
Usage: $PRGNAME [options] [apt-get options]
Options:
--apt-help print apt help.
--apt-version print apt version.
-h print short help and exit.
--help print this help and exit.
--sourceslist
Select the sourceslist file to be used (default
is /etc/apt/sources.list)
Options handed over to rpm, see rpm manual for their functionality.
--test Rpm option --test.
--force-rpm Rpm option --force.
--force-rpm-install
Rpm option --force, this option will only be active
during rpm installation (rpm -U or rpm -i).
$PRGNAME is a wrapper around apt-get, extending the available arguments of
apt-get with some specific rpm arguments. $PRGNAME does nothing more than
passing the provided arguments to apt-get. The specific rpm arguments are
converted into the apt-get argument convention, before they are passed to
apt-get.
Report bugs to <apt4rpm-devel@lists.sourceforge.net>.
EOF
}
PRGNAME=$(basename $0)
readonly SHORTHELP="Usage: $PRGNAME [apt-options] [--apt-help]
[--test] [--force-rpm] [--force-rpm-install} [--sourceslist] [--verbose]"
# Command line argument parsing, the allowed arguments (for apt-get) are
# alphabetically listed, keep it this way please.
APTOPT="checksig,force,test,arch-only,assume-yes,build,compile,config-file:"
APTOPT="$APTOPT,default-release,diff-only,download-only,dry-run,fix-broken"
APTOPT="$APTOPT,fix-missing,force-yes,help,ignore-hold,ignore-missing"
APTOPT="$APTOPT,just-print,list-cleanup,no-act,no-download,no-list-cleanup"
APTOPT="$APTOPT,no-remove,no-upgrade,only-source,option:,print-uris,purge"
APTOPT="$APTOPT,quiet,recon,reinstall,remove,show-upgraded,simulate,tar-only"
APTOPT="$APTOPT,target-release,trivial-only,version,yes"
# Additional options, provided by apt-rpm
# ADDOPT="apt-help,apt-version,checksig,force-rpm,no-checksig,test"
ADDOPT="apt-help,apt-version,force-rpm,force-rpm-install,sourceslist:,test"
# Note that we use `"$@"' to let each command-line parameter expand to a
# separate word. The quotes around `$@' are essential!
# We need TEMP as the `eval set --' would nuke the return value of getopt.
TEMP=$(getopt --options=bc:dfhmo:qstuvy --long $ADDOPT,$APTOPT -n $PRGNAME -- "$@")
if [ $? -ne 0 ]; then
echo "Terminating..." >&2
exit 1
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
while true
do
case $1 in
--apt-help) ARG="$ARG --help";;
--apt-version|-v) ARG="$ARG --version";;
--arch-only) ARG="$ARG $1";;
--assume-yes) ARG="$ARG $1";;
--build|-b) ARG="$ARG $1";;
--checksig) RPM_CHECKSIG=yes;;
--compile) ARG="$ARG $1";;
--config-file|-c) ARG="$ARG $1 $2"; shift;;
--default-release) ARG="$ARG $1";;
--diff-only) ARG="$ARG $1";;
--download-only|-d) ARG="$ARG $1";;
--dry-run) ARG="$ARG $1";;
--fix-broken|-f) APT_FIXBROKEN=yes;;
--fix-missing|-m) ARG="$ARG $1";;
--force-rpm) RPM_FORCE=yes;;
--force-rpm-install) RPM_FORCE_INSTALL=yes;;
--force-yes) ARG="$ARG $1";;
--help) help; exit;;
-h) usage;exit;;
--ignore-hold) ARG="$ARG $1";;
--ignore-missing) ARG="$ARG $1";;
--just-print) ARG="$ARG $1";;
--list-cleanup) ARG="$ARG $1";;
--no-act) ARG="$ARG $1";;
--no-checksig) RPM_CHECKSIG=no;;
--no-download) ARG="$ARG $1";;
--no-list-cleanup) ARG="$ARG $1";;
--no-remove) ARG="$ARG $1";;
--no-upgrade) ARG="$ARG $1";;
--only-source) ARG="$ARG $1";;
--option|-o) ARG="$ARG $1 $2"; shift;;
--print-uris) ARG="$ARG $1";;
--purge) ARG="$ARG $1";;
--quiet|-q) ARG="$ARG $1";;
--recon) ARG="$ARG $1";;
--reinstall) ARG="$ARG $1";;
--remove) ARG="$ARG $1";;
--show-upgraded) ARG="$ARG $1";;
--simulate|-s) ARG="$ARG $1";;
--sourceslist) RPM_SRC_LIST=$2; shift;;
--tar-only) ARG="$ARG $1";;
--target-release|-t) ARG="$ARG $1";;
--test) RPM_TEST=yes ;;
--trivial-only) ARG="$ARG $1";;
--version) echo "$PRGNAME version: 0.11"; exit;; # needed for help2man
--yes|-y) ARG="$ARG $1";;
--) shift; ARG="$ARG $@"; break;;
*) echo "unknow argument \"$1\""; exit 1;;
esac
shift
done
[ -n "$RPM_CHECKSIG" ] && ARG="-o rpm::checksig=$RPM_CHECKSIG $ARG"
[ -n "$RPM_FORCE_INSTALL" ] && ARG="-o rpm::Install-Options::=--force $ARG"
[ -n "$RPM_TEST" ] && ARG="-o rpm::options::=--test $ARG"
if [ "$RPM_FORCE" == "yes" ]; then
ARG="-o rpm::options::=--force $ARG"
if [ "$RPM_FORCE_INSTALL" == "yes" ]; then
echo -n "warning: it does not make sense to use "
echo "--force-rpm-install in combination"
echo "with --force-rpm."
fi
fi
if [ -n "$RPM_SRC_LIST" ]; then
DIR=$(apt-config dump 2>&1 | grep "Dir::Etc " | cut -d\" -f2)
if [ -f /$DIR/$RPM_SRC_LIST ]; then
ARG="-o dir::etc::sourcelist=$RPM_SRC_LIST $ARG"
else
echo "error: the provided sourceslist file does not exist" >&2
exit 1
fi
fi
if [ "$APT_FIXBROKEN" == "yes" ]; then
echo "warning: the argument --fix-broken (-f) is not needed normally."
echo "If you want to use this apt argument, use apt-get directly."
exit 1
fi
echo "$PRGNAME executing: apt-get $ARG" | tr -s " "
echo
apt-get $ARG

View File

@ -1,45 +0,0 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.28.
.TH APT-RPM "1" "June 2003" "apt-rpm version: 0.11" "User Commands"
.SH NAME
apt-rpm \- rpm wrapper around apt-get
.SH SYNOPSIS
.B apt-rpm
[\fIoptions\fR] [\fIapt-get options\fR]
.SH OPTIONS
.TP
\fB\-\-apt\-help\fR
print apt help.
.HP
\fB\-\-apt\-version\fR print apt version.
.TP
\fB\-h\fR
print short help and exit.
.TP
\fB\-\-help\fR
print this help and exit.
.HP
\fB\-\-sourceslist\fR
.IP
Select the sourceslist file to be used (default
is /etc/apt/sources.list)
.PP
Options handed over to rpm, see rpm manual for their functionality.
.TP
\fB\-\-test\fR
Rpm option \fB\-\-test\fR.
.TP
\fB\-\-force\-rpm\fR
Rpm option \fB\-\-force\fR.
.HP
\fB\-\-force\-rpm\-install\fR
.IP
Rpm option \fB\-\-force\fR, this option will only be active
during rpm installation (rpm \fB\-U\fR or rpm \fB\-i\fR).
.PP
apt-rpm is a wrapper around apt-get, extending the available arguments of
apt-get with some specific rpm arguments. apt-rpm does nothing more than
passing the provided arguments to apt-get. The specific rpm arguments are
converted into the apt-get argument convention, before they are passed to
apt-get.
.SH "REPORTING BUGS"
Report bugs to <apt4rpm-devel@lists.sourceforge.net>.

397
apt/contrib/apt-wrapper/apt Normal file
View File

@ -0,0 +1,397 @@
#!/bin/sh
##################################################################
#
# Copyright (C) 2003 R Bos
#
# File: $RCSfile: apt,v $
# Revision: $Revision: 1.13 $
# Last change: $Date: 2004/02/20 19:30:15 $
#
# Send suggestions to: apt4rpm-devel@lists.sourceforge.net
# Homepage: http://apt4rpm.sourceforge.net
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# For a copy of the GNU General Public License, visit
# http://www.gnu.org or write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##################################################################
# It should be possible to show the user which application apt (this tool)
# is dispatching. It can't be done via a command line option as the
# options are passed on to the dispatched application. Therefor an environment
# variable is used. Export APT_VERBOSE in your environment and set it to
# anything, e.g. APT_VERBOSE=1, APT_VERBOSE=true, etc. Apt will than show
# the application that is being dispatched.
[ -z "$APT_VERBOSE" ] && APT_VERBOSE=no
function usage
{
( echo "$SHORTHELP"
echo "Use man $PRGNAME for extended help."
) >&2
}
ARGV="$@"
PRGNAME=$(basename $0)
readonly SHORTHELP="Usage: $PRGNAME [options] [apt-rpm options] <action> [packages]"
while [ $# -gt 0 ]; do
case $1 in
shell|dump)
APTCMD=apt-config
break
;;
update|upgrade|install|remove|dist-upgrade|\
build-dep|clean|autoclean|check|source|moo|script|reinstall)
APTCMD=apt-get
break
;;
add|ident)
APTCMD=apt-cdrom
break
;;
add|gencaches|showsrc|showpkg|stats|dump|dumpavail|\
unmet|search|depends|whatdepends|dotty|show|pkgnames|policy|\
rdepends|xvcg)
APTCMD="apt-cache"
break
;;
query)
APTCMD=query
break
;;
querytags)
APTCMD=querytags
break
;;
list-extras)
APTCMD=list-extras
break
;;
-h|--h|--he|--hel|--help)
APTCMD=usage
;;
-v|--v|--ve|--ver|--vers|--versi|--version)
APTCMD=version
# Workaround. apt-config and apt-cache execute the command
# instead of showing the version information only.
DISPLAY_VERSION=yes
;;
esac
shift
done
set -- $ARGV
if [ -z "$APTCMD" ]; then
if [ $# -ne 0 ]; then
echo "$PRGNAME: error: no or unrecognized action provided" >&2
fi
usage
exit 100
fi
case $APTCMD in
apt-get)
# Command line argument parsing, the allowed arguments (for apt-get) are
# alphabetically listed, keep it this way please.
APTOPT="arch-only,assume-yes,build,compile,config-file:"
APTOPT="$APTOPT,default-release,diff-only,download-only,dry-run,fix-broken"
APTOPT="$APTOPT,fix-missing,force-yes,help,ignore-hold,ignore-missing"
APTOPT="$APTOPT,just-print,list-cleanup,no-act,no-download,no-list-cleanup"
APTOPT="$APTOPT,no-remove,no-upgrade,only-source,option:,print-uris,purge"
APTOPT="$APTOPT,quiet,recon,reinstall,remove,show-upgraded,simulate,tar-only"
APTOPT="$APTOPT,target-release,trivial-only,version,yes"
# Additional options, provided by this tool
ADDOPT="force-rpm,hold:,sourceslist:,show-rpm-command,test"
# Note that we use `"$@"' to let each command-line parameter expand to a
# separate word. The quotes around `$@' are essential!
# We need TEMP as the `eval set --' would nuke the return value of getopt.
TEMP=$(getopt --options=bc:dDfhmo:qstuvy --long $ADDOPT,$APTOPT -n $PRGNAME -- "$@")
if [ $? -ne 0 ]; then
echo "Terminating..." >&2
exit 100
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
while true
do
case $1 in
--arch-only) ARG="$ARG $1";;
--assume-yes) ARG="$ARG $1";;
--build|-b) ARG="$ARG $1";;
--checksig) RPM_CHECKSIG=yes;;
--compile) ARG="$ARG $1";;
--config-file|-c) ARG="$ARG $1 $2"; shift;;
-D) ARG="$ARG $1";;
--default-release) ARG="$ARG $1";;
--diff-only) ARG="$ARG $1";;
--download-only|-d) ARG="$ARG $1";;
--dry-run) ARG="$ARG $1";;
--fix-broken|-f) APT_FIXBROKEN=yes;;
--fix-missing|-m) ARG="$ARG $1";;
--force-rpm) RPM_FORCE=yes;;
--force-yes) ARG="$ARG $1";;
--help|-h) ARG="$ARG $1";;
--hold) ARG="$ARG -o rpm::hold::=$2"; shift;;
--ignore-hold) ARG="$ARG $1";;
--ignore-missing) ARG="$ARG $1";;
--just-print) ARG="$ARG $1";;
--list-cleanup) ARG="$ARG $1";;
--no-act) ARG="$ARG $1";;
--no-checksig) RPM_CHECKSIG=no;;
--no-download) ARG="$ARG $1";;
--no-list-cleanup) ARG="$ARG $1";;
--no-remove) ARG="$ARG $1";;
--no-run-post) ARG="-o Scripts::Exec::Post=no $ARG";;
--only-source) ARG="$ARG $1";;
--option|-o) ARG="$ARG $1 $2"; shift;;
--print-uris) ARG="$ARG $1";;
--purge) ARG="$ARG $1";;
--quiet|-q) ARG="$ARG $1";;
--recon) ARG="$ARG $1";;
--reinstall) ARG="$ARG $1";;
--remove) ARG="$ARG $1";;
--run-post) ARG="-o Scripts::Exec::Post=true $ARG";;
--show-rpm-command) RPM_SHOW_CMD=yes;;
--show-upgraded) ARG="$ARG $1";;
--simulate|-s) ARG="$ARG $1";;
--sourceslist) RPM_SRC_LIST=$2; shift;;
--tar-only) ARG="$ARG $1";;
--target-release|-t) ARG="$ARG $1";;
--test) RPM_TEST=yes ;;
--trivial-only) ARG="$ARG $1";;
--version|-v) ARG="$ARG $1";;
--yes|-y) ARG="$ARG $1";;
--) shift; ARG="$ARG $@"; break;;
*) echo "unknow argument \"$1\""; exit 100;;
esac
shift
done
[ -n "$RPM_CHECKSIG" ] && ARG="-o rpm::checksig=$RPM_CHECKSIG $ARG"
[ -n "$RPM_FORCE" ] && ARG="-o rpm::Install-Options::=--force $ARG"
[ -n "$RPM_TEST" ] && ARG="-o rpm::options::=--test $ARG"
if [ -n "$RPM_SHOW_CMD" ]; then
RPM_CMD=/usr/lib/apt/show_rpm_cmd
if [ ! -x $RPM_CMD ]; then
if [ ! -f $RPM_CMD ]; then
if [ $(id -u) -eq 0 ]; then
# It's dirty to do this, using hardcoded
# path and creating an executable on
# the fly...
echo "echo rpm \$@" > $RPM_CMD
chmod +x $RPM_CMD
else
echo "$PRGNAME: error: you need to be root" >&2
exit 100
fi
else
( echo -n "$PRGNAME: error: the file $RPM_CMD "
echo "must be executable for the option:"
echo "--show-rpm-cmd"
) >&2
exit 100
fi
fi
# It might be possible to use -o Debug::pkgRPMPM=true, but
# a trial with that, did not show the rpm -Uvh command while
# performing a dist-upgrade involving the removal and installation
# of packages.
ARG="-o RPM::PM=external -o Dir::Bin::rpm=$RPM_CMD $ARG"
fi
if [ -n "$RPM_SRC_LIST" ]; then
eval $(apt-config shell ROOT Dir DIR Dir::Etc)
if [ -f $ROOT$DIR$RPM_SRC_LIST ]; then
ARG="-o dir::etc::sourcelist=$RPM_SRC_LIST $ARG"
else
echo "error: the provided sourceslist file does not exist" >&2
exit 100
fi
fi
if [ "$APT_FIXBROKEN" == "yes" ]; then
echo "warning: the argument --fix-broken (-f) is not needed normally."
echo "If you want to use this apt argument, use apt-get directly."
exit 100
fi
if [ "$APT_VERBOSE" != "no" ]; then
( echo "$PRGNAME dispatching: apt-get $ARG" | tr -s " "
echo
) >&2
fi
apt-get $ARG
;;
apt-config)
if [ "$APT_VERBOSE" != "no" ]; then
( echo "$PRGNAME dispatching: apt-config $ARGV" | tr -s " "
echo
) >&2
fi
# Workaround. apt-config executes the action instead of showing
# the version information only.
# e.g. apt-config --version dump, in this example "dump" is the
# command/action.
if [ "$DISPLAY_VERSION" == "yes" ]; then
apt-config --version
else
apt-config $ARGV
fi
;;
apt-cache)
if [ "$APT_VERBOSE" != "no" ]; then
( echo "$PRGNAME dispatching: apt-cache $ARGV" | tr -s " "
echo
) >&2
fi
# Workaround. apt-cache executes the action instead of showing
# the version information only.
# e.g. apt-cache --version show, in this example "show" is the
# command/action.
if [ "$DISPLAY_VERSION" == "yes" ]; then
apt-cache --version
else
apt-cache $ARGV
fi
;;
apt-cdrom)
if [ "$APT_VERBOSE" != "no" ]; then
( echo "$PRGNAME dispatching: apt-cdrom $ARGV" | tr -s " "
echo
) >&2
fi
apt-cdrom $ARGV
;;
list-extras)
# Like yum's list extras functionality. As discussed on:
# http://lwn.net/Articles/60650/
apt-cache list-extras
;;
query)
while [ $# -gt 0 ]; do
case $1 in
-a|--all)
RPM_ARG_ALL=yes
;;
-q|query)
# -q is supported for rpm users that
# have the habit to execute rpm -q...
;;
-*)
# The user provided e.g. -i or -l as rpm query argument
RPM_OPT="yes"
break
;;
*)
if [ -z "$QRYSTR" ]; then
QRYSTR=$1
else
QRYSTR="$QRYSTR|$1"
fi
;;
esac
shift
done
if [ "$RPM_OPT" == "yes" ]; then
if [ "$APT_VERBOSE" != "no" ]; then
( echo "$PRGNAME dispatching: rpm -q $(echo $ARGV |
sed s/query//)" | tr -s " "
echo
) >&2
fi
rpm -q $(echo $ARGV | sed s/query//)
else
if [ "$RPM_ARG_ALL" == "yes" ]; then
if [ "$APT_VERBOSE" != "no" ]; then
( echo "$PRGNAME dispatching: rpm -qa |
grep -E ${QRYSTR:-^}" | tr -s " "
echo
) >&2
fi
rpm -qa | grep -Ei -- ${QRYSTR:-^} | sort
else
if [ "$APT_VERBOSE" != "no" ]; then
( echo -n "$PRGNAME dispatching: rpm -q"
echo "$(echo $ARGV | sed s/query//)" | tr -s " "
echo
) >&2
fi
rpm -q $(echo $ARGV | sed s/query//)
fi
fi
;;
querytags)
if [ "$APT_VERBOSE" != "no" ]; then
( echo "$PRGNAME dispatching: rpm --querytags"
echo
) >&2
fi
rpm --querytags
;;
usage)
usage
;;
version)
echo "The version of this wrapper around the apt tools is: 0.21"
echo
echo "The version of the apt tools is:"
apt-cdrom -v
;;
esac

View File

@ -0,0 +1,140 @@
.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "APT" 1 "20 February 2004" "Linux" ""
.SH NAME
apt \- Advanced Package Tool
.SH "SYNOPSIS"
.ad l
.hy 0
.HP 4
\fBapt\fR [\fB\fIoptions\fR\fR] [\fB\fIapt\-rpm\ options\fR\fR] [\fB\fIaction\fR\fR] [\fB\fIpackages\fR\fR]
.ad
.hy
.SH "DESCRIPTION"
.PP
Apt provides a single command line user interface for the following commands: \fB\fBapt\-get\fR\fR(8), \fB\fBapt\-cache\fR\fR(8), \fB\fBapt\-config\fR\fR(8), \fB\fBapt\-cdrom\fR\fR(8) and the \fBrpm\fR query possibilities\&. Besides the single interface it provides some additional options that are specific to apt in combination with rpm\&.
.PP
Unless the \fB\-h\fR, \fB\-\-help\fR, \fB\-v\fR, or \fB\-\-version\fR option is given one of the commands mentioned in the ACTIONS section must be present\&.
.PP
Detailed information about each apt command and its options can be found in the man pages that belong to the dispatched apt applications\&.
.SH "ACTIONS"
.PP
A full list of actions that are supported by \fBapt\fR: add, autoclean, build\-dep, check, clean, depends, dist\-upgrade, dotty, dump, dumpavail, gencaches, ident, install, list\-extras, moo, pkgnames, policy, query, querytags, rdepends\&. remove, script, search, show, showpkg, showsrc, source, stats, unmet, update, upgrade, whatdepends, xvcg\&.
.TP
list\-extras
shows packages not found in any online repositories\&. These are packages downloaded or build and installed locally\&. It's useful to review that list and decide if all those packages are still needed\&. Specifically if the system is used to build packages distributed to other systems\&. It's very important to be aware of all installed non\-standard packages to avoid dependencies that cannot be satisfied from the standard repository\&.
.PP
The functionality of the remaining actions are provided by other apt tools\&. The actions listed by their respective command:
.TP
\fBapt\-get\fR
autoclean, build\-dep, check, clean, dist\-upgrade, install, moo, remove, script, source, update, upgrade\&.
.TP
\fBapt\-cache\fR
add, depends, dotty, dump, dumpavail, gencaches, pkgnames, policy, rdepends\&. search, show, showpkg, showsrc, stats, unmet, whatdepends, xvcg\&.
.TP
\fBapt\-config\fR
shell, dump\&.
.TP
\fBapt\-cdrom\fR
add, ident\&.
.SH "OPTIONS"
.TP
\fB\-\-hold\fR
puts a package on hold\&. A package on hold won't be upgraded unless overruled with the install action\&. Repeat this option if multiple packages must be kept from upgrading\&. This option uses regular expressions to find the package to be put on hold\&. E\&.g\&. in case the package "at" must be hold, it must be specified as \-\-hold ^at$, if not done like this a package like attr will be put on hold as well\&. In any case it is better to put packages on hold with the rpm::hold variable in the file \fIapt\&.conf\fR!
.TP
\fB\-\-show\-rpm\-command\fR
Shows the exact rpm command to be performed, during install, upgrade or dist\-upgrade actions\&. The action itself will not be performed\&.
.TP
\fB\-\-sourceslist\fR
Select the sourceslist file to be used (default is \fI/etc/apt/sources\&.list\fR)\&.
.TP
\fB\-h\fR, \fB\-\-help\fR
Show a short usage summary\&.
.TP
\fB\-v\fR, \fB\-\-version\fR
Show the program version\&.
.TP
\fB\-c\fR, \fB\-\-config\-file\fR
Configuration File; Specify a configuration file to use\&. The program will read the default configuration file and then this configuration file\&. See \fB\fIapt\&.conf\fR\fR(5) for syntax information\&.
.TP
\fB\-o\fR, \fB\-\-option\fR
Set a Configuration Option; This will set an arbitary configuration option\&. The syntax is \fB\-o Foo::Bar=bar\fR\&.
.SH "RPM OPTIONS"
.PP
Options handed over to \fBrpm\fR, see rpm man page for their functionality\&.
.TP
\fB\-\-test\fR
\fBRpm\fR option \-\-test\&.
.TP
\fB\-\-force\-rpm\fR
\fBRpm\fR option \-\-force\&.
.SH "ENVIRONMENT"
.TP
\fBAPT_VERBOSE\fR
\fBapt\fR will show which application is being dispatched\&.
.SH "CAVEATS"
.PP
There are 2 apt actions, add and dump, that are used by several apt commands\&. The action add is used by \fBapt\-cdrom\fR and \fBapt\-cache\fR\&. \fBapt\fR uses add from \fBapt\-cdrom\&.\fR The action dump is used by \fBapt\-config\fR and \fBapt\-cache\fR\&. \fBapt\fR uses dump from \fBapt\-config\fR\&.
.SH "SEE ALSO"
.PP
\fB\fBapt\-get\fR\fR(8), \fB\fBapt\-cache\fR\fR(8), \fB\fBapt\-config\fR\fR(8), \fB\fBapt\-cdrom\fR\fR(8)
.SH "DIAGNOSTICS"
.PP
\fBapt\fR returns zero on normal operation, decimal 100 on error\&.
.SH "BUGS"
.PP
Report bugs to <apt4rpm\-devel@lists\&.sourceforge\&.net>
.SH AUTHOR
Richard Bos.

View File

@ -0,0 +1,271 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY % aptent SYSTEM "apt.ent">
%aptent;
]>
<refentry>
<refentryinfo>
<author>
<firstname>Richard</firstname>
<surname>Bos</surname>
</author>
&apt-product;
<!-- The last update date -->
<date>20 February 2004</date>
<copyright>
<year>2004</year>
<holder>Richard Bos</holder>
</copyright>
</refentryinfo>
<refmeta>
<refentrytitle>apt</refentrytitle>
<manvolnum>1</manvolnum>
</refmeta>
<!-- Man page title -->
<refnamediv>
<refname>apt</refname>
<refpurpose>Advanced Package Tool</refpurpose>
</refnamediv>
<!-- Arguments -->
<refsynopsisdiv>
<cmdsynopsis>
<command>apt</command>
<arg><option><replaceable>options</replaceable></option></arg>
<arg><option><replaceable>apt-rpm options</replaceable></option></arg>
<arg><option><replaceable>action</replaceable></option></arg>
<arg><option><replaceable>packages</replaceable></option></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>Apt provides a single command line user interface for the following
commands: &apt-get;, &apt-cache;, &apt-config;, &apt-cdrom; and
the <command>rpm</command> query possibilities.
Besides the single interface it provides some additional
options that are specific to apt in combination with rpm.</para>
<para>Unless the <option>-h</option>, <option>--help</option>,
<option>-v</option>, or <option>--version</option> option is
given one of the commands mentioned in the ACTIONS section must be
present.</para>
<para>Detailed information about each apt command and its options
can be found in the man pages that belong to the dispatched apt
applications.</para>
</refsect1>
<refsect1><title>Actions</title>
<para>A full list of actions that are supported by <command>apt</command>:
<literal>add</literal>,
<literal>autoclean</literal>,
<literal>build-dep</literal>,
<literal>check</literal>,
<literal>clean</literal>,
<literal>depends</literal>,
<literal>dist-upgrade</literal>,
<literal>dotty</literal>,
<literal>dump</literal>,
<literal>dumpavail</literal>,
<literal>gencaches</literal>,
<literal>ident</literal>,
<literal>install</literal>,
<literal>list-extras</literal>,
<literal>moo</literal>,
<literal>pkgnames</literal>,
<literal>policy</literal>,
<literal>query</literal>,
<literal>querytags</literal>,
<literal>rdepends</literal>.
<literal>reinstall</literal>.
<literal>remove</literal>,
<literal>script</literal>,
<literal>search</literal>,
<literal>show</literal>,
<literal>showpkg</literal>,
<literal>showsrc</literal>,
<literal>source</literal>,
<literal>stats</literal>,
<literal>unmet</literal>,
<literal>update</literal>,
<literal>upgrade</literal>,
<literal>whatdepends</literal>,
<literal>xvcg</literal>.</para>
<variablelist>
<varlistentry><term><literal>list-extras</literal></term>
<listitem><para>shows packages not found in any online repositories.
These are packages downloaded or build and installed locally. It's useful
to review that list and decide if all those packages are still needed.
Specifically if the system is used to build packages distributed to other
systems. It's very important to be aware of all installed non-standard
packages to avoid dependencies that cannot be satisfied from the standard
repository.</para></listitem>
</varlistentry>
</variablelist>
<para>The functionality of the remaining actions are provided by other
apt tools. The actions listed by their respective command:</para>
<variablelist>
<varlistentry><term><command>apt-get</command></term>
<listitem><para><literal>autoclean</literal>,
<literal>build-dep</literal>,
<literal>check</literal>,
<literal>clean</literal>,
<literal>dist-upgrade</literal>,
<literal>install</literal>,
<literal>moo</literal>,
<literal>remove</literal>,
<literal>reinstall</literal>.
<literal>script</literal>,
<literal>source</literal>,
<literal>update</literal>,
<literal>upgrade</literal>.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist>
<varlistentry><term><command>apt-cache</command></term>
<listitem><para><literal>add</literal>,
<literal>depends</literal>,
<literal>dotty</literal>,
<literal>dump</literal>,
<literal>dumpavail</literal>,
<literal>gencaches</literal>,
<literal>pkgnames</literal>,
<literal>policy</literal>,
<literal>rdepends</literal>.
<literal>search</literal>,
<literal>show</literal>,
<literal>showpkg</literal>,
<literal>showsrc</literal>,
<literal>stats</literal>,
<literal>unmet</literal>,
<literal>whatdepends</literal>,
<literal>xvcg</literal>.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist>
<varlistentry><term><command>apt-config</command></term>
<listitem><para><literal>shell</literal>,
<literal>dump</literal>.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist>
<varlistentry><term><command>apt-cdrom</command></term>
<listitem><para><literal>add</literal>,
<literal>ident</literal>.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1><title>Options</title>
<variablelist>
<varlistentry><term><option>--hold</option></term>
<listitem><para>puts a package on hold. A package on hold won't be upgraded
unless overruled with the <literal>install</literal> action. Repeat this option
if multiple packages must be kept from upgrading. This option
uses regular expressions to find the package to be put on hold.
E.g. in case the package "at" must be hold, it must be specified
as --hold ^at$, if not done like this a package like
<literal>attr</literal> will be put on hold as well. In any case
it is better to put packages on hold with the
<literal>rpm::hold</literal> variable in the file
<filename>apt.conf</filename>!</para>
</listitem>
</varlistentry>
<varlistentry><term><option>--show-rpm-command</option></term>
<listitem><para>Shows the exact rpm command to be performed, during
<literal>install</literal>, <literal>upgrade</literal> or
<literal>dist-upgrade</literal> actions. The action itself
will not be performed.</para>
</listitem>
</varlistentry>
<varlistentry><term><option>--sourceslist</option></term>
<listitem><para>Select the sourceslist file to be used
(default is <filename>/etc/apt/sources.list</filename>).</para>
</listitem>
</varlistentry>
&apt-commonoptions;
</variablelist>
</refsect1>
<refsect1><title>Rpm options</title>
<para>Options handed over to <command>rpm</command>, see rpm man page
for their functionality.</para>
<variablelist>
<varlistentry><term><option>--test</option></term>
<listitem><para><command>Rpm</command> option
<literal>--test</literal>.</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist>
<varlistentry><term><option>--force-rpm</option></term>
<listitem><para><command>Rpm</command> option
<literal>--force</literal>.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1><title>Environment</title>
<variablelist>
<varlistentry><term><option>APT_VERBOSE</option></term>
<listitem><para><command>apt</command> will show which application is being
dispatched.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1><title>Caveats</title>
<para>There are 2 apt actions, <literal>add</literal> and
<literal>dump</literal>, that are used by several apt commands.
The action <literal>add</literal> is used by
<command>apt-cdrom</command> and <command>apt-cache</command>.
<command>apt</command> uses <literal>add</literal> from <command>apt-cdrom.</command>
The action <literal>dump</literal> is used by <command>apt-config</command> and
<command>apt-cache</command>. <command>apt</command> uses <literal>dump</literal> from
<command>apt-config</command>.</para>
</refsect1>
<refsect1><title>See Also</title>
<para>&apt-get;, &apt-cache;, &apt-config;, &apt-cdrom;</para>
</refsect1>
<refsect1><title>Diagnostics</title>
<para><command>apt</command> returns zero on normal operation, decimal 100 on error.
</para>
</refsect1>
<refsect1><title>Bugs</title>
<para>Report bugs to
<email>apt4rpm-devel@lists.sourceforge.net</email></para>
</refsect1>
</refentry>

View File

@ -0,0 +1,227 @@
<!-- -*- mode: sgml; mode: fold -*- -->
<!-- Some common paths.. -->
<!ENTITY docdir "/usr/share/doc/apt/">
<!ENTITY configureindex "<filename>&docdir;examples/configure-index.gz</filename>">
<!ENTITY aptconfdir "<filename>/etc/apt.conf</filename>">
<!ENTITY statedir "/var/lib/apt">
<!ENTITY cachedir "/var/cache/apt">
<!-- Cross references to other man pages -->
<!ENTITY apt-conf "<citerefentry>
<refentrytitle><filename>apt.conf</filename></refentrytitle>
<manvolnum>5</manvolnum>
</citerefentry>"
>
<!ENTITY apt-get "<citerefentry>
<refentrytitle><command>apt-get</command></refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>"
>
<!ENTITY apt-config "<citerefentry>
<refentrytitle><command>apt-config</command></refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>"
>
<!ENTITY apt-cdrom "<citerefentry>
<refentrytitle><command>apt-cdrom</command></refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>"
>
<!ENTITY apt-cache "<citerefentry>
<refentrytitle><command>apt-cache</command></refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>"
>
<!ENTITY apt-preferences "<citerefentry>
<refentrytitle><command>apt_preferences</command></refentrytitle>
<manvolnum>5</manvolnum>
</citerefentry>"
>
<!ENTITY sources-list "<citerefentry>
<refentrytitle><filename>sources.list</filename></refentrytitle>
<manvolnum>5</manvolnum>
</citerefentry>"
>
<!ENTITY reportbug "<citerefentry>
<refentrytitle><command>reportbug</command></refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>"
>
<!ENTITY dpkg "<citerefentry>
<refentrytitle><command>dpkg</command></refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>"
>
<!ENTITY dpkg-buildpackage "<citerefentry>
<refentrytitle><command>dpkg-buildpackage</command></refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>"
>
<!ENTITY gzip "<citerefentry>
<refentrytitle><command>gzip</command></refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>"
>
<!ENTITY dpkg-scanpackages "<citerefentry>
<refentrytitle><command>dpkg-scanpackages</command></refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>"
>
<!ENTITY dpkg-scansources "<citerefentry>
<refentrytitle><command>dpkg-scansources</command></refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>"
>
<!ENTITY dselect "<citerefentry>
<refentrytitle><command>dselect</command></refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>"
>
<!-- Boiler plate docinfo section -->
<!ENTITY apt-docinfo "
<refentryinfo>
<address><email>apt@packages.debian.org</email></address>
<author><firstname>Jason</firstname> <surname>Gunthorpe</surname></author>
<copyright><year>1998-2001</year> <holder>Jason Gunthorpe</holder></copyright>
<date>14 December 2003</date>
<productname>Linux</productname>
</refentryinfo>
">
<!ENTITY apt-email "
<address>
<email>apt@packages.debian.org</email>
</address>
">
<!ENTITY apt-author.jgunthorpe "
<author>
<firstname>Jason</firstname>
<surname>Gunthorpe</surname>
</author>
">
<!ENTITY apt-author.team "
<author>
<othername>APT team</othername>
</author>
">
<!ENTITY apt-product "
<productname>Linux</productname>
">
<!ENTITY apt-email "
<address>
<email>apt@packages.debian.org</email>
</address>
">
<!ENTITY apt-author.jgunthorpe "
<author>
<firstname>Jason</firstname>
<surname>Gunthorpe</surname>
</author>
">
<!ENTITY apt-author.team "
<author>
<othername>APT team</othername>
</author>
">
<!ENTITY apt-copyright "
<copyright>
<holder>Jason Gunthorpe</holder>
<year>1998-2001</year>
</copyright>
">
<!ENTITY apt-product "
<productname>Linux</productname>
">
<!-- Boiler plate Bug reporting section -->
<!ENTITY manbugs "
<refsect1><title>Bugs</title>
<para><ulink url='http://bugs.debian.org/src:apt'>APT bug page</ulink>.
If you wish to report a bug in APT, please see
<filename>/usr/share/doc/debian/bug-reporting.txt</filename> or the
&reportbug; command.
</para>
</refsect1>
">
<!-- Boiler plate Author section -->
<!ENTITY manauthor "
<refsect1><title>Author</title>
<para>APT was written by the APT team <email>apt@packages.debian.org</email>.
</para>
</refsect1>
">
<!-- Should be used within the option section of the text to
put in the blurb about -h, -v, -c and -o -->
<!ENTITY apt-commonoptions "
<varlistentry><term><option>-h</option></term>
<term><option>--help</option></term>
<listitem><para>Show a short usage summary.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-v</option></term>
<term><option>--version</option></term>
<listitem><para>Show the program version.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-c</option></term>
<term><option>--config-file</option></term>
<listitem><para>Configuration File; Specify a configuration file to use.
The program will read the default configuration file and then this
configuration file. See &apt-conf; for syntax information.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-o</option></term>
<term><option>--option</option></term>
<listitem><para>Set a Configuration Option; This will set an arbitary
configuration option. The syntax is <option>-o Foo::Bar=bar</option>.
</para>
</listitem>
</varlistentry>
">
<!-- Should be used within the option section of the text to
put in the blurb about -h, -v, -c and -o -->
<!ENTITY apt-cmdblurb "
<para>All command line options may be set using the configuration file, the
descriptions indicate the configuration option to set. For boolean
options you can override the config file by using something like
<option>-f-</option>,<option>--no-f</option>, <option>-f=no</option>
or several other variations.
</para>
">

View File

@ -1 +1,2 @@
Scripts::AptCache::Command:: "list-extras.lua";
Scripts::AptCache::Help::Command:: "list-extras.lua";

View File

@ -4,16 +4,23 @@
--
-- Author: Gustavo Niemeyer <niemeyer@conectiva.com>
if script_slot == "Scripts::AptCache::Help::Command" then
print(_(" list-extras - Show installed pkgs not available in repositories"))
return
end
if command_args[1] ~= "list-extras" then
return
return
end
command_consume = 1
for i, pkg in pairs(pkglist()) do
ver = pkgvercur(pkg)
verlist = pkgverlist(pkg)
if ver and not verisonline(ver)
and table.getn(verlist) == 1 then
print(pkgname(pkg) .. "-" .. verstr(ver))
end
ver = pkgvercur(pkg)
verlist = pkgverlist(pkg)
if ver and not verisonline(ver)
and table.getn(verlist) == 1 then
print(pkgname(pkg) .. "-" .. verstr(ver))
end
end
-- vim:ts=4:sw=4:et

View File

@ -0,0 +1,10 @@
This script will list all installed packages which are not
required by any other installed package.
This script must be plugged in the slot
Scripts::AptCache::Command
To use it, just run
apt-cache list-nodeps

View File

@ -0,0 +1 @@
Scripts::AptCache::Command:: "list-nodeps.lua";

View File

@ -0,0 +1,44 @@
-- This script will list all installed packages which are not
-- required by any other installed package. It must be plugged
-- in the slot Scripts::AptCache::Command
--
-- Author: Gustavo Niemeyer <niemeyer@conectiva.com>
if script_slot == "Scripts::AptCache::Help::Command" then
print(_(" list-nodeps - Show installed pkgs not required by other installed pkgs"))
return
end
if command_args[1] ~= "list-nodeps" then
return
end
command_consume = 1
-- Collect dependencies from installed packages
deplist = {}
verlist = {}
for i, pkg in ipairs(pkglist()) do
ver = pkgvercur(pkg)
if ver then
table.insert(verlist, ver)
for i, dep in ipairs(verdeplist(ver)) do
for i, depver in ipairs(dep.verlist) do
deplist[verid(depver)] = true
end
end
end
end
-- Now list all versions which are not dependencies
for i, ver in ipairs(verlist) do
if not deplist[verid(ver)] then
name = pkgname(verpkg(ver))
if name ~= "gpg-pubkey" then
-- Print package name and version without epoch
-- (rpm -e friendly ;-).
print(name.."-"..string.gsub(verstr(ver), "^%d+:", ""))
end
end
end
-- vim:ts=4:sw=4:et

View File

@ -5,9 +5,9 @@ if http_proxy == "" and ftp_proxy == "" then
return
end
print("Enter proxy username:")
print(_("Enter proxy username:"))
username = io.read()
print("Enter proxy password:")
print(_("Enter proxy password:"))
os.execute("stty -echo")
password = io.read()
os.execute("stty echo")

View File

@ -54,6 +54,8 @@ COMPILE_APTSHELL_FALSE = @COMPILE_APTSHELL_FALSE@
COMPILE_APTSHELL_TRUE = @COMPILE_APTSHELL_TRUE@
COMPILE_MANPAGES_FALSE = @COMPILE_MANPAGES_FALSE@
COMPILE_MANPAGES_TRUE = @COMPILE_MANPAGES_TRUE@
COMPILE_STATIC_FALSE = @COMPILE_STATIC_FALSE@
COMPILE_STATIC_TRUE = @COMPILE_STATIC_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@

View File

@ -9,7 +9,7 @@ For details and rationale, see http://www.lua.org/license.html .
===============================================================================
Copyright (C) 2003 Tecgraf, PUC-Rio.
Copyright (C) 2003-2004 Tecgraf, PUC-Rio.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -54,6 +54,8 @@ COMPILE_APTSHELL_FALSE = @COMPILE_APTSHELL_FALSE@
COMPILE_APTSHELL_TRUE = @COMPILE_APTSHELL_TRUE@
COMPILE_MANPAGES_FALSE = @COMPILE_MANPAGES_FALSE@
COMPILE_MANPAGES_TRUE = @COMPILE_MANPAGES_TRUE@
COMPILE_STATIC_FALSE = @COMPILE_STATIC_FALSE@
COMPILE_STATIC_TRUE = @COMPILE_STATIC_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@

View File

@ -1,5 +1,5 @@
/*
** $Id: lua.h,v 1.175 2003/03/18 12:31:39 roberto Exp $
** $Id: lua.h,v 1.175b 2003/03/18 12:31:39 roberto Exp $
** Lua - An Extensible Extension Language
** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
** http://www.lua.org mailto:info@lua.org
@ -14,8 +14,8 @@
#include <stddef.h>
#define LUA_VERSION "Lua 5.0"
#define LUA_COPYRIGHT "Copyright (C) 1994-2003 Tecgraf, PUC-Rio"
#define LUA_VERSION "Lua 5.0.2"
#define LUA_COPYRIGHT "Copyright (C) 1994-2004 Tecgraf, PUC-Rio"
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
@ -365,7 +365,7 @@ struct lua_Debug {
/******************************************************************************
* Copyright (C) 1994-2003 Tecgraf, PUC-Rio. All rights reserved.
* Copyright (C) 1994-2004 Tecgraf, PUC-Rio. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@ -1,5 +1,5 @@
/*
** $Id: ldo.c,v 1.217 2003/04/03 13:35:34 roberto Exp $
** $Id: ldo.c,v 1.217a 2003/04/03 13:35:34 roberto Exp $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
@ -322,11 +322,11 @@ static void resume (lua_State *L, void *ud) {
int nargs = *cast(int *, ud);
CallInfo *ci = L->ci;
if (ci == L->base_ci) { /* no activation record? */
if (nargs >= L->top - L->base)
luaG_runerror(L, "cannot resume dead coroutine");
lua_assert(nargs < L->top - L->base);
luaD_precall(L, L->top - (nargs + 1)); /* start coroutine */
}
else if (ci->state & CI_YIELD) { /* inside a yield? */
else { /* inside a yield */
lua_assert(ci->state & CI_YIELD);
if (ci->state & CI_C) { /* `common' yield? */
/* finish interrupted execution of `OP_CALL' */
int nresults;
@ -341,18 +341,31 @@ static void resume (lua_State *L, void *ud) {
ci->state &= ~CI_YIELD;
}
}
else
luaG_runerror(L, "cannot resume non-suspended coroutine");
firstResult = luaV_execute(L);
if (firstResult != NULL) /* return? */
luaD_poscall(L, LUA_MULTRET, firstResult); /* finalize this coroutine */
}
static int resume_error (lua_State *L, const char *msg) {
L->top = L->ci->base;
setsvalue2s(L->top, luaS_new(L, msg));
incr_top(L);
lua_unlock(L);
return LUA_ERRRUN;
}
LUA_API int lua_resume (lua_State *L, int nargs) {
int status;
lu_byte old_allowhooks;
lua_lock(L);
if (L->ci == L->base_ci) {
if (nargs >= L->top - L->base)
return resume_error(L, "cannot resume dead coroutine");
}
else if (!(L->ci->state & CI_YIELD)) /* not inside a yield? */
return resume_error(L, "cannot resume non-suspended coroutine");
old_allowhooks = L->allowhook;
lua_assert(L->errfunc == 0 && L->nCcalls == 0);
status = luaD_rawrunprotected(L, resume, &nargs);

View File

@ -1,5 +1,5 @@
/*
** $Id: lgc.c,v 1.171 2003/04/03 13:35:34 roberto Exp $
** $Id: lgc.c,v 1.171a 2003/04/03 13:35:34 roberto Exp $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@ -110,7 +110,8 @@ static void marktmu (GCState *st) {
/* move `dead' udata that need finalization to list `tmudata' */
void luaC_separateudata (lua_State *L) {
size_t luaC_separateudata (lua_State *L) {
size_t deadmem = 0;
GCObject **p = &G(L)->rootudata;
GCObject *curr;
GCObject *collected = NULL; /* to collect udata with gc event */
@ -125,6 +126,7 @@ void luaC_separateudata (lua_State *L) {
p = &curr->gch.next;
}
else { /* must call its gc method */
deadmem += sizeudata(gcotou(curr)->uv.len);
*p = curr->gch.next;
curr->gch.next = NULL; /* link `curr' at the end of `collected' list */
*lastcollected = curr;
@ -134,6 +136,7 @@ void luaC_separateudata (lua_State *L) {
/* insert collected udata with gc event into `tmudata' list */
*lastcollected = G(L)->tmudata;
G(L)->tmudata = collected;
return deadmem;
}
@ -244,7 +247,7 @@ static void traversestack (GCState *st, lua_State *L1) {
for (ci = L1->base_ci; ci <= L1->ci; ci++) {
lua_assert(ci->top <= L1->stack_last);
lua_assert(ci->state & (CI_C | CI_HASFRAME | CI_SAVEDPC));
if (!(ci->state & CI_C) && lim < ci->top)
if (lim < ci->top)
lim = ci->top;
}
for (o = L1->stack; o < L1->top; o++)
@ -387,7 +390,7 @@ static void sweepstrings (lua_State *L, int all) {
}
static void checkSizes (lua_State *L) {
static void checkSizes (lua_State *L, size_t deadmem) {
/* check size of string hash */
if (G(L)->strt.nuse < cast(ls_nstr, G(L)->strt.size/4) &&
G(L)->strt.size > MINSTRTABSIZE*2)
@ -397,7 +400,7 @@ static void checkSizes (lua_State *L) {
size_t newsize = luaZ_sizebuffer(&G(L)->buff) / 2;
luaZ_resizebuffer(L, &G(L)->buff, newsize);
}
G(L)->GCthreshold = 2*G(L)->nblocks; /* new threshold */
G(L)->GCthreshold = 2*G(L)->nblocks - deadmem; /* new threshold */
}
@ -451,7 +454,8 @@ static void markroot (GCState *st, lua_State *L) {
}
static void mark (lua_State *L) {
static size_t mark (lua_State *L) {
size_t deadmem;
GCState st;
GCObject *wkv;
st.g = G(L);
@ -464,7 +468,7 @@ static void mark (lua_State *L) {
wkv = st.wkv; /* keys must be cleared after preserving udata */
st.wkv = NULL;
st.wv = NULL;
luaC_separateudata(L); /* separate userdata to be preserved */
deadmem = luaC_separateudata(L); /* separate userdata to be preserved */
marktmu(&st); /* mark `preserved' userdata */
propagatemarks(&st); /* remark, to propagate `preserveness' */
cleartablekeys(wkv);
@ -473,13 +477,14 @@ static void mark (lua_State *L) {
cleartablevalues(st.wv);
cleartablekeys(st.wkv);
cleartablevalues(st.wkv);
return deadmem;
}
void luaC_collectgarbage (lua_State *L) {
mark(L);
size_t deadmem = mark(L);
luaC_sweep(L, 0);
checkSizes(L);
checkSizes(L, deadmem);
luaC_callGCTM(L);
}

View File

@ -1,5 +1,5 @@
/*
** $Id: lgc.h,v 1.19 2003/02/28 19:45:15 roberto Exp $
** $Id: lgc.h,v 1.19a 2003/02/28 19:45:15 roberto Exp $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@ -15,7 +15,7 @@
if (G(L)->nblocks >= G(L)->GCthreshold) luaC_collectgarbage(L); }
void luaC_separateudata (lua_State *L);
size_t luaC_separateudata (lua_State *L);
void luaC_callGCTM (lua_State *L);
void luaC_sweep (lua_State *L, int all);
void luaC_collectgarbage (lua_State *L);

View File

@ -1,5 +1,5 @@
/*
** $Id: lbaselib.c,v 1.130 2003/04/03 13:35:34 roberto Exp $
** $Id: lbaselib.c,v 1.130b 2003/04/03 13:35:34 roberto Exp $
** Basic library
** See Copyright Notice in lua.h
*/
@ -274,10 +274,11 @@ static int luaB_loadfile (lua_State *L) {
static int luaB_dofile (lua_State *L) {
const char *fname = luaL_optstring(L, 1, NULL);
int n = lua_gettop(L);
int status = luaL_loadfile(L, fname);
if (status != 0) lua_error(L);
lua_call(L, 0, LUA_MULTRET);
return lua_gettop(L) - 1;
return lua_gettop(L) - n;
}
@ -324,7 +325,7 @@ static int luaB_xpcall (lua_State *L) {
static int luaB_tostring (lua_State *L) {
char buff[64];
char buff[128];
luaL_checkany(L, 1);
if (luaL_callmeta(L, 1, "__tostring")) /* is there a metafield? */
return 1; /* use its value */

View File

@ -1,5 +1,5 @@
/*
** $Id: liolib.c,v 2.39 2003/03/19 21:16:12 roberto Exp $
** $Id: liolib.c,v 2.39a 2003/03/19 21:16:12 roberto Exp $
** Standard I/O (and system) library
** See Copyright Notice in lua.h
*/
@ -158,7 +158,7 @@ static int aux_close (lua_State *L) {
static int io_close (lua_State *L) {
if (lua_isnone(L, 1)) {
if (lua_isnone(L, 1) && lua_type(L, lua_upvalueindex(1)) == LUA_TTABLE) {
lua_pushstring(L, IO_OUTPUT);
lua_rawget(L, lua_upvalueindex(1));
}
@ -175,7 +175,7 @@ static int io_gc (lua_State *L) {
static int io_tostring (lua_State *L) {
char buff[32];
char buff[128];
FILE **f = topfile(L, 1);
if (*f == NULL)
strcpy(buff, "closed");

View File

@ -6,39 +6,40 @@
/* local/linit.lua */
static const unsigned char B1[]={
10,114,101,120, 46,110,101,119, 32, 61, 32,114,101,120, 46,110,101,119, 80, 79,
83, 73, 88, 10, 10,102,117,110, 99,116,105,111,110, 32,114,101,120, 46,103,114,
101,112, 40,102,105,108,101,110, 97,109,101, 44, 32,101,120,112,114, 41, 10, 9,
105,102, 32,110,111,116, 32,112,111,115,105,120, 46,115,116, 97,116, 40,102,105,
108,101,110, 97,109,101, 44, 32, 34,109,111,100,101, 34, 41, 32,116,104,101,110,
10, 9, 9,114,101,116,117,114,110, 32,110,105,108, 10, 9,101,110,100, 10, 9,
108,111, 99, 97,108, 32,108,105,110,101,115, 32, 61, 32,123,125, 10, 9,108,111,
99, 97,108, 32,112, 97,116, 32, 61, 32,114,101,120, 46,110,101,119, 40,101,120,
112,114, 41, 10, 9,108,111, 99, 97,108, 32,112,111,115, 32, 61, 32, 49, 10, 9,
102,111,114, 32,108,105,110,101, 32,105,110, 32,105,111, 46,108,105,110,101,115,
40,102,105,108,101,110, 97,109,101, 41, 32,100,111, 10, 9, 9,105,102, 32,112,
97,116, 58,109, 97,116, 99,104, 40,108,105,110,101, 41, 32,116,104,101,110, 10,
9, 9, 9,116, 97, 98,108,101, 46,105,110,115,101,114,116, 40,108,105,110,101,
115, 44, 32,112,111,115, 44, 32,108,105,110,101, 41, 10, 9, 9,101,110,100, 10,
9, 9,112,111,115, 32, 61, 32,112,111,115, 32, 43, 32, 49, 10, 9,101,110,100,
10, 9,105,102, 32,116, 97, 98,108,101, 46,103,101,116,110, 40,108,105,110,101,
115, 41, 32, 61, 61, 32, 48, 32,116,104,101,110, 10, 9, 9,114,101,116,117,114,
110, 32,110,105,108, 10, 9,101,110,100, 10, 9,114,101,116,117,114,110, 32,108,
105,110,101,115, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,114,
101,120, 46,105,103,114,101,112, 40,102,105,108,101,110, 97,109,101, 44, 32,101,
120,112,114, 41, 10, 9,114,101,116,117,114,110, 32,105,112, 97,105,114,115, 40,
114,101,120, 46,103,114,101,112, 40,102,105,108,101,110, 97,109,101, 44, 32,101,
120,112,114, 41, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,
114,101,120, 46, 98,103,114,101,112, 40,102,105,108,101,110, 97,109,101, 44, 32,
101,120,112,114, 41, 10, 9,105,102, 32,110,111,116, 32,112,111,115,105,120, 46,
115,116, 97,116, 40,102,105,108,101,110, 97,109,101, 44, 32, 34,109,111,100,101,
34, 41, 32,116,104,101,110, 10, 9, 9,114,101,116,117,114,110, 32,110,105,108,
10, 9,101,110,100, 10, 9,108,111, 99, 97,108, 32,112, 97,116, 32, 61, 32,114,
101,120, 46,110,101,119, 40,101,120,112,114, 41, 10, 9,102,111,114, 32,108,105,
110,101, 32,105,110, 32,105,111, 46,108,105,110,101,115, 40,102,105,108,101,110,
97,109,101, 41, 32,100,111, 10, 9, 9,105,102, 32,112, 97,116, 58,109, 97,116,
99,104, 40,108,105,110,101, 41, 32,116,104,101,110, 10, 9, 9, 9,114,101,116,
117,114,110, 32,116,114,117,101, 10, 9, 9,101,110,100, 10, 9,101,110,100, 10,
9,114,101,116,117,114,110, 32,102, 97,108,115,101, 10,101,110,100, 10, 10,
83, 73, 88, 10, 10,117,116,105,108, 32, 61, 32,123,125, 10, 10,102,117,110, 99,
116,105,111,110, 32,117,116,105,108, 46,103,114,101,112, 40,101,120,112,114, 44,
32,102,105,108,101,110, 97,109,101, 41, 10, 9,105,102, 32,110,111,116, 32,112,
111,115,105,120, 46,115,116, 97,116, 40,102,105,108,101,110, 97,109,101, 44, 32,
34,109,111,100,101, 34, 41, 32,116,104,101,110, 10, 9, 9,114,101,116,117,114,
110, 32,110,105,108, 10, 9,101,110,100, 10, 9,108,111, 99, 97,108, 32,108,105,
110,101,115, 32, 61, 32,123,125, 10, 9,108,111, 99, 97,108, 32,112, 97,116, 32,
61, 32,114,101,120, 46,110,101,119, 40,101,120,112,114, 41, 10, 9,108,111, 99,
97,108, 32,112,111,115, 32, 61, 32, 49, 10, 9,102,111,114, 32,108,105,110,101,
32,105,110, 32,105,111, 46,108,105,110,101,115, 40,102,105,108,101,110, 97,109,
101, 41, 32,100,111, 10, 9, 9,105,102, 32,112, 97,116, 58,109, 97,116, 99,104,
40,108,105,110,101, 41, 32,116,104,101,110, 10, 9, 9, 9,116, 97, 98,108,101,
46,105,110,115,101,114,116, 40,108,105,110,101,115, 44, 32,112,111,115, 44, 32,
108,105,110,101, 41, 10, 9, 9,101,110,100, 10, 9, 9,112,111,115, 32, 61, 32,
112,111,115, 32, 43, 32, 49, 10, 9,101,110,100, 10, 9,105,102, 32,116, 97, 98,
108,101, 46,103,101,116,110, 40,108,105,110,101,115, 41, 32, 61, 61, 32, 48, 32,
116,104,101,110, 10, 9, 9,114,101,116,117,114,110, 32,110,105,108, 10, 9,101,
110,100, 10, 9,114,101,116,117,114,110, 32,108,105,110,101,115, 10,101,110,100,
10, 10,102,117,110, 99,116,105,111,110, 32,117,116,105,108, 46,105,103,114,101,
112, 40,101,120,112,114, 44, 32,102,105,108,101,110, 97,109,101, 41, 10, 9,114,
101,116,117,114,110, 32,105,112, 97,105,114,115, 40,114,101,120, 46,103,114,101,
112, 40,101,120,112,114, 44, 32,102,105,108,101,110, 97,109,101, 41, 41, 10,101,
110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,117,116,105,108, 46, 98,103,
114,101,112, 40,101,120,112,114, 44, 32,102,105,108,101,110, 97,109,101, 41, 10,
9,105,102, 32,110,111,116, 32,112,111,115,105,120, 46,115,116, 97,116, 40,102,
105,108,101,110, 97,109,101, 44, 32, 34,109,111,100,101, 34, 41, 32,116,104,101,
110, 10, 9, 9,114,101,116,117,114,110, 32,110,105,108, 10, 9,101,110,100, 10,
9,108,111, 99, 97,108, 32,112, 97,116, 32, 61, 32,114,101,120, 46,110,101,119,
40,101,120,112,114, 41, 10, 9,102,111,114, 32,108,105,110,101, 32,105,110, 32,
105,111, 46,108,105,110,101,115, 40,102,105,108,101,110, 97,109,101, 41, 32,100,
111, 10, 9, 9,105,102, 32,112, 97,116, 58,109, 97,116, 99,104, 40,108,105,110,
101, 41, 32,116,104,101,110, 10, 9, 9, 9,114,101,116,117,114,110, 32,116,114,
117,101, 10, 9, 9,101,110,100, 10, 9,101,110,100, 10, 9,114,101,116,117,114,
110, 32,102, 97,108,115,101, 10,101,110,100, 10, 10,
};
lua_dobuffer(L,(const char*)B1,sizeof(B1),"local/linit.lua");

View File

@ -1,7 +1,9 @@
rex.new = rex.newPOSIX
function rex.grep(filename, expr)
util = {}
function util.grep(expr, filename)
if not posix.stat(filename, "mode") then
return nil
end
@ -20,11 +22,11 @@ function rex.grep(filename, expr)
return lines
end
function rex.igrep(filename, expr)
return ipairs(rex.grep(filename, expr))
function util.igrep(expr, filename)
return ipairs(rex.grep(expr, filename))
end
function rex.bgrep(filename, expr)
function util.bgrep(expr, filename)
if not posix.stat(filename, "mode") then
return nil
end

View File

@ -1,7 +1,7 @@
/* lrexlib.c - POSIX & PCRE regular expression library */
/* POSIX regexs can use Spencer extensions for matching NULs if available
(REG_BASIC) */
/* Reuben Thomas nov00-06oct03 */
/* Reuben Thomas nov00-09jan04 */
#include <stdio.h>
#include <stdlib.h>
@ -22,7 +22,7 @@
#include <regex.h>
static int rex_comp(lua_State *L) {
static int posix_comp(lua_State *L) {
size_t l;
const char *pattern;
int res;
@ -46,8 +46,12 @@ static int rex_comp(lua_State *L) {
return 1;
}
static void rex_getargs(lua_State *L, size_t *len, size_t *ncapt,
const char **text, regex_t **pr, regmatch_t **match) {
static void posix_getargs(lua_State *L,
#ifdef REG_BASIC
size_t *len,
#endif
size_t *ncapt, const char **text, regex_t **pr,
regmatch_t **match) {
luaL_checkany(L, 1);
*pr = (regex_t *)lua_touserdata(L, 1);
#ifdef REG_BASIC
@ -60,7 +64,7 @@ static void rex_getargs(lua_State *L, size_t *len, size_t *ncapt,
*match = malloc((*ncapt + 1) * sizeof(regmatch_t));
}
static void rex_push_matches(lua_State *L, const char *text, regmatch_t *match,
static void posix_push_matches(lua_State *L, const char *text, regmatch_t *match,
size_t ncapt) {
size_t i;
lua_newtable(L);
@ -73,7 +77,7 @@ static void rex_push_matches(lua_State *L, const char *text, regmatch_t *match,
}
}
static int rex_match(lua_State *L) {
static int posix_match(lua_State *L) {
int res;
#ifdef REG_BASIC
size_t len;
@ -82,11 +86,9 @@ static int rex_match(lua_State *L) {
const char *text;
regex_t *pr;
regmatch_t *match;
rex_getargs(L,
posix_getargs(L,
#ifdef REG_BASIC
&len,
#else
NULL,
#endif
&ncapt, &text, &pr, &match);
#ifdef REG_BASIC
@ -99,7 +101,7 @@ static int rex_match(lua_State *L) {
if (res == 0) {
lua_pushnumber(L, match[0].rm_so + 1);
lua_pushnumber(L, match[0].rm_eo);
rex_push_matches(L, text, match, ncapt);
posix_push_matches(L, text, match, ncapt);
lua_pushstring(L, "n");
lua_pushnumber(L, ncapt);
lua_rawset(L, -3);
@ -108,20 +110,18 @@ static int rex_match(lua_State *L) {
return 0;
}
static int rex_gmatch(lua_State *L) {
static int posix_gmatch(lua_State *L) {
int res;
#ifdef REG_BASIC
size_t len;
#endif
size_t ncapt, nmatch = 0, maxmatch, limit = 0;
size_t ncapt, nmatch = 0, maxmatch = 0, limit = 0;
const char *text;
regex_t *pr;
regmatch_t *match;
rex_getargs(L,
posix_getargs(L,
#ifdef REG_BASIC
&len,
#else
NULL,
#endif
&ncapt, &text, &pr, &match);
luaL_checktype(L, 3, LUA_TFUNCTION);
@ -140,7 +140,7 @@ static int rex_gmatch(lua_State *L) {
if (res == 0) {
lua_pushvalue(L, 3);
lua_pushlstring(L, text + match[0].rm_so, match[0].rm_eo - match[0].rm_so);
rex_push_matches(L, text, match, ncapt);
posix_push_matches(L, text, match, ncapt);
lua_call(L, 2, 0);
text += match[0].rm_eo;
#ifdef REG_BASIC
@ -154,17 +154,17 @@ static int rex_gmatch(lua_State *L) {
return 1;
}
static int rex_gc (lua_State *L) {
static int posix_gc (lua_State *L) {
regex_t *r = (regex_t *)luaL_checkudata(L, 1, "regex_t");
if (r)
regfree(r);
return 0;
}
static const luaL_reg rexmeta[] = {
{"match", rex_match},
{"gmatch", rex_gmatch},
{"__gc", rex_gc},
static const luaL_reg posixmeta[] = {
{"match", posix_match},
{"gmatch", posix_gmatch},
{"__gc", posix_gc},
{NULL, NULL}
};
@ -197,7 +197,7 @@ static int pcre_comp(lua_State *L)
return 1;
}
static void pcre_getargs(lua_State *L, int *len, int *ncapt, const char **text,
static void pcre_getargs(lua_State *L, size_t *len, int *ncapt, const char **text,
pcre ***ppr, int **match)
{
luaL_checkany(L, 1);
@ -230,9 +230,9 @@ static int pcre_match(lua_State *L)
pcre **ppr;
int *match;
int ncapt;
int len;
size_t len;
pcre_getargs(L, &len, &ncapt, &text, &ppr, &match);
res = pcre_exec(*ppr, NULL, text, len, 0, 0, match, (ncapt + 1) * 3);
res = pcre_exec(*ppr, NULL, text, (int)len, 0, 0, match, (ncapt + 1) * 3);
if (res >= 0) {
lua_pushnumber(L, match[0] + 1);
lua_pushnumber(L, match[1]);
@ -248,12 +248,11 @@ static int pcre_match(lua_State *L)
static int pcre_gmatch(lua_State *L)
{
int res;
size_t len;
int ncapt, nmatch = 0, maxmatch = 0, limit = 0;
const char *text;
int limit = 0;
int ncapt, nmatch = 0, maxmatch;
pcre **ppr;
int *match;
int len;
pcre_getargs(L, &len, &ncapt, &text, &ppr, &match);
luaL_checktype(L, 3, LUA_TFUNCTION);
if (lua_gettop(L) > 3) {
@ -261,8 +260,9 @@ static int pcre_gmatch(lua_State *L)
limit = 1;
}
while (!limit || nmatch < maxmatch) {
res = pcre_exec(*ppr, NULL, text, len, 0, 0, match, (ncapt + 1) * 3);
if (res == 0) {
res = pcre_exec(*ppr, NULL, text, (int)len, 0, 0, match,
(ncapt + 1) * 3);
if (res >= 0) {
lua_pushvalue(L, 3);
lua_pushlstring(L, text + match[0], match[1] - match[0]);
pcre_push_matches(L, text, match, ncapt);
@ -299,7 +299,7 @@ static const luaL_reg pcremeta[] = {
static const luaL_reg rexlib[] = {
#ifdef WITH_POSIX
{"newPOSIX", rex_comp},
{"newPOSIX", posix_comp},
#endif
#ifdef WITH_PCRE
{"newPCRE", pcre_comp},
@ -319,7 +319,7 @@ LUALIB_API int luaopen_rex(lua_State *L)
{
#ifdef WITH_POSIX
createmeta(L, "regex_t");
luaL_openlib(L, NULL, rexmeta, 0);
luaL_openlib(L, NULL, posixmeta, 0);
lua_pop(L, 1);
#endif
#ifdef WITH_PCRE

View File

@ -1,5 +1,5 @@
/*
** $Id: lparser.c,v 1.208 2003/04/03 13:35:34 roberto Exp $
** $Id: lparser.c,v 1.208a 2003/04/03 13:35:34 roberto Exp $
** Lua Parser
** See Copyright Notice in lua.h
*/
@ -1141,11 +1141,15 @@ static void ifstat (LexState *ls, int line) {
static void localfunc (LexState *ls) {
expdesc v, b;
FuncState *fs = ls->fs;
new_localvar(ls, str_checkname(ls), 0);
init_exp(&v, VLOCAL, ls->fs->freereg++);
init_exp(&v, VLOCAL, fs->freereg);
luaK_reserveregs(fs, 1);
adjustlocalvars(ls, 1);
body(ls, &b, 0, ls->linenumber);
luaK_storevar(ls->fs, &v, &b);
luaK_storevar(fs, &v, &b);
/* debug information will only see the variable after this point! */
getlocvar(fs, fs->nactvar - 1).startpc = fs->pc;
}

View File

@ -1,5 +1,5 @@
/*
** $Id: luac.c,v 1.44 2003/04/07 20:34:20 lhf Exp $
** $Id: luac.c,v 1.44a 2003/04/07 20:34:20 lhf Exp $
** Lua compiler (saves bytecodes to files; also list bytecodes)
** See Copyright Notice in lua.h
*/
@ -182,7 +182,9 @@ int main(int argc, char* argv[])
FILE* D=fopen(output,"wb");
if (D==NULL) cannot(output,"open","out");
if (stripping) strip(L,f);
lua_lock(L);
luaU_dump(L,f,writer,D);
lua_unlock(L);
if (ferror(D)) cannot(output,"write","out");
fclose(D);
}

View File

@ -1,5 +1,5 @@
/*
** $Id: lvm.c,v 1.284 2003/04/03 13:35:34 roberto Exp $
** $Id: lvm.c,v 1.284b 2003/04/03 13:35:34 roberto Exp $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@ -66,7 +66,7 @@ int luaV_tostring (lua_State *L, StkId obj) {
static void traceexec (lua_State *L) {
lu_byte mask = L->hookmask;
if (mask > LUA_MASKLINE) { /* instruction-hook set? */
if (mask & LUA_MASKCOUNT) { /* instruction-hook set? */
if (L->hookcount == 0) {
resethookcount(L);
luaD_callhook(L, LUA_HOOKCOUNT, -1);
@ -399,10 +399,12 @@ StkId luaV_execute (lua_State *L) {
TObject *k;
const Instruction *pc;
callentry: /* entry point when calling new functions */
L->ci->u.l.pc = &pc;
if (L->hookmask & LUA_MASKCALL)
if (L->hookmask & LUA_MASKCALL) {
L->ci->u.l.pc = &pc;
luaD_callhook(L, LUA_HOOKCALL, -1);
}
retentry: /* entry point when returning to old functions */
L->ci->u.l.pc = &pc;
lua_assert(L->ci->state == CI_SAVEDPC ||
L->ci->state == (CI_SAVEDPC | CI_CALLING));
L->ci->state = CI_HASFRAME; /* activate frame */
@ -673,9 +675,7 @@ StkId luaV_execute (lua_State *L) {
}
else { /* yes: continue its execution */
int nresults;
lua_assert(ci->u.l.pc == &pc &&
ttisfunction(ci->base - 1) &&
(ci->state & CI_SAVEDPC));
lua_assert(ttisfunction(ci->base - 1) && (ci->state & CI_SAVEDPC));
lua_assert(GET_OPCODE(*(ci->u.l.savedpc - 1)) == OP_CALL);
nresults = GETARG_C(*(ci->u.l.savedpc - 1)) - 1;
luaD_poscall(L, nresults, ra);
@ -778,3 +778,4 @@ StkId luaV_execute (lua_State *L) {
}
}

View File

@ -54,6 +54,8 @@ COMPILE_APTSHELL_FALSE = @COMPILE_APTSHELL_FALSE@
COMPILE_APTSHELL_TRUE = @COMPILE_APTSHELL_TRUE@
COMPILE_MANPAGES_FALSE = @COMPILE_MANPAGES_FALSE@
COMPILE_MANPAGES_TRUE = @COMPILE_MANPAGES_TRUE@
COMPILE_STATIC_FALSE = @COMPILE_STATIC_FALSE@
COMPILE_STATIC_TRUE = @COMPILE_STATIC_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@

View File

@ -54,6 +54,8 @@ COMPILE_APTSHELL_FALSE = @COMPILE_APTSHELL_FALSE@
COMPILE_APTSHELL_TRUE = @COMPILE_APTSHELL_TRUE@
COMPILE_MANPAGES_FALSE = @COMPILE_MANPAGES_FALSE@
COMPILE_MANPAGES_TRUE = @COMPILE_MANPAGES_TRUE@
COMPILE_STATIC_FALSE = @COMPILE_STATIC_FALSE@
COMPILE_STATIC_TRUE = @COMPILE_STATIC_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -216,16 +216,6 @@ msgid ""
" dotty - Generate package graphs for GraphVis\n"
" xvcg - Generate package graphs for xvcg\n"
" policy - Show policy settings\n"
"\n"
"Options:\n"
" -h This help text.\n"
" -p=? The package cache.\n"
" -s=? The source cache.\n"
" -q Disable progress indicator.\n"
" -i Show only important deps for the unmet command.\n"
" -c=? Read this configuration file\n"
" -o=? Set an arbitary configuration option, eg -o dir::cache=/tmp\n"
"See the apt-cache(8) and apt.conf(5) manual pages for more information.\n"
msgstr ""
"使用方法: apt-cache [オプション] コマンド\n"
" apt-cache [オプション] add file1 [file2 ...]\n"
@ -252,6 +242,19 @@ msgstr ""
" dotty - GraphVis 用のパッケージグラフを生成する\n"
" xvcg - xvcg 用のパッケージグラフを生成する\n"
" policy - ポリシー設定情報を表示する\n"
msgid ""
"\n"
"Options:\n"
" -h This help text.\n"
" -p=? The package cache.\n"
" -s=? The source cache.\n"
" -q Disable progress indicator.\n"
" -i Show only important deps for the unmet command.\n"
" -c=? Read this configuration file\n"
" -o=? Set an arbitary configuration option, eg -o dir::cache=/tmp\n"
"See the apt-cache(8) and apt.conf(5) manual pages for more information.\n"
msgstr ""
"\n"
"オプション:\n"
" -h このヘルプを表示する\n"
@ -1048,25 +1051,6 @@ msgid ""
" clean - Erase downloaded archive files\n"
" autoclean - Erase old downloaded archive files\n"
" check - Verify that there are no broken dependencies\n"
"\n"
"Options:\n"
" -h This help text.\n"
" -q Loggable output - no progress indicator\n"
" -qq No output except for errors\n"
" -d Download only - do NOT install or unpack archives\n"
" -s No-act. Perform ordering simulation\n"
" -y Assume Yes to all queries and do not prompt\n"
" -f Attempt to continue if the integrity check fails\n"
" -m Attempt to continue if archives are unlocatable\n"
" -u Show a list of upgraded packages as well\n"
" -b Build the source package after fetching it\n"
" -D When removing packages, remove dependencies as possible\n"
" -V Show verbose version numbers\n"
" -c=? Read this configuration file\n"
" -o=? Set an arbitary configuration option, eg -o dir::cache=/tmp\n"
"See the apt-get(8), sources.list(5) and apt.conf(5) manual\n"
"pages for more information and options.\n"
" This APT has Super Cow Powers.\n"
msgstr ""
"使用方法: apt-get [オプション] コマンド\n"
" apt-get [オプション] install|remove pkg1 [pkg2 ...]\n"
@ -1090,6 +1074,28 @@ msgstr ""
" clean - アーカイブファイルを削除します\n"
" autoclean - 古いアーカイブファイルを削除します\n"
" check - 壊れた依存関係がないかチェックします\n"
msgid ""
"\n"
"Options:\n"
" -h This help text.\n"
" -q Loggable output - no progress indicator\n"
" -qq No output except for errors\n"
" -d Download only - do NOT install or unpack archives\n"
" -s No-act. Perform ordering simulation\n"
" -y Assume Yes to all queries and do not prompt\n"
" -f Attempt to continue if the integrity check fails\n"
" -m Attempt to continue if archives are unlocatable\n"
" -u Show a list of upgraded packages as well\n"
" -b Build the source package after fetching it\n"
" -D When removing packages, remove dependencies as possible\n"
" -V Show verbose version numbers\n"
" -c=? Read this configuration file\n"
" -o=? Set an arbitary configuration option, eg -o dir::cache=/tmp\n"
"See the apt-get(8), sources.list(5) and apt.conf(5) manual\n"
"pages for more information and options.\n"
" This APT has Super Cow Powers.\n"
msgstr ""
"\n"
"オプション:\n"
" -h このヘルプを表示する\n"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,7 @@ SWIG = swig
#SWIGFLAGS = -w312 -w315 -w508 -w509
SWIGFLAGS = -w312 -w315 -w508
#SWIG = /var/tmp/swig/BUILD/SWIG-1.3.16/swig
LUAFLAGS = -DWITH_LUA
PYTHONVER = $(shell python -c "import sys; v=sys.version_info[:2]; print '%d.%d'%v" 2>/dev/null || echo NONE)
PYTHONFLAGS=-I/usr/include/python$(PYTHONVER)
@ -15,10 +16,10 @@ all: $(MODULES)
$(MODULES): %.py: _%.so
_%.so: %_wrap.cxx
$(CC) -shared -I.. $(PYTHONFLAGS) -L../bin -L../build/bin -lapt-pkg -o $@ $<
$(CC) -shared -I.. $(PYTHONFLAGS) $(LUAFLAGS) -L../bin -L../build/bin -lapt-pkg -o $@ $<
apt_wrap.cxx: apt.i
$(SWIG) $(SWIGFLAGS) -c++ -I.. -python $<
$(SWIG) $(SWIGFLAGS) -c++ -I.. $(LUAFLAGS) -python $<
clean:
rm -f *.cxx

View File

@ -20,6 +20,7 @@
#include <apt-pkg/packagemanager.h>
#include <apt-pkg/sourcelist.h>
#include <apt-pkg/contrib/error.h>
#include <apt-pkg/luaiface.h>
#include <string>
#include <time.h>
@ -214,6 +215,9 @@ ItemsIter()
%immutable _error;
GlobalError *_error;
%immutable _lua;
Lua *_lua;
/* Undefined reference!? */
%ignore pkgCache::PkgIterator::TargetVer;
@ -246,6 +250,7 @@ Py_END_ALLOW_THREADS
%include <apt-pkg/packagemanager.h>
%include <apt-pkg/sourcelist.h>
%include <apt-pkg/contrib/error.h>
%include <apt-pkg/luaiface.h>
/* Create a dumb status class which can be instantiated. pkgAcquireStatus
* has fully abstract methods. */

View File

@ -9,7 +9,6 @@ Essential:
fileutils
glibc-base
initscripts
kernel
modutils
mount
pam

View File

@ -54,6 +54,8 @@ COMPILE_APTSHELL_FALSE = @COMPILE_APTSHELL_FALSE@
COMPILE_APTSHELL_TRUE = @COMPILE_APTSHELL_TRUE@
COMPILE_MANPAGES_FALSE = @COMPILE_MANPAGES_FALSE@
COMPILE_MANPAGES_TRUE = @COMPILE_MANPAGES_TRUE@
COMPILE_STATIC_FALSE = @COMPILE_STATIC_FALSE@
COMPILE_STATIC_TRUE = @COMPILE_STATIC_TRUE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@

View File

@ -238,14 +238,14 @@ WORKDIR=
exit_handler()
{
local rc=$?
trap '' EXIT
trap - EXIT
[ -z "$WORKDIR" ] || rm -rf "$WORKDIR"
exit $rc
}
trap exit_handler SIGHUP SIGPIPE SIGINT SIGQUIT SIGTERM EXIT
WORKDIR="$(mktemp -dt "$PROG.XXXXXXXXXX")"
WORKDIR="$(mktemp -dt "$PROG.XXXXXXXXXX")" || exit
if [ ! -d "$basedir" ]; then
if [ -n "$create" ]; then