[haiku-commits] Change in haiku[master]: tools/hardlink_packages: Fix parsing of package versions.

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 16 Oct 2020 21:00:29 +0000

From Alex von Gluck IV <kallisti5@xxxxxxxxxxx>:

Alex von Gluck IV has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/3324 ;)


Change subject: tools/hardlink_packages: Fix parsing of package versions.
......................................................................

tools/hardlink_packages: Fix parsing of package versions.

Change-Id: I8f15522b898ad4069d643c879819ece41f46bc5d
---
M src/tools/hardlink_packages.py
1 file changed, 7 insertions(+), 5 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/24/3324/1

diff --git a/src/tools/hardlink_packages.py b/src/tools/hardlink_packages.py
index 125287b..a95996a 100755
--- a/src/tools/hardlink_packages.py
+++ b/src/tools/hardlink_packages.py
@@ -6,9 +6,11 @@
 #
 # Copyright 2017-2020 Augustin Cavalier <waddlesplash>
 # Distributed under the terms of the MIT License.
+#
+# pip3 install packaging

 import sys, os, subprocess, re, hashlib
-from distutils.version import LooseVersion
+from pkg_resources import parse_version

 if len(sys.argv) != 5:
        print("usage: hardlink_packages.py [arch] [jam RemotePackageRepository 
file] "
@@ -68,10 +70,10 @@

                greatestVersion = None
                for pkgVersion in packageVersions:
-                       if (pkgVersion.startswith(pkgname + '-') and
-                                       ((greatestVersion == None)
-                                               or (LooseVersion(pkgVersion) > 
LooseVersion(greatestVersion)))):
-                               greatestVersion = pkgVersion
+                       if (pkgVersion.startswith(pkgname + '-')):
+                               #print(pkgVersion + " > " + 
str(greatestVersion) + "?")
+                               if ((greatestVersion == None) or 
parse_version(pkgVersion) > parse_version(greatestVersion)):
+                                       greatestVersion = pkgVersion
                if (greatestVersion == None):
                        print("not found: " + pkg)
                        newFileForJam.append(line)

--
To view, visit https://review.haiku-os.org/c/haiku/+/3324
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I8f15522b898ad4069d643c879819ece41f46bc5d
Gerrit-Change-Number: 3324
Gerrit-PatchSet: 1
Gerrit-Owner: Alex von Gluck IV <kallisti5@xxxxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: tools/hardlink_packages: Fix parsing of package versions. - Gerrit