1

I want bazel to fetch an external dependency from a URL. The file is an rpm file. I added this in the WORKSPACE file in root dir:

http_archive(
    name = "mylib",
    url = "someURL/somefile.rpm",
    build_file = "example.BUILD"
)

When I try:

bazel fetch @mylib//...

It says:

"com.google.devtools.build.lib.syntax.EvalException: Expected a file with a .zip, .jar, .war, .tar, .tar.gz, .tgz, .tar.xz, .txz, or .tar.bz2 suffix"

Basically it is not allowing to download rpm deps. How can I achieve this ? How to download external dependency of type rpm.

Shayan Anwar
  • 149
  • 2
  • 10

2 Answers2

0

You're trying to fetch an .rpm file, but it seems that bazel only accepts archive files with the suffixes .zip, .jar, .war, .tar, .tar.gz, .tgz, .tar.xz, .txz, or .tar.bz2.

vincent
  • 1,370
  • 2
  • 13
  • 29
0

You certainly figured it out by now. Like @sebastian-nowak commented, you can do something like:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")

http_file(
    name = "mylib",
    url = "someURL/somefile.rpm"
)

and in your example.BUILD, reference it with @mylib//file

(Source: https://docs.bazel.build/versions/master/repo/http.html#http_file)