autopkg / apizz-recipes

MIT License
14 stars 23 forks source link

Fix empty pkginfo_repo_path GoogleDrive #73

Closed reneski closed 1 year ago

reneski commented 1 year ago

If GoogleDrive.munki.recipe is executed but the same App version is already in the munki repo it returns an error that no pkginfo repo path is set:

PkgCopier: Mounted disk image /Users/edv/Library/AutoPkg/Cache/local.munki.GoogleDrive/downloads/GoogleDrive.dmg
PkgCopier: Copied /private/tmp/dmg.C36MG7/GoogleDrive.pkg to /Users/edv/Library/AutoPkg/Cache/local.munki.GoogleDrive/GoogleDrive-66.0.3.pkg
MunkiPkginfoMerger
MunkiPkginfoMerger: Merged {'minimum_os_version': '10.13', 'version': '66.0.3'} into pkginfo
MunkiImporter
MunkiImporter: Using repo lib: AutoPkgLib
MunkiImporter:         plugin: FileRepo
MunkiImporter:           repo: /Volumes/munki_repo
MunkiImporter: Item GoogleDrive.dmg already exists in the munki repo as pkgs/apps/googledrive/GoogleDrive-66.0.3.dmg.
MunkiOptionalReceiptEditor
You must specify at least one pkginfo repo path
Failed.
Receipt written to /Users/edv/Library/AutoPkg/Cache/local.munki.GoogleDrive/receipts/GoogleDrive-receipt-20221116-164603.plist

The following recipes failed:
    GoogleDrive.munki
        Error in local.munki.GoogleDrive: Processor: MunkiOptionalReceiptEditor: Error: You must specify at least one pkginfo repo path

The following packages were copied:
    Pkg Path                                                                         
    --------                                                                         
    /Users/edv/Library/AutoPkg/Cache/local.munki.GoogleDrive/GoogleDrive-66.0.3.pk

With this commit (thanks to gerardkok) it stops the process without an error:

PkgCopier: Mounted disk image /Users/edv/Library/AutoPkg/Cache/local.munki.GoogleDrive/downloads/GoogleDrive.dmg
PkgCopier: Copied /private/tmp/dmg.WYnIlq/GoogleDrive.pkg to /Users/edv/Library/AutoPkg/Cache/local.munki.GoogleDrive/GoogleDrive-66.0.3.pkg
MunkiPkginfoMerger
MunkiPkginfoMerger: Merged {'minimum_os_version': '10.13', 'version': '66.0.3'} into pkginfo
MunkiImporter
MunkiImporter: Using repo lib: AutoPkgLib
MunkiImporter:         plugin: FileRepo
MunkiImporter:           repo: /Volumes/munki_repo
MunkiImporter: Item GoogleDrive.dmg already exists in the munki repo as pkgs/apps/googledrive/GoogleDrive-66.0.3.dmg.
StopProcessingIf
StopProcessingIf: (pkginfo_repo_path == '') is True
Receipt written to /Users/edv/Library/AutoPkg/Cache/local.munki.GoogleDrive/receipts/GoogleDrive-receipt-20221116-165506.plist

The following packages were copied:
    Pkg Path                                                                         
    --------                                                                         
    /Users/edv/Library/AutoPkg/Cache/local.munki.GoogleDrive/GoogleDrive-66.0.3.pkg 
apizz commented 1 year ago

Handled this differently per 34dcc206d66da58be64a180ae37173bf51c6e1a8. This instead checks if we've actually imported something, and only then do we try to update the receipts.

Confirms on my end this works as expected.