Skip to content

Commit

Permalink
Recreate tar #2
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinqian-db committed Oct 24, 2024
1 parent 7e578a3 commit ef34ed4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions container/incremental_load.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ function untar_and_retar_without_xattrs() {
# Create a temporary directory for untarring
local tmp_dir
tmp_dir=$(mktemp -d)
chmod +rw "${tmp_dir}"

# Step 1: Untar the original tarball into the temporary directory
tar -xPf "${original_tarball}" -C "${tmp_dir}"

# Step 2: Remove extended attributes from all files in the extracted directory
find "${tmp_dir}" -exec xattr -c {} \;
find "${tmp_dir}" -exec chmod +rw {} 2>/dev/null \; -exec xattr -c {} 2>/dev/null \;

# Step 3: Re-tar the files without xattrs
tar --no-xattrs -cPf "${new_tarball}" -C "${tmp_dir}" .
Expand All @@ -54,7 +55,7 @@ RUNFILES="${PYTHON_RUNFILES:-$(guess_runfiles)}"
DOCKER="${DOCKER:-docker}"

COPYFILE_DISABLE=1
TAR=(tar --xattrs)
TAR=(tar --no-xattrs)

# Create temporary files in which to record things to clean up.
TEMP_FILES="$(mktemp -t 2>/dev/null || mktemp -t 'rules_docker_files')"
Expand Down Expand Up @@ -211,8 +212,8 @@ function import_config() {
# Only create the link if it doesn't exist.
# Only add files to MISSING once.
if [ ! -f "${diff_id}.tar" ]; then
untar_and_retar_without_xattrs "${layer}" "${diff_id}.tar"
# cp "${layer}" "${diff_id}.tar"
# untar_and_retar_without_xattrs "${layer}" "${diff_id}.tar"
cp "${layer}" "${diff_id}.tar"
# ln -s "${layer}" "${diff_id}.tar"
# TEST TEST TEST
# chmod +w "${diff_id}.tar"
Expand Down

0 comments on commit ef34ed4

Please sign in to comment.