From af2497291f58a50e4616a4a771259b04f50013f2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 22 Dec 2010 15:44:22 +0100 Subject: [PATCH] add "add-patch" that provides the non-interactive version of edit-patch --- add-patch | 1 + debian/changelog | 4 ++++ edit-patch | 51 ++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 48 insertions(+), 8 deletions(-) create mode 120000 add-patch diff --git a/add-patch b/add-patch new file mode 120000 index 0000000..7287791 --- /dev/null +++ b/add-patch @@ -0,0 +1 @@ +edit-patch \ No newline at end of file diff --git a/debian/changelog b/debian/changelog index 360fbaf..f91b1b4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -31,6 +31,10 @@ ubuntu-dev-tools (0.109) UNRELEASED; urgency=low - Fix crash if uploading to ubuntu without building the package before. - Fix: The package was only uploaded if the target was "ubuntu". * Recommend bzr-builddeb (used by sponsor-patch for branches). + + [ Michael Vogt ] + * add "add-patch" that provides the non-interactive version of + edit-patch -- Benjamin Drung Wed, 22 Dec 2010 14:22:58 +0100 diff --git a/edit-patch b/edit-patch index 4ccb8c7..14cd8e8 100755 --- a/edit-patch +++ b/edit-patch @@ -3,8 +3,8 @@ # Copyright (C) 2009 Canonical # # Authors: -# Daniel Holbach # Michael Vogt +# Daniel Holbach # David Futcher # # This program is free software; you can redistribute it and/or modify it under @@ -142,6 +142,43 @@ edit_patch_quilt() { vcs_add $PREFIX/$1 $PREFIX/series } +edit_patch_none() { + # Dummy edit-patch function, just display a warning message + echo "No patchsystem could be found so the patch was applied inline and a copy \ +stored in debian/patches-applied. Please remember to mention this in your changelog." +} + +add_patch_quilt() { + # $1 is the original patchfile, $2 the normalized name + # FIXME: use quilt import instead? + cp $1 $PREFIX/$2 + if ! grep -q $2 $PREFIX/series; then + echo "$2" >> $PREFIX/series + fi + vcs_add $PREFIX/$2 $PREFIX/series +} + +add_patch_cdbs() { + # $1 is the original patchfile, $2 the normalized name + cp $1 $PREFIX/$2 + vcs_add $PREFIX/$2 +} + +add_patch_dpatch() { + # $1 is the original patchfile, $2 the normalized name + cp $1 $PREFIX + if ! grep -q $2 $PREFIX/00list; then + echo "$2" >> $PREFIX/00list + fi + vcs_add $PREFIX/$2 $PREFIX/00list +} + +add_patch_none() { + # $1 is the original patchfile, $2 the normalized name + cp $1 $PREFIX/$2 + vcs_add $PREFIX/$2 +} + vcs_add() { if [ -d .bzr ]; then bzr add $@ @@ -204,12 +241,6 @@ detect_patch_location() { fi } -edit_patch_none() { - # Dummy edit-patch function, just display a warning message - echo "No patchsystem could be found so the patch was applied inline and a copy \ -stored in debian/patches-applied. Please remember to mention this in your changelog." -} - handle_file_patch() { if [ "$PATCHTYPE" = "file" ]; then [ -f "$PATCHORIG" ] || fatal_error "No patch detected" @@ -259,7 +290,11 @@ main() { normalize_patch_path normalize_patch_extension handle_file_patch - edit_patch_$PATCHSYSTEM $PATCHNAME + if [ "$(basename $0)" = "edit-patch" ]; then + edit_patch_$PATCHSYSTEM $PATCHNAME + elif [ "$(basename $0)" = "add-patch" ]; then + add_patch_$PATCHSYSTEM $1 $PATCHNAME + fi add_patch_tagging $PATCHNAME add_changelog $PATCHNAME vcs_commit