summaryrefslogtreecommitdiff
path: root/ftparchive/writer.h
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-07-28 18:20:14 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2017-08-04 13:06:10 +0200
commitd108e019d3ca74c31a1ab646ddef5c60744a5e7d (patch)
tree944a9784a75c6bfc42de30b33be338af131e66d8 /ftparchive/writer.h
parenteb0ccb003ceedac0fd78fee05d7b8119dd04c48b (diff)
ftparchive: sort discovered filenames before writing indexes
If 'apt-ftparchive packages /path/to/files/' (or sources) is used the files to include in the generated index (on stdout) were included in the order in which they were discovered, which isn't a very stable order which could lead to indexes changing without actually changing content causing needless changes in the repository changing hashsums, pdiffs, rsyncs, downloads, …. This does not effect apt-ftparchive calls which already have an order defined via a filelist (like generate) which will still print in the order given by the filelist. Note that a similar effect can be achieved by post-processing index files with apt-sortpkgs. Closes: 869557 Thanks: Chris Lamb for initial patch & Stefan Lippers-Hollmann for testing
Diffstat (limited to 'ftparchive/writer.h')
-rw-r--r--ftparchive/writer.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/ftparchive/writer.h b/ftparchive/writer.h
index b2cef4f00..b7c6435bf 100644
--- a/ftparchive/writer.h
+++ b/ftparchive/writer.h
@@ -19,6 +19,7 @@
#include <map>
#include <set>
#include <string>
+#include <utility>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
@@ -39,6 +40,7 @@ class FTWScanner
{
protected:
vector<string> Patterns;
+ vector<std::pair<string, bool>> FilesToProcess;
string Arch;
bool IncludeArchAll;
const char *OriginalPath;
@@ -49,7 +51,8 @@ class FTWScanner
static FTWScanner *Owner;
static int ScannerFTW(const char *File,const struct stat *sb,int Flag);
- static int ScannerFile(const char *File, bool const &ReadLink);
+ static int ScannerFile(const char *const File, bool const ReadLink);
+ static int ProcessFile(const char *const File, bool const ReadLink);
bool Delink(string &FileName,const char *OriginalPath,
unsigned long long &Bytes,unsigned long long const &FileSize);