Apply apt-0.5.15lorg2-alt-manifest.patch
Added in commit c8560f7
:
- add support of manifest file
This commit is contained in:
parent
3e598a0610
commit
6b6a46f6fe
@ -1,128 +0,0 @@
|
|||||||
diff -Naur apt-0.5.15lorg2.orig/apt-pkg/contrib/cmndline.cc apt-0.5.15lorg2/apt-pkg/contrib/cmndline.cc
|
|
||||||
--- apt-0.5.15lorg2.orig/apt-pkg/contrib/cmndline.cc 2007-10-30 14:42:33 +0300
|
|
||||||
+++ apt-0.5.15lorg2/apt-pkg/contrib/cmndline.cc 2007-10-30 14:43:33 +0300
|
|
||||||
@@ -19,9 +19,23 @@
|
|
||||||
#include <apt-pkg/strutl.h>
|
|
||||||
|
|
||||||
#include <apti18n.h>
|
|
||||||
+
|
|
||||||
+#include <memory>
|
|
||||||
/*}}}*/
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
+void CommandLine::FreeFileList()
|
|
||||||
+{
|
|
||||||
+ if (FileList)
|
|
||||||
+ {
|
|
||||||
+ for (const char **I=FileList; *I; ++I)
|
|
||||||
+ free(const_cast<char *>(*I));
|
|
||||||
+
|
|
||||||
+ delete [] FileList;
|
|
||||||
+ FileList = 0;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
// CommandLine::CommandLine - Constructor /*{{{*/
|
|
||||||
// ---------------------------------------------------------------------
|
|
||||||
/* */
|
|
||||||
@@ -35,7 +49,7 @@
|
|
||||||
/* */
|
|
||||||
CommandLine::~CommandLine()
|
|
||||||
{
|
|
||||||
- delete [] FileList;
|
|
||||||
+ FreeFileList();
|
|
||||||
}
|
|
||||||
/*}}}*/
|
|
||||||
// CommandLine::Parse - Main action member /*{{{*/
|
|
||||||
@@ -43,8 +57,11 @@
|
|
||||||
/* */
|
|
||||||
bool CommandLine::Parse(int argc,const char **argv)
|
|
||||||
{
|
|
||||||
- delete [] FileList;
|
|
||||||
+ FreeFileList();
|
|
||||||
FileList = new const char *[argc];
|
|
||||||
+ std::uninitialized_fill(const_cast<char**>(FileList),
|
|
||||||
+ const_cast<char**>(FileList+argc),
|
|
||||||
+ static_cast<char*>(0));
|
|
||||||
const char **Files = FileList;
|
|
||||||
int I;
|
|
||||||
for (I = 1; I != argc; I++)
|
|
||||||
@@ -54,7 +71,7 @@
|
|
||||||
// It is not an option
|
|
||||||
if (*Opt != '-')
|
|
||||||
{
|
|
||||||
- *Files++ = Opt;
|
|
||||||
+ *Files++ = strdup(Opt);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -136,7 +153,7 @@
|
|
||||||
|
|
||||||
// Copy any remaining file names over
|
|
||||||
for (; I != argc; I++)
|
|
||||||
- *Files++ = argv[I];
|
|
||||||
+ *Files++ = strdup(argv[I]);
|
|
||||||
*Files = 0;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
diff -Naur apt-0.5.15lorg2.orig/apt-pkg/contrib/cmndline.h apt-0.5.15lorg2/apt-pkg/contrib/cmndline.h
|
|
||||||
--- apt-0.5.15lorg2.orig/apt-pkg/contrib/cmndline.h 2007-10-24 19:20:13 +0400
|
|
||||||
+++ apt-0.5.15lorg2/apt-pkg/contrib/cmndline.h 2007-10-30 14:42:59 +0300
|
|
||||||
@@ -52,6 +52,10 @@
|
|
||||||
|
|
||||||
class CommandLine
|
|
||||||
{
|
|
||||||
+ CommandLine(const CommandLine& other);
|
|
||||||
+ CommandLine& operator=(const CommandLine& other);
|
|
||||||
+
|
|
||||||
+
|
|
||||||
public:
|
|
||||||
struct Args;
|
|
||||||
struct Dispatch;
|
|
||||||
@@ -84,6 +88,7 @@
|
|
||||||
|
|
||||||
CommandLine(Args *AList,Configuration *Conf);
|
|
||||||
~CommandLine();
|
|
||||||
+ void FreeFileList();
|
|
||||||
};
|
|
||||||
|
|
||||||
struct CommandLine::Args
|
|
||||||
diff -Naur apt-0.5.15lorg2.orig/cmdline/apt-get.cc apt-0.5.15lorg2/cmdline/apt-get.cc
|
|
||||||
--- apt-0.5.15lorg2.orig/cmdline/apt-get.cc 2007-10-30 14:42:33 +0300
|
|
||||||
+++ apt-0.5.15lorg2/cmdline/apt-get.cc 2007-10-30 14:42:59 +0300
|
|
||||||
@@ -3366,6 +3366,7 @@
|
|
||||||
{0,"check-only","APT::Get::Check-Only",0}, // CNC:2003-03-06
|
|
||||||
{'c',"config-file",0,CommandLine::ConfigFile},
|
|
||||||
{'o',"option",0,CommandLine::ArbItem},
|
|
||||||
+ {0,"manifest","manifest",CommandLine::HasArg},
|
|
||||||
{0,0,0,0}};
|
|
||||||
CommandLine::Dispatch Cmds[] = {{"update",&DoUpdate},
|
|
||||||
{"upgrade",&DoUpgrade},
|
|
||||||
@@ -3405,6 +3406,27 @@
|
|
||||||
return 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ //append manifest content to FileList
|
|
||||||
+ if (!_config->Find("manifest").empty())
|
|
||||||
+ {
|
|
||||||
+ std::ifstream is(_config->Find("manifest").c_str());
|
|
||||||
+ vector<char*> new_filelist;
|
|
||||||
+ std::string line;
|
|
||||||
+
|
|
||||||
+ for (const char **I = CmdL.FileList; *I != 0; I++)
|
|
||||||
+ new_filelist.push_back(strdup(*I));
|
|
||||||
+ while (std::getline(is,line))
|
|
||||||
+ new_filelist.push_back(strdup(line.c_str()));
|
|
||||||
+
|
|
||||||
+ CmdL.FreeFileList();
|
|
||||||
+
|
|
||||||
+ size_t len = new_filelist.size();
|
|
||||||
+ CmdL.FileList = new const char *[len + 1];
|
|
||||||
+ for(int i=0;i<len;++i)
|
|
||||||
+ CmdL.FileList[i]=new_filelist[i];
|
|
||||||
+ CmdL.FileList[len] = 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
// See if the help should be shown
|
|
||||||
if (_config->FindB("help") == true ||
|
|
||||||
_config->FindB("version") == true ||
|
|
@ -19,9 +19,23 @@
|
|||||||
#include <apt-pkg/strutl.h>
|
#include <apt-pkg/strutl.h>
|
||||||
|
|
||||||
#include <apti18n.h>
|
#include <apti18n.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
/*}}}*/
|
/*}}}*/
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
void CommandLine::FreeFileList()
|
||||||
|
{
|
||||||
|
if (FileList)
|
||||||
|
{
|
||||||
|
for (const char **I=FileList; *I; ++I)
|
||||||
|
free(const_cast<char *>(*I));
|
||||||
|
|
||||||
|
delete [] FileList;
|
||||||
|
FileList = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// CommandLine::CommandLine - Constructor /*{{{*/
|
// CommandLine::CommandLine - Constructor /*{{{*/
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
/* */
|
/* */
|
||||||
@ -35,7 +49,7 @@ CommandLine::CommandLine(Args *AList,Configuration *Conf) : ArgList(AList),
|
|||||||
/* */
|
/* */
|
||||||
CommandLine::~CommandLine()
|
CommandLine::~CommandLine()
|
||||||
{
|
{
|
||||||
delete [] FileList;
|
FreeFileList();
|
||||||
}
|
}
|
||||||
/*}}}*/
|
/*}}}*/
|
||||||
// CommandLine::Parse - Main action member /*{{{*/
|
// CommandLine::Parse - Main action member /*{{{*/
|
||||||
@ -43,8 +57,11 @@ CommandLine::~CommandLine()
|
|||||||
/* */
|
/* */
|
||||||
bool CommandLine::Parse(int argc,const char **argv)
|
bool CommandLine::Parse(int argc,const char **argv)
|
||||||
{
|
{
|
||||||
delete [] FileList;
|
FreeFileList();
|
||||||
FileList = new const char *[argc];
|
FileList = new const char *[argc];
|
||||||
|
std::uninitialized_fill(const_cast<char**>(FileList),
|
||||||
|
const_cast<char**>(FileList+argc),
|
||||||
|
static_cast<char*>(0));
|
||||||
const char **Files = FileList;
|
const char **Files = FileList;
|
||||||
int I;
|
int I;
|
||||||
for (I = 1; I != argc; I++)
|
for (I = 1; I != argc; I++)
|
||||||
@ -54,7 +71,7 @@ bool CommandLine::Parse(int argc,const char **argv)
|
|||||||
// It is not an option
|
// It is not an option
|
||||||
if (*Opt != '-')
|
if (*Opt != '-')
|
||||||
{
|
{
|
||||||
*Files++ = Opt;
|
*Files++ = strdup(Opt);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +153,7 @@ bool CommandLine::Parse(int argc,const char **argv)
|
|||||||
|
|
||||||
// Copy any remaining file names over
|
// Copy any remaining file names over
|
||||||
for (; I != argc; I++)
|
for (; I != argc; I++)
|
||||||
*Files++ = argv[I];
|
*Files++ = strdup(argv[I]);
|
||||||
*Files = 0;
|
*Files = 0;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -52,6 +52,10 @@
|
|||||||
|
|
||||||
class CommandLine
|
class CommandLine
|
||||||
{
|
{
|
||||||
|
CommandLine(const CommandLine& other);
|
||||||
|
CommandLine& operator=(const CommandLine& other);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct Args;
|
struct Args;
|
||||||
struct Dispatch;
|
struct Dispatch;
|
||||||
@ -84,6 +88,7 @@ class CommandLine
|
|||||||
|
|
||||||
CommandLine(Args *AList,Configuration *Conf);
|
CommandLine(Args *AList,Configuration *Conf);
|
||||||
~CommandLine();
|
~CommandLine();
|
||||||
|
void FreeFileList();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CommandLine::Args
|
struct CommandLine::Args
|
||||||
|
@ -3372,6 +3372,7 @@ int main(int argc,const char *argv[])
|
|||||||
{0,"check-only","APT::Get::Check-Only",0}, // CNC:2003-03-06
|
{0,"check-only","APT::Get::Check-Only",0}, // CNC:2003-03-06
|
||||||
{'c',"config-file",0,CommandLine::ConfigFile},
|
{'c',"config-file",0,CommandLine::ConfigFile},
|
||||||
{'o',"option",0,CommandLine::ArbItem},
|
{'o',"option",0,CommandLine::ArbItem},
|
||||||
|
{0,"manifest","manifest",CommandLine::HasArg},
|
||||||
{0,0,0,0}};
|
{0,0,0,0}};
|
||||||
CommandLine::Dispatch Cmds[] = {{"update",&DoUpdate},
|
CommandLine::Dispatch Cmds[] = {{"update",&DoUpdate},
|
||||||
{"upgrade",&DoUpgrade},
|
{"upgrade",&DoUpgrade},
|
||||||
@ -3411,6 +3412,27 @@ int main(int argc,const char *argv[])
|
|||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//append manifest content to FileList
|
||||||
|
if (!_config->Find("manifest").empty())
|
||||||
|
{
|
||||||
|
std::ifstream is(_config->Find("manifest").c_str());
|
||||||
|
vector<char*> new_filelist;
|
||||||
|
std::string line;
|
||||||
|
|
||||||
|
for (const char **I = CmdL.FileList; *I != 0; I++)
|
||||||
|
new_filelist.push_back(strdup(*I));
|
||||||
|
while (std::getline(is,line))
|
||||||
|
new_filelist.push_back(strdup(line.c_str()));
|
||||||
|
|
||||||
|
CmdL.FreeFileList();
|
||||||
|
|
||||||
|
size_t len = new_filelist.size();
|
||||||
|
CmdL.FileList = new const char *[len + 1];
|
||||||
|
for(int i=0;i<len;++i)
|
||||||
|
CmdL.FileList[i]=new_filelist[i];
|
||||||
|
CmdL.FileList[len] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// See if the help should be shown
|
// See if the help should be shown
|
||||||
if (_config->FindB("help") == true ||
|
if (_config->FindB("help") == true ||
|
||||||
_config->FindB("version") == true ||
|
_config->FindB("version") == true ||
|
||||||
|
Loading…
Reference in New Issue
Block a user