packages icon indicating copy to clipboard operation
packages copied to clipboard

package_checks: output dep lists with proper offset

Open Staudey opened this issue 1 year ago • 4 comments

Summary

Change loader/dumper to ruamel to enable putting out dependency lists with proper offset and colon spacing. This way the output can directly be copied and pasted into the recipe.

Note: I couldn't find a way to do this with pyyaml; Dumper implementation adopted from ruamel docs. I also couldn't get top_level_colon_align to work for some reason, so in cases of very short subpackage names with dependencies the colon might be placed too far to the left (not 100% sure if there is such a case in the repo; the "^g++" case happens to perfectly align)

Resolves https://github.com/getsolus/packages/issues/3924

Test Plan

Old output budgie-desktop-branding:

- breeze-cursor-theme
- budgie-backgrounds
- budgie-desktop
- font-hack-ttf
- livecd:
  - budgie-desktop-branding
  - test
- materia-gtk-theme
- materia-gtk-theme-dark
- noto-sans-ttf
- noto-serif-ttf
- papirus-icon-theme
- qtstyleplugins
- solus-artwork
- test

New output budgie-desktop-branding:

    - breeze-cursor-theme
    - budgie-backgrounds
    - budgie-desktop
    - font-hack-ttf
    - livecd :
        - budgie-desktop-branding
        - test
    - materia-gtk-theme
    - materia-gtk-theme-dark
    - noto-sans-ttf
    - noto-serif-ttf
    - papirus-icon-theme
    - qtstyleplugins
    - solus-artwork
    - test

Old output gcc rundeps:

- ^g++: gcc
- ^gfortran:
  - gcc
  - libgfortran
- ^libgcc-32bit: libgcc
- ^libgfortran-32bit: libgfortran
- ^libgomp-32bit:
  - libgcc-32bit
  - libgomp
- ^libstdc++-32bit: libstdc++
- mpc
- mpfr
- test

New output gcc rundeps:

    - ^g++ : gcc
    - ^gfortran :
        - gcc
        - libgfortran
    - ^libgcc-32bit : libgcc
    - ^libgfortran-32bit : libgfortran
    - ^libgomp-32bit :
        - libgcc-32bit
        - libgomp
    - ^libstdc++-32bit : libstdc++
    - mpc
    - mpfr
    - test

Checklist

  • [x] Package was built and tested against unstable

Staudey avatar Sep 26 '24 11:09 Staudey

https://github.com/getsolus/packages/blob/0e04a2d586d70d0d66de13d63df9fc17582aa3e5/.github/workflows/script_lint.yml#L36

I guess this will need

requirements:
  - ruamel.yaml
  - types-PyYAML

or something to properly clear CI?

Locally I still get an error though

package_checks.py:470:33: error: Incompatible types in assignment (expression has type "str", variable has type "None")  [assignment]
Found 1 error in 1 file (checked 1 source file)

Not sure how I can resolve that

Staudey avatar Sep 26 '24 11:09 Staudey

https://github.com/getsolus/packages/blob/0e04a2d586d70d0d66de13d63df9fc17582aa3e5/.github/workflows/script_lint.yml#L36

I guess this will need

requirements:
  - ruamel.yaml
  - types-PyYAML

or something to properly clear CI?

Maybe, if ruamel.yaml provides the correct type annotations to work.

The ruamel.yaml dependency should also be included in package_lint.yaml (no idea how though).

Locally I still get an error though

package_checks.py:470:33: error: Incompatible types in assignment (expression has type "str", variable has type "None")  [assignment]
Found 1 error in 1 file (checked 1 source file)

Not sure how I can resolve that

That's a type error, apparently you are assigning a string to a variable that is None. You can solve it by adding a type annotation or expressly ignoring the issue.

silkeh avatar Sep 30 '24 18:09 silkeh

Okay, I fixed the lint errors. Not sure if everything is 100% above board though ^^

Going to take a look at the package_lint.yaml tomorrow

Staudey avatar Oct 01 '24 22:10 Staudey

Okay, package lint worked with a test commit to nano. Seems like everything is in order now.

Staudey avatar Oct 03 '24 08:10 Staudey

@silkeh It's probably best if you're the one reviewing this...?

ermo avatar Oct 20 '24 15:10 ermo