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

ChoicesXMLGenerator should specify undesired choices, not just desired choices #81

Open
homebysix opened this issue Nov 9, 2021 · 1 comment

Comments

@homebysix
Copy link
Member

homebysix commented Nov 9, 2021

I'd like to be able to use ChoicesXMLGenerator to designate which choices I don't want to install. For example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
<plist version="1.0">
<array>
     <dict>
        <key>choiceIdentifier</key>
        <string>com.corel.pkg.painter2020.zh_TW</string>
        <key>choiceAttribute</key>
        <string>selected</string>
        <key>attributeSetting</key>
        <integer>0</integer>
    </dict>
     <dict>
        <key>choiceIdentifier</key>
        <string>com.corel.pkg.painter2020.Japanese</string>
        <key>choiceAttribute</key>
        <string>selected</string>
        <key>attributeSetting</key>
        <integer>0</integer>
    </dict>
     <dict>
        <key>choiceIdentifier</key>
        <string>com.corel.pkg.painter2020.German</string>
        <key>choiceAttribute</key>
        <string>selected</string>
        <key>attributeSetting</key>
        <integer>0</integer>
    </dict>
     <dict>
        <key>choiceIdentifier</key>
        <string>com.corel.pkg.painter2020.French</string>
        <key>choiceAttribute</key>
        <string>selected</string>
        <key>attributeSetting</key>
        <integer>0</integer>
    </dict>
</array>
</plist>

This will install the default choices, with the exception of the above four components, whose attributeSetting are all set to zero.

To reproduce these choices with ChoicesXMLGenerator, I would need to specify the other components as desired, which to me seems less resilient and more prone to failure if new components are added to subsequent software versions.

  - Processor: com.github.grahampugh.recipes.commonprocessors/ChoicesXMLGenerator
    Arguments:
      choices_pkg_path: "%pkg_path%"
      choices_xml_dest: "%RECIPE_CACHE_DIR%/Scripts/choices.xml"
      desired_choices:
        - com.corel.pkg.painter2020
        - com.corel.pkg.stubhelper.painter2020
        - com.corel.Messages
        - com.corel.CUH
        - com.corel.PCU2
        - com.corel.CUH.update
        - com.corel.LaunchAgents

Ideally, the choices argument would allow eithersetting the attributeSetting to either true (1) or false (0), and would leave at the default if unspecified. A dictionary would work for this, since the choice identifiers should be unique anyway. Like so:

  - Processor: com.github.grahampugh.recipes.commonprocessors/ChoicesXMLGenerator
    Arguments:
      choices_pkg_path: "%pkg_path%"
      choices_xml_dest: "%RECIPE_CACHE_DIR%/Scripts/choices.xml"
      choice_changes:
        com.corel.pkg.painter2020.zh_TW: false
        com.corel.pkg.painter2020.Japanese: false
        com.corel.pkg.painter2020.German: false
        com.corel.pkg.painter2020.French: false

Thanks for considering!

@grahampugh
Copy link
Collaborator

grahampugh commented Feb 2, 2022

HI, for some reason I only just saw this. I kind of see your point though I'm not sure I agree that setting the desired choices is less resilient. If some new component is added, I still want my original choices to stand, at least until that new component is evaluated. But then, for the two times I've used this processor, I explicitly want to select desired choices, not deselect some. The dictionary method seems reasonably sensible though. I'll try and look into it.

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