Beispiel #1
0
    def get_package_real(self, obs_name, upstream_name):
        m = Message()
        f = Fetcher()

        base = "%s/%s" % (self.base_url, upstream_name)
        url = "%s/cache.json" % base
        fp = f.get(url)
        j = json.load(fp)

        stable = []
        unstable = []

        if upstream_name in PackageSource.no_odd_even_rule:
            versions = j[2][upstream_name]
        else:
            for version in j[2][upstream_name]:
                v = version.split(".")
                major = int(v[0])
                minor = int(v[1])

                if obs_name in self.gnome2 and (major != 2 or minor >= 90):
                    continue

                if minor % 2 == 0:
                    stable.append(version)
                else:
                    unstable.append(version)

            versions = stable

        if len(versions) == 0:
            m.warn("could not parse json data: %s" % j[2])
            return None

        return Package(obs_name, versions)
    def get_package_real(self, obs_name, upstream_name):
        m = Message()
        f = Fetcher()

        base = "%s/%s" % (self.base_url, upstream_name)
        url = "%s/cache.json" % base
        fp = f.get(url)
        j = json.load(fp)

        stable = []
        unstable = []

        if upstream_name in PackageSource.no_odd_even_rule:
            versions = j[2][upstream_name]
        else:
            for version in j[2][upstream_name]:
                v = version.split(".")
                major = int(v[0])
                minor = int(v[1])

                if obs_name in self.gnome2 and (major != 2 or minor >= 90):
                    continue

                if minor % 2 == 0:
                    stable.append(version)
                else:
                    unstable.append(version)

            versions = stable

        if len(versions) == 0:
            m.warn("could not parse json data: %s" % j[2])
            return None

        return Package(obs_name, versions)
 def add_upstream_name_override(self, obs_name, upstream_name):
     m = Message()
     if self.package_map.has_key(obs_name):
         m.warn("duplicate upstream name override %s => %s, ignoring" %
                (obs_name, upstream_name))
         return
     self.package_map[obs_name] = upstream_name
Beispiel #4
0
 def add_upstream_name_override(self, obs_name, upstream_name):
     m = Message()
     if self.package_map.has_key(obs_name):
         m.warn("duplicate upstream name override %s => %s, ignoring" %
               (obs_name, upstream_name))
         return
     self.package_map[obs_name] = upstream_name
    def __init__(self):
        m = Message()
        self.index = Index(Dispatcher.urldb)
        self.gnome = GNOME()

        if not Dispatcher.urldb:
            csv.register_dialect('urldb',
                                 delimiter=' ',
                                 quotechar='"',
                                 lineterminator='\n',
                                 quoting=csv.QUOTE_MINIMAL)
            m.debug("Opening urldb")
            db = open('urldb', 'r')
            reader = csv.reader(db, dialect='urldb')
            for fields in reader:
                if len(fields) == 0:
                    continue
                if fields[0][0] == '#':
                    continue
                if len(fields) != 3:
                    m.warn("expecting 3 fields %s" % fields)
                    continue
                obs_name = string.strip(fields[0])
                regex = string.strip(fields[1])
                url = string.strip(fields[2])
                # obs_name => (regex, url, tags)
                entry = (self.resolve_regex(obs_name, regex),
                         self.resolve_url(obs_name, url), [])
                # autotag packages with a gnome.org url as 'GNOME'
                if entry[1].find('gnome.org') != -1:
                    entry[2].append('GNOME')

                m.debug("inserting %s => (%s,%s,%s)" %
                        (obs_name, entry[0], entry[1], entry[2]))

                if Dispatcher.urldb.has_key(obs_name):
                    m.warn("Duplicate entry for %s, ignoring" % obs_name)
                elif entry[0].find('DEFAULT') != -1:
                    m.warn("Could not resolve regex for %s, ignoring" %
                           obs_name)
                elif entry[1].find('DEFAULT') != -1:
                    m.warn("Could not resolve url for %s, ignoring" % obs_name)
                else:
                    Dispatcher.urldb[obs_name] = entry
            m.debug("urldb parsed")
Beispiel #6
0
    def __init__(self):
        m = Message()
        self.index = Index(Dispatcher.urldb)
        self.gnome = GNOME()

        if not Dispatcher.urldb:
            csv.register_dialect('urldb', delimiter=' ', quotechar='"',
                                 lineterminator='\n', quoting=csv.QUOTE_MINIMAL)
            m.debug("Opening urldb")
            db = open('urldb', 'r')
            reader = csv.reader(db, dialect='urldb')
            for fields in reader:
                if len(fields) == 0:
                    continue
                if fields[0][0] == '#':
                    continue
                if len(fields) != 3:
                    m.warn("expecting 3 fields %s" % fields)
                    continue
                obs_name = string.strip(fields[0])
                regex = string.strip(fields[1])
                url = string.strip(fields[2])
                # obs_name => (regex, url, tags)
                entry = (self.resolve_regex(obs_name, regex),
                         self.resolve_url(obs_name, url),
                         [])
                # autotag packages with a gnome.org url as 'GNOME'
                if entry[1].find('gnome.org') != -1:
                    entry[2].append('GNOME')

                m.debug("inserting %s => (%s,%s,%s)" % (obs_name, entry[0],
                        entry[1], entry[2]))

                if Dispatcher.urldb.has_key(obs_name):
                    m.warn("Duplicate entry for %s, ignoring" % obs_name)
                elif entry[0].find('DEFAULT') != -1:
                    m.warn("Could not resolve regex for %s, ignoring" % obs_name)
                elif entry[1].find('DEFAULT') != -1:
                    m.warn("Could not resolve url for %s, ignoring" % obs_name)
                else:
                    Dispatcher.urldb[obs_name] = entry
            m.debug("urldb parsed")
 def get_package_real(self, name):
     m = Message()
     m.warn("subclasses must implement get_package_real()")
     return None
    m.set_verbosity(options.verbose)

    dispatcher = Dispatcher()

    # Holds the (package, obs version, upstream version) to display in the
    # summary at the end
    display_packages = []

    # The object representing the OBS project we are working with
    repo = OBSRepository(options.project)

    if options.package:
        name = options.package

        if not repo.has_package(name):
            m.warn("could not find %s in %s" % (name, options.project))
            sys.exit(1)

        obs_version = repo.get_version(name)
        display_packages.append((name, repo.get_version(name),
                                 dispatcher.get_upstream_version(name)))

    else:
        started = not options.start_from
        progress_bar = ProgressBar('green', width=42, block='▣', empty='□')
        if not m.stdout_used():
            progress_bar.render(0)
        progress = 0

        packages = repo.packages.items()
        packages.sort()
Beispiel #9
0
 def get_package_real(self, name):
     m = Message()
     m.warn("subclasses must implement get_package_real()")
     return None
Beispiel #10
0
    m.set_verbosity(options.verbose)

    dispatcher = Dispatcher()

    # Holds the (package, obs version, upstream version) to display in the
    # summary at the end
    display_packages = []

    # The object representing the OBS project we are working with
    repo = OBSRepository(options.project)

    if options.package:
        name = options.package

        if not repo.has_package(name):
            m.warn("could not find %s in %s" % (name, options.project))
            sys.exit(1)

        obs_version = repo.get_version(name)
        display_packages.append((name,
                                 repo.get_version(name),
                                 dispatcher.get_upstream_version(name)))

    else:
        started = not options.start_from
        progress_bar = ProgressBar('green', width=42, block='▣', empty='□')
        if not m.stdout_used():
            progress_bar.render(0)
        progress = 0

        packages = repo.packages.items()