Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6797bfaa authored by Sasha Smundak's avatar Sasha Smundak
Browse files

Fix copy_files implementation

It has to copy all the files into the same directory, stripping the
relative path from the source file.

Bug: 193540681
Test: rbcrun build/make/tests/run.rbc
Change-Id: I2d61d966ad94d73131c7ad6016ce319f8d2ae509
parent 6b795dc6
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -373,9 +373,14 @@ def _inherit(handle, pcm_name, pcm):
        if type(val) == "list":
            val.append(_indirect(pcm_name))

def __base(path):
    """Returns basename."""
    return path.rsplit("/",1)[-1]


def _copy_files(l, outdir):
    """Generate <item>:<outdir>/item for each item."""
    return ["%s:%s/%s" % (item, outdir, item) for item in __words(l)]
    return ["%s:%s/%s" % (path, outdir, __base(path)) for path in __words(l)]

def _copy_if_exists(path_pair):
    """If from file exists, returns [from:to] pair."""
+2 −0
Original line number Diff line number Diff line
@@ -48,6 +48,8 @@ def init(g, handle):
  cfg["PRODUCT_COPY_FILES"] += (rblf.find_and_copy("audio_platform_info*.xml", "device/google/redfin", "||VENDOR-PATH-PH||/etc") +
      ["xyz:/etc/xyz"])
  cfg["PRODUCT_COPY_FILES"] += rblf.copy_files("x.xml y.xml", "/etc")
  cfg["PRODUCT_COPY_FILES"] += rblf.copy_files(["from/sub/x", "from/sub/y"], "to")

  rblf.add_soong_config_namespace(g, "NS1")
  rblf.add_soong_config_var_value(g, "NS1", "v1", "abc")
  rblf.add_soong_config_var_value(g, "NS1", "v2", "def")
+2 −0
Original line number Diff line number Diff line
@@ -57,6 +57,8 @@ assert_eq(
          "xyz:/etc/xyz",
          "x.xml:/etc/x.xml",
          "y.xml:/etc/y.xml",
          "from/sub/x:to/x",
          "from/sub/y:to/y",
      ],
      "PRODUCT_HOST_PACKAGES": ["host"],
      "PRODUCT_PACKAGES": [