google / bazel_rules_install Goto Github PK
View Code? Open in Web Editor NEWBazel rules for installing build results. Similar to `make install`.
License: Apache License 2.0
Bazel rules for installing build results. Similar to `make install`.
License: Apache License 2.0
I can no longer do any maintenance on this repo.
bazel build -c opt //:install_foo -- ~/test
but get error message "not a valid absolute pattern (absolute target patterns must start with exactly two slashes): '/home/xxx/test'...."
Confused about this, and how could resolve it?
Example:
$ bazel build -c opt //install:buildifier ~/bin
would install buildifier
as ~/bin/buildifier
Create a flag which lets the user install buildifier
as ~/bin/bazelfier
A common use is to install various artifacts in places in a $(PREFIX)
location. So e.g. with PRFIX=/usr/local, we'd like to install, e.g.
Right now, the install task directly installs everything in one directory, however the above use-case is essentially the next step. Short of manually lining up a bunch of separate install() rules, is there a recommended way, or possibly planned future way, to accomodate this situation ?
For installing binaries in system directories, one has to run the installer as root
sudo bazel run :install -c opt /usr/local/bin
Bazel does all kinds of internal caching of object files and writes status files etc. Will this mess up the ~/.cache/bazel
files, or will this 'just work', as then bazel would create these artifacts in ~root/.cache/bazel
. I suspect the latter; and while this is duplicate of build work as different user, this is probably an acceptable solution for now.
(in a typical make
situation, one would run make
to build the artifacts, then sudo make install
to just do the copying. Bazel is a lot more complex, so I want to make sure that this will work as intended).
OR: is it currently not recommended running bazel as root and wait for the When needed asks for write access checkbox to be implemented ?
Either way, it is probably good to clarify that in the README.
Since we now have a bzlmod compatible version, I suggest to make a new release (0.0.4), and then it would also be nice to have it on the bzlmod registry (https://registry.bazel.build/).
There is still the issue that it won't work well on MacOS, but this is something we can only fix once we find someone who uses a Mac and can contribute. So, good enough for now.
@bttk what do you think ? Are there other things we should address before 0.0.4 ?
Version: bazel_rules_install tag 0.4. Not sure what MacOS exactly, uname spits out something like Darwin Kernel Version 19.6.0
When compiling a project that compiles with bazel on MacOS (in my case: verible), the install procedure is not working, possibly because the install on MacOS is a BSD install, not GNU install.
In particular it seems to stumble upon the --
separator between options and arguments.
bazel run -c opt :install -- ~/bin
#....
install: illegal option -- -
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
[-o owner] file1 file2
install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
[-o owner] file1 ... fileN directory
install -d [-v] [-g group] [-m mode] [-o owner] directory ...
Looking at the bazel-bin/_install_gen.sh
(which I suspect is the one invoked) contains the following snippet, which is possibly the culprit:
$sudo install --mode="${target_mode}" \
-T -- "${source}" "${target_dir}/${target_name}"
I know that MacOS is still on the TODO list, but I hope this actual use-case might help raise the awareness (we just recently were able to get the project to compile on MacOS, so this would be the final stumbling block).
Maybe as a first step, the --
could only be emitted if the target looks like it would be in danger to be interpreted as option ? Given that binaries rarely (if ever) start with dash, this should fix the typical use-case.
An alias rule
https://docs.bazel.build/versions/3.2.0/be/general.html#alias
gives a different name to an existing thing.
I'd like to use this in verible to phase out legacy binary names and move them to new names (to implement chipsalliance/verible#169 ).
But simply declaring this in bazel:
alias(
name = "old_binary_name",
actual = ":new_binary_name"
)
and then using the old_binary_name
alias name in an bazel_rules_install
installer()
target will not install anything (but will also not complain); I suppose because the alias is actually just an internal name within bazel
, but actually never shows up as tangible object.
For installation: My proposal would be to interpret the alias
information and create either a symbolic link or a copy, depending on the installation platform.
(Of course, I could implement the legacy-names with a little shell-script which then exec's the new location etc., but it would be less platform agnostic. Using 'alias' is the exact abstraction that conveys the intent much better and the install target can use the additional context to do the right thing on the target platform - symbolic link or copy)
Currently, install seems to not work around this line:
https://github.com/google/bazel_rules_install/blob/master/installer/def.bzl#L33
there is a short_path accessed on the file object, but apparently that file is a broken object.
This is with bazel 2.2.0, trying to compile https://github.com/google/verible
ERROR: /tmp/verible/BUILD:15:1: in _gen_installer rule //:_install_gen:
Traceback (most recent call last):
File "/tmp/verible/BUILD", line 15
_gen_installer(name = '_install_gen')
File "/home/hzeller/.cache/bazel/_bazel_hzeller/738e401e7245498e1452e2a408c408c7/external/com_github_google_rules_install/installer/def.bzl", line 33, in _gen_install_binary_impl
sources.append(file.short_path)
File "/home/hzeller/.cache/bazel/_bazel_hzeller/738e401e7245498e1452e2a408c408c7/external/com_github_google_rules_install/installer/def.bzl", line 33, in sources.append
file.short_path
'NoneType' value has no field or method 'short_path'
We are seeing multiple Critical and High severity vulnerabilities in the java images, in both version 8 & 11.
They appear to be in glibc, libpng & libjpeg-turbo packages. Below is the image scanning report from Docker hub.
An online search reveals that there are newer versions of these packages available. But I am not sure how to update the packages inside the base images, or if there is an alternative to addressing these security findings.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.