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

Graal does not honor environment variable #101

Open
nhasabni opened this issue Dec 2, 2021 · 4 comments
Open

Graal does not honor environment variable #101

nhasabni opened this issue Dec 2, 2021 · 4 comments

Comments

@nhasabni
Copy link

nhasabni commented Dec 2, 2021

I am using a different version of git than the one installed on the system by default. Newer version of the git is installed in ~/bin and PATH variable is set to ~/bin. Shell command for git picks it up correctly as:

$ which git
~/bin/git

But Graal does not:

$ PATH=~/bin:${PATH} graal -g cocom https://github.com/chaoss/grimoirelab-perceval --git-path /tmp/graal-cocom
[2021-12-02 11:58:14,207 - root - INFO] - Starting the quest for the Graal.
[2021-12-02 11:58:14,211 - perceval.backends.core.git - DEBUG] - Running command /usr/bin/git worktree add /tmp/worktrees/graal-cocom (cwd: /tmp/graal-cocom, env: {'LANG': 'C', 'PAGER': '', 'HTTP_PROXY': 'http://<proxy>:911/', 'HTTPS_PROXY': 'http://<proxy>:912/', 'NO_PROXY': '', 'HOME': '/home/nhasabni'})
[2021-12-02 11:58:14,224 - perceval.backend - ERROR] - Error!: git command - git: 'worktree' is not a git command. See 'git --help'.

[2021-12-02 11:58:14,224 - root - INFO] - Quest completed.

worktree is part of git installed under ~/bin:

$ git worktree list
/tmp/worktrees/graal-cocom                          2e6a58b [graal-cocom] prunable
$ /usr/bin/git worktree list
git: 'worktree' is not a git command. See 'git --help'.
@valeriocos
Copy link
Member

valeriocos commented Dec 3, 2021

Hi @nhasabni,

But Graal does not:

The git executable path is hardcoded here: https://github.com/chaoss/grimoirelab-graal/blob/master/graal/graal.py#L50. The code should be modified to accept the git executable path via the command line.

Please try to create a soft link, it worked for me

  • install git latest version
cd /home/valcos/Desktop
git clone https://github.com/git/git
sudo apt-get install tcl build-essential tk gettext
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libssl-dev
make configure
  • check git version
git --version
git version 2.25.1
  • create soft link and backup old executable
sudo cp /usr/bin/git /usr/bin/git.backup
sudo rm /usr/bin/git
sudo ln -s /home/valcos/Desktop/git/git /usr/bin/git
  • check git version
git --version
git version 2.34.1.75.gabe6bb3905
  • execute cocom backend
graal cocom https://github.com/chaoss/grimoirelab-perceval --git-path /tmp/graal-cocom
  • restore old executable
sudo rm /usr/bin/git
sudo cp /usr/bin/git.backup /usr/bin/git

Hope it helps!

@jgbarah
Copy link
Contributor

jgbarah commented Dec 3, 2021

Thx, @valeriocos!

@nhasabni
Copy link
Author

nhasabni commented Dec 3, 2021

Hi @nhasabni,

But Graal does not:

The git executable path is hardcoded here: https://github.com/chaoss/grimoirelab-graal/blob/master/graal/graal.py#L50. The code should be modified to accept the git executable path via the command line.

Please try to create a soft link, it worked for me

  • install git latest version
cd /home/valcos/Desktop
git clone https://github.com/git/git
sudo apt-get install tcl build-essential tk gettext
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libssl-dev
make configure
  • check git version
git --version
git version 2.25.1
  • create soft link and backup old executable
sudo cp /usr/bin/git /usr/bin/git.backup
sudo rm /usr/bin/git
sudo ln -s /home/valcos/Desktop/git/git /usr/bin/git
  • check git version
git --version
git version 2.34.1.75.gabe6bb3905
  • execute cocom backend
graal cocom https://github.com/chaoss/grimoirelab-perceval --git-path /tmp/graal-cocom
  • restore old executable
sudo rm /usr/bin/git
sudo cp /usr/bin/git.backup /usr/bin/git

Hope it helps!

Thanks @valeriocos for looking into this. Unfortunately, --exec-path command line param does not help.

$ graal cocom https://github.com/chaoss/grimoirelab-perceval --git-path /tmp/graal-cocom --exec-path ~/bin/git
[2021-12-03 10:25:39,906] - Starting the quest for the Graal.
[2021-12-03 10:25:39,921] - Error!: git command - git: 'worktree' is not a git command. See 'git --help'.

[2021-12-03 10:25:39,921] - Quest completed.

Also, I do not have sudo access in the machine that I am using for setup. So I cannot create a softlink for /usr/bin/git. I think I will modify the Graal script to use path of git binary for my environment. Thanks.

@jgbarah
Copy link
Contributor

jgbarah commented Dec 4, 2021

@nhasabni if that suits you, feel free to fork Graal, patch it so that instead of using an specific path for git it uses the one in $PATH, and make it public. It seems some other people in the hackathon could benefit from that. Also, feel free to pull request the modification to the Graal repo.

BTW, if you do this, please ensure that is mention in your final paper: not only working with the tools as such, but also adapting them to your specific needs, show a high level of engagement.

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

3 participants