Summary:
This is a followup to https://github.com/facebook/rocksdb/issues/13190. We're patching the targets generating script to construct `BUCK` file instead of deprecated `TARGETS` file + adding safety checks to ensure that `BUCK` file does not go missing (either as a direct renaming / removal OR as a modification to buckfier's script(s)).
Pull Request resolved: https://github.com/facebook/rocksdb/pull/13196
Test Plan:
1. Manually verify 'Compare buckify output' step produces expected results (vs previously soft-failed one [here](3404417354
)).
2. Manually test following scenarios (for both of which we expect the buckifier script to fail):
-> Simulate removing `BUCK` file via commit
-> Simulate buckifier script removing the `BUCK` file
Reviewed By: pdillinger
Differential Revision: D66903948
Pulled By: mszeszko-meta
fbshipit-source-id: 0f83fd2f87b600981f640ccdbc3a4640974a63d4
44 lines
926 B
Bash
Executable file
44 lines
926 B
Bash
Executable file
#!/usr/bin/env bash
|
|
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
|
|
if [[ ! -f "BUCK" ]]
|
|
then
|
|
echo "BUCK file is missing!"
|
|
echo "Please do not remove / rename BUCK file in your commit(s)."
|
|
exit 1
|
|
fi
|
|
|
|
TGT_DIFF=`git diff BUCK | head -n 1`
|
|
|
|
if [ ! -z "$TGT_DIFF" ]
|
|
then
|
|
echo "BUCK file has uncommitted changes. Skip this check."
|
|
exit 0
|
|
fi
|
|
|
|
echo Backup original BUCK file.
|
|
|
|
cp BUCK BUCK.bkp
|
|
|
|
${PYTHON:-python3} buckifier/buckify_rocksdb.py
|
|
|
|
if [[ ! -f "BUCK" ]]
|
|
then
|
|
echo "BUCK file went missing after running buckifier/buckify_rocksdb.py!"
|
|
echo "Please do not remove the BUCK file."
|
|
exit 1
|
|
fi
|
|
|
|
TGT_DIFF=`git diff BUCK | head -n 1`
|
|
|
|
if [ -z "$TGT_DIFF" ]
|
|
then
|
|
mv BUCK.bkp BUCK
|
|
exit 0
|
|
else
|
|
echo "Please run '${PYTHON:-python3} buckifier/buckify_rocksdb.py' to update BUCK file."
|
|
echo "Do not manually update BUCK file."
|
|
${PYTHON:-python3} --version
|
|
mv BUCK.bkp BUCK
|
|
exit 1
|
|
fi
|