diff --git a/internal/rpm.bzl b/internal/rpm.bzl index 4a6d0fb..429d519 100644 --- a/internal/rpm.bzl +++ b/internal/rpm.bzl @@ -27,7 +27,6 @@ filegroup( def _rpm_impl(ctx): if ctx.attr.urls: downloaded_file_path = "downloaded" - download_path = ctx.path("rpm/" + downloaded_file_path) download_info = ctx.download( url = ctx.attr.urls, output = "rpm/" + downloaded_file_path, diff --git a/internal/rpmtree.bzl b/internal/rpmtree.bzl index bd4fdd2..d362341 100644 --- a/internal/rpmtree.bzl +++ b/internal/rpmtree.bzl @@ -104,19 +104,16 @@ _tar2files = rule( toolchains = [BAZELDNF_TOOLCHAIN], ) -def rpmtree(**kwargs): +def rpmtree(name, **kwargs): """Creates a tar file from a list of rpm files.""" - kwargs.pop("files", None) - basename = kwargs["name"] - kwargs.pop("name", None) - tarname = basename + ".tar" + tarname = name + ".tar" _rpm2tar( - name = basename, + name = name, out = tarname, **kwargs ) -def tar2files(**kwargs): +def tar2files(name, files = None, **kwargs): """Extracts files from a tar file. Args: @@ -125,19 +122,18 @@ def tar2files(**kwargs): If not provided, the function will fail. **kwargs: Additional keyword arguments to be passed to the _tar2files function. """ - files = kwargs["files"] - kwargs.pop("files", None) - basename = kwargs["name"] - kwargs.pop("name", None) - if files: - for k, v in files.items(): - name = basename + k - files = [] - for file in v: - files = files + [name + "/" + file] - _tar2files( - name = name, - prefix = k, - out = files, - **kwargs - ) + if not files: + fail("files is a required attribute") + + basename = name + for k, v in files.items(): + name = basename + k + files = [] + for file in v: + files.append(name + "/" + file) + _tar2files( + name = name, + prefix = k, + out = files, + **kwargs + )