code: def compare_tar_against_git(tarname, gitroot):
      """
      Compare the contents of the tarball against git ls-files
  
      See the bottom of the file for the whitelists.
      """
      git_lsfiles = {
          i.strip() for i in run("git", "ls-files", cwd=gitroot)
      }
      tar_output_orig = set(run("tar", "tf", tarname))
      tar_output = set()
      for file in tar_output_orig:
          # The tar files are like sympy-0.7.3/sympy/__init__.py, and the git
          # files are like sympy/__init__.py.
          split_path = full_path_split(file)
          if split_path[-1]:
              # Exclude directories, as git ls-files does not include them
              tar_output.add(os.path.join(*split_path[1:]))
      # print tar_output
      # print git_lsfiles
      fail = False
      print()
      print(
          blue(
              "Files in the tarball from git that should not be there:"
          )
      )
      print()
      for line in sorted(tar_output.intersection(git_whitelist)):
          fail = True
          print(line)
      print()
      print(blue("Files in git but not in the tarball:"))
      print()
      for line in sorted(git_lsfiles - tar_output - git_whitelist):
          fail = True
          print(line)
      print()
      print(blue("Files in the tarball but not in git:"))
      print()
      for line in sorted(tar_output - git_lsfiles - tarball_whitelist):
          fail = True
          print(line)
      print()
  
      if fail:
          sys.exit(
              red(
                  "Non-whitelisted files found or not found in the tarball"
              )
          )
  
file_path: sympy/release/compare_tar_against_git.py
imports: from subprocess import check_output
  import sys
  import os.path
label_desc: Use image node_id 6 for calling a global function with example usage: compare_tar_against_git(tarname, gitroot) without return types