From: Nicolas Dechesne <ndec13@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] scripts: xorg-release: handle case when version needs downgrade
Date: Mon, 4 Feb 2013 23:47:41 +0100 [thread overview]
Message-ID: <1360018061-6834-1-git-send-email-ndec13@gmail.com> (raw)
the initial implementation assumes that when a version found in
buildroot is different from the one in the X11 release, it
requires an upgrade. even though this is most likely the case, it
could be a downgrade too, and it's probably worth highlighting
such cases when it (rarely) happens.
LooseVersion from distutils is doing the low level job of sorting
version numbers represented in strings...
Signed-off-by: Nicolas Dechesne <ndec13@gmail.com>
---
support/scripts/xorg-release | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/support/scripts/xorg-release b/support/scripts/xorg-release
index 70ba41c..4e18c68 100755
--- a/support/scripts/xorg-release
+++ b/support/scripts/xorg-release
@@ -9,6 +9,7 @@ import BeautifulSoup
import re
import os
import urllib
+from distutils.version import LooseVersion
# This can be customized
XORG_VERSION = "X11R7.7"
@@ -131,6 +132,7 @@ def show_summary(packages):
pkgs.sort()
total_pkgs = 0
upgrade_pkgs = 0
+ downgrade_pkgs = 0
add_pkgs = 0
remove_pkgs = 0
nothing_todo_pkgs = 0
@@ -147,13 +149,16 @@ def show_summary(packages):
xorg_version = "N/A"
action = "Remove from Buildroot"
remove_pkgs += 1
- # For now, we assume that if a package version is different,
- # it's because an upgrade is needed.
- elif pkg[XORG_VERSION_KEY] != pkg[BR_VERSION_KEY]:
+ elif LooseVersion(pkg[XORG_VERSION_KEY]) > LooseVersion(pkg[BR_VERSION_KEY]):
br_version = pkg[BR_VERSION_KEY]
xorg_version = pkg[XORG_VERSION_KEY]
action = "Upgrade"
upgrade_pkgs += 1
+ elif LooseVersion(pkg[XORG_VERSION_KEY]) < LooseVersion(pkg[BR_VERSION_KEY]):
+ br_version = pkg[BR_VERSION_KEY]
+ xorg_version = pkg[XORG_VERSION_KEY]
+ action = "Downgrade"
+ downgrade_pkgs += 1
else:
br_version = pkg[BR_VERSION_KEY]
xorg_version = pkg[XORG_VERSION_KEY]
@@ -165,6 +170,7 @@ def show_summary(packages):
STAT_FORMAT_STRING = "%40s : %3d"
print STAT_FORMAT_STRING % ("Total number of packages", total_pkgs)
print STAT_FORMAT_STRING % ("Packages to upgrade", upgrade_pkgs)
+ print STAT_FORMAT_STRING % ("Packages to downgrade", downgrade_pkgs)
print STAT_FORMAT_STRING % ("Packages to add", add_pkgs)
print STAT_FORMAT_STRING % ("Packages to remove", remove_pkgs)
print STAT_FORMAT_STRING % ("Packages with nothing to do", nothing_todo_pkgs)
--
1.7.10.4
next reply other threads:[~2013-02-04 22:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-04 22:47 Nicolas Dechesne [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-02-04 9:26 [Buildroot] [PATCH] scripts: xorg-release: handle case when version needs downgrade Thomas Petazzoni
2014-02-04 9:32 ` Peter Korsgaard
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=1360018061-6834-1-git-send-email-ndec13@gmail.com \
--to=ndec13@gmail.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