Bladeren bron

* cmdline/acqprogress.cc:
- Set Mode to Medium so that the correct prefix is used.
Thanks Stefan Haller for the patch! (Closes: #567304 LP: #275243)
* ftparchive/writer.cc:
- generate sha1 and sha256 checksums for dsc (Closes: #567343)
* cmdline/apt-get.cc:
- don't mark as manually if in download only (Closes: #468180)

Michael Vogt 16 jaren geleden
bovenliggende
commit
2893f7b5ec
6 gewijzigde bestanden met toevoegingen van 53 en 30 verwijderingen
  1. 7 23
      apt-pkg/contrib/error.h
  2. 9 0
      apt-pkg/contrib/system.h
  3. 1 1
      cmdline/acqprogress.cc
  4. 2 1
      cmdline/apt-get.cc
  5. 9 0
      debian/changelog
  6. 25 5
      ftparchive/writer.cc

+ 7 - 23
apt-pkg/contrib/error.h

@@ -40,28 +40,15 @@
 #ifndef PKGLIB_ERROR_H
 #ifndef PKGLIB_ERROR_H
 #define PKGLIB_ERROR_H
 #define PKGLIB_ERROR_H
 
 
+#include <apt-pkg/macros.h>
 
 
-
-#ifdef __GNUG__
-// Methods have a hidden this parameter that is visible to this attribute
-#define APT_MFORMAT1 __attribute__ ((format (printf, 2, 3)))
-#define APT_MFORMAT2 __attribute__ ((format (printf, 3, 4)))
-#else
-#define APT_MFORMAT1
-#define APT_MFORMAT2    
-#endif    
-    
 #include <string>
 #include <string>
 
 
-#include <system.h>
-
-using std::string;
-
 class GlobalError
 class GlobalError
 {
 {
    struct Item
    struct Item
    {
    {
-      string Text;
+      std::string Text;
       bool Error;
       bool Error;
       Item *Next;
       Item *Next;
    };
    };
@@ -73,18 +60,18 @@ class GlobalError
    public:
    public:
 
 
    // Call to generate an error from a library call.
    // Call to generate an error from a library call.
-   bool Errno(const char *Function,const char *Description,...) APT_MFORMAT2 __cold;
-   bool WarningE(const char *Function,const char *Description,...) APT_MFORMAT2 __cold;
+   bool Errno(const char *Function,const char *Description,...) __like_printf_2 __cold;
+   bool WarningE(const char *Function,const char *Description,...) __like_printf_2 __cold;
 
 
    /* A warning should be considered less severe than an error, and may be
    /* A warning should be considered less severe than an error, and may be
       ignored by the client. */
       ignored by the client. */
-   bool Error(const char *Description,...) APT_MFORMAT1 __cold;
-   bool Warning(const char *Description,...) APT_MFORMAT1 __cold;
+   bool Error(const char *Description,...) __like_printf_1 __cold;
+   bool Warning(const char *Description,...) __like_printf_1 __cold;
 
 
    // Simple accessors
    // Simple accessors
    inline bool PendingError() {return PendingFlag;};
    inline bool PendingError() {return PendingFlag;};
    inline bool empty() {return List == 0;};
    inline bool empty() {return List == 0;};
-   bool PopMessage(string &Text);
+   bool PopMessage(std::string &Text);
    void Discard();
    void Discard();
 
 
    // Usefull routine to dump to cerr
    // Usefull routine to dump to cerr
@@ -97,7 +84,4 @@ class GlobalError
 GlobalError *_GetErrorObj();
 GlobalError *_GetErrorObj();
 #define _error _GetErrorObj()
 #define _error _GetErrorObj()
 
 
-#undef APT_MFORMAT1
-#undef APT_MFORMAT2
-
 #endif
 #endif

+ 9 - 0
apt-pkg/contrib/system.h

@@ -77,4 +77,13 @@
         #define __cold  /* no cold marker */
         #define __cold  /* no cold marker */
 #endif
 #endif
 
 
+#ifdef __GNUG__
+// Methods have a hidden this parameter that is visible to this attribute
+	#define __like_printf_1 __attribute__ ((format (printf, 2, 3)))
+	#define __like_printf_2 __attribute__ ((format (printf, 3, 4)))
+#else
+	#define __like_printf_1
+	#define __like_printf_2
+#endif
+
 #endif
 #endif

+ 1 - 1
cmdline/acqprogress.cc

@@ -150,7 +150,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
    if (Quiet > 0)
    if (Quiet > 0)
       return true;
       return true;
    
    
-   enum {Long = 0,Medium,Short} Mode = Long;
+   enum {Long = 0,Medium,Short} Mode = Medium;
    
    
    char Buffer[sizeof(BlankLine)];
    char Buffer[sizeof(BlankLine)];
    char *End = Buffer + sizeof(Buffer);
    char *End = Buffer + sizeof(Buffer);

+ 2 - 1
cmdline/apt-get.cc

@@ -1776,7 +1776,8 @@ bool DoInstall(CommandLine &CmdL)
 	    if(!Remove && 
 	    if(!Remove && 
 	       Cache[Pkg].Install() == false && 
 	       Cache[Pkg].Install() == false && 
 	       (Cache[Pkg].Flags & pkgCache::Flag::Auto) &&
 	       (Cache[Pkg].Flags & pkgCache::Flag::Auto) &&
-	       _config->FindB("APT::Get::ReInstall",false) == false)
+	       _config->FindB("APT::Get::ReInstall",false) == false &&
+	       _config->FindB("APT::Get::Download-Only",false) == false)
 	    {
 	    {
 	       ioprintf(c1out,_("%s set to manually installed.\n"),
 	       ioprintf(c1out,_("%s set to manually installed.\n"),
 			Pkg.Name());
 			Pkg.Name());

+ 9 - 0
debian/changelog

@@ -4,6 +4,15 @@ apt (0.7.25.3) UNRELEASED; urgency=low
   * Italian translation update. Closes: #567532
   * Italian translation update. Closes: #567532
   * French translation update.
   * French translation update.
 
 
+  [ David Kalnischkies ]
+  * cmdline/acqprogress.cc:
+    - Set Mode to Medium so that the correct prefix is used.
+      Thanks Stefan Haller for the patch! (Closes: #567304 LP: #275243)
+  * ftparchive/writer.cc:
+    - generate sha1 and sha256 checksums for dsc (Closes: #567343)
+  * cmdline/apt-get.cc:
+    - don't mark as manually if in download only (Closes: #468180)
+  
  -- Michael Vogt <mvo@debian.org>  Sun, 31 Jan 2010 16:20:50 +0100
  -- Michael Vogt <mvo@debian.org>  Sun, 31 Jan 2010 16:20:50 +0100
 
 
 apt (0.7.25.2) unstable; urgency=low
 apt (0.7.25.2) unstable; urgency=low

+ 25 - 5
ftparchive/writer.cc

@@ -559,7 +559,12 @@ bool SourcesWriter::DoPackage(string FileName)
    char *BlkEnd = Buffer + St.st_size;
    char *BlkEnd = Buffer + St.st_size;
    MD5Summation MD5;
    MD5Summation MD5;
    MD5.Add((unsigned char *)Start,BlkEnd - Start);
    MD5.Add((unsigned char *)Start,BlkEnd - Start);
-      
+
+   SHA1Summation SHA1;
+   SHA256Summation SHA256;
+   SHA1.Add((unsigned char *)Start,BlkEnd - Start);
+   SHA256.Add((unsigned char *)Start,BlkEnd - Start);
+
    // Add an extra \n to the end, just in case
    // Add an extra \n to the end, just in case
    *BlkEnd++ = '\n';
    *BlkEnd++ = '\n';
    
    
@@ -650,12 +655,25 @@ bool SourcesWriter::DoPackage(string FileName)
    }
    }
    
    
    // Add the dsc to the files hash list
    // Add the dsc to the files hash list
+   string const strippedName = flNotDir(FileName);
    char Files[1000];
    char Files[1000];
    snprintf(Files,sizeof(Files),"\n %s %lu %s\n %s",
    snprintf(Files,sizeof(Files),"\n %s %lu %s\n %s",
 	    string(MD5.Result()).c_str(),St.st_size,
 	    string(MD5.Result()).c_str(),St.st_size,
-	    flNotDir(FileName).c_str(),
+	    strippedName.c_str(),
 	    Tags.FindS("Files").c_str());
 	    Tags.FindS("Files").c_str());
-   
+
+   char ChecksumsSha1[1000];
+   snprintf(ChecksumsSha1,sizeof(ChecksumsSha1),"\n %s %lu %s\n %s",
+	    string(SHA1.Result()).c_str(),St.st_size,
+	    strippedName.c_str(),
+	    Tags.FindS("Checksums-Sha1").c_str());
+
+   char ChecksumsSha256[1000];
+   snprintf(ChecksumsSha256,sizeof(ChecksumsSha256),"\n %s %lu %s\n %s",
+	    string(SHA256.Result()).c_str(),St.st_size,
+	    strippedName.c_str(),
+	    Tags.FindS("Checksums-Sha256").c_str());
+
    // Strip the DirStrip prefix from the FileName and add the PathPrefix
    // Strip the DirStrip prefix from the FileName and add the PathPrefix
    string NewFileName;
    string NewFileName;
    if (DirStrip.empty() == false &&
    if (DirStrip.empty() == false &&
@@ -700,12 +718,14 @@ bool SourcesWriter::DoPackage(string FileName)
       Directory.erase(Directory.end()-1);
       Directory.erase(Directory.end()-1);
 
 
    // This lists all the changes to the fields we are going to make.
    // This lists all the changes to the fields we are going to make.
-   // (5 hardcoded + maintainer + end marker)
-   TFRewriteData Changes[5+1+SOverItem->FieldOverride.size()+1];
+   // (5 hardcoded + checksums + maintainer + end marker)
+   TFRewriteData Changes[5+2+1+SOverItem->FieldOverride.size()+1];
 
 
    unsigned int End = 0;
    unsigned int End = 0;
    SetTFRewriteData(Changes[End++],"Source",Package.c_str(),"Package");
    SetTFRewriteData(Changes[End++],"Source",Package.c_str(),"Package");
    SetTFRewriteData(Changes[End++],"Files",Files);
    SetTFRewriteData(Changes[End++],"Files",Files);
+   SetTFRewriteData(Changes[End++],"Checksums-Sha1",ChecksumsSha1);
+   SetTFRewriteData(Changes[End++],"Checksums-Sha256",ChecksumsSha256);
    if (Directory != "./")
    if (Directory != "./")
       SetTFRewriteData(Changes[End++],"Directory",Directory.c_str());
       SetTFRewriteData(Changes[End++],"Directory",Directory.c_str());
    SetTFRewriteData(Changes[End++],"Priority",BestPrio.c_str());
    SetTFRewriteData(Changes[End++],"Priority",BestPrio.c_str());