scripts: xorg-release: handle case when version needs downgrade
PATCH 1/1 scripts: xorg-release: handle case when version needs downgrade
From: Nicolas Dechesne <[email protected]>
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...
[Thomas & Thomas:
- do not count packages more recent in Buildroot than in the latest X.org release as to be downgraded. If we have more recent version, it's generally for a good reason, so we want to keep them as is. Such packages are counted as "nothing to do", but for information, we indicate that there are "More recent"
- also remove the "nothing to do" action indicator. It used to be a simple dash, which was not really useful.
]
--- support/scripts/xorg-release | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
support/scripts/xorg-release +8 -4
@@ -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"
@@ -147,17 +148,20 @@ 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 = "More recent" + nothing_todo_pkgs += 1 else: br_version = pkg[BR_VERSION_KEY] xorg_version = pkg[XORG_VERSION_KEY] - action = "-" + action = "" nothing_todo_pkgs += 1 print FORMAT_STRING % (pkgname, br_version.center(15), xorg_version.center(15), action)
Signature · 1 line
1.8.3.2
PATCH 1/1 scripts: xorg-release: handle case when version needs downgrade
Quoted 20 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni <[email protected]> writes:
From: Nicolas Dechesne <[email protected]>
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...
[Thomas & Thomas:
- do not count packages more recent in Buildroot than in the latest X.org release as to be downgraded. If we have more recent version, it's generally for a good reason, so we want to keep them as is. Such packages are counted as "nothing to do", but for information, we indicate that there are "More recent"
Quoted 7 lines
- also remove the "nothing to do" action indicator. It used to be a simple dash, which was not really useful.
]Signed-off-by Nicolas Dechesne <[email protected]>Signed-off-by Thomas Petazzoni <[email protected]>Signed-off-by Thomas De Schampheleire <[email protected]>
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard