code: def build_r_package(
      src_root_dir: str,
      build_native_root_dir: str,
      platform_name: str,
      dry_run: bool,
      verbose: bool,
  ):
      system, _ = platform_name.split("-")
  
      def get_catboostr_artifact_src_and_dst_name(system: str):
          return {
              "linux": ("libcatboostr.so", "libcatboostr.so"),
              "darwin": ("libcatboostr.dylib", "libcatboostr.so"),
              "windows": ("catboostr.dll", "libcatboostr.dll"),
          }[system]
  
      os.chdir(os.path.join(src_root_dir, "catboost", "R-package"))
  
      if not dry_run:
          os.makedirs("catboost", exist_ok=True)
  
      entries = [
          "DESCRIPTION",
          "NAMESPACE",
          "README.md",
          "R",
          "inst",
          "man",
          "tests",
      ]
      for entry in entries:
          if os.path.isdir(entry):
              distutils.dir_util.copy_tree(
                  entry,
                  os.path.join("catboost", entry),
                  verbose=verbose,
                  dry_run=dry_run,
              )
          else:
              distutils.file_util.copy_file(
                  entry,
                  os.path.join("catboost", entry),
                  verbose=verbose,
                  dry_run=dry_run,
              )
  
      binary_dst_dir = os.path.join("catboost", "inst", "libs")
      if system == "windows":
          binary_dst_dir = os.path.join(binary_dst_dir, "x64")
  
      if not dry_run:
          os.makedirs(binary_dst_dir, exist_ok=True)
  
      src, dst = get_catboostr_artifact_src_and_dst_name(system)
      full_src = os.path.join(
          build_native_root_dir, "catboost", "R-package", "src", src
      )
      full_dst = os.path.join(binary_dst_dir, dst)
      if dry_run:
          logging.info(f"copying {full_src} -> {full_dst}")
      else:
          distutils.file_util.copy_file(
              full_src, full_dst, verbose=verbose, dry_run=dry_run
          )
  
      # some R versions on macOS use 'dylib' extension
      if system == "darwin":
          full_dst = os.path.join(binary_dst_dir, "libcatboostr.dylib")
          if dry_run:
              logging.info(f"making a symlink {dst} -> {full_dst}")
          else:
              os.symlink(dst, full_dst)
  
      r_package_file_name = f"catboost-R-{platform_name}.tgz"
      logging.info(f"creating {r_package_file_name}")
      if not dry_run:
          with tarfile.open(r_package_file_name, "w:gz") as tar:
              tar.add("catboost", arcname=os.path.basename("catboost"))
  
      os.chdir(src_root_dir)
  
imports: import argparse
  import distutils
  import hashlib
  import logging
  import os
  import subprocess
  import sys
  import tarfile
  from typing import List, Tuple
label_desc: Use image node_id 10 for calling a global function with example usage: build_r_package(src_root_dir, build_native_root_dir, platform_name, dry_run, verbose) and returns: dict