Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH next v2 4/5] support/scripts/pkg-stats-new: add latest upstream version information
Date: Wed, 21 Mar 2018 21:58:24 +0100	[thread overview]
Message-ID: <20180321215824.45a5b5bc@windsurf> (raw)
In-Reply-To: <5a961c197f405_484fb72dfc147d@ultri3.mail>

Hello Ricardo,

On Wed, 28 Feb 2018 00:03:53 -0300, Ricardo Martincoski wrote:

> But that would require:
> The projects in the Buildroot distro to be named exactly as the buildroot
> package, i.e. samba4, not samba. Or of course implementing the search by
> similarity with regexp.
> 
> And be aware: it produces few different guesses (some better, some worst).
> 
> Here the sample code without Queue/threading:
>     cache_latest_version_by_distro()
>     cache_latest_version_by_guess()
> 
>     for pkg in packages:
>         pkg.latest_version = get_latest_version(pkg.name)
>         print " [%04d] %s => %s" % (packages.index(pkg), pkg.name, str(pkg.latest_version))
> 
> 
> distro_list = None
> guess_list = None
> 
> 
> def cache_latest_version_by_distro():
>     global distro_list
>     req = urllib2.Request(os.path.join(RELEASE_MONITORING_API, "projects", "?distro=Buildroot"))
>     f = urllib2.urlopen(req)
>     distro_list = json.loads(f.read())
> 
> 
> def cache_latest_version_by_guess():
>     global guess_list
>     req = urllib2.Request(os.path.join(RELEASE_MONITORING_API, "projects"))
>     f = urllib2.urlopen(req)
>     guess_list = json.loads(f.read())
> 
> 
> def get_latest_version(package):
>     # We first try by using the "Buildroot" distribution on
>     # release-monitoring.org, if it has a mapping for the current
>     # package name.
>     for data in distro_list["projects"]:
>         if data["name"] != package:
>             continue
>         if len(data['versions']) > 0:
>             return (True, data['versions'][0], data['id'])
>         else:
>             return (True, None, data['id'])
>     # If that fails because there is no mapping, we try to search
>     # in all packages for a package of this name.
>     for p in guess_list['projects']:
>         if p['name'] == package and len(p['versions']) > 0:
>             return (False, p['versions'][0], p['id'])
>     return (False, None, None)

I looked more closely into this, and unfortunately, it doesn't work.
Indeed, the data returned by the URL:

  RELEASE_MONITORING_API/projects/?distro=Buildroot

does not take into account the mapping between Buildroot package names
and release-monitoring.org package names, it only contains the
release-monitoring.org package names.

For example, we have a mapping samba4 -> samba, that allows
https://release-monitoring.org/api/project/Buildroot/samba4 to return
the expected result. But you won't find anything named "samba4" in
https://release-monitoring.org/api/projects/?distro=Buildroot. This
makes the entire concept of distro mapping useless.

Therefore, your proposal cannot work with the data that we can
currently download from release-monitoring.org. I have asked on the
#fedora-apps IRC channel about this.

Perhaps we could go with my v2 version on this aspect (i.e make HTTP
requests for each package), and change that later on if a better
solution is found ?

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

  parent reply	other threads:[~2018-03-21 20:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-21 22:13 [Buildroot] [PATCH next v2 0/5] New pkg-stats script, with version information Thomas Petazzoni
2018-02-21 22:13 ` [Buildroot] [PATCH next v2 1/5] support/scripts/pkg-stats-new: rewrite in Python Thomas Petazzoni
2018-02-22  1:58   ` Ricardo Martincoski
2018-03-07 22:35     ` Thomas Petazzoni
2018-02-21 22:13 ` [Buildroot] [PATCH next v2 2/5] support/scripts/pkg-stats-new: add -n and -p options Thomas Petazzoni
2018-02-24  4:54   ` Ricardo Martincoski
2018-03-07 22:35     ` Thomas Petazzoni
2018-02-21 22:13 ` [Buildroot] [PATCH next v2 3/5] support/scripts/pkg-stats-new: add current version information Thomas Petazzoni
2018-02-26  0:47   ` Ricardo Martincoski
2018-03-07 22:25     ` Thomas Petazzoni
2018-03-08  3:14       ` Ricardo Martincoski
2018-03-08  7:48         ` Thomas Petazzoni
2018-02-21 22:13 ` [Buildroot] [PATCH next v2 4/5] support/scripts/pkg-stats-new: add latest upstream " Thomas Petazzoni
2018-02-28  3:03   ` Ricardo Martincoski
2018-03-07 22:41     ` Thomas Petazzoni
2018-03-08  9:52       ` Ricardo Martincoski
2018-03-08  9:56         ` Thomas Petazzoni
2018-03-09  2:41           ` Ricardo Martincoski
2018-03-21 20:58     ` Thomas Petazzoni [this message]
2018-03-22  3:11       ` Ricardo Martincoski
2018-03-22  7:53         ` Thomas Petazzoni
2018-03-21 21:35     ` Thomas Petazzoni
2018-03-22  3:17       ` Ricardo Martincoski
2018-03-22 10:01         ` Thomas Petazzoni
2018-02-21 22:13 ` [Buildroot] [PATCH next v2 5/5] support/scripts/pkg-stats: replace with new Python version Thomas Petazzoni
2018-02-24 17:55 ` [Buildroot] [PATCH next v2 0/5] New pkg-stats script, with version information Arnout Vandecappelle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180321215824.45a5b5bc@windsurf \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox