Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RemoteUpdateManager.pkg fails with AutoPkg 2.7 #84

Open
davidbpirie opened this issue Oct 11, 2022 · 2 comments
Open

RemoteUpdateManager.pkg fails with AutoPkg 2.7 #84

davidbpirie opened this issue Oct 11, 2022 · 2 comments

Comments

@davidbpirie
Copy link

RemoteUpdateManager.pkg is failing under AutoPkg 2.7 in the URLTextSearcher processor:

URLTextSearcher
{'Input': {'re_pattern': 'CFBundleShortVersionString\s+([\d.]+)',
'result_output_var_name': 'version',
'url': 'file:///Users/username/Library/AutoPkg/Cache/com.github.moofit-recipes.pkg.RemoteUpdateManager/payload/usr/local/bin/RemoteUpdateManager'}}
Traceback (most recent call last):
File "/Library/AutoPkg/autopkglib/init.py", line 840, in process
self.env = processor.process()
File "/Library/AutoPkg/autopkglib/init.py", line 626, in process
self.main()
File "/Library/AutoPkg/autopkglib/URLTextSearcher.py", line 121, in main
content = self.download_with_curl(curl_cmd)
File "/Library/AutoPkg/autopkglib/URLGetter.py", line 186, in download_with_curl
proc_stdout, proc_stderr, retcode = self.execute_curl(curl_cmd, text)
File "/Library/AutoPkg/autopkglib/URLGetter.py", line 172, in execute_curl
result = subprocess.run(
File "/Library/AutoPkg/Python3/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 503, in run
stdout, stderr = process.communicate(input, timeout=timeout)
File "/Library/AutoPkg/Python3/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 1152, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
File "/Library/AutoPkg/Python3/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 2041, in _communicate
stdout = self._translate_newlines(stdout,
File "/Library/AutoPkg/Python3/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 1029, in _translate_newlines
data = data.decode(encoding, errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xca in position 0: invalid continuation byte
File "/Library/AutoPkg/autopkglib/init.py", line 840, in process
self.env = processor.process()
'utf-8' codec can't decode byte 0xca in position 0: invalid continuation byte
Failed.

I had another mac running AutoPkg 2.3.1 and tried it there and it completed successfully, so I believe it to be caused by a change to AutoPkg which now includes Python 3.10.6 and PyObjc 8.5.

@mpanighetti
Copy link
Contributor

Ideally you could change the version check mechanism to not curl the binary, which I imagine could be an error-prone process in general since compiled binaries aren't made to have directly parseable text. Possible alternatives would be to query the tool itself by running /path/to/RemoteUpdateManager --help, or to extract the Info.plist content using an Apple-supported workflow such as launchctl plist /path/to/RemoteUpdateManager, then parsing that output. But I don't think either of these are currently offered in AutoPkg processors, so you'd have to write your own shared processor (though I could imagine that adding launchctl plist support for Versioner would be a useful addition to that processor's functionality).

@mpanighetti
Copy link
Contributor

Recipe continues to fail with the above error in AutoPkg 2.7.2, but I've submitted #89 to address this issue by switching to the BinaryFileVersioner shared processor, which uses launchctl plist to read version data in an approved manner and avoids the curl error in my testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants