Esempio n. 1
0
 def complete(self):
     """Check the options file to see if it is up-to-date."""
     if not self.port.attr["options"] or env.flags["config"] == "none":
         return True
     elif env.flags["config"] == "all":
         return False
     optionfile = env.flags["chroot"] + self.port.attr["optionsfile"]
     pkgname = self.port.attr["pkgname"]
     config_pkgname = ""
     options = set()
     if os.path.isfile(optionfile):
         with open(optionfile, 'r') as optionfile:
             for i in optionfile:
                 if i.startswith("_OPTIONS_READ="):
                     # The option set to the last pkgname this config file
                     # was set for
                     config_pkgname = i[14:-1]
                 elif i.startswith("_FILE_COMPLETE_OPTIONS_LIST"):
                     options.update(i[28:-1].split())
                     break
                 elif i.startswith("WITHOUT_"):
                     options.add(i[8:-6])
                 elif i.startswith("WITH_"):
                     options.add(i[5:-6])
                 elif i.startswith("OPTIONS_FILE_UNSET+="):
                     options.add(i[20:-1])
                 elif i.startswith("OPTIONS_FILE_SET+="):
                     options.add(i[18:-1])
     if (env.flags["config"] == "changed"
             and options != set(self.port.attr["options"])):
         return False
     if (env.flags["config"] == "newer"
             and pkg.version(pkgname, config_pkgname) == pkg.NEWER):
         return False
     return True
Esempio n. 2
0
 def complete(self):
     """Check the options file to see if it is up-to-date."""
     if not self.port.attr["options"] or env.flags["config"] == "none":
         return True
     elif env.flags["config"] == "all":
         return False
     optionfile = env.flags["chroot"] + self.port.attr["optionsfile"]
     pkgname = self.port.attr["pkgname"]
     config_pkgname = ""
     options = set()
     if os.path.isfile(optionfile):
         with open(optionfile, 'r') as optionfile:
             for i in optionfile:
                 if i.startswith("_OPTIONS_READ="):
                     # The option set to the last pkgname this config file
                     # was set for
                     config_pkgname = i[14:-1]
                 elif i.startswith("_FILE_COMPLETE_OPTIONS_LIST"):
                     options.update(i[28:-1].split())
                     break
                 elif i.startswith("WITHOUT_"):
                     options.add(i[8:-6])
                 elif i.startswith("WITH_"):
                     options.add(i[5:-6])
                 elif i.startswith("OPTIONS_FILE_UNSET+="):
                     options.add(i[20:-1])
                 elif i.startswith("OPTIONS_FILE_SET+="):
                     options.add(i[18:-1])
     if (env.flags["config"] == "changed" and
             options != set(self.port.attr["options"])):
         return False
     if (env.flags["config"] == "newer" and
         pkg.version(pkgname, config_pkgname) == pkg.NEWER) :
         return False
     return True