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
Overhauling HPPrinterDrivers #175
Conversation
Due to some changes on HP's side, the HPPrinterDrivers recipe is not functioning. I have made some changes in order to fix those errors and provide greater flexibility in the recipe. ### HPSoftwareInfoProvider.py * Added additional imports * Removed Python 2 workaround * Modified HP_BASE_URL to also have a key for the query type * Added optional query * Fixed references to case-sensitive environment variables * Added new HP_QUERY_TYPE environment variable * Modified "OS" to be `operating_system` to prevent conflicts with `os` built-in. * Changed "product_number" to "HP_QUERY" as it's ProductNumber sometimes and ModelName otherwise * Used the packaging versioner to parse the version strings and figure out which is higher. It is *not* always the first one in the new schema. * Verified if the discovered url begins with `ftp` and modify it to use `https` since the HP FTP server rejects FTP requests now. Even the HP Easy Admin client tries HTTPS first. ### HPPrinterDrivers.download.recipe * Modified to use the above changes.
Oh my! I've been wanting to figure out a way to fix my HP Print Driver override for so long.... It "worked" (I guess until recently), but 98 times out of 100, it would fail at the end of the download. When I looked at it forever ago, it was (vaguely something along the lines of) an issue with curl and FTP, where curl just didn't receive the proper closing it expected on the file and thought it was corrupted, but if you renamed the temp file that curl downloads, e.g. I've just been ignoring the failure for years as it would randomly work, while hoping HP would eventually stop using FTP as the service to distribute these drivers. And I didn't notice the error had changed from what it used to be. I went to look into this again and find this PR, which is super exciting! (As much as an AutoPkg recipe, albeit working, can be.) I've tested these changes and I can confirm they work as is, but it will not work if you try to use the original method and value, e.g. using <key>HP_QUERY_TYPE</key>
<string>ProductNumber</string>
<key>HP_QUERY</key>
<string>E6B70A</string> Due to Which results in the variable 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/RecipeRepos/com.github.autopkg.n8felton-recipes/SharedProcessors/HPSoftwareInfoProvider.py", line 144, in main
parsed_url = urlparse(recent_software["FtpURL"])
UnboundLocalError: local variable 'recent_software' referenced before assignment
File "/Library/AutoPkg/autopkglib/__init__.py", line 840, in process
self.env = processor.process()
local variable 'recent_software' referenced before assignment This may want to be accounted for in the PR, but otherwise, I got an updated .pkg using the default values, with a newer .pkg version with all (actually more) of the same printer models PPDs files. Great work @primalcurve, I really appreciate the contribution. |
Great work on this! Sorry for my extended delayed response to this. I added a few extra bits to what you had. Give everything look over and if you're good with them, I'll finish up this PR. Thanks again! |
@n8felton Works great for me still. (I cleaned up some of the unnecessary output.)
|
Due to some changes on HP's side, the HPPrinterDrivers recipe is not functioning. I have made some changes in order to fix those errors and provide greater flexibility in the recipe.
HPSoftwareInfoProvider.py
operating_system
to prevent conflicts withos
built-in.ftp
and modify it to usehttps
since the HP FTP server rejects FTP requests now. Even the HP Easy Admin client tries HTTPS first.HPPrinterDrivers.download.recipe
Output of
autopkg run -vvvv