autopkg / bnpl-recipes

AutoPkg recipes
MIT License
4 stars 14 forks source link

JetBrains recipe improvements #57

Closed apizz closed 2 years ago

apizz commented 2 years ago

~The core intention of this change was to add the ability for admins to specify for a JetBrains item whether or not they wanted an Intel or Apple silicon version. However, I added some additional improvements as well.~

~Given that creating an override will add input variables into the resulting recipe, I opted not to add to every single JetBrains app .download or .munki recipe and only added to description. But if you want to be more explicit that's totally fine. That said, adding this new ARCHITECTURE input variable would cause existing overrides to break since updating trust will not update the input vars. There may be a better way to handle that piece.~

Summary of changes:

~- Add ARCHITECTURE Input variable to allow specifying 'mac' for Intel-based distros or 'macM1' for Apple Silicon~

Output from successful run with PyCharm-PE.munki.recipe ~when specified for M1~:

autopkg run -vv ./PyCharm-PE.munki.recipe                                    16:17:55
Processing ./PyCharm-PE.munki.recipe...
WARNING: ./PyCharm-PE.munki.recipe is missing trust info and FAIL_RECIPES_WITHOUT_TRUST_INFO is not set. Proceeding...
URLTextSearcher
{'Input': {'re_pattern': '"macM1":{"link":"(https://download.jetbrains.com/.*?.dmg)"',
           'request_headers': {'user-agent': 'Mozilla/5.0 (Macintosh; Intel '
                                             'Mac OS X 10.11; rv:46.0) '
                                             'Gecko/20100101 Firefox/46.0'},
           'url': 'https://data.services.jetbrains.com/products/releases?code=PCP&latest=true&type=release'}}
URLTextSearcher: No value supplied for result_output_var_name, setting default value of: match
URLTextSearcher: Found matching text (match): https://download.jetbrains.com/python/pycharm-professional-2021.3.2.dmg
{'Output': {'match': 'https://download.jetbrains.com/python/pycharm-professional-2021.3.2-aarch64.dmg'}}
URLDownloader
{'Input': {'request_headers': {'user-agent': 'Mozilla/5.0 (Macintosh; Intel '
                                             'Mac OS X 10.11; rv:46.0) '
                                             'Gecko/20100101 Firefox/46.0'},
           'url': 'https://download.jetbrains.com/python/pycharm-professional-2021.3.2-aarch64.dmg'}}
URLDownloader: No value supplied for prefetch_filename, setting default value of: False
URLDownloader: No value supplied for CHECK_FILESIZE_ONLY, setting default value of: False
URLDownloader: Storing new Last-Modified header: Fri, 28 Jan 2022 18:10:10 GMT
URLDownloader: Storing new ETag header: "4ea7211ca0f9ef60891d9851522afc03-75"
URLDownloader: Downloaded /Users/autopkgadmin/Library/AutoPkg/Cache/com.github.bnpl.autopkg.munki.pycharmpe/downloads/pycharm-professional-2021.3.2-aarch64.dmg
{'Output': {'download_changed': True,
            'etag': '"4ea7211ca0f9ef60891d9851522afc03-75"',
            'last_modified': 'Fri, 28 Jan 2022 18:10:10 GMT',
            'pathname': '/Users/autopkgadmin/Library/AutoPkg/Cache/com.github.bnpl.autopkg.munki.pycharmpe/downloads/pycharm-professional-2021.3.2-aarch64.dmg',
            'url_downloader_summary_result': {'data': {'download_path': '/Users/autopkgadmin/Library/AutoPkg/Cache/com.github.bnpl.autopkg.munki.pycharmpe/downloads/pycharm-professional-2021.3.2-aarch64.dmg'},
                                              'summary_text': 'The following '
                                                              'new items were '
                                                              'downloaded:'}}}
FileFinder
{'Input': {'pattern': '/Users/autopkgadmin/Library/AutoPkg/Cache/com.github.bnpl.autopkg.munki.pycharmpe/downloads/pycharm-professional-2021.3.2-aarch64.dmg/*.app'}}
FileFinder: No value supplied for find_method, setting default value of: glob
FileFinder: Mounted disk image /Users/autopkgadmin/Library/AutoPkg/Cache/com.github.bnpl.autopkg.munki.pycharmpe/downloads/pycharm-professional-2021.3.2-aarch64.dmg
FileFinder: Found file match: '/private/tmp/dmg.dyCiJB/PyCharm.app' from globbed '/private/tmp/dmg.dyCiJB/*.app'
FileFinder: DMG-relative file match: 'PyCharm.app'
{'Output': {'dmg_found_filename': 'PyCharm.app',
            'found_filename': '/private/tmp/dmg.dyCiJB/PyCharm.app'}}
PlistReader
{'Input': {'info_path': '/Users/autopkgadmin/Library/AutoPkg/Cache/com.github.bnpl.autopkg.munki.pycharmpe/downloads/pycharm-professional-2021.3.2-aarch64.dmg/PyCharm.app',
           'plist_keys': {'CFBundleShortVersionString': 'version',
                          'LSMinimumSystemVersion': 'min_os_vers'}}}
PlistReader: Mounted disk image /Users/autopkgadmin/Library/AutoPkg/Cache/com.github.bnpl.autopkg.munki.pycharmpe/downloads/pycharm-professional-2021.3.2-aarch64.dmg
PlistReader: Reading: /private/tmp/dmg.fwZ0cY/PyCharm.app/Contents/Info.plist
PlistReader: Assigning value of '2021.3.2' to output variable 'version'
PlistReader: Assigning value of '10.8' to output variable 'min_os_vers'
{'Output': {'plist_reader_output_variables': {'min_os_vers': '10.8',
                                              'version': '2021.3.2'}}}
CodeSignatureVerifier
{'Input': {'input_path': '/Users/autopkgadmin/Library/AutoPkg/Cache/com.github.bnpl.autopkg.munki.pycharmpe/downloads/pycharm-professional-2021.3.2-aarch64.dmg/PyCharm.app',
           'requirement': 'identifier "com.jetbrains.pycharm" and anchor apple '
                          'generic and certificate '
                          '1[field.1.2.840.113635.100.6.2.6] /* exists */ and '
                          'certificate leaf[field.1.2.840.113635.100.6.1.13] '
                          '/* exists */ and certificate leaf[subject.OU] = '
                          '"2ZEFAR8TH3"',
           'strict_verification': True}}
CodeSignatureVerifier: Mounted disk image /Users/autopkgadmin/Library/AutoPkg/Cache/com.github.bnpl.autopkg.munki.pycharmpe/downloads/pycharm-professional-2021.3.2-aarch64.dmg
CodeSignatureVerifier: Verifying code signature...
CodeSignatureVerifier: Deep verification enabled...
CodeSignatureVerifier: Strict verification enabled...
CodeSignatureVerifier: /private/tmp/dmg.3iNjFM/PyCharm.app: valid on disk
CodeSignatureVerifier: /private/tmp/dmg.3iNjFM/PyCharm.app: satisfies its Designated Requirement
CodeSignatureVerifier: /private/tmp/dmg.3iNjFM/PyCharm.app: explicit requirement satisfied
CodeSignatureVerifier: Signature is valid
{'Output': {}}
EndOfCheckPhase
{'Input': {}}
{'Output': {}}
MunkiImporter
{'Input': {'MUNKI_REPO': '/Users/Shared/munki_repo',
           'munkiimport_appname': 'PyCharm.app',
           'pkg_path': '/Users/autopkgadmin/Library/AutoPkg/Cache/com.github.bnpl.autopkg.munki.pycharmpe/downloads/pycharm-professional-2021.3.2-aarch64.dmg',
           'pkginfo': {'catalogs': ['testing'],
                       'category': 'Developer Tools',
                       'description': 'Python IDE for professional developers\n'
                                      '\n'
                                      'https://www.jetbrains.com/pycharm',
                       'developer': 'JetBrains',
                       'display_name': 'PyCharm Professional Edition',
                       'name': 'PyCharm Professional Edition',
                       'unattended_install': True,
                       'unattended_uninstall': True,
                       'uninstallable': True},
           'repo_subdirectory': 'apps/jetbrains'}}
MunkiImporter: No value supplied for MUNKI_REPO_PLUGIN, setting default value of: FileRepo
MunkiImporter: No value supplied for MUNKILIB_DIR, setting default value of: /usr/local/munki
MunkiImporter: No value supplied for force_munki_repo_lib, setting default value of: False
MunkiImporter: Using repo lib: AutoPkgLib
MunkiImporter:         plugin: FileRepo
MunkiImporter:           repo: /Users/Shared/munki_repo
MunkiImporter: Copied pkginfo to: /Users/Shared/munki_repo/pkgsinfo/apps/jetbrains/PyCharm Professional Edition-2021.3.2.plist
MunkiImporter:            pkg to: /Users/Shared/munki_repo/pkgs/apps/jetbrains/pycharm-professional-2021.3.2.dmg
{'Output': {'munki_importer_summary_result': {'data': {'catalogs': 'testing',
                                                       'icon_repo_path': '',
                                                       'name': 'PyCharm '
                                                               'Professional '
                                                               'Edition',
                                                       'pkg_repo_path': 'apps/jetbrains/pycharm-professional-2021.3.2.dmg',
                                                       'pkginfo_path': 'apps/jetbrains/PyCharm '
                                                                       'Professional '
                                                                       'Edition-2021.3.2.plist',
                                                       'version': '2021.3.2'},
                                              'report_fields': ['name',
                                                                'version',
                                                                'catalogs',
                                                                'pkginfo_path',
                                                                'pkg_repo_path',
                                                                'icon_repo_path'],
                                              'summary_text': 'The following '
                                                              'new items were '
                                                              'imported into '
                                                              'Munki:'},
            'munki_info': {'_metadata': {'created_by': 'autopkgadmin',
                                         'creation_date': datetime.datetime(2022, 2, 9, 21, 18, 55),
                                         'munki_version': '5.6.2.4398',
                                         'os_version': '12.1'},
                           'autoremove': False,
                           'catalogs': ['testing'],
                           'category': 'Developer Tools',
                           'description': 'Python IDE for professional '
                                          'developers\n'
                                          '\n'
                                          'https://www.jetbrains.com/pycharm',
                           'developer': 'JetBrains',
                           'display_name': 'PyCharm Professional Edition',
                           'installer_item_hash': '188b998660e7cfb7ac1364c818c008a5608ab2aeb17c6cc19d1d9dda547d3775',
                           'installer_item_location': 'apps/jetbrains/pycharm-professional-2021.3.2.dmg',
                           'installer_item_size': 612520,
                           'installer_type': 'copy_from_dmg',
                           'installs': [{'CFBundleIdentifier': 'com.jetbrains.pycharm',
                                         'CFBundleName': 'PyCharm',
                                         'CFBundleShortVersionString': '2021.3.2',
                                         'CFBundleVersion': 'PY-213.6777.50',
                                         'minosversion': '10.8',
                                         'path': '/Applications/PyCharm.app',
                                         'type': 'application',
                                         'version_comparison_key': 'CFBundleShortVersionString'}],
                           'items_to_copy': [{'destination_path': '/Applications',
                                              'source_item': 'PyCharm.app'}],
                           'minimum_os_version': '10.8',
                           'name': 'PyCharm Professional Edition',
                           'unattended_install': True,
                           'unattended_uninstall': True,
                           'uninstall_method': 'remove_copied_items',
                           'uninstallable': True,
                           'version': '2021.3.2'},
            'munki_repo_changed': True,
            'pkg_repo_path': '/Users/Shared/munki_repo/pkgs/apps/jetbrains/pycharm-professional-2021.3.2.dmg',
            'pkginfo_repo_path': '/Users/Shared/munki_repo/pkgsinfo/apps/jetbrains/PyCharm '
                                 'Professional Edition-2021.3.2.plist'}}
Receipt written to /Users/autopkgadmin/Library/AutoPkg/Cache/com.github.bnpl.autopkg.munki.pycharmpe/receipts/PyCharm-PE.munki-receipt-20220209-161856.plist

The following new items were downloaded:
    Download Path                                                                                                         
    -------------                                                                                                         
    /Users/autopkgadmin/Library/AutoPkg/Cache/com.github.bnpl.autopkg.munki.pycharmpe/downloads/pycharm-professional-2021.3.2.dmg  

The following new items were imported into Munki:
    Name                          Version   Catalogs  Pkginfo Path                                                Pkg Repo Path                                     Icon Repo Path  
    ----                          -------   --------  ------------                                                -------------                                     --------------  
    PyCharm Professional Edition  2021.3.2  testing   apps/jetbrains/PyCharm Professional Edition-2021.3.2.plist  apps/jetbrains/pycharm-professional-2021.3.2.dmg     
apizz commented 2 years ago

😞 annnnnd I'm just now realizing that despite having a DMG download for Intel & Apple Silicon that it's just a universal app! Going to make some tweaks here because I think the other improvements are beneficial