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

Use find_packages in securedrop-client setup.py; use bash in securedrop-export postrm #1873

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

rocodes
Copy link
Contributor

@rocodes rocodes commented Feb 27, 2024

Status

WIP
Fixes #1874

Description

After #1854 and #1844, there were two issues with building packages.

  • securedrop-export built successfully, but when installing, postrm generated an error due to not being POSIX compliant
  • securedrop-client built "successfully" but a number of packages were missing. This was confusing until @cfm pointed me at setup.py, noticing that it specifies packages by name, and does not include all the packages. MANIFEST.in was filling that gap for us, which probably wasn't intentional.

Test Plan

  • Visual review
  • CI passing
  • .scripts/build-deb.sh and smoketest (packages install and launch successfully)
  • After installing freshly built package, venv in sd-app does not contain unnecessary files or directories

Checklist

If these changes modify code paths involving cryptography, the opening of files in VMs or network (via the RPC service) traffic, Qubes testing in the staging environment is required. For fine tuning of the graphical user interface, testing in any environment in Qubes is required. Please check as applicable:

  • I have tested these changes in the appropriate Qubes environment
  • I do not have an appropriate Qubes OS workstation set up (the reviewer will need to test these changes)
  • These changes should not need testing in Qubes

If these changes add or remove files other than client code, the AppArmor profile may need to be updated. Please check as applicable:

  • I have updated the AppArmor profile
  • No update to the AppArmor profile is required for these changes
  • I don't know and would appreciate guidance

If these changes modify the database schema, you should include a database migration. Please check as applicable:

  • I have written a migration and upgraded a test database based on main and confirmed that the migration is self-contained and applies cleanly
  • I have written a migration but have not upgraded a test database based on main and would like the reviewer to do so
  • I need help writing a database migration
  • No database schema changes are needed

@rocodes rocodes requested a review from a team as a code owner February 27, 2024 00:47
@rocodes
Copy link
Contributor Author

rocodes commented Feb 27, 2024

(Building packages myself now)

@rocodes
Copy link
Contributor Author

rocodes commented Feb 27, 2024

This will be a little more complicated than just the above change: we need to make sure that all of the data we need (resources, fonts, css files, maybe alembic files?) are included in the right places. setup.py has an option to specify package_data that we can use, but lots of edge case testing will still be required, or we should revert the removal of MANIFEST.in for the client component only if we're concerned about getting moving on release things.

@legoktm
Copy link
Member

legoktm commented Feb 28, 2024

For the postrm, should we switch to just having the shebang explicitly be bash? I think we get no advantage from using dash/"sh".

Copy link
Member

@legoktm legoktm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for diagnosing these errors, overall LGTM and an improvement, see inline comment and the one above about switching the postrm to bash.

client/setup.py Outdated
@@ -24,7 +24,16 @@
install_requires=["SQLAlchemy", "alembic", "securedrop-sdk", "python-dateutil", "arrow"],
python_requires=">=3.5",
url="https://github.com/freedomofpress/securedrop-client",
packages=["securedrop_client", "securedrop_client.gui", "securedrop_client.resources"],
packages=setuptools.find_packages(include=["securedrop_client", "securedrop_client.*"]),
package_data={
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can skip this part if we keep the MANIFEST.in? (Also not all the CSS is in resources/, we'd need some **/*.css I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, gonna remove the package_data stuff, was experimenting

@rocodes
Copy link
Contributor Author

rocodes commented Feb 29, 2024

Yup, fine with switching to bash, was just trying to do the thing that kept our packaging the most "vanilla" while you were out ;) on it!

@rocodes rocodes changed the title Find all securedrop-client packages in (client) setup.py; fix securedrop-export postrm Use find_packages in securedrop-client setup.py; use bash in securedrop-export postrm Feb 29, 2024
@rocodes rocodes requested a review from legoktm February 29, 2024 16:57
@legoktm legoktm self-assigned this Feb 29, 2024
Copy link
Member

@legoktm legoktm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@legoktm legoktm merged commit 2de3a3b into main Feb 29, 2024
88 checks passed
@legoktm legoktm deleted the packaging-fixups branch February 29, 2024 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Without MANIFEST.in, client component does not build a working package
2 participants