From d108e019d3ca74c31a1ab646ddef5c60744a5e7d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 28 Jul 2017 18:20:14 +0200 Subject: ftparchive: sort discovered filenames before writing indexes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- ftparchive/writer.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ftparchive/writer.h') 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 #include #include +#include #include #include #include @@ -39,6 +40,7 @@ class FTWScanner { protected: vector Patterns; + vector> 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); -- cgit v1.2.3