mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-07 15:01:34 +00:00
support adding existing patches (e.g. from launchpad)
thanks to David Futcher (LP: #586787)
This commit is contained in:
parent
f3c6d92b03
commit
3ed4038008
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -23,6 +23,8 @@ ubuntu-dev-tools (0.100) UNRELEASED; urgency=low
|
|||||||
[ Michael Vogt ]
|
[ Michael Vogt ]
|
||||||
* edit-patch:
|
* edit-patch:
|
||||||
- support full path to the patch as well (LP: #585599)
|
- 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
|
-- Benjamin Drung <bdrung@ubuntu.com> Thu, 03 Jun 2010 21:32:01 +0200
|
||||||
|
|
||||||
|
38
edit-patch
38
edit-patch
@ -180,6 +180,40 @@ add_patch_tagging() {
|
|||||||
sed -i ${RANGE}i"$PATCH_DESC" debian/patches/$1
|
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:
|
# TODO:
|
||||||
# - edit-patch --remove implementieren
|
# - edit-patch --remove implementieren
|
||||||
@ -190,13 +224,15 @@ main() {
|
|||||||
# parse args
|
# parse args
|
||||||
if [ $# -ne 1 ]; then
|
if [ $# -ne 1 ]; then
|
||||||
fatal_error "Need exactly one patch name"
|
fatal_error "Need exactly one patch name"
|
||||||
fi
|
fi
|
||||||
PATCHNAME="$1"
|
PATCHNAME="$1"
|
||||||
# do the work
|
# do the work
|
||||||
ensure_debian_dir
|
ensure_debian_dir
|
||||||
detect_patchsystem
|
detect_patchsystem
|
||||||
|
detect_patch_location
|
||||||
normalize_patch_path
|
normalize_patch_path
|
||||||
normalize_patch_extension
|
normalize_patch_extension
|
||||||
|
prepare_new_patch
|
||||||
edit_patch_$PATCHSYSTEM $PATCHNAME
|
edit_patch_$PATCHSYSTEM $PATCHNAME
|
||||||
add_patch_tagging $PATCHNAME
|
add_patch_tagging $PATCHNAME
|
||||||
add_changelog $PATCHNAME
|
add_changelog $PATCHNAME
|
||||||
|
Loading…
x
Reference in New Issue
Block a user