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 brave-browser-stable as the /usr/bin/ symlink for release packages #2083

Closed
wants to merge 1 commit into from

Conversation

fmarier
Copy link
Member

@fmarier fmarier commented Mar 27, 2019

This fixes brave/brave-browser#1324 by ensuring that the release Debian package can also provide an alternative (of higher priority) for the /usr/bin/brave-browser binary.

With this in place, that binary will default to the release browser and it can be configured normally using:

sudo update-alternatives --config brave-browser

As noted previously, the RPMs don't need to be fixed since they already exhibit the correct behavior.

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Verified that these changes build without errors on
    • Windows
    • macOS
    • Linux
  • Verified that these changes pass automated tests (npm test brave_unit_tests && npm test brave_browser_tests && npm run test-security) on
    • Windows
    • macOS
    • Linux
  • Verified that all lint errors/warnings are resolved (npm run lint)
  • Ran git rebase master (if needed).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.
  • Request a security/privacy review as needed.
  • Add appropriate QA labels (QA/Yes or QA/No) to include the closed issue in milestone

Test Plan:

I tested the following "upgrade" scenario on Ubuntu 18.04:

  1. Install current stable release (0.61) and then current beta (0.62).
  2. Confirm that the /usr/bin/brave-browser binary is a symlink to
    /etc/alternatives/brave-browser which in turn is a symlink to beta.
  3. Confirm that update-alternatives --config brave-browser only offers beta.
  4. Upgrade the stable package to the one in this PR.
  5. Confirm that the /usr/bin/brave-browser-stable binary now exists.
  6. Confirm that the /etc/alternatives/brave-browser symlink now points to stable and that update-alternatives --config brave-browser offers both stable and beta.
  7. apt purge brave-browser and confirm that
    /etc/alternatives/brave-browser symlink now points to beta and that
    update-alternatives --config brave-browser only offers beta.

and this simpler "new install" scenario:

  1. Purge all existing brave-browser* packages.
  2. Install the stable package from this PR.
  3. Confirm that the /etc/alternatives/brave-browser symlink points to stable and that update-alternatives --config brave-browser offers only stable.
  4. Confirm that typing brave-browser launches the browser.

Finally, I built a beta version of this package and ran through this scenario:

  1. Install the stable package from this PR.
  2. Install the current beta (0.62) package from the official repo.
  3. Confirm that the /etc/alternatives/brave-browser symlink points to stable and that update-alternatives --config brave-browser offers stable and beta.
  4. Upgrade brave-browser-beta with the package from this PR.
  5. Confirm that the /etc/alternatives/brave-browser symlink still points to stable and that update-alternatives --config brave-browser also offers stable and beta.

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

This fixes brave/brave-browser#1324 by ensuring that the release
package can also provide an alternative (of higher priority) for
the /usr/bin/brave-browser binary.

With this in place, that binary will default to the release browser
and it can be configured normally using:

    sudo update-alternatives --config brave-browser
@fmarier fmarier self-assigned this Mar 27, 2019
@fmarier fmarier requested a review from mbacchi March 27, 2019 00:14

-update-alternatives --install /usr/bin/@@PACKAGE_ORIG@@ @@PACKAGE_ORIG@@ \
- /usr/bin/@@USR_BIN_SYMLINK_NAME@@ $PRIORITY
+if [ '"@@PACKAGE_ORIG@@"' != '"@@USR_BIN_SYMLINK_NAME@@"' ]; then
Copy link
Member Author

Choose a reason for hiding this comment

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

There's no reason to prevent the stable package from providing an alternative for /usr/bin/brave-browser since it now uses a unique name for its binary (/usr/bin/brave-browser-stable).

install -m 755 -d "${STAGEDIR}/DEBIAN" \
"${STAGEDIR}/etc/cron.daily" \
"${STAGEDIR}/usr/share/menu" \
- "${STAGEDIR}/usr/share/doc/${USR_BIN_SYMLINK_NAME}"
Copy link
Member Author

Choose a reason for hiding this comment

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

Since we no longer patch the value of ${USR_BIN_SYMLINK_NAME}, we need to make sure that the doc directory uses the package name (${PACKAGEANDCHANNEL} == 'brave-browser') and not the binary name (${USR_BIN_SYMLINK_NAME} == 'brave-browser-stable').

@fmarier
Copy link
Member Author

fmarier commented Mar 27, 2019

Superseded by #2101.

@fmarier fmarier closed this Mar 27, 2019
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.

brave-browser launches the most recent install (.deb packages)
1 participant