]> git.tdb.fi Git - builder.git/commitdiff
Prevent crashes if a tool's executable cannot be found
authorMikko Rasa <tdb@tdb.fi>
Fri, 28 Sep 2012 12:20:02 +0000 (15:20 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 28 Sep 2012 12:20:02 +0000 (15:20 +0300)
source/filetarget.cpp
source/gnucompiler.cpp
source/gnucxxcompiler.cpp
source/gnucxxcompiler.h

index af63c237a2a0e849b8fe403bb0edb2ed3a772425..b42580a099a0a95eb411bc34fa65345cd72a2b03 100644 (file)
@@ -102,11 +102,14 @@ void FileTarget::check_rebuild()
                if(package->get_config().get_mtime()>mtime)
                        mark_rebuild("Package options changed");
 
-               string build_sig = create_build_signature();
-               if(package->get_cache().has_key(this, "build_sig"))
+               if(tool->get_executable())
                {
-                       if(package->get_cache().get_value(this, "build_sig")!=build_sig)
-                               mark_rebuild("Build signature changed");
+                       string build_sig = create_build_signature();
+                       if(package->get_cache().has_key(this, "build_sig"))
+                       {
+                               if(package->get_cache().get_value(this, "build_sig")!=build_sig)
+                                       mark_rebuild("Build signature changed");
+                       }
                }
        }
 }
index 43e8e300ad08132bb8cf5ce72d4d254fdd463cd8..a3052df1a6d4a4b2041ec5940e75239d4f6ffccf 100644 (file)
@@ -20,6 +20,8 @@ GnuCompiler::GnuCompiler(Builder &b, const Architecture &a, const string &t, con
        if(architecture->is_cross())
                command = format("%s-%s", architecture->get_cross_prefix(), command);
        executable = builder.get_vfs().find_binary(command);
+       if(!executable)
+               builder.problem(string(), format("Can't find executable %s for tool %s", command, tag));
 
        if(architecture->is_native())
                system_path.push_back("/usr/include");
index 05782e4ecb3ce09d0586b8332085816184121108..9e206cc6b525edca08587ec43e966eba37afdf76 100644 (file)
@@ -17,6 +17,12 @@ GnuCxxCompiler::GnuCxxCompiler(Builder &b, const Architecture &a):
        input_suffixes.push_back(".cc");
        aux_suffixes.push_back(".hpp");
 
+       if(executable)
+               query_version();
+}
+
+void GnuCxxCompiler::query_version()
+{
        ExternalTask::Arguments argv;
        argv.push_back(executable->get_path().str());
        argv.push_back("-dumpversion");
index a764e89bdcc05923d0c5f4d31bedf15142f911f2..314bb510e9ceb233d97fb91d3c7536b194f7acfb 100644 (file)
@@ -10,7 +10,10 @@ class GnuCxxCompiler: public GnuCompiler
 {
 public:
        GnuCxxCompiler(Builder &, const Architecture &);
+private:
+       void query_version();
 
+public:
        virtual Target *create_source(const Component &, const Msp::FS::Path &) const;
        virtual Target *create_source(const Msp::FS::Path &) const;
 };