]> git.tdb.fi Git - builder.git/commitdiff
Also use file size to determine whether to reinstall a file
authorMikko Rasa <tdb@tdb.fi>
Mon, 21 Sep 2009 16:23:33 +0000 (16:23 +0000)
committerMikko Rasa <tdb@tdb.fi>
Mon, 21 Sep 2009 16:23:33 +0000 (16:23 +0000)
source/filetarget.cpp
source/filetarget.h
source/install.cpp

index ed3e66b7c3711577a6a5e620086eec18e506f063..08b0f3115e984e25d30b73f6d2e21d5a5543236c 100644 (file)
@@ -15,9 +15,13 @@ using namespace Msp;
 FileTarget::FileTarget(Builder &b, const Package *p, const FS::Path &a):
        // XXX Builder depends on target name being its path for locating file targets
        Target(b, p, /*FS::basename*/(a.str())),
-       path(a)
+       path(a),
+       size(0)
 {
        struct stat st;
        if(!FS::stat(path, st))
+       {
                mtime=Time::TimeStamp::from_unixtime(st.st_mtime);
+               size=st.st_size;
+       }
 }
index 3b8bfcc4a0f0212f43bc23a058ecbf6f422215c2..982b8cb6abce166751d05cd4f5c4b82021503d56 100644 (file)
@@ -19,10 +19,12 @@ class FileTarget: public Target
 {
 protected:
        Msp::FS::Path path;
+       unsigned size;
 
        FileTarget(Builder &, const Package *, const Msp::FS::Path &);
 public:
        const Msp::FS::Path &get_path() const { return path; }
+       unsigned get_size() const { return size; }
 };
 
 #endif
index b5d70f45557fda665241fb67509b9929a509a59c..27bb9a334a970a5936efcad487ce720917bd7588 100644 (file)
@@ -32,7 +32,7 @@ void Install::check_rebuild()
 {
        if(!mtime)
                mark_rebuild("Does not exist");
-       else if(source.get_mtime()>mtime)
+       else if(source.get_mtime()>mtime || source.get_size()!=size)
                mark_rebuild(FS::basename(source.get_name())+" has changed");
        else if(source.get_rebuild())
                mark_rebuild(FS::basename(source.get_name())+" needs rebuilding");