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

Switch to using a recursive structure to build layers for extracting nested archives, rather than just a 2 parse system where names could align #4

Open
arran4 opened this issue Sep 2, 2024 · 1 comment
Assignees

Comments

@arran4
Copy link
Owner

arran4 commented Sep 2, 2024

Since I am building a tree of "unpack this to get this, rename this to get this" I should instead of using a complex set of loops and ifs and praying that the names align, recursively descend it to create a series of actions, ie:

  • decompress
  • unarchive
  • rename

It will reduce complexity and be more readable plus filename alignment issues will be greatly reduced especially con converging and expanding packages (or where the same manual page is stored in multiple files:)

[[- range $pname, $prog := .Programs ]]
[[- range $keyword, $binary := $prog.Binary ]]
  [[- if ne $prog.InstalledFilename (index $binary 1) ]]
    [[- if gt (len $binary) 2 ]]
                echo '  if use [[ $keyword ]]; then'
                echo "    mv \"${{ env.[[ join (filterEmpty $pname "appimage_archived_name" $keyword) "_" ]] }}\" \"${{ env.[[ join (filterEmpty $pname "appimage_installed_name" ) "_" ]] }}\"  || die \"Can't move archived file\""
                echo '  fi'
    [[- else ]]
                echo '  if use [[ $keyword ]]; then'
                echo "    cp \"\${DISTDIR}/\${P}-${{ env.[[ join (filterEmpty $pname "release_name" $keyword) "_" ]] }}\" \"${{ env.[[ join (filterEmpty $pname "appimage_installed_name" ) "_" ]] }}\"  || die \"Can't copy downloaded file\""
                echo '  fi'
    [[- end ]]
  [[- end ]]

@arran4
Copy link
Owner Author

arran4 commented Sep 3, 2024

Unrelated to above, but definitely related to:
arran4/arrans_overlay#5

It would definitely reduce complexity. I will probably do it when I have more energy & focus when there are more users. I need to work on other things right now.

@arran4 arran4 self-assigned this Sep 3, 2024
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

1 participant