prezto prompt shows ~RVM_PROJECT_PATH instead of current working directory - prezto

I installed prezto following this guide: http://codurance.com/2015/03/16/installing-zprezto-a-quick-guide/
If I start in a regular folder that's not in git, I see the current working directory as expected in the prompt.
~/Documents/projects/
As soon as I change to directory that's managed in git, the prompt changes to:
~RVM_PROJECT_PATH [feature/awesome]
where feature/awesome is my branch name.
No matter which prompt I configure to use, as soon as I navigate to a git repo, RVM_PROJECT_PATH shows up. How do I fix this?

Put this in your ~/.zshrc
unsetopt auto_name_dirs
Thanks to mcornella in this response: https://github.com/rvm/rvm/issues/3091#issuecomment-60083194
Tested in zsh 5.2 (x86_64-unknown-linux-gnu)

I was having this issue too and I was having an old version of prezto. Updating prezto (cd to ~/.zprezto && git pull && git submodule update --init --recursive) solved the issue thanks to this update in the ~/.zprezto/modules/ruby/init.zsh:
# Load RVM into the shell session.
if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then
# Unset AUTO_NAME_DIRS since auto adding variable-stored paths to ~ list
# conflicts with RVM.
unsetopt AUTO_NAME_DIRS
# Source RVM.
source "$HOME/.rvm/scripts/rvm"
...
# Prepend local gems bin directories to PATH.
else
path=($HOME/.gem/ruby/*/bin(N) $path)
fi

Related

Github Actions path does not update

Right now, I'm trying to build a tool from source and use it to build a C++ project. I'm able to extract the tar file (gcc-arm-none-eabi). But, when I try to add it to path (using $GITHUB_PATH, not add-path), the path doesn't apply on my next action and I can't build the file. The error states that it can't find the gcc-arm-none-eabi toolset, which means that it didn't go to path.
Here's the script for the entrypoint of the first function (make is ran in the next action to allow for path to apply)
echo "Downloading ARM Toolchain"
# The one from apt isn't updated so I have to build from source
curl -L https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 -o gcc-arm-none-eabi.tar.bz2
tar -xjf gcc-arm-none-eabi.tar.bz2
echo "/github/workspace/gcc-arm-none-eabi-10-2020-q4-major/bin" >> $GITHUB_PATH
I can't even debug by seeing what's in the path because running echo $(PATH) just says that PATH cannot be found. What should I do?
I can't even debug by seeing what's in the path because running echo $(PATH) just says that PATH cannot be found. What should I do?
First, PATH is not a command so if you want to print its value, it would be something like echo "${PATH}" or echo "$PATH"
Then, if you want to add a value to an existing environment variable, it would be something like
export PATH="${PATH}:/github/workspace/gcc-arm-none-eabi-10-2020-q4-major/bin"
EDIT: seems not a valid way to add something to the path using Github Actions, meanwhile it seems correct in the question. To get more details: https://docs.github.com/en/free-pro-team#latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path . Thanks to Benjamin W. for pointing this out in the comments.
Finally I think it would be a better fit if you use a docker image that already contains that kind of dependancies (you could easily write your own Dockerfile if this image doesn't already exists). Github action is designed to use docker (or OCI containers) image that contains the dependancies you need to perform your build actions. You should take a look here: https://docs.github.com/en/free-pro-team#latest/actions/creating-actions/dockerfile-support-for-github-actions

How to use SSTATE_DUPWHITELIST variable in yocto

I'll try to explain it as easy as I can. I tried to include and build package "A" in my Yocto image, but package A depends on libftdi and ftdi-eeprom. Now, "ftdi-eeprom" depends on the "libftdi".
In the newer versions of the "libftdi" the tarball also includes the ftdi-eeprom sources too and when you build the libftdi it builds both of the packages. Although because of the way that package "A" is configured I need two different recipes for each of the dependencies.
long story short, I made the two bitbake recipes as best as I could and successfully built "libftdi". Now when I run the "ftdi-eeprom" recipe, it wants to populate some files into the sysroot that are already installed there by libftdi. Here is where the error occurs... duplicates!
Apparently I need to set a SSTATE_DUPWHITELIST variable and declare that these duplicate files are safe to replace the old ones in the image (this overwrite must happen). Can someone please help me with configuring the SSTATE_DUPWHITELIST? I am not that pro working with Yocto.
Errors that I get on screen are uploaded in Dropbox
Thanks in advance!
The answer is to not use SSTATE_DUPWHITELIST for this at all. Instead, in the libftdi recipe's do_install (or do_install_append, if the recipe itself doesn't define its own do_install) you should delete the duplicate files from within ${D} and then they won't get staged and the error won't occur.
I got it to work by using:
SSTATE_DUPWHITELIST = "/"
Dont forget the quotes. Here's my bb excerpt:
SSTATE_DUPWHITELIST = "/"
DEPENDS = ""
do_unpack() {
mkdir -pv ${S}
tar xvf ${DL_DIR}/${FILENAME}.tar -C ${S}
}
do_install() {
install -d -m 755 ${D}${includedir}
install -m 644 ${S}/${MYPATH}/inc/myHeader1.h ${D}${includedir}
install -m 644 ${S}/${MYPATH}/inc/myHeader2.h ${D}${includedir}
install -m 644 ${S}/${MYPATH}/inc/myHeader3.h ${D}${includedir}
}
I managed to solve this problem by adding the SSTATE_DUPWHITELIST to the bitbake recipe of the package as follows:
SSTATE_DUPWHITELIST = "${TMPDIR}/PATH/TO/THE/FILES"
I added the absolute path of all of the 6,7 files that had the conflict to the list. I did that because they were basically coming from a same source and it was all safe to do that. correct me if there is a better way though.
Hope this helps someone!

requirements.txt bad interpreter: No such file or directory

I'm working on a github repo which I just cloned. I have a new virtual environment and I'd like to add all of the packages from the requirements.txt file to the virtual env.
For some reason it is not finding my requirements.txt file.
Edit the first line of /Users/byrd/Desktop/Github Repositories/herokusite/venv/bin/pip file to correct the path to python. You can obtain this path by calling which python. I think it should be:
#!/Users/byrd/Desktop/Github\ Repositories/herokusite/venv/bin/python
EDIT: Seems like it is a known bug in unixes - you can't use spaces in shebang line.
Also try this workaround, it may help you.
Do not use spaces in any component of the path where your virtual environment is stored.
It causes problems for the bootstrapping process.
Create a new blank environment, in a directory that has no spaces in its path:
$ cd # this takes you to your home directory, in OSX its is /Users/yourlogin
$ cd Desktop
$ virtualenv myvenv
$ source myvenv/bin/activate
(myvenv) $ pip install -r /path/to/requirements.txt
first, execute which pip after activating the environment if you found a space between any of the folders like
as seen in this link
you must have noticed a space between the folder name
2nd july
next, delete the new virualenv (in my case envname) and rename the folder with space between its name
then create a new virual environment and then install the requirements through
pip install -r requirements.txt
on the folder location with the requirements file

Execute gradle build task from any location

I´m trying to build my gradle projects from other locations than the project folder itself, but it always says it couldn´t find build task.
What I´ve tried so far:
sudo ./myprojects/myapp/gradlew build
sudo ./myprojects/myapp/gradlew ./myprojects/myapp/build
How can I execute a gradle build task from any location?
Various people have written (and published) scripts to execute gradlew from any subproject directory (in a multi-project build). To reliably execute Gradle from any subdirectory, it is necessary to set the "current project directory" via -p. It would be nice to have this restriction lifted (this would make a good feature request).
You may try this script, which is 90-lines long: https://github.com/dougborg/gdub
Or use this straightforward one-liner I use myself:
function lookupgradle() {
find . .. ../.. ../../.. ../../../.. ../../../../.. ../../../../../.. -maxdepth 1 -name 'gradlew' -executable -print -quit
}
alias g='$(lookupgradle)'
If you'll find out that it is still required to specify project directory, add -p .:
alias g='$(lookupgradle) -p .'
./usmobile-microservice/gradlew -p ./usmobile-microservice clean buildUI
./project_directory/gradlew -p ./project_directory clean build
worked for me

running an executable in its own working directory

I added a button to my gvim toolbar which runs a .sh file. The .sh file runs scons to build my c++ application in the /build subdirectory and runs it. The problem is that when the application is running, its current working directory is the folder that contains the .sh file (not the applications /build subdirectory)! So how do I run a built c++ applications executable (linux) from a .sh file, so that its working directory would be the folder which contains executable?
Just
cd $(dirname "$0")
./exec_test
Note, you need ./exec_test, not exec_test unless the directory is actually already in PATH
Here's an example of something similar (I don't use scons.)
I add my toolbar icon with:
:amenu ToolBar.mytool :!/home/me/code/misc/foo.sh "%"
For me, when I click this, vim runs the script in the same working directory as vim.
foo.sh contains:
#!/bin/bash
set -e
# You should see the name of your file.
# It might just be "my_file.c"
echo "$1"
# This will tell you where your script is current cd'd to.
pwd
# `cd` to where the file passed on the command line is:
cd "$(dirname "$1")"
# Look for "CMakeLists.txt"
# You only need this loop if your build file / program might be up a few directories.
# My stuff tends to be:
# / - project root
# CMakeLists.txt
# src/
# foo.c
# bar.c
while true; do
# We found it.
if [[ -e "CMakeLists.txt" ]]; then
break
fi
# We didn't find it. If we're at the root, just abort.
if [[ "`pwd -P`" = "/" ]]; then
echo "Couldn't find CMakeLists.txt." >&2
exit 1
fi
cd ..
done
# I do builds in a separate directory.
cd build && make
You'd replace CMakeLists.txt with SConstruct, and the last cd build && make with scons, or something appropriate to scons.