Make auto-debuild configuration idempotent
[mass-build.git] / build_system.py
index 6e72e71e9b8eed6713bc5a3a789133f5a9deee6a..979a47ac35e078c8200f7e60b3888d14e97d983d 100644 (file)
@@ -68,6 +68,7 @@ try:
                                self.autoDebuildConfig[dstName] = src[name]
 
                def configure(self, force=False): # force is ignored
+                       if self.configured: return # do not configure twice
                        self.autoDebuildConfig['version'] = self.vcs.version() # by now, data has been fetched, so this is possible
                        if self.autoDebuildConfig['version'] is None:
                                raise Exception("VCS did not provide us with a proper version, please fix this")
@@ -77,12 +78,12 @@ try:
                        self.configured = True
 
                def build(self):
-                       if not self.configured: self.configure()
+                       self.configure() # make sure we are configured (this call is idempotent)
                        os.chdir(self.sourceFolder)
                        auto_debuild.buildDebianPackage(self.autoDebuildConfig)
 
                def install(self):
-                       if not self.configured: self.configure()
+                       self.configure() # make sure we are configured (this call is idempotent)
                        os.chdir(self.sourceFolder)
                        subprocess.check_call(['sudo', 'dpkg', '--install'] + self.files)
 except ImportError: