]> git.tdb.fi Git - builder.git/commitdiff
Make sure that symlinks point to the right place
authorMikko Rasa <tdb@tdb.fi>
Fri, 27 Jul 2012 07:29:32 +0000 (10:29 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 27 Jul 2012 07:29:32 +0000 (10:29 +0300)
source/copy.cpp
source/installedfile.cpp

index 0073320504b0daff45e2c9577a93e9ab4c095dff..75d047df7ef50c6371835f456a747f2c34b6121a 100644 (file)
@@ -87,6 +87,8 @@ void Copy::Worker::main()
        if(!link.empty())
        {
                FS::Path relpath = FS::relative(dst_path, FS::dirname(link));
+               if(FS::exists(link))
+                       FS::unlink(link);
                symlink(relpath.str().c_str(), link.str().c_str());
        }
 
index 4638cc40d6cec73cdb4b9af420c3d947da385523..76e7b69456010b8dd30d233a5d4d23f384ffbb1f 100644 (file)
@@ -55,8 +55,17 @@ void InstalledFile::check_rebuild()
                mark_rebuild(source.get_name()+" has changed");
        else if(source.needs_rebuild())
                mark_rebuild(source.get_name()+" needs rebuilding");
-       else if(!link.empty() && !FS::exists(link))
-               mark_rebuild("Symlink does not exist");
+       if(!needs_rebuild() && !link.empty())
+       {
+               if(!FS::exists(link))
+                       mark_rebuild("Symlink does not exist");
+               else
+               {
+                       FS::Path rel_path = FS::relative(path, FS::dirname(link));
+                       if(FS::readlink(link)!=rel_path)
+                               mark_rebuild("Symlink needs updating");
+               }
+       }
 }
 
 void InstalledFile::clean()