def lock(self):
        try:
            if not os.path.exists(os.path.dirname(self.LOCK_FILE)):
                os.makedirs(os.path.dirname(self.LOCK_FILE))
            self.log("Attempting acquire mutext "
                     "({0})...".format(self.LOCK_FILE))
            self.lock_fd = open(self.LOCK_FILE, 'w+')
            fcntl.flock(self.lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
            self.log(self.format_title("Mutex Acquired"))
            return True
        except IOError, exc_value:
            self.lock_fd = None
            #  IOError: [Errno 11] Resource temporarily unavailable
            if exc_value[0] == 11:
                self.log(
                    "DNS build script attempted to acquire the "
                    "build mutux but another process already has it."
                )
                fail_mail(
                    "An attempt was made to start the DNS build script "
                    "while an instance of the script was already running. "
                    "The attempt was denied.",
                    subject="Concurrent DNS builds attempted.")
                return False
            else:
                raise
Shorthand helper function for comparing SHA1s. If rev_type == 'sha1' then
dataset/ETHPy150Open mozilla/inventory/mozdns/mozbind/builder.py/DNSBuilder.lock--crossover with--dataset/ETHPy150Open saltstack/salt/salt/states/git.py/_revs_equal