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

Remove perl from codebase #988

Open
1 task done
legoktm opened this issue Apr 17, 2024 · 1 comment
Open
1 task done

Remove perl from codebase #988

legoktm opened this issue Apr 17, 2024 · 1 comment

Comments

@legoktm
Copy link
Member

legoktm commented Apr 17, 2024

  • I have searched for duplicates or related issues

Description

Remove all the perl oneliners from our codebase.

User Stories

  • As a developer, our code is primarily written in Python, and when necessary, shell script. We should avoid shelling out to Perl and introducing yet another language in our stack.
user@dev ~/g/f/securedrop-workstation (main)> rg 'perl '
files/provision-all
36:all_sdw_vms_target="$(qvm-ls --tags sd-workstation --raw-list | perl -npE 's/\n/,/g' | perl -npE 's/,$//' )"

dom0/sd-clean-all.sls
119:      - qvm-run sys-firewall 'sudo perl -pi -E "s#^/rw/config/sd-copy-rpm-repo-pubkey.sh##" /rw/config/rc.local'

dom0/sd-usb-autoattach-remove.sls
9:        qvm-run sys-usb 'sudo perl -i -0pe "s/### BEGIN securedrop-workstation ###.*### END securedrop-workstation ###//gms" /rw/config/rc.local'

tests/test_vms_platform.py
41:        cmd = "perl -nE '/^PRETTY_NAME=\"(.*)\"$/ and say $1' /etc/os-release"

tests/test_proxy_vm.py
72:        cmd = "perl -F= -lane 'print $F[0]' /usr/share/applications/mimeapps.list"

tests/test_app.py
25:        cmd = "perl -F= -lane 'print $F[1]' /usr/share/applications/mimeapps.list | sort | uniq -c"
31:        cmd = "perl -F= -lane 'print $F[0]' /usr/share/applications/mimeapps.list"

There is absolutely no need to use perl in tests. The perl snippet in our Makefile is pretty standard so I wouldn't include that in this issue.

legoktm added a commit that referenced this issue Sep 25, 2024
There's no reason to use perl here, given that we can do the same
manipulations in Python itself in a way that's more maintainable
and approachable.

I took the opportunity to consolidate the two mimeapps tests in
test_app into one, but decided to just copy it over to test_proxy_vm
instead of moving it to the base test to avoid too much refactoring
here besides the deperlification.

Refs #988.
@legoktm legoktm mentioned this issue Sep 25, 2024
2 tasks
@legoktm
Copy link
Member Author

legoktm commented Sep 25, 2024

Just leaves:

securedrop_salt/sd-usb-autoattach-remove.sls
8:        qvm-run sys-usb 'sudo perl -i -0pe "s/### BEGIN securedrop-workstation ###.*### END securedrop-workstation ###//gms" /rw/config/rc.local'

which seems like a straightforward sed.

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