Esempio n. 1
0
    def add_update(self, package, kernel_update=False):
        if package.name in ['linux-libc-dev', 'linux-kernel-generic']:
            source_name = package.name
        elif (package.candidate.source_name
              in ['linux', 'linux-meta', 'linux-hwe', 'linux-hwe-edge']
              or (package.name.startswith("linux-image")
                  or package.name.startswith("linux-headers")
                  or package.name.startswith("linux-modules")
                  or package.name.startswith("linux-tools"))):
            source_name = "linux-%s" % package.candidate.version
        else:
            source_name = package.candidate.source_name

        # ignore packages blacklisted by the user
        if self.is_blacklisted(package.candidate.source_name,
                               package.candidate.version):
            return

        if source_name in PRIORITY_UPDATES:
            if self.priority_updates_available == False and len(
                    self.updates) > 0:
                self.updates = {}
            self.priority_updates_available = True
        if source_name in PRIORITY_UPDATES or self.priority_updates_available == False:
            if source_name in self.updates:
                update = self.updates[source_name]
                update.add_package(package)
            else:
                update = Update(package, source_name=source_name)
                self.updates[source_name] = update
            if kernel_update:
                update.type = "kernel"
Esempio n. 2
0
 def __init__(self):
     if len(sys.argv) == 2 and sys.argv[1] == str("--update"):
         Update()
     elif len(sys.argv) == 2 and sys.argv[1] == str("--protocols"):
         Protocols()
     elif len(sys.argv) < 3:
         self.help()
     elif len(sys.argv) == 3:
         if sys.argv[2] == str("--update"):
             Update()
         elif sys.argv[2] == str("--help"):
             self.help()
         elif sys.argv[1] == str("--tools"):
             Tools()
         elif sys.argv[2] == str("--batch"):
             ip = sys.argv[1]
             Batch(ip)
         elif sys.argv[2] == str("--specific"):
             ip = sys.argv[1]
             Specific(ip)
         elif sys.argv[2] == str("--multiple"):
             ip = sys.argv[1]
             Multiple(ip)
         else:
             self.help()
Esempio n. 3
0
    def add_update(self, package, kernel_update=False):
        source_version = package.candidate.version
        # Change version of kernel meta packages to that of the actual kernel
        # for grouping with related updates
        if package.candidate.source_name.startswith("linux-meta"):
            _source_version = self.get_kernel_version_from_meta_package(
                package.candidate)
            if _source_version:
                source_version = _source_version

        # Change source name of kernel packages for grouping with related updates
        if (package.candidate.source_name == "linux"
                or package.candidate.source_name.startswith("linux-hwe")
                or package.candidate.source_name.startswith("linux-meta")
                or package.candidate.source_name.startswith("linux-signed") or
            [
                True for flavor in SUPPORTED_KERNEL_TYPES
                if package.candidate.source_name.startswith("linux%s" % flavor)
            ]):
            kernel_update = True
            source_name = "linux-%s" % source_version
        else:
            source_name = package.candidate.source_name

        # ignore packages blacklisted by the user
        if self.is_blacklisted(package.candidate.source_name,
                               package.candidate.version):
            return

        if source_name in PRIORITY_UPDATES:
            if not self.priority_updates_available and len(self.updates) > 0:
                self.updates.clear()
            self.priority_updates_available = True
        if source_name in PRIORITY_UPDATES or not self.priority_updates_available:
            if source_name in self.updates:
                update = self.updates[source_name]
                update.add_package(package)
                # Adjust update.old_version for kernel updates to try and
                # match the kernel, not the meta
                if kernel_update and package.is_installed and not \
                   "-" in update.old_version and "-" in package.installed.version:
                    update.old_version = package.installed.version
            else:
                short_description = None
                # Get the short_description from the source package
                if not kernel_update and package.name != source_name and self.cache.has_key(
                        source_name):
                    short_description = self.cache[
                        source_name].candidate.raw_description

                update = Update(package,
                                source_name=source_name,
                                short_description=short_description)
                self.updates[source_name] = update
            if kernel_update:
                update.type = "kernel"
            update.new_version = source_version
Esempio n. 4
0
    def add_update(self, package, kernel_update=False):

        if package.name in [
                'linux-libc-dev', 'linux-kernel-' + self.kernel_type
        ]:
            source_name = package.name
        elif package.name.startswith("linux-image") or package.name.startswith(
                "linux-headers"):
            source_name = package.name.replace(
                "-" + self.kernel_type,
                "").replace("-extra", "").replace("-headers",
                                                  "").replace("-image", "")
        else:
            source_name = package.candidate.source_name

        # ignore packages blacklisted by the user
        for blacklist in self.settings.get_strv("blacklisted-packages"):
            if fnmatch.fnmatch(source_name, blacklist):
                return

        if source_name in PRIORITY_UPDATES:
            if self.priority_updates_available == False and len(
                    self.updates) > 0:
                self.updates = {}
            self.priority_updates_available = True
        if (source_name in PRIORITY_UPDATES
            ) or self.priority_updates_available == False:
            if source_name in self.updates:
                update = self.updates[source_name]
                update.add_package(package)
            else:
                update = Update(package, source_name=source_name)

                if source_name in self.named_rules.keys():
                    rule = self.named_rules[source_name]
                    if (rule.match(source_name, update.new_version)):
                        update.level = rule.level
                else:
                    for rule_name in self.wildcard_rules.keys():
                        rule = self.wildcard_rules[rule_name]
                        if rule.match(source_name, update.new_version):
                            update.level = rule.level
                            break

                if update.level < 5:
                    self.updates[source_name] = update
            if kernel_update:
                update.type = "kernel"
Esempio n. 5
0
    def add_update(self, package, kernel_update=False):
        source_version = package.candidate.version
        # Change version of kernel meta packages to that of the actual kernel
        # for grouping with related updates
        if package.candidate.source_name.startswith("linux-meta"):
            _source_version = self.get_kernel_version_from_meta_package(package.candidate)
            if _source_version:
                source_version = _source_version

        # Change source name of kernel packages for grouping with related updates
        if (package.candidate.source_name == "linux" or
            package.candidate.source_name.startswith("linux-hwe") or
            package.candidate.source_name.startswith("linux-meta") or
            package.candidate.source_name.startswith("linux-signed") or
            [True for flavor in SUPPORTED_KERNEL_TYPES if package.candidate.source_name.startswith(f"linux{flavor}")]
           ):
            kernel_update = True
            source_name = f"linux-{source_version}"
        else:
            source_name = package.candidate.source_name

        # ignore packages blacklisted by the user
        if self.is_blacklisted(package.candidate.source_name, package.candidate.version):
            return

        if source_name in PRIORITY_UPDATES:
            if not self.priority_updates_available and len(self.updates) > 0:
                self.updates.clear()
            self.priority_updates_available = True
        if source_name in PRIORITY_UPDATES or not self.priority_updates_available:
            if source_name in self.updates:
                update = self.updates[source_name]
                update.add_package(package)
                # Adjust update.old_version for kernel updates to try and
                # match the kernel, not the meta
                if kernel_update and package.is_installed and not \
                   "-" in update.old_version and "-" in package.installed.version:
                    update.old_version = package.installed.version
            else:
                update = Update(package, source_name=source_name)
                self.updates[source_name] = update
            if kernel_update:
                update.type = "kernel"
            update.new_version = source_version