Пример #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)
Пример #2
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)
Пример #3
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
Пример #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
Пример #5
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")
Пример #6
0
 def get_package_real(self, name):
     m = Message()
     m.warn("subclasses must implement get_package_real()")
     return None
Пример #7
0
        # we don't parse those upstream versions
        'libjpeg',

        # sysfsutils does not show up in the linux-diag SF rss feed
        'sysfsutils',

        # Really no hope left to automate those packages
        'rpm')

    # Messages
    if options.output:
        output_fd = open(options.output, 'w')
    else:
        output_fd = sys.stdout

    m = Message()
    m.set_fd(output_fd)
    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
Пример #8
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")
Пример #9
0
 def get_package_real(self, name):
     m = Message()
     m.warn("subclasses must implement get_package_real()")
     return None
Пример #10
0
        'libjpeg',

        # sysfsutils does not show up in the linux-diag SF rss feed
        'sysfsutils',

        # Really no hope left to automate those packages
        'rpm'
    )

    # Messages
    if options.output:
        output_fd = open(options.output, 'w')
    else:
        output_fd = sys.stdout

    m = Message()
    m.set_fd(output_fd)
    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