Skip to content

Instantly share code, notes, and snippets.

@mikepurvis
Last active March 3, 2018 07:46
Show Gist options
  • Save mikepurvis/7036293 to your computer and use it in GitHub Desktop.
Save mikepurvis/7036293 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Prerequisites:
# sudo apt-get install python-bloom git-buildpackage
#
# Installation:
# cd ~/bin
# wget https://gist.github.com/mikepurvis/7036293/raw/bloom-local-deb
# chmod +x bloom-local-deb
#
# Usage:
# - Prepare the repo (catkin_generate_changelog, catkin_prepare_release)
# - Invoke bloom-local-deb in the repo.
git rev-parse
if [[ "$?" != "0" ]]; then
echo "This directory is not a git repo!"
exit 1
fi
GIT_REMOTE_URL=$(git config --get remote.origin.url)
DEV_BRANCH=${DEV_BRANCH-kinetic-devel}
TEMPDIR=$(mktemp -d --tmpdir $(basename $(pwd)).XXXX)
mkdir $TEMPDIR/gbp
pushd $TEMPDIR/gbp
cat <<EOF > tracks.yaml
tracks:
${ROS_DISTRO}:
actions:
- bloom-export-upstream :{vcs_local_uri} :{vcs_type} --tag :{release_tag} --display-uri :{vcs_uri} --name :{name} --output-dir :{archive_dir_path}
- git-bloom-import-upstream :{archive_path} :{patches} --release-version :{version} --replace
- git-bloom-generate -y rosrelease :{ros_distro} --source upstream -i :{release_inc}
- git-bloom-generate -y rosdebian --prefix release/:{ros_distro} :{ros_distro} -i :{release_inc}
devel_branch: ${DEV_BRANCH}
last_version: null
name: upstream
patches: null
release_inc: '0'
release_repo_url: null
release_tag: :{version}
ros_distro: ${ROS_DISTRO}
vcs_type: git
vcs_uri: ${GIT_REMOTE_URL}
version: :{auto}
EOF
git init
git add tracks.yaml
git commit -m "Add tracks.yaml"
git-bloom-release ${ROS_DISTRO}
BRANCHES=$(git branch | grep "\sdebian/kinetic/$(lsb_release -cs)/")
for BRANCH in ${BRANCHES}
do
git checkout ${BRANCH}
git clean -df
git-buildpackage -uc -us --git-ignore-new
done
echo
echo "Generated:"
ls -1 $TEMPDIR/*.deb
@zhouchengming1
Copy link

Hi, thanks for this script! But I encounter a problem when I try it on my upstream repo.
There are 2 packages in this repo, A and B, and B depend on A.
When I run this script, report error:

==> git-bloom-generate -y rosdebian --prefix release/kinetic kinetic -i 0

Pre-verifying Debian dependency keys...
Running 'rosdep update'...
Could not resolve rosdep key 'A'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment