update scripts
Signed-off-by: renoseven <dev@renoseven.net>
This commit is contained in:
parent
2901ec3d3c
commit
27bb77c699
@ -1,25 +1,31 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
readonly REPO_NAME="syscare"
|
readonly SPEC_FILE="$(find . -name '*.spec' | head -n 1)"
|
||||||
readonly REPO_PROVIDER="openeuler"
|
|
||||||
readonly REPO_URL="https://gitee.com/$REPO_PROVIDER/$REPO_NAME"
|
readonly REPO_NAME="$(basename ${SPEC_FILE} | sed 's/.spec//')"
|
||||||
readonly REPO_BRANCH="openEuler-22.03"
|
readonly REPO_URL="https://gitee.com/openeuler/${REPO_NAME}"
|
||||||
|
readonly REPO_BRANCH="$(git branch --show-current | sed 's/-LTS.*//')"
|
||||||
|
readonly REPO_VERSION="$(grep Version ${SPEC_FILE} | head -n 1 | awk -F ' ' '{print $NF}')"
|
||||||
|
|
||||||
|
readonly PKG_NAME="${REPO_NAME}-${REPO_VERSION}"
|
||||||
|
readonly PKG_DIR="$(realpath ./${PKG_NAME})"
|
||||||
|
|
||||||
|
echo "Preparing..."
|
||||||
|
rm -rf ./${REPO_NAME} ./${PKG_NAME}
|
||||||
|
rm -f ./*.tar.gz
|
||||||
|
|
||||||
|
echo "--------------------------"
|
||||||
|
echo "Name: ${REPO_NAME}"
|
||||||
|
echo "Branch: ${REPO_BRANCH}"
|
||||||
|
echo "--------------------------"
|
||||||
|
|
||||||
echo "Cloning source code..."
|
echo "Cloning source code..."
|
||||||
repo_version=$(grep "Version" "$REPO_NAME.spec" | head -n 1 | awk -F ' ' '{print $NF}')
|
git clone ${REPO_URL} -b ${REPO_BRANCH} ${PKG_NAME}
|
||||||
repo_dir="$REPO_NAME-$repo_version"
|
|
||||||
|
|
||||||
rm -rf "$REPO_NAME" "$repo_dir"
|
|
||||||
git clone "$REPO_URL"
|
|
||||||
|
|
||||||
echo "Prepare build requirements..."
|
|
||||||
pushd "$REPO_NAME"
|
|
||||||
|
|
||||||
echo "Checking out dest branch..."
|
|
||||||
git checkout "$REPO_BRANCH"
|
|
||||||
|
|
||||||
echo "Vendoring dependencies..."
|
echo "Vendoring dependencies..."
|
||||||
cargo vendor --respect-source-config --sync Cargo.toml
|
pushd ${PKG_DIR} > /dev/null
|
||||||
|
|
||||||
|
cargo vendor --quiet --respect-source-config --sync Cargo.toml
|
||||||
|
|
||||||
mkdir -p .cargo
|
mkdir -p .cargo
|
||||||
cat << EOF > .cargo/config.toml
|
cat << EOF > .cargo/config.toml
|
||||||
@ -30,14 +36,12 @@ replace-with = "vendored-sources"
|
|||||||
directory = "vendor"
|
directory = "vendor"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
popd
|
popd > /dev/null
|
||||||
|
|
||||||
echo "Compressing package..."
|
echo "Compressing package..."
|
||||||
mv "$REPO_NAME" "$repo_dir"
|
tar -czf ./${PKG_NAME}.tar.gz ${PKG_NAME}
|
||||||
tar -czf "$repo_dir.tar.gz" "$repo_dir"
|
|
||||||
|
|
||||||
echo "Cleaning up..."
|
echo "Cleaning up..."
|
||||||
rm -rf "$repo_dir"
|
rm -rf ${PKG_DIR}
|
||||||
|
|
||||||
echo "Done"
|
echo "Done"
|
||||||
|
|
||||||
|
|||||||
@ -1,48 +1,47 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
readonly ROOT_DIR="$(dirname $(readlink -f ${BASH_SOURCE[0]}))"
|
|
||||||
|
|
||||||
readonly SPEC_FILE="$(find . -name '*.spec' | head -n 1)"
|
readonly SPEC_FILE="$(find . -name '*.spec' | head -n 1)"
|
||||||
|
|
||||||
readonly REPO_NAME="$(basename ${SPEC_FILE} | sed 's/.spec//')"
|
readonly REPO_NAME="$(basename ${SPEC_FILE} | sed 's/.spec//')"
|
||||||
|
readonly REPO_URL="https://gitee.com/openeuler/${REPO_NAME}"
|
||||||
|
readonly REPO_BRANCH="$(git branch --show-current | sed 's/-LTS.*//')"
|
||||||
readonly REPO_VERSION="$(grep Version ${SPEC_FILE} | head -n 1 | awk -F ' ' '{print $NF}')"
|
readonly REPO_VERSION="$(grep Version ${SPEC_FILE} | head -n 1 | awk -F ' ' '{print $NF}')"
|
||||||
readonly REPO_REMOTE="origin"
|
|
||||||
|
|
||||||
readonly PKG_NAME="${REPO_NAME}-${REPO_VERSION}"
|
readonly PKG_NAME="${REPO_NAME}-${REPO_VERSION}"
|
||||||
readonly PKG_DIR="${ROOT_DIR}/${PKG_NAME}"
|
readonly PKG_DIR="$(realpath ./${PKG_NAME})"
|
||||||
readonly PKG_BRANCH="$(git branch --show-current | sed 's/-LTS.*//')"
|
|
||||||
|
readonly PATCH_DIR="$(pwd)"
|
||||||
|
|
||||||
echo "Preparing..."
|
echo "Preparing..."
|
||||||
# clean old files
|
|
||||||
rm -f ${ROOT_DIR}/*.patch
|
|
||||||
rm -rf ${PKG_DIR}
|
rm -rf ${PKG_DIR}
|
||||||
|
rm -f ./*.patch
|
||||||
|
|
||||||
# extract package
|
tar -xf ./${PKG_NAME}.tar.gz
|
||||||
tar -xf ${PKG_NAME}.tar.gz
|
|
||||||
|
|
||||||
# fetch baseline
|
|
||||||
pushd ${PKG_DIR} > /dev/null
|
pushd ${PKG_DIR} > /dev/null
|
||||||
readonly PKG_BASELINE=$(git rev-parse --short HEAD)
|
readonly REPO_BASELINE="$(git rev-parse --short HEAD)"
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
|
||||||
echo "------------------------------"
|
echo "------------------------------"
|
||||||
echo "Name: ${PKG_NAME}"
|
echo "Name: ${REPO_NAME}"
|
||||||
echo "Branch: ${PKG_BRANCH}"
|
echo "Branch: ${REPO_BRANCH}"
|
||||||
echo "Baseline: ${PKG_BASELINE}"
|
echo "Baseline: ${REPO_BASELINE}"
|
||||||
echo "------------------------------"
|
echo "------------------------------"
|
||||||
|
|
||||||
echo "Syncing with remote..."
|
echo "Syncing with remote..."
|
||||||
pushd ${PKG_DIR} > /dev/null
|
pushd ${PKG_DIR} > /dev/null
|
||||||
git fetch ${REPO_REMOTE}
|
git fetch origin
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
|
||||||
echo "Generating patches..."
|
echo "Generating patches..."
|
||||||
# format patches
|
# format patches
|
||||||
pushd ${PKG_DIR} > /dev/null
|
pushd ${PKG_DIR} > /dev/null
|
||||||
git checkout -q ${REPO_REMOTE}/${PKG_BRANCH}
|
git checkout -q origin/${REPO_BRANCH}
|
||||||
git format-patch -qN -o ${ROOT_DIR} ${PKG_BASELINE}
|
git format-patch -qN -o ${PATCH_DIR} ${REPO_BASELINE}
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
|
||||||
# print patch list
|
# print patch list
|
||||||
patch_list="$(find ${ROOT_DIR} -maxdepth 1 -name "*.patch" | sort)"
|
patch_list="$(find . -maxdepth 1 -name "*.patch" | sort)"
|
||||||
for patch_file in ${patch_list}; do
|
for patch_file in ${patch_list}; do
|
||||||
patch_name="$(basename ${patch_file})"
|
patch_name="$(basename ${patch_file})"
|
||||||
patch_id="$(echo ${patch_name} | awk -F '-' '{print $1}')"
|
patch_id="$(echo ${patch_name} | awk -F '-' '{print $1}')"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user