repoclean: TypeError: '<' not supported between instances of 'str' and 'int'

26 views
Skip to first unread message

b...@macmule.com

unread,
Jan 3, 2023, 6:19:12 AM1/3/23
to munki-dev
This is more of an FYI than a bug to be addresses as such.

But, we've found repoclean to error as per:

/usr/local/munki/repoclean -k1 /Users/Shared/munki_repo
Using repo url: file:///Users/Shared/munki_repo
Analyzing manifest files...
Analyzing pkginfo files...
Analyzing installer items...
name: FreeCAD
catalogs: production
minimum_os_version: 10.4.0
[not in any manifests]
versions:
Traceback (most recent call last):
File "/usr/local/munki/repoclean", line 538, in <module>
main()
File "/usr/local/munki/repoclean", line 535, in main
RepoCleaner(repo, options).clean()
File "/usr/local/munki/repoclean", line 452, in clean
self.find_cleanup_items()
File "/usr/local/munki/repoclean", line 304, in find_cleanup_items
for version in sorted(list(self.pkginfodb[key].keys()),
File "/usr/local/munki/Python.framework/Versions/3.9/lib/python3.9/distutils/version.py", line 52, in __lt__
c = self._cmp(other)
File "/usr/local/munki/Python.framework/Versions/3.9/lib/python3.9/distutils/version.py", line 341, in _cmp
if self.version < other.version:
TypeError: '<' not supported between instances of 'str' and 'int'


In investigating this, it appears that the issue is with the LooseVersion comparison within distutils. And as that has been deprecated in Python 3.10 (https://peps.python.org/pep-0632/), I'm posting here to advise.

The issue came about with FreeCAD and it changing it's versions from 0.20-29177 to 0.20.2-29603.

Might not seem like a big change, LooseVersion splits the version into a tuple and them compares each.

So the above become:
  •  [0, 20, '-', 29177]
  •  [0, 20, 2, '-', 29603]

What seems to happen is that '-' is compared against '2', resulting in this error.

This isn't something that can be addressed in Munki, and I'm not sure if addressed in the newer versioning module or what the plans are for LooseVersion with Python 3.10+ within Munki etc.

Just sharing as tracked it down and decided the "fix" is to ,manually remove the offending items.

Greg Neagle

unread,
Jan 3, 2023, 12:41:11 PM1/3/23
to munki-dev
I wonder why managedsoftwareupdate isn’t encountering the same issue when doing version comparisons with that set of items...

--
Find related discussion groups here:
https://github.com/munki/munki/wiki/Discussion-Group
---
You received this message because you are subscribed to the Google Groups "munki-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to munki-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/munki-dev/f07d51dd-be52-4b98-b90a-474751fe7796n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages