【shell打tag差异包脚本】

shell打tag差异包脚本

function convert_compiled_path_2_installed_path(){
if [[ “$f” =~ “target/classes/” ]];then
dst_dir=echo $1 | sed 's/^.*target\//WEB-INF\//'
elif [[ “$1” =~ “script/” ]];then
dst_dir=echo $1 | sed 's/^.*script\//WEB-INF\/classes\/script\//'
elif [[ “$1” =~ “model/” ]];then
dst_dir=echo $1 | sed 's/^.*model\//WEB-INF\/classes\/model\//'
else
echo " - Error: 未知源文件路径 $f"
exit 1
fi
echo $dst_dir
}

PATCH_FILE_NAME=agla-web_patch_8.31.20_$publish_date_req
echo “=== Start to calculate the patch files ======”

#查询差异文件,并将相应文件路径转换为编译后文件路径
git diff $rTag $tTag --name-only | grep -v version.md | grep -v pom.xml | grep -v pomExec.xml| grep -v pomTsf.xml | grep -v .gitignore >patch.log

- java工程

sed -i ‘s/.java$/.class/’ patch.log
sed -i ‘s/src/main/java/target/classes/’ patch.log
sed -i ‘s/src/main/resources/target/classes/’ patch.log
sed -i 's/\s/
/g’ patch.log

PATCH_FILE_NUM=cat patch.log|wc -l
echo “=== Patch file count: $PATCH_FILE_NUM”
if [ $PATCH_FILE_NUM -eq 0 ];then
echo “no files for pack”
exit 0
fi

cat patch.log | while read f
do
ls $f >/dev/null 2>&1
src_dir=dirname $f

#将编译后文件路径转换为部署后文件路径
dst_dir=convert_compiled_path_2_installed_path $src_dir

echo " - src_file: $f, dst_dir: d s t d i r " m k d i r − p . . / p a t c h d e v 8 . 31.20 / dst_dir" mkdir -p ../patch_dev_8.31.20/ dstdir"mkdirp../patchdev8.31.20/PATCH_FILE_NAME/$dst_dir
cp -u -r f . . / p a t c h d e v 8 . 31.20 / f ../patch_dev_8.31.20/ f../patchdev8.31.20/PATCH_FILE_NAME/$dst_dir
if [ $? -gt 0 ];then
echo " - Error: Copy failed"
exit 1
fi
done

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值