Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

Commit

Permalink
Have make_dpkg preserve release branch
Browse files Browse the repository at this point in the history
- Instead of always checking out aiyprojects, grab the SHA hash that the
submodule points to. This should result in a checkout w/ detached HEAD
pointing to the release.
- Add a git reset at the end, to clean up dirty files from the
packaging.

Change-Id: Icb3e28d8f02180f904b268fc0643d08bede16f69
  • Loading branch information
atvrager committed Apr 12, 2018
1 parent 8208cd6 commit fca6998
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions make_dpkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,26 @@ cp -r debian ${WORK_DIR}

# Copy aiyprojects and set remote to github.
AIY_PYTHON_DIR=${WORK_DIR}/opt/aiy/projects-python
WORK_BRANCH=aiyprojects
rm -f ${AIY_PYTHON_DIR}/.git
if [ -d ${AIY_PYTHON_DIR}/.git ]; then
rsync -rL --exclude=.git/shallow ${SCRIPT_DIR}/.git ${AIY_PYTHON_DIR}
else
WORK_BRANCH=$(git -C ${SCRIPT_DIR}/.. submodule status aiy-projects-python | awk '{print $1}' | sed 's/[+-]//g')
cp -r ${SCRIPT_DIR}/../.git/modules/aiy-projects-python ${AIY_PYTHON_DIR}/.git
fi
ls -la ${AIY_PYTHON_DIR}/.git/
sed -i '/\tworktree =/d' ${AIY_PYTHON_DIR}/.git/config
git -C ${AIY_PYTHON_DIR} checkout aiyprojects
for BRANCH in $(git -C ${AIY_PYTHON_DIR} branch | sed 's/\*//'); do
git -C ${AIY_PYTHON_DIR} checkout "${WORK_BRANCH}"
for BRANCH in $(git -C ${AIY_PYTHON_DIR} branch | grep -v 'detached' | sed 's/\*//'); do
if [[ "$BRANCH" != "aiyprojects" ]]; then
git -C ${AIY_PYTHON_DIR} branch -D ${BRANCH}
fi
done
git -C ${AIY_PYTHON_DIR} remote remove origin | true
git -C ${AIY_PYTHON_DIR} remote add origin \
https://github.com/google/aiyprojects-raspbian
git -C ${AIY_PYTHON_DIR} reset --hard ${WORK_BRANCH}

pushd ${WORK_DIR}
dpkg-buildpackage -b -rfakeroot -us -uc
Expand Down

0 comments on commit fca6998

Please sign in to comment.