Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix create_source_tarball.sh script to be compatible with recent setuptools versions #894

Merged
merged 3 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:

# script should fail if expected source tarball did not get created in dist/
($GITHUB_WORKSPACE/scripts/create_source_tarball.sh ${{matrix.repo}} $version 2>&1 | tee $out) || true
grep "ERROR: Expected file dist/${{matrix.repo}}-${version}.tar.gz not found!" $out
grep "ERROR: No source tarball for ${{matrix.repo}} ${version} found" $out
echo "Expected error found in output: OK!"

# clean up index file, to avoid check for dirty working directory failing
Expand Down
54 changes: 35 additions & 19 deletions scripts/create_source_tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function success() {
}

function warning() {
echo -e "\033[31mWARNING: $1\033[0m" >&2
echo -e "\033[33mWARNING: $1\033[0m" >&2
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just makes warnings yellow rather than red, so they stand out from errors a bit better

warnings="$warnings$1 "
}

Expand Down Expand Up @@ -78,14 +78,19 @@ else
error "Expected to be in $repo directory, found myself in $cwd"
fi

# recent version of setuptools normalize source tarball name by replacing dashes ('-)
# in package name with underscores ('_'), so easybuild-framework becomes easybuild_framework;
repo_underscore=$(echo ${repo} | tr '-' '_')

# make sure source tarball doesn't already exist in dist/ subdirectory
sdist_tar_gz=dist/${repo}-${version}.tar.gz
echo -n ">> making sure $sdist_tar_gz doesn't exist yet ... "
if [ -f $sdist_tar_gz ]; then
error "Found $sdist_tar_gz, which will be blindly overwritten by this script, please (re)move first!"
else
ok
fi
for sdist_tar_gz in dist/${repo_underscore}-${version}.tar.gz dist/${repo}-${version}.tar.gz; do
echo -n ">> making sure $sdist_tar_gz doesn't exist yet ... "
if [ -f $sdist_tar_gz ]; then
error "Found $sdist_tar_gz, which will be blindly overwritten by this script, please (re)move first!"
else
ok
fi
done

# make sure we're on the main branch
curr_branch=$(git status -b --porcelain | grep '^##' | cut -f2 -d' ' | cut -f1 -d'.')
Expand Down Expand Up @@ -189,21 +194,32 @@ else
error "Creating source tarball failed, output in $out"
fi

echo -n ">> checking for $sdist_tar_gz ... "
if [ -f $sdist_tar_gz ]; then
ok
else
error "Expected file $sdist_tar_gz not found!"
for sdist_tar_gz in dist/${repo_underscore}-${version}.tar.gz dist/${repo}-${version}.tar.gz; do
echo -n ">> checking for $sdist_tar_gz ... "
if [ -f $sdist_tar_gz ]; then
ok
break
else
warning "$sdist_tar_gz not found"
fi
done
if [ ! -f $sdist_tar_gz ]; then
error "No source tarball for ${repo} ${version} found in $PWD/dist!"
fi

# sanity checks on source tarball
cd $tmpdir; tar xfz $cwd/$sdist_tar_gz; cd - > /dev/null
unpacked_sdist=$tmpdir/${repo}-${version}
echo -n ">> checking for unpacked source tarball at $unpacked_sdist ... "
if [ -d $unpacked_sdist ]; then
ok
else
error "Expected unpacked source tarball at $unpacked_sdist, not found!"
for unpacked_sdist in $tmpdir/${repo_underscore}-${version} $tmpdir/${repo}-${version}; do
echo -n ">> checking for unpacked source tarball at $unpacked_sdist ... "
if [ -d $unpacked_sdist ]; then
ok
break
else
warning "Unpacked source tarball at $unpacked_sdist not found!"
fi
done
if [ ! -d $unpacked_sdist ]; then
error "No unpacked source tarball found for ${repo} ${version} in $tmpdir!"
fi

if [[ "$repo" == "easybuild-easyconfigs" ]]; then
Expand Down
Loading