120 lines
3.3 KiB
Diff
120 lines
3.3 KiB
Diff
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-22 15:58:39 +0400
|
|
+++ apt-0.5.15lorg2/apt-pkg/contrib/cmndline.cc 2007-10-22 15:21:15 +0400
|
|
@@ -22,6 +22,18 @@
|
|
/*}}}*/
|
|
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 +47,7 @@
|
|
/* */
|
|
CommandLine::~CommandLine()
|
|
{
|
|
- delete [] FileList;
|
|
+ FreeFileList();
|
|
}
|
|
/*}}}*/
|
|
// CommandLine::Parse - Main action member /*{{{*/
|
|
@@ -43,7 +55,7 @@
|
|
/* */
|
|
bool CommandLine::Parse(int argc,const char **argv)
|
|
{
|
|
- delete [] FileList;
|
|
+ FreeFileList();
|
|
FileList = new const char *[argc];
|
|
const char **Files = FileList;
|
|
int I;
|
|
@@ -54,7 +66,7 @@
|
|
// It is not an option
|
|
if (*Opt != '-')
|
|
{
|
|
- *Files++ = Opt;
|
|
+ *Files++ = strdup(Opt);
|
|
continue;
|
|
}
|
|
|
|
@@ -136,7 +148,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-08-11 23:36:20 +0400
|
|
+++ apt-0.5.15lorg2/apt-pkg/contrib/cmndline.h 2007-10-22 16:05:41 +0400
|
|
@@ -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-22 15:58:39 +0400
|
|
+++ apt-0.5.15lorg2/cmdline/apt-get.cc 2007-10-22 15:57:37 +0400
|
|
@@ -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 ||
|