code: def archive_deterministically(
      dir_to_archive, dest_archive, prepend_path=None, timestamp=0
  ):
      """Create a .tar.gz archive in a deterministic (reproducible) manner.
  
      See https://reproducible-builds.org/docs/archives/ for more details.
      """
  
      def reset(tarinfo):
          """Helper to reset owner/group and modification time for tar entries"""
          tarinfo.uid = tarinfo.gid = 0
          tarinfo.uname = tarinfo.gname = "root"
          tarinfo.mtime = timestamp
          return tarinfo
  
      dest_archive = os.path.abspath(dest_archive)
      with cd(dir_to_archive):
          current_dir = "."
          file_list = [current_dir]
          for root, dirs, files in os.walk(current_dir):
              for name in itertools.chain(dirs, files):
                  file_list.append(os.path.join(root, name))
  
          # Sort file entries with the fixed locale
          with setlocale("C"):
              file_list.sort(key=locale.strxfrm)
  
          # Use a temporary file and atomic rename to avoid partially-formed
          # packaging (in case of exceptional situations like running out of disk space).
          temp_file = f"{dest_archive}.temp~"
          with os.fdopen(
              os.open(temp_file, os.O_WRONLY | os.O_CREAT, 0o644), "wb"
          ) as out_file:
              with gzip.GzipFile(
                  fileobj=out_file, mtime=0, mode="wb"
              ) as gzip_file:
                  with tarfile.open(
                      fileobj=gzip_file, mode="w:"
                  ) as tar_file:
                      for entry in file_list:
                          arcname = entry
                          if prepend_path is not None:
                              arcname = os.path.normpath(
                                  os.path.join(prepend_path, arcname)
                              )
                          tar_file.add(
                              entry,
                              filter=reset,
                              recursive=False,
                              arcname=arcname,
                          )
          os.rename(temp_file, dest_archive)
  
file_path: airflow/dev/breeze/src/airflow_breeze/utils/reproducible.py
imports: from __future__ import annotations
  import contextlib
  import gzip
  import itertools
  import locale
  import os
  import tarfile
  from argparse import ArgumentParser
  from airflow_breeze.utils.path_utils import AIRFLOW_SOURCES_ROOT
label_desc: Use image node_id 4 for calling a global function with example usage: archive_deterministically(dir_to_archive, dest_archive, prepend_path, timestamp) and returns: tarinfo