tips - Debian Perl Group tips and tricks
This is a small guide describing functions, aliases and scripts used by Perl team members to make life easier when packaging perl modules.
Contributions are welcome.
If you think you are using an interesting script or such, feel free to add it on this page.
for generating ITPs from debian/{control,changelog,copyright}, http://anonscm.debian.org/gitweb/?p=pkg-perl/scripts.git;a=blob_plain;f=examples/gen-itp;hb=HEAD
for adopting packages, http://anonscm.debian.org/gitweb/?p=pkg-perl/scripts.git;a=blob_plain;f=takeover-for-pkg-perl.sh;hb=HEAD
update various aspects of one or all packages, http://anonscm.debian.org/gitweb/?p=pkg-perl/scripts.git;a=blob_plain;f=qa/packagecheck;hb=HEAD
add mising pristine-tar data to git repository, http://anonscm.debian.org/gitweb/?p=pkg-perl/scripts.git;a=blob_plain;f=git-missing-pristine-tar;hb=HEAD
add missing upstream release in upstream branch of git repository, http://anonscm.debian.org/gitweb/?p=pkg-perl/scripts.git;a=blob_plain;f=git-missing-upstream;hb=HEAD
helper for editing patch headers according to DEP3, http://anonscm.debian.org/gitweb/?p=pkg-perl/scripts.git;a=blob_plain;f=patchedit;hb=HEAD
helper for forwaring Debian bug reports to CPAN RT, http://anonscm.debian.org/gitweb/?p=pkg-perl/scripts.git;a=blob_plain;f=forward-bug;hb=HEAD
helper for forwarding patches from a source package to CPAN RT, http://anonscm.debian.org/gitweb/?p=pkg-perl/scripts.git;a=blob_plain;f=forward-patch;hb=HEAD
wrapper script for building and checking packages with {svn,git}-buildpackage and pdebuild, http://anonscm.debian.org/gitweb/?p=pkg-perl/scripts.git;a=blob_plain;f=examples/buildpackage-pdebuild;hb=HEAD
wraper script for running some checks against built package, http://anonscm.debian.org/gitweb/?p=pkg-perl/scripts.git;a=blob_plain;f=examples/check-build;hb=HEAD
# download upstream tarball and import it into git-buildpackage
alias git-uscan='gbp-pull ; git-import-orig --uscan ; rm ../*.tar.gz'
# quickly edit your aliases/functions
# presumes ~/.aliases is loaded on shell startup
alias ale='vim ~/.aliases; unalias -a; source ~/.aliases'
# afsp = apt-file search $perl; obsolete since `dh-make-perl --locate'
function afsp {
apt-file search $(echo "$@" | sed -e 's;::;/;g' -e 's;$;.pm;') | uniq
}
# clone one of our repos. adjust path!
function gbp-pkg-perl-clone {
cd /home/gregoa/src/git-pkg-perl/meta/packages
gbp-clone --all git+ssh://git.debian.org/git/pkg-perl/packages/$1.git
cd /home/gregoa/src/git-pkg-perl/meta/packages/$1
}
# extract package details. used in the rest below
pkg_info()
{
dpkg-parsechangelog|grep ^$1|cut -f2 -d' '
}
# run lintian and diffstat on the package built in pbuilder result/
# directory
# package name is deduced from ./debian.
# all argumentts are given to lintian
lpdb()
{
local PKG=`pkg_info Source:`
local VER=`pkg_info Version:|sed 's/^.\+://'`
local ARCH=`dpkg-architecture -qDEB_HOST_ARCH`
local PDB=/var/cache/pbuilder/result
local CMD="lintian $@ -I --color=auto ${PDB}/${PKG}_${VER}_${ARCH}.changes"
echo $CMD
$CMD
if [ -e ${PDB}/${PKG}_${VER}.diff.gz ]; then
echo diffstat ${PDB}/${PKG}_${VER}.diff.gz
diffstat ${PDB}/${PKG}_${VER}.diff.gz
else
echo Native package.
fi
}
# show upstream/debian/binary differences between the version in the
# archive and the built package in pbuilder result/ directory
# package name deduced from ./debian/
dpdb()
{
local PKG=`pkg_info Source:`
local VER=`pkg_info Version:|sed 's/^.\+://'`
local ARCH=`dpkg-architecture -qDEB_HOST_ARCH`
local PDB=/var/cache/pbuilder/result
BINS=`awk '/^Package: /{print $2}' < debian/control`
TMP=`mktemp -d`
trap "rm -r $TMP" INT TERM QUIT
(cd $TMP && apt-get -t sid -d source ${PKG})
( echo "UPSTREAM DIFF"; debdiff -w $TMP/*.dsc ${PDB}/${PKG}_${VER}.dsc \
| filterdiff -x '*/debian/*' ) \
| tee $PDB/${PKG}_${VER}-upstream.diff | colordiff | less -R
( echo "DEBIAN DIFF"; debdiff -w $TMP/*.dsc ${PDB}/${PKG}_${VER}.dsc \
| filterdiff -i '*/debian/*' ) \
| tee ${PDB}/${PKG}_${VER}-debian.diff | colordiff | less -R
( cd $TMP && mkdir -p archives/partial && for b in $BINS; do apt-get -o Dir::Cache=. -o Debug::NoLocking=1 install --reinstall -y -d -t sid $b/unstable; done )
( cd $TMP && for p in $BINS; do echo "DEBDIFF $p"; echo "============"; debdiff --wl archives/${p}_*.deb ${PDB}/${p}_${VER}*.deb; echo; done ) \
| tee ${PDB}/${PKG}_${VER}-deb.diff \
| less -R
}
# debc on the package in the pbuilder result/ directory
cpdb()
{
local PKG=`pkg_info Source:`
local VER=`pkg_info Version:|sed 's/^.\+://'`
local ARCH=`dpkg-architecture -qDEB_HOST_ARCH`
local PDB=/var/cache/pbuilder/result
echo debc ${PDB}/${PKG}_${VER}_${ARCH}.changes
debc ${PDB}/${PKG}_${VER}_${ARCH}.changes|less
}
# sign and upload the package from pbuilder result/ directory
# any arguments are passed to debsign (-k $SELF useful when sponsoring)
spdb()
{
local PKG=`pkg_info Source:`
local VER=`pkg_info Version:|sed 's/^.\+://'`
local ARCH=`dpkg-architecture -qDEB_HOST_ARCH`
local PDB=/var/cache/pbuilder/result
echo debsign $* ${PDB}/${PKG}_${VER}_${ARCH}.changes
debsign $* ${PDB}/${PKG}_${VER}_${ARCH}.changes
echo dupload --to debian ${PDB}/${PKG}_${VER}_${ARCH}.changes
dupload --to debian ${PDB}/${PKG}_${VER}_${ARCH}.changes
}
# upload package from pbuilder result/ directory to local apt reposutory
# useful for making packages in NEW available to pbuilder
lupdb()
{
local DEST
DEST=$1
if [ -z "$DEST" ]; then
echo "Synopsys: lpdb DEST"
return 1
fi
local PKG=`pkg_info Source:`
local VER=`pkg_info Version:|sed 's/^.\+://'`
local ARCH=`dpkg-architecture -qDEB_HOST_ARCH`
local PDB=/var/cache/pbuilder/result
reprepro -b /disk1/test-repo/$DEST include sid ${PDB}/${PKG}_${VER}_${ARCH}.changes
}
# inject new package into pkg-perl SVN repository
pkg-perl-inject() {
local PKG=`pkg_info 'Source: '`
local VER=`pkg_info 'Version: '`
local DSC="../${PKG}_${VER}.dsc"
if ! [ -f "$DSC" ]; then
echo "'$DSC' not found"
return 1
fi
local CMD="svn-inject -l2 -c0 $DSC svn+ssh://svn.debian.org/svn/pkg-perl"
echo $CMD
$CMD
}
# run development version of dh-make-perl
dh-make-perl-dev() {
local DHMP=~/work/debian/pkg-perl/apps/dh-make-perl
PERL5LIB=$DHMP/lib $DHMP/dh-make-perl --data-dir $DHMP/share "$@"
}
Copyright (c) 2009, 2010, 2012 by the individual authors and contributors noted above. All rights reserved. This document is free software; you may redistribute it and/or modify it under the same terms as Perl itself
Perl is distributed under your choice of the GNU General Public License or the Artistic License. On Debian GNU/Linux systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL' and the Artistic License in `/usr/share/common-licenses/Artistic'.