summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ftparchive/apt-ftparchive.cc4
-rw-r--r--ftparchive/writer.cc44
-rw-r--r--ftparchive/writer.h19
-rw-r--r--po/apt-all.pot40
4 files changed, 77 insertions, 30 deletions
diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc
index c811343b6..02e98bae6 100644
--- a/ftparchive/apt-ftparchive.cc
+++ b/ftparchive/apt-ftparchive.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: apt-ftparchive.cc,v 1.9 2003/12/26 20:08:56 mdz Exp $
+// $Id: apt-ftparchive.cc,v 1.10 2003/12/26 20:50:01 mdz Exp $
/* ######################################################################
apt-scanpackages - Efficient work-alike for dpkg-scanpackages
@@ -684,6 +684,8 @@ bool SimpleGenRelease(CommandLine &CmdL)
if (Release.RecursiveScan(CmdL.FileList[1]) == false)
return false;
+ Release.Finish();
+
return true;
}
diff --git a/ftparchive/writer.cc b/ftparchive/writer.cc
index 68fd85091..3b1cb69f5 100644
--- a/ftparchive/writer.cc
+++ b/ftparchive/writer.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: writer.cc,v 1.8 2003/12/26 20:08:56 mdz Exp $
+// $Id: writer.cc,v 1.9 2003/12/26 20:50:01 mdz Exp $
/* ######################################################################
Writer
@@ -22,6 +22,7 @@
#include <apt-pkg/error.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/md5.h>
+#include <apt-pkg/sha1.h>
#include <apt-pkg/deblistparser.h>
#include <sys/types.h>
@@ -829,8 +830,6 @@ ReleaseWriter::ReleaseWriter(string DB)
fprintf(Output, "%s: %s\n", (*I).first.c_str(), Value.c_str());
}
-
- fprintf(Output, "MD5Sum:\n");
}
/*}}}*/
// ReleaseWriter::DoPackage - Process a single package /*{{{*/
@@ -856,14 +855,47 @@ bool ReleaseWriter::DoPackage(string FileName)
return false;
}
+ CheckSums[FileName].size = fd.Size();
+
MD5Summation MD5;
MD5.AddFD(fd.Fd(), fd.Size());
+ CheckSums[FileName].MD5 = MD5.Result();
- string MD5Sum = MD5.Result();
- fprintf(Output, " %s %16d %s\n",
- MD5Sum.c_str(), fd.Size(), FileName.c_str());
+ fd.Seek(0);
+ SHA1Summation SHA1;
+ SHA1.AddFD(fd.Fd(), fd.Size());
+ CheckSums[FileName].SHA1 = SHA1.Result();
fd.Close();
return true;
}
+
+ /*}}}*/
+// ReleaseWriter::Finish - Output the checksums /*{{{*/
+// ---------------------------------------------------------------------
+void ReleaseWriter::Finish()
+{
+ fprintf(Output, "MD5Sum:\n");
+ for(map<string,struct CheckSum>::iterator I = CheckSums.begin();
+ I != CheckSums.end();
+ ++I)
+ {
+ fprintf(Output, " %s %16ld %s\n",
+ (*I).second.MD5.c_str(),
+ (*I).second.size,
+ (*I).first.c_str());
+ }
+
+ fprintf(Output, "SHA1:\n");
+ for(map<string,struct CheckSum>::iterator I = CheckSums.begin();
+ I != CheckSums.end();
+ ++I)
+ {
+ fprintf(Output, " %s %16ld %s\n",
+ (*I).second.SHA1.c_str(),
+ (*I).second.size,
+ (*I).first.c_str());
+ }
+}
+
diff --git a/ftparchive/writer.h b/ftparchive/writer.h
index 6f728dd1b..f347ca3b3 100644
--- a/ftparchive/writer.h
+++ b/ftparchive/writer.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: writer.h,v 1.5 2003/12/26 20:08:56 mdz Exp $
+// $Id: writer.h,v 1.6 2003/12/26 20:50:01 mdz Exp $
/* ######################################################################
Writer
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <iostream>
#include <vector>
+#include <map>
#include "cachedb.h"
#include "override.h"
@@ -30,6 +31,7 @@ using std::string;
using std::cout;
using std::endl;
using std::vector;
+using std::map;
class FTWScanner
{
@@ -154,11 +156,22 @@ class ReleaseWriter : public FTWScanner
public:
ReleaseWriter(string DB);
virtual bool DoPackage(string FileName);
-protected:
+ void Finish();
+
+ FILE *Output;
// General options
string PathPrefix;
string DirStrip;
- FILE *Output;
+
+protected:
+ struct CheckSum
+ {
+ string MD5;
+ string SHA1;
+ // Limited by FileFd::Size()
+ unsigned long size;
+ };
+ map<string,struct CheckSum> CheckSums;
};
#endif
diff --git a/po/apt-all.pot b/po/apt-all.pot
index 221306fcb..7a3d481c7 100644
--- a/po/apt-all.pot
+++ b/po/apt-all.pot
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2003-12-26 12:05-0800\n"
+"POT-Creation-Date: 2003-12-26 12:44-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -305,11 +305,11 @@ msgid ""
" -o=? Set an arbitary configuration option"
msgstr ""
-#: ftparchive/apt-ftparchive.cc:747
+#: ftparchive/apt-ftparchive.cc:749
msgid "No selections matched"
msgstr ""
-#: ftparchive/apt-ftparchive.cc:820
+#: ftparchive/apt-ftparchive.cc:822
#, c-format
msgid "Some files are missing in the package file group `%s'"
msgstr ""
@@ -337,83 +337,83 @@ msgstr ""
msgid "Unable to get a cursor"
msgstr ""
-#: ftparchive/writer.cc:78
+#: ftparchive/writer.cc:79
#, c-format
msgid "W: Unable to read directory %s\n"
msgstr ""
-#: ftparchive/writer.cc:83
+#: ftparchive/writer.cc:84
#, c-format
msgid "W: Unable to stat %s\n"
msgstr ""
-#: ftparchive/writer.cc:125
+#: ftparchive/writer.cc:126
msgid "E: "
msgstr ""
-#: ftparchive/writer.cc:127
+#: ftparchive/writer.cc:128
msgid "W: "
msgstr ""
-#: ftparchive/writer.cc:134
+#: ftparchive/writer.cc:135
msgid "E: Errors apply to file "
msgstr ""
-#: ftparchive/writer.cc:151 ftparchive/writer.cc:181
+#: ftparchive/writer.cc:152 ftparchive/writer.cc:182
#, c-format
msgid "Failed to resolve %s"
msgstr ""
-#: ftparchive/writer.cc:163
+#: ftparchive/writer.cc:164
msgid "Tree walking failed"
msgstr ""
-#: ftparchive/writer.cc:188
+#: ftparchive/writer.cc:189
#, c-format
msgid "Failed to open %s"
msgstr ""
-#: ftparchive/writer.cc:245
+#: ftparchive/writer.cc:246
#, c-format
msgid " DeLink %s [%s]\n"
msgstr ""
-#: ftparchive/writer.cc:253
+#: ftparchive/writer.cc:254
#, c-format
msgid "Failed to readlink %s"
msgstr ""
-#: ftparchive/writer.cc:257
+#: ftparchive/writer.cc:258
#, c-format
msgid "Failed to unlink %s"
msgstr ""
-#: ftparchive/writer.cc:264
+#: ftparchive/writer.cc:265
#, c-format
msgid "*** Failed to link %s to %s"
msgstr ""
-#: ftparchive/writer.cc:274
+#: ftparchive/writer.cc:275
#, c-format
msgid " DeLink limit of %sB hit.\n"
msgstr ""
-#: ftparchive/writer.cc:351 apt-inst/extract.cc:181 apt-inst/extract.cc:193
+#: ftparchive/writer.cc:352 apt-inst/extract.cc:181 apt-inst/extract.cc:193
#: apt-inst/extract.cc:210 apt-inst/deb/dpkgdb.cc:121
#, c-format
msgid "Failed to stat %s"
msgstr ""
-#: ftparchive/writer.cc:371
+#: ftparchive/writer.cc:372
msgid "Archive had no package field"
msgstr ""
-#: ftparchive/writer.cc:379 ftparchive/writer.cc:588
+#: ftparchive/writer.cc:380 ftparchive/writer.cc:589
#, c-format
msgid " %s has no override entry\n"
msgstr ""
-#: ftparchive/writer.cc:422 ftparchive/writer.cc:670
+#: ftparchive/writer.cc:423 ftparchive/writer.cc:671
#, c-format
msgid " %s maintainer is %s not %s\n"
msgstr ""