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

Indent block collection characters to comply with spec #861

Merged
merged 1 commit into from
Jun 20, 2023

Conversation

homebysix
Copy link
Member

As mentioned in #859, PyYAML does not indent - (and other block collection indicators) according to the YAML indentation spec.

This is a cosmetic difference, and some disagree that the indentation is counter to the spec, but the fix is simple enough and may improve compatibility with certain YAML parsers.

Test output forthcoming.

@homebysix
Copy link
Member Author

Test output

Three verbs can produce yaml recipes: new-recipe, make-override, and update-trust-info.

new-recipe

Before (dev branch):

% ./Code/autopkg new-recipe /tmp/newrecipe.check.recipe.yaml --format=yaml
Saved new recipe to /tmp/newrecipe.check.recipe.yaml

% cat /tmp/newrecipe.check.recipe.yaml
Description: Recipe description
Identifier: local.newrecipe
Input:
  NAME: newrecipe
MinimumVersion: '2.3'
Process:
- Arguments:
    Argument1: Value1
    Argument2: Value2
  Processor: ProcessorName

After:

% rm /tmp/newrecipe.check.recipe.yaml

% ./Code/autopkg new-recipe /tmp/newrecipe.check.recipe.yaml --format=yaml
Saved new recipe to /tmp/newrecipe.check.recipe.yaml

% cat /tmp/newrecipe.check.recipe.yaml
Description: Recipe description
Identifier: local.newrecipe
Input:
  NAME: newrecipe
MinimumVersion: '2.3'
Process:
  - Arguments:
      Argument1: Value1
      Argument2: Value2
    Processor: ProcessorName

make-override

Before (dev branch):

% ./Code/autopkg make-override coconutBattery.munki --format=yaml
Override file saved to ~/Library/AutoPkg/RecipeOverrides/coconutBattery.munki.recipe.yaml

% cat ~/Library/AutoPkg/RecipeOverrides/coconutBattery.munki.recipe.yaml
Identifier: local.munki.coconutBattery
Input:
  MUNKI_REPO_SUBDIR: apps/%NAME%
  NAME: coconutBattery
  pkginfo:
    catalogs:
    - testing
    description: Displays info about your laptop battery.
    developer: Christoph Sinai
    display_name: coconutBattery
    name: '%NAME%'
    unattended_install: true
ParentRecipe: com.github.homebysix.munki.coconutBattery
ParentRecipeTrustInfo:
  non_core_processors: {}
  parent_recipes:
    com.github.homebysix.download.coconutBattery:
      git_hash: 9b0234d95b80ae32897d954ef507d569599a6918
      path: ~/Library/AutoPkg/RecipeRepos/com.github.autopkg.homebysix-recipes/coconutBattery/coconutBattery.download.recipe
      sha256_hash: 54aa4af7cf13ea1de224bc6a103adec2f23d58ba01e22a93f1afda853b284dc7
    com.github.homebysix.munki.coconutBattery:
      git_hash: ce2e59330b7039cefcab2975af9fc2b47334305d
      path: ~/Library/AutoPkg/RecipeRepos/com.github.autopkg.homebysix-recipes/coconutBattery/coconutBattery.munki.recipe
      sha256_hash: 1edc338e95235e1a5a6b5d468b33abc97ec85adc65ef8192a31a6e48d5402116

After:

% rm ~/Library/AutoPkg/RecipeOverrides/coconutBattery.munki.recipe.yaml

% ./Code/autopkg make-override coconutBattery.munki --format=yaml
Override file saved to ~/Library/AutoPkg/RecipeOverrides/coconutBattery.munki.recipe.yaml

% cat ~/Library/AutoPkg/RecipeOverrides/coconutBattery.munki.recipe.yaml
Identifier: local.munki.coconutBattery
Input:
  MUNKI_REPO_SUBDIR: apps/%NAME%
  NAME: coconutBattery
  pkginfo:
    catalogs:
      - testing
    description: Displays info about your laptop battery.
    developer: Christoph Sinai
    display_name: coconutBattery
    name: '%NAME%'
    unattended_install: true
ParentRecipe: com.github.homebysix.munki.coconutBattery
ParentRecipeTrustInfo:
  non_core_processors: {}
  parent_recipes:
    com.github.homebysix.download.coconutBattery:
      git_hash: 9b0234d95b80ae32897d954ef507d569599a6918
      path: ~/Library/AutoPkg/RecipeRepos/com.github.autopkg.homebysix-recipes/coconutBattery/coconutBattery.download.recipe
      sha256_hash: 54aa4af7cf13ea1de224bc6a103adec2f23d58ba01e22a93f1afda853b284dc7
    com.github.homebysix.munki.coconutBattery:
      git_hash: ce2e59330b7039cefcab2975af9fc2b47334305d
      path: ~/Library/AutoPkg/RecipeRepos/com.github.autopkg.homebysix-recipes/coconutBattery/coconutBattery.munki.recipe
      sha256_hash: 1edc338e95235e1a5a6b5d468b33abc97ec85adc65ef8192a31a6e48d5402116

update-trust-info

Before (dev branch):

% ./Code/autopkg update-trust-info coconutBattery.munki
Wrote updated ~/Library/AutoPkg/RecipeOverrides/coconutBattery.munki.recipe.yaml

% cat ~/Library/AutoPkg/RecipeOverrides/coconutBattery.munki.recipe.yaml
Identifier: local.munki.coconutBattery
Input:
  MUNKI_REPO_SUBDIR: apps/%NAME%
  NAME: coconutBattery
  pkginfo:
    catalogs:
    - testing
    description: Displays info about your laptop battery.
    developer: Christoph Sinai
    display_name: coconutBattery
    name: '%NAME%'
    unattended_install: true
ParentRecipe: com.github.homebysix.munki.coconutBattery
ParentRecipeTrustInfo:
  non_core_processors: {}
  parent_recipes:
    com.github.homebysix.download.coconutBattery:
      git_hash: 9b0234d95b80ae32897d954ef507d569599a6918
      path: ~/Library/AutoPkg/RecipeRepos/com.github.autopkg.homebysix-recipes/coconutBattery/coconutBattery.download.recipe
      sha256_hash: 54aa4af7cf13ea1de224bc6a103adec2f23d58ba01e22a93f1afda853b284dc7
    com.github.homebysix.munki.coconutBattery:
      git_hash: ce2e59330b7039cefcab2975af9fc2b47334305d
      path: ~/Library/AutoPkg/RecipeRepos/com.github.autopkg.homebysix-recipes/coconutBattery/coconutBattery.munki.recipe
      sha256_hash: 1edc338e95235e1a5a6b5d468b33abc97ec85adc65ef8192a31a6e48d5402116

After:

% ./Code/autopkg update-trust-info coconutBattery.munki
Wrote updated ~/Library/AutoPkg/RecipeOverrides/coconutBattery.munki.recipe.yaml

% cat ~/Library/AutoPkg/RecipeOverrides/coconutBattery.munki.recipe.yaml
Identifier: local.munki.coconutBattery
Input:
  MUNKI_REPO_SUBDIR: apps/%NAME%
  NAME: coconutBattery
  pkginfo:
    catalogs:
      - testing
    description: Displays info about your laptop battery.
    developer: Christoph Sinai
    display_name: coconutBattery
    name: '%NAME%'
    unattended_install: true
ParentRecipe: com.github.homebysix.munki.coconutBattery
ParentRecipeTrustInfo:
  non_core_processors: {}
  parent_recipes:
    com.github.homebysix.download.coconutBattery:
      git_hash: 9b0234d95b80ae32897d954ef507d569599a6918
      path: ~/Library/AutoPkg/RecipeRepos/com.github.autopkg.homebysix-recipes/coconutBattery/coconutBattery.download.recipe
      sha256_hash: 54aa4af7cf13ea1de224bc6a103adec2f23d58ba01e22a93f1afda853b284dc7
    com.github.homebysix.munki.coconutBattery:
      git_hash: ce2e59330b7039cefcab2975af9fc2b47334305d
      path: ~/Library/AutoPkg/RecipeRepos/com.github.autopkg.homebysix-recipes/coconutBattery/coconutBattery.munki.recipe
      sha256_hash: 1edc338e95235e1a5a6b5d468b33abc97ec85adc65ef8192a31a6e48d5402116

@homebysix homebysix changed the base branch from master to dev June 20, 2023 02:42
@homebysix homebysix merged commit 47a7b0f into autopkg:dev Jun 20, 2023
1 check passed
@homebysix homebysix deleted the yaml-dump-indent branch June 20, 2023 02:42
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

Successfully merging this pull request may close these issues.

None yet

1 participant