3
0
mirror of https://git.launchpad.net/ubuntu-dev-tools synced 2025-03-13 08:01:09 +00:00

support adding existing patches (e.g. from launchpad)

thanks to David Futcher (LP: )
This commit is contained in:
Michael Vogt 2010-06-07 13:34:06 +02:00
parent f3c6d92b03
commit 3ed4038008
2 changed files with 39 additions and 1 deletions

2
debian/changelog vendored

@ -23,6 +23,8 @@ ubuntu-dev-tools (0.100) UNRELEASED; urgency=low
[ Michael Vogt ]
* edit-patch:
- support full path to the patch as well (LP: #585599)
- support adding existing patches (e.g. from launchpad)
thanks to David Futcher (LP: #586787)
-- Benjamin Drung <bdrung@ubuntu.com> Thu, 03 Jun 2010 21:32:01 +0200

@ -180,6 +180,40 @@ add_patch_tagging() {
sed -i ${RANGE}i"$PATCH_DESC" debian/patches/$1
}
detect_patch_location() {
# Checks whether the specified patch exists in debian/patches or on the filesystem
FILENAME=${PATCHNAME##*/}
if [ -f "debian/patches/$FILENAME" ]; then
PATCHTYPE="debian"
elif [ -f "$PATCHNAME" ]; then
PATCHTYPE="file"
PATCHORIG="$PATCHNAME"
else
PATCHTYPE="new"
fi
}
prepare_new_patch() {
# Prepares new patches by copying them into debian/patches and adding
# them to the relevant series files. Also adds dpatch headers when required.
if [ "$PATCHTYPE" = "file" ]; then
cp "$PATCHORIG" "debian/patches/$PATCHNAME"
if [ "$PATCHSYSTEM" = "quilt" ]; then
echo "$PATCHNAME" >> debian/patches/series
elif [ "$PATCHSYSTEM" = "dpatch" ]; then
echo "$PATCHNAME" >> debian/patches/00list
# Add the dpatch header to files that don't already have it
if ! grep -q "@DPATCH@" "debian/patches/$PATCHNAME"; then
sed -i '1i#! /bin/sh /usr/share/dpatch/dpatch-run\n@DPATCH@' debian/patches/$PATCHNAME
fi
fi
echo "Copying and applying new patch. You can now edit the patch or exit the subshell to save."
fi
}
# TODO:
# - edit-patch --remove implementieren
@ -195,8 +229,10 @@ main() {
# do the work
ensure_debian_dir
detect_patchsystem
detect_patch_location
normalize_patch_path
normalize_patch_extension
prepare_new_patch
edit_patch_$PATCHSYSTEM $PATCHNAME
add_patch_tagging $PATCHNAME
add_changelog $PATCHNAME