Package: svn-buildpackage
Version: 0.6.14
Severity: wishlist
Tags: patch
Hi,
If you consider it useful, please include the attached command in a
contrib dir of your package with whatever license your package
currently uses.
The need for such a command appeared in pkg-gnome because we use
various patch systems (CDBS' simple-patchsys, dpatch, and now
quilt...), which provide some commands to edit patches when in a source
tree, but these helpers were useless from a SVN checkout and required
exporting the source and copying back the result.
Sample uses in pkg-gnome:
1) clean the tree (useful if this requires the full source tree)
% svn-do debclean
I: Exporting source tree via svn-buildpackage...
[...]
I: Running command: debclean
[...]
I: Copying back the debian/ tree...
`debian/control' ->
`/home/lool/svn/debian/pkg-gnome/desktop/unstable/nautilus-cd-burner/debian/control'
2) use quilt to refresh a patch
% QUILT_PATCHES=debian/patches svn-do \
sh -c "quilt push 002_static-linking-dont-build-perf.patch; quilt
refresh"
[...]
I: Copying back the debian/ tree...
[...]
`debian/patches/002_static-linking-dont-build-perf.patch' ->
`/home/lool/svn/debian/pkg-gnome/desktop/experimental/gtk+2.0/debian/patches/002_static-linking-dont-build-perf.patch'
3) start a source editing session and decide later not to copy back the
debian/ tree
% svn-do $SHELL
[...]
I: Running command: /bin/zsh
% exit 1
E: command exited with 1; not copying back the debian/ tree.
4) edit a patch in a CDBS' simple-patchsys based package
% svn-do cdbs-edit-patch 02_pmount.patch
[...]
(XXX this requires patching cdbs-edit-patch to return 0 when the
patch is updated, I've filed a different bug about this)
Thanks!
-- System Information:
Debian Release: Debian unstable (sid)
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-2-686
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)
Versions of packages svn-buildpackage depends on:
ii devscripts 2.9.21 Scripts to make the life of a Debi
ii libsvn-core-perl 1.3.2-6 Perl bindings for Subversion
ii perl 5.8.8-6.1 Larry Wall's Practical Extraction
ii subversion 1.4.0-2 Advanced version control system
ii subversion-tools 1.4.0-2 Assorted tools related to Subversi
svn-buildpackage recommends no packages.
-- no debconf information
--
Loïc Minier <[EMAIL PROTECTED]>
#!/bin/sh
#
# svn-do
#
# svn-do will use svn-buildpackage to export a source, run a command inside the
# exported source, and -- if the command succeeds -- copy back the debian/ tree
#
# Copyright (C) 2006 Loïc Minier <[EMAIL PROTECTED]>
#
# 1) clean the tree (useful if this requires the full source tree)
# % svn-do debclean
# I: Exporting source tree via svn-buildpackage...
# [...]
# I: Running command: debclean
# [...]
# I: Copying back the debian/ tree...
# `debian/control' ->
#
`/home/lool/svn/debian/pkg-gnome/desktop/unstable/nautilus-cd-burner/debian/control'
#
# 2) use quilt to refresh a patch
# % QUILT_PATCHES=debian/patches svn-do \
# sh -c "quilt push 002_static-linking-dont-build-perf.patch; quilt
refresh"
# [...]
# I: Copying back the debian/ tree...
# [...]
# `debian/patches/002_static-linking-dont-build-perf.patch' ->
#
`/home/lool/svn/debian/pkg-gnome/desktop/experimental/gtk+2.0/debian/patches/002_static-linking-dont-build-perf.patch'
#
# 3) start a source editing session and decide later not to copy back the
# debian/ tree
# % svn-do $SHELL
# [...]
# I: Running command: /bin/zsh
# % exit 1
# E: command exited with 1; not copying back the debian/ tree.
#
# 4) edit a patch in a CDBS' simple-patchsys based package
# % svn-do cdbs-edit-patch 02_pmount.patch
# [...]
set -e
OLD_WD=$(pwd)
if ! [ -d .svn ]; then
echo "E: Not in a SVN checkout" >&2
exit 1
fi
if ! dh_testdir; then
echo "E: Not in a Debian source tree" >&2
exit 1
fi
echo "I: Exporting source tree via svn-buildpackage..." >&2
tree=$(LC_ALL=C svn-buildpackage --svn-dont-clean --svn-export | sed -n
's/.*exported to \(.*\)/\1/p')
# uncomment this if you want to purge the exported tree on completion
# (successful or not)
#cleanup() {
# echo "I: Cleaning up..." >&2
# rm -rf "$*"
#}
#trap "cleanup $tree" 0 1 2 3 9 11 13 15
cd "$tree"
echo "I: Running command: $*"
("$@")
err=$?
if [ 0 != $err ]; then
echo "E: command exited with $err; not copying back the debian/ tree." >&2
exit 1
fi
echo "I: Copying back the debian/ tree..." >&2
cp -vuapf debian/* "$OLD_WD/debian"