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

Clean up contents from previously-sb tarball post binary-cleanup #40772

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 16 additions & 15 deletions src/SourceBuild/content/prep-source-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -223,34 +223,35 @@ fi

if [ "$removeBinaries" == true ]; then

originalPackagesDir=$packagesDir
# Create working directory for extracking packages
workingDir=$(mktemp -d)

# If --with-packages is not passed, unpack PSB artifacts
if [[ $packagesDir == $defaultPackagesDir ]]; then
echo " Extracting previously source-built to $workingDir"
sourceBuiltArchive=$(find "$packagesArchiveDir" -maxdepth 1 -name 'Private.SourceBuilt.Artifacts*.tar.gz')

if [ ! -d "$packagesDir" ] && [ -f "$sourceBuiltArchive" ]; then
echo " Unpacking Private.SourceBuilt.Artifacts.*.tar.gz into $packagesDir"
mkdir -p "$packagesDir"
tar -xzf "$sourceBuiltArchive" -C "$packagesDir"
elif [ -f "$sourceBuiltArchive" ]; then
if [ ! -f "$packagesDir/PackageVersions.props" ]; then
echo " Creating $packagesDir/PackageVersions.props..."
tar -xzf "$sourceBuiltArchive" -C "$packagesDir" PackageVersions.props
fi
if [ ! -f "$packagesDir/VerticalManifest.xml" ]; then
echo " Unpacking Asset manifests into $packagesDir..."
tar -xzf "$sourceBuiltArchive" -C "$packagesDir" VerticalManifest.xml
fi
else
if [ ! -f "$sourceBuiltArchive" ]; then
jkoritzinsky marked this conversation as resolved.
Show resolved Hide resolved
echo " ERROR: Private.SourceBuilt.Artifacts.*.tar.gz does not exist..."\
"Cannot remove non-SB allowed binaries. Either pass --with-packages or download the artifacts."
exit 1
fi

echo " Unpacking Private.SourceBuilt.Artifacts.*.tar.gz into $workingDir"
tar -xzf "$sourceBuiltArchive" -C "$workingDir"

packagesDir=$workingDir
fi

"$REPO_ROOT/eng/detect-binaries.sh" \
"$REPO_ROOT/eng/detect-binaries.sh" \
--clean \
--allowed-binaries-file "$REPO_ROOT/eng/allowed-sb-binaries.txt" \
--with-packages $packagesDir \
--with-sdk $dotnetSdk \

rm -rf "$workingDir"

packagesDir=$originalPackagesDir
unset originalPackagesDir
fi