What does the "build" keyword do? - bash

in a bash file, There is code like below. searched for shell commands and found no build-related stuff.What is the role of this build in the bash file? This bash file is used to install bazel
build --curses=no
build --curses=no
build --show_task_finish

build could be an alias, function script or binary in your path. This has not nothing to do with bazel. You can execute type build in your shell prompt to see what build refers to.

Related

CMake substitute text in a file generated by a target

I have cmake target which runs a setup.exe on windows which installs a tool using add_custom_target as follows
# TOOL_TEMP_INSTALL_PATH is the installation path which is set earlier in cmake
add_custom_target(
install_tool
COMMAND ${TOOL_TEMP_DIR}/setup.exe /DIR=${TOOL_TEMP_INSTALL_PATH}
)
After the installation, I want to replace text in a configuration file located at ${TOOL_TEMP_INSTALL_PATH}/tool.ini replacing a line of text "LICENSE_FILE=Enter License server" with "LICENSE_FILE=30309#server"
Following commands will achieve this but this needs to be run after install_tool target is built.
file(READ "${TOOL_TEMP_INSTALL_PATH}/tool.ini" filedata)
string(REGEX REPLACE "LICENSE_FILE=Enter License server here"
"LICENSE_FILE=30309#server" filedata "${filedata}")
file(WRITE "${TOOL_TEMP_INSTALL_PATH}/tool.ini" "${filedata}")
How can I add these commands as a dependency to install_tool? Or is there a better way to achieve this on windows?
Since you want to run two things in order as part of the same target, you can use multiple COMMAND entries in the same target. The difficulty is that COMMAND can't handle CMake code, but only system commands. The typical solution is to call CMake in a subshell on a script file:
COMMAND ${CMAKE_COMMAND} -P path_to_script
So, place your file modification commands in a file in your source tree called license-install.cmake, and add another COMMAND to your add_custom_target
Hint: You might consider add_custom_command instead, so you can specify a file in the installed tree as a dependency. This will allow CMake to see the installed tool as a build product, and to skip the install step if the tool is already installed. You'll still need an add_custom_target with a dependency on your command output to hook it in correctly.

Making Sphinx documentation inside of a virtual environment with cron

I have an application development server that is automatically updated every night with a massive shell script that we run with crontab. The script specifies #!/bin/sh at the top of the file and I am not able to change that. The basic purpose of the script is to go through the machine and download the latest code in each of the directories that we list in the script. After all of the repositories are updated, we execute a number of scripts to update the relevant databases using the appropriate virtual environment (Django manage.py commands) by calling that virtualenv's python directly.
The issue that I am having is that we have all the necessary Sphinx plugins installed in one of the virtual environments to allow us to build the documentation from the code at the end of the script, but I cannot seem to figure out how to allow the make command to run inside of the virtualenv so that it has access to the proper packages and libraries. I need a way to run the make command inside of the virtual environment and if necessary deactivate that environment afterwards so that the remainder of the script can run.
My current script looks like the below and gives errors on the latter 3 lines, because sh does not have workon or deactivate, and because make can't find the sphinx-build.
cd ${_proj_root}/dev/docs
workon dev
make clean && make html
deactivate
I was able to find the answer to this question here. The error message that is shown when you attempt to build the sphinx documentation from the root is as follows, and leads to the answer that was provided there:
Makefile:12: *** The 'sphinx-build' command was not found. Make sure
you have Sphinx installed, then set the SPHINXBUILD environment
variable to point to the full path of the 'sphinx-build' executable.
Alternatively you can add the directory with the executable to your
PATH. If you don't have Sphinx installed, grab it from
http://sphinx-doc.org/. Stop.
The full command for anyone looking to build sphinx documentation through a cron when all tools are installed in various virtual environments are listed below. You can find the location of your python and sphinx-build commands by using which while the environment is activated.
make html SPHINXBUILD='<virtualenv-path-to>/python <virtualenv-path-to>/sphinx-build'

Pass on branch name to a script in teamcity

I have a python script that runs as build step in teamcity 9.0. Now I need to know the branch name from which the build is triggered. I could use %teamcity.build.branch% to get the branch name. But I need it to be passed on to my script so that I can use it for some condition checking. Is this possible? How? Please help me out.
You can pass parameters to a python script if you're running it from a terminal, so the code you need to run will be
$ python MyScript.py %teamcity.build.branch%
Alternatively, install the python build runner as this will help you to pass parameters through to scripts / source code through the UI
Python Build Runner
Hope this helps

Install a go script to run from shell

I have a go script named SSL_CHECK.go. Now to run it I need to run it as go run SSL_CHECK.go <<optiional arguments>>
I want to compile this script so that I can execute it as a shell command.
For instance like ./ssl_check <<optional arguments>> from the shell.
Can I achieve that in Go.
If you SSL_CHECK.go is in the package main, all you need to do is go install (as in "Compile and install packages and dependencies").
That will generate a SSH_CHECK executable and put it in your $GOPATH/bin folder, which should be referenced in your $PATH.

xCode external build No such file or directory

I have added a new target with external build in xCode 4.3.2 which is suposed to run a shell script. The script is in a folder Scripts/update.sh in the project.
My external build tool configuration are:
Build Tool /bin/bash
Arguments ../Scripts/update.sh
But when i run i get:
/bin/bash: ../Scripts/update.sh: No such file or directory
How do i refer the file correct?
According to Apple's Documentation, it looks like you probably want refer to update.sh as:
${SRCROOT}/Scripts/update.sh

Resources