-
Recent Posts
-
Archives
- September 2025
- December 2024
- August 2024
- September 2023
- July 2022
- October 2021
- August 2021
- April 2021
- October 2020
- May 2020
- December 2019
- August 2019
- May 2019
- August 2018
- June 2018
- March 2018
- December 2017
- October 2016
- April 2016
- February 2016
- December 2015
- November 2015
- June 2015
- April 2015
- February 2015
- January 2015
- December 2014
- November 2014
- October 2014
- September 2014
- July 2014
- June 2014
- May 2014
- April 2014
- March 2014
- February 2014
- January 2014
- November 2013
- October 2013
- August 2013
- July 2013
- June 2013
- April 2013
- March 2013
- February 2013
- August 2012
- May 2012
- February 2012
-
Categories
-
Meta
-
RSS links
Automatic backport script
Since I have to do a lot of backports for the OpenStack packages in Debian Wheezy, I got tired of doing them by hand. Therefore, I have created a script to automate the task. I’m not particularly proud (or ashamed) of that script, but I just want to share it. Probably some fellow readers will happily provide me with enhancements and ideas.
Note that the use of mk-build-deps implies that the “equivs” package has to be installed. What I do is run this “build-backport” script within a cowbuilder, to make sure I always have a clean backport environment.
#!/bin/sh
set -e
set -x
PKG_NAME=${1}
BPO_DISTRO=wheezy-backports
BPO_POSTFIX=bpo70+1
REPO_ROOT=/home/ftp
REPO_DEST=icehouse-backports
if [ `whoami` = "jenkins" ] ; then
BUILD_ROOT=/var/lib/jenkins/jobs/openstack-pkg-tools/builds/${BUILD_NUMBER}
else
BUILD_ROOT=~/sources
fi
# Get info from packages.debian.org
PKG_INFO_FILE=`mktemp -t pkg_info_file.XXXXXX`
wget --no-check-certificate -O ${PKG_INFO_FILE} http://packages.debian.org/sid/${PKG_NAME}
DEB_VERSION=`rmadison ${PKG_NAME} | grep sid | awk '{print 3ドル}'`
UPSTREAM_VERSION=`echo ${DEB_VERSION} | cut -d'-' -f1 | cut -d":" -f2`
DSC_URL=`cat ${PKG_INFO_FILE} | grep dsc | cut -d'"' -f2`
rm ${PKG_INFO_FILE}
# Prepare build folder and go in it
MY_CWD=`pwd`
rm -rf ${BUILD_ROOT}/$PKG_NAME
mkdir -p ${BUILD_ROOT}/$PKG_NAME
cd ${BUILD_ROOT}/$PKG_NAME
# Download the .dsc and extract it
dget -d -u ${DSC_URL}
PKG_SRC_NAME=`ls *.dsc | cut -d_ -f1`
PKG_NAME_FIRST_CHAR=`echo ${PKG_SRC_NAME} | awk '{print substr(0,1,1ドル)}'`
dpkg-source -x *.dsc
echo "Now running mk-build-deps -i ${PKG_SRC_NAME}-${UPSTREAM_VERSION}/debian/control"
mk-build-deps -i ${PKG_SRC_NAME}-${UPSTREAM_VERSION}/debian/control
# Build the package as backport using cowbuilder
cd ${PKG_SRC_NAME}-${UPSTREAM_VERSION}
dch --bpo -m "Backported for ${BPO_DISTRO}."
dpkg-buildpackage
cd ..
PKG_FINAL_DEST=${REPO_ROOT}/debian/pool/${REPO_DEST}/main/${PKG_NAME_FIRST_CHAR}/${PKG_SRC_NAME}
ssh archive.gplhost.com "mkdir -p ${PKG_FINAL_DEST}"
scp *.orig.tar.* *${DEB_VERSION}~${BPO_POSTFIX}* archive.gplhost.com:${PKG_FINAL_DEST}
This entry was written by Goirand Thomas , posted on March 28, 2014 at 8:24 am, filed under Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
Both comments and trackbacks are currently closed.