Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37400686
en ru br
Репозитории ALT
S:0.5.15lorg2-alt86
5.1: 0.5.15lorg2-alt33.M50P.1
4.1: 0.5.15lorg2-alt20.M41.1
4.0: 0.5.15lorg2-alt18.M40.1
+updates:0.5.15lorg2-alt18
3.0: 0.5.15cnc6-alt16
www.altlinux.org/Changes

Группа :: Система/Настройка/Пакеты
Пакет: apt

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: apt-0.5.15lorg2-alt-manifest.patch
Скачать


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 ||
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin