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 bash #5

Open
wants to merge 2 commits into
base: default
Choose a base branch
from
Open

Use bash #5

wants to merge 2 commits into from

Conversation

tusharpm
Copy link

The intent is to (help) address the issue travis-ci/apt-package-safelist#3946 I raised earlier among others. The message pointed to a missing source repository for the given package (mine was g++-6).
On further debugging, I found out that without the -s flag apt-add-repository adds the deb-src entry under /etc/apt/sources.list.d/,,, commented, unavailable for the subsequent apt commands.

In this PR:

  • Modified the ruby script to enable adding the source repository along with the binary repository
  • Modified the bash script to perform the same action(s) locally (instead of invoking ruby) - use jq for JSON.

- apt-add-repository adds the binaries repository, and misses the sources entry
- Add the -s flag to apt-add-repository to add the deb-src entry
- Reduce the repetition of the same command.
- use jq for JSON processing
- use bash-builtins for processing the output
- retain the same logic as the Ruby script
@grooverdan
Copy link

Nice work.

It looks like this will prevent the selecting a very different source repo like I encountered in travis-ci/apt-package-safelist/issues/4071 (clang-5.0 became a clang-3.5 request).

Ref: its corresponding build https://travis-ci.org/travis-ci/apt-whitelist-checker/builds/219882514#L789

@BanzaiMan, willing to give this pull request a try?

@tusharpm
Copy link
Author

Happy to help.
Although, I'm not sure this will be accepted in its current form - it can look like too many changes to solve a simple problem. I had made it two commits for that reason, the first one addressing the problem in the Ruby script itself. The second one is a simplification as it performs the same actions from bash.
The maintainers can optionally cp either commit (or both) as that would have the same result. Alternatively, I can open a different PR with just the flag added in the Ruby script (in two places without my change).
@grooverdan @BanzaiMan Please let me know how to proceed.

Copy link
Contributor

@BanzaiMan BanzaiMan left a comment

Choose a reason for hiding this comment

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

Sorry for the delay. If add_sources.rb is being replaced with the bash equivalent, it is best to remove the file altogether.

@@ -4,15 +4,22 @@ source `dirname $0`/common.sh

PKG=$1

fold_start ruby19 "Installing Ruby 1.9.1"

This comment was marked as spam.

This comment was marked as spam.

meatballhat added a commit that referenced this pull request Jul 18, 2017
@tusharpm
Copy link
Author

tusharpm commented Jul 18, 2017

Just a heads-up: I saw another Ruby script doing something similar in another repo - https://github.com/travis-ci/apt-source-whitelist/blob/master/add_all.rb.
The same change might be required there as well.

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.

3 participants