diff --git a/add-patch b/add-patch deleted file mode 120000 index 7287791..0000000 --- a/add-patch +++ /dev/null @@ -1 +0,0 @@ -edit-patch \ No newline at end of file diff --git a/debian/changelog b/debian/changelog index 7f90a06..b30908a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ubuntu-dev-tools (0.124) UNRELEASED; urgency=low + + * Move add-patch, edit-patch, and what-patch from ubuntu-dev-tools into + devscripts (Closes: #568481). + + -- Benjamin Drung Sat, 21 May 2011 17:50:52 +0200 + ubuntu-dev-tools (0.123) unstable; urgency=low [ Stefano Rivera ] diff --git a/debian/control b/debian/control index c12b4e1..fe53e09 100644 --- a/debian/control +++ b/debian/control @@ -30,7 +30,7 @@ Package: ubuntu-dev-tools Architecture: all Depends: binutils, dctrl-tools, - devscripts, + devscripts (>= 2.10.74~), diffstat, dpkg-dev, lsb-release, @@ -119,6 +119,4 @@ Description: useful tools for Ubuntu developers - ubuntu-distro-info - provides information about Ubuntu's distributions. - ubuntu-iso - output information of an Ubuntu ISO image. - update-maintainer - script to update maintainer field in ubuntu packages. - - what-patch - determines what patch system, if any, a source package is - using. - wrap-and-sort - wrap long lines and sort items in packaging files. diff --git a/debian/copyright b/debian/copyright index 9602b66..0b0502f 100644 --- a/debian/copyright +++ b/debian/copyright @@ -87,7 +87,6 @@ License: GPL-2+ Files: ack-sync doc/bitesize.1 - doc/edit-patch.1 doc/get-branches.1 doc/grab-attachments.1 doc/grab-merge.1 @@ -98,7 +97,6 @@ Files: ack-sync doc/setup-packaging-environment.1 doc/syncpackage.1 bitesize - edit-patch get-branches grab-attachments grab-merge @@ -137,7 +135,6 @@ Files: dch-repeat doc/pull-lp-source.1 doc/pull-revu-source.1 doc/ubuntu-build.1 - doc/what-patch.1 get-build-deps grep-merges lp-list-bugs @@ -148,12 +145,10 @@ Files: dch-repeat ubuntutools/lp/libsupport.py ubuntutools/lp/lpapicache.py ubuntutools/misc.py - what-patch Copyright: 2007-2010, Canonical Ltd. 2008-2009, Iain Lane 2006, John Dong 2009, Jonathan Davies - 2007-2008, Kees Cook 2009, Markus Korn 2009-2010, Michael Bienia 2009, Nathan Handler diff --git a/debian/links b/debian/links index 37f1cbf..27a79e1 100644 --- a/debian/links +++ b/debian/links @@ -1,4 +1,2 @@ -/usr/bin/edit-patch /usr/bin/add-patch /usr/bin/pbuilder-dist /usr/bin/cowbuilder-dist -/usr/share/man/man1/edit-patch.1.gz /usr/share/man/man1/add-patch.1.gz /usr/share/man/man1/pbuilder-dist.1.gz /usr/share/man/man1/cowbuilder-dist.1.gz diff --git a/doc/edit-patch.1 b/doc/edit-patch.1 deleted file mode 100644 index 5e811c0..0000000 --- a/doc/edit-patch.1 +++ /dev/null @@ -1,43 +0,0 @@ -.TH EDIT-PATCH "1" "June 2010" "ubuntu-dev-tools" -.SH NAME -\fBedit-patch\fR, \fBadd-patch\fR \- tool for preparing patches for Debian -source packages - -.SH SYNOPSIS -\fBedit-patch\fR - -\fBadd-patch\fR - -.SH DESCRIPTION -\fBedit-patch\fR is a wrapper script around the quilt, cdbs, and dpatch patch -systems. It simplifies the process of preparing and editing patches to Debian -source packages and allows the user to not have to be concerned with which patch -system is in use. -Run from inside the root directory of the source package, \fBedit-patch\fR can -be used to edit existing patches located in /debian/patches. - -It can also be used to incorporate new patches. -If pointed at a patch not already present, it will copy the patch to -/debian/patches in the correct format for the patch system in use. -Next, the patch is applied and a subshell is opened in order to edit the patch. -Typing "exit" or pressing Ctrl-d will close the subshell and launch an editor -to record the debian/changelog entry. - -\fBedit-patch\fR is integrated with the bzr and git version control systems. -The patch will be automatically added to the tree, and the debian/changelog -entry will be used as the commit message. - -If no patch system is present, the patch is applied inline, -and a copy is stored in debian/patches-applied. - -\fBadd-patch\fR is the non-interactive version of \fBedit-patch\fR. -The patch will be incorporated but no editor or subshell will be -spawned. - -.SH AUTHORS -\fBedit-patch\fR was written by Daniel Holbach , -Michael Vogt , and David Futcher . - -This manual page was written by Andrew Starr-Bochicchio . -.PP -Both are released under the terms of the GNU General Public License, version 3. diff --git a/doc/what-patch.1 b/doc/what-patch.1 deleted file mode 100644 index 8969d88..0000000 --- a/doc/what-patch.1 +++ /dev/null @@ -1,40 +0,0 @@ -.TH WHAT\-PATCH "1" "10 August 2008" "ubuntu-dev-tools" -.SH NAME -what\-patch \- detects which patch system a Debian package uses - -.SH SYNOPSIS -.B what\-patch [options] - -.SH DESCRIPTION -\fBwhat\-patch\fR examines the debian/rules file to determine which patch -system the Debian package is using. -.PP -\fBwhat\-patch\fR should be run from the root directory of the Debian source -package. - -.SH OPTIONS -Listed below are the command line options for what\-patch: -.TP -.B \-h or \-\-help -Display a help message and exit. -.TP -.B \-v -Enable verbose mode. -This will include the listing of any files modified outside or the debian/ -directory and report any additional details about the patch system if -available. - -.SH AUTHORS -\fBwhat\-patch\fR was written by Kees Cook , -Siegfried-A. Gevatter , and Daniel Hahler -, among others. -This manual page was written by Jonathan Patrick Davies . -.PP -Both are released under the GNU General Public License, version 2. - -.SH SEE ALSO -The Ubuntu MOTU team has some documentation about patch systems at the Ubuntu -wiki: \fBhttps://wiki.ubuntu.com/PackagingGuide/PatchSystems\fR - -.PP -.B cdbs\-edit\-patch(1), dbs\-edit\-patch(1), dpatch\-edit\-patch(1) diff --git a/edit-patch b/edit-patch deleted file mode 100755 index 671c7ba..0000000 --- a/edit-patch +++ /dev/null @@ -1,303 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2009 Canonical -# -# Authors: -# Michael Vogt -# Daniel Holbach -# David Futcher -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free Software -# Foundation; version 3. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -set -e - - -PATCHSYSTEM="unknown" -PATCHNAME="no-patch-name" -PREFIX="debian/patches" - -PATCH_DESC=$(cat<&2 - exit 1 -} - -# check if the given binary is installed and give a error if not -# arg1: binary -# arg2: error message -require_installed() { - if ! which "$1" >/dev/null; then - fatal_error "$2" - fi -} - -ensure_debian_dir() { - if [ ! -e debian/control ] || [ ! -e debian/rules ]; then - fatal_error "Can not find debian/rules or debian/control. Not in a debian dir?" - fi - -} - -detect_patchsystem() { - CDBS_PATCHSYS="^[^#]*simple-patchsys.mk" - - if grep -q "$CDBS_PATCHSYS" debian/rules; then - PATCHSYSTEM="cdbs" - require_installed cdbs-edit-patch "no cdbs-edit-patch found, is 'cdbs' installed?" - elif [ -e debian/patches/00list ]; then - PATCHSYSTEM="dpatch" - require_installed dpatch-edit-patch "no dpatch-edit-patch found, is 'dpatch' installed?" - elif [ -e debian/patches/series -o \ - "$(cat debian/source/format 2> /dev/null)" = "3.0 (quilt)" ]; then - PATCHSYSTEM="quilt" - require_installed quilt "no quilt found, is 'quilt' installed?" - else - PATCHSYSTEM="none" - PREFIX="debian/applied-patches" - fi -} - -# remove full path if given -normalize_patch_path() { - PATCHNAME=${PATCHNAME##*/} - echo "Normalizing patch path to $PATCHNAME" -} - -# ensure (for new patches) that: -# - dpatch ends with .dpatch -# - cdbs/quilt with .patch -normalize_patch_extension() { - # check if we have a patch already - if [ -e $PREFIX/$PATCHNAME ]; then - echo "Patch $PATCHNAME exists, not normalizing" - return - fi - - # normalize name for new patches - PATCHNAME=${PATCHNAME%.*} - if [ "$PATCHSYSTEM" = "quilt" ]; then - PATCHNAME="${PATCHNAME}.patch" - elif [ "$PATCHSYSTEM" = "cdbs" ]; then - PATCHNAME="${PATCHNAME}.patch" - elif [ "$PATCHSYSTEM" = "dpatch" ]; then - PATCHNAME="${PATCHNAME}.dpatch" - elif [ "$PATCHSYSTEM" = "none" ]; then - PATCHNAME="${PATCHNAME}.patch" - fi - - echo "Normalizing patch name to $PATCHNAME" -} - -edit_patch_cdbs() { - cdbs-edit-patch $PATCHNAME - vcs_add debian/patches/$1 -} - -edit_patch_dpatch() { - dpatch-edit-patch $PATCHNAME - # add if needed - if ! grep -q $1 $PREFIX/00list; then - echo "$1" >> $PREFIX/00list - fi - vcs_add $PREFIX/00list $PREFIX/$1 -} - -edit_patch_quilt() { - export QUILT_PATCHES=debian/patches - if [ -e $PREFIX/$1 ]; then - # if its a existing patch and we are at the end of the stack, - # go back at the beginning - if ! quilt unapplied; then - quilt pop -a - fi - quilt push $1 - else - # if its a new patch make sure we are at the end of the stack - if quilt unapplied >/dev/null; then - quilt push -a - fi - quilt new $1 - fi - # use a sub-shell - quilt shell - quilt refresh - quilt pop -a - 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 $@ - elif [ -d .git ];then - git add $@ - else - echo "Remember to add $@ to a VCS if you use one" - fi -} - -vcs_commit() { - # check if debcommit is happy - if ! debcommit --noact 2>/dev/null; then - return - fi - # commit (if the user confirms) - debcommit --confirm -} - -add_changelog() { - S="$PREFIX/$1: [DESCRIBE CHANGES HERE]" - if head -n1 debian/changelog|grep UNRELEASED; then - dch --append "$S" - else - dch --increment "$S" - fi - # let the user edit it - dch --edit -} - -add_patch_tagging() { - # check if we have a descripton already - if grep "## Description:" $PREFIX/$1; then - return - fi - # if not, add one - RANGE=1,1 - # make sure we keep the first line (for dpatch) - if head -n1 $PREFIX/$1|grep -q '^#'; then - RANGE=2,2 - fi - sed -i ${RANGE}i"$PATCH_DESC" $PREFIX/$1 -} - -detect_patch_location() { - # Checks whether the specified patch exists in debian/patches or on the filesystem - FILENAME=${PATCHNAME##*/} - - if [ -f "$PREFIX/$FILENAME" ]; then - PATCHTYPE="debian" - elif [ -f "$PATCHNAME" ]; then - PATCHTYPE="file" - PATCHORIG="$PATCHNAME" - else - if [ "$PATCHSYSTEM" = "none" ]; then - fatal_error "No patchsystem detected, cannot create new patch (no dpatch/quilt/cdbs?)" - else - PATCHTYPE="new" - fi - fi -} - -handle_file_patch() { - if [ "$PATCHTYPE" = "file" ]; then - [ -f "$PATCHORIG" ] || fatal_error "No patch detected" - - if [ "$PATCHSYSTEM" = "none" ]; then - # If we're supplied a file and there is no patchsys we apply it directly - # and store it in debian/applied patches - [ -d $PREFIX ] || mkdir $PREFIX - - patch -p0 < "$PATCHORIG" - cp "$PATCHORIG" "$PREFIX/$PATCHNAME" - else - # Patch type is file but there is a patchsys present, so we add it - # correctly - cp "$PATCHORIG" "$PREFIX/$PATCHNAME" - - if [ "$PATCHSYSTEM" = "quilt" ]; then - echo "$PATCHNAME" >> $PREFIX/series - elif [ "$PATCHSYSTEM" = "dpatch" ]; then - echo "$PATCHNAME" >> $PREFIX/00list - - # Add the dpatch header to files that don't already have it - if ! grep -q "@DPATCH@" "$PREFIX/$PATCHNAME"; then - sed -i '1i#! /bin/sh /usr/share/dpatch/dpatch-run\n@DPATCH@' $PREFIX/$PATCHNAME - fi - fi - - echo "Copying and applying new patch. You can now edit the patch or exit the subshell to save." - fi - fi -} - -# TODO: -# - edit-patch --remove implementieren -# - dbs patch system - -main() { - # parse args - if [ $# -ne 1 ]; then - fatal_error "Need exactly one patch name" - fi - PATCHNAME="$1" - # do the work - ensure_debian_dir - detect_patchsystem - detect_patch_location - normalize_patch_path - normalize_patch_extension - handle_file_patch - 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 -} - -main $@ diff --git a/setup.py b/setup.py index 50ecf3a..dd6f5f7 100755 --- a/setup.py +++ b/setup.py @@ -21,7 +21,6 @@ scripts = ['404main', 'dch-repeat', 'debian-distro-info', 'dgetlp', - 'edit-patch', 'get-branches', 'get-build-deps', 'grab-attachments', @@ -54,7 +53,6 @@ scripts = ['404main', 'ubuntu-distro-info', 'ubuntu-iso', 'update-maintainer', - 'what-patch', 'wrap-and-sort', ] diff --git a/ubuntutools/test/test_help.py b/ubuntutools/test/test_help.py index 485846b..221a84f 100644 --- a/ubuntutools/test/test_help.py +++ b/ubuntutools/test/test_help.py @@ -27,7 +27,6 @@ from ubuntutools.test import unittest BLACKLIST = { 'check-mir': 'No Help', 'check-symbols': 'No Help', - 'edit-patch': 'No Help', 'get-build-deps': 'No Help, runs sudo', 'grep-merges': 'No Help', 'lp-project-upload': 'Returns non-zero after help. ' diff --git a/what-patch b/what-patch deleted file mode 100755 index dc5c173..0000000 --- a/what-patch +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash -# -# Copyright 2006-2008 (C) Kees Cook -# Modified by Siegfried-A. Gevatter -# Modified by Daniel Hahler -# -# ################################################################## -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 3 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# See file /usr/share/common-licenses/GPL for more details. -# -# ################################################################## -# -# By default only the name of the patch system is printed. Verbose mode can be -# enabled with -v. - -if [ "$1" = "-h" ] || [ "$1" = "--help" ] -then - cat </dev/null | grep -v 'debian/'` - if [ -n "$files" ] - then - echo "Following files were modified outside of the debian/ directory:" - echo "$files" - echo "--------------------" - echo - echo -n "Patch System: " - fi -fi - -if fgrep -q quilt debian/source/format 2>/dev/null; then - echo "quilt" - exit 0 -fi - -# Do not change the output of existing checks by default, as there are build -# tools that rely on the exisitng output. If changes in reporting is needed, -# please check the "VERBOSE" flag (see below for examples). Feel free -# to add new patchsystem detection and reporting. -for filename in $(echo "debian/rules"; grep ^include debian/rules | fgrep -v '$(' | awk '{print $2}') -do - fgrep patchsys.mk "$filename" | grep -q -v "^#" && { - if [ "$VERBOSE" -eq 0 ]; then - echo "cdbs"; exit 0; - else - echo "cdbs (patchsys.mk: see 'cdbs-edit-patch')"; exit 0; - fi - } - fgrep quilt "$filename" | grep -q -v "^#" && { echo "quilt"; exit 0; } - fgrep dbs-build.mk "$filename" | grep -q -v "^#" && { - if [ "$VERBOSE" -eq 0 ]; then - echo "dbs"; exit 0; - else - echo "dbs (see 'dbs-edit-patch')"; exit 0; - fi - } - fgrep dpatch "$filename" | grep -q -v "^#" && { - if [ "$VERBOSE" -eq 0 ]; then - echo "dpatch"; exit 0; - else - echo "dpatch (see 'patch-edit-patch')"; exit 0; - fi - } - fgrep '*.diff' "$filename" | grep -q -v "^#" && { - if [ "$VERBOSE" -eq 0 ]; then - echo "diff splash"; exit 0; - else - echo "diff splash (check debian/rules)"; exit 0; - fi - } -done -[ -d debian/patches ] || { - if [ "$VERBOSE" -eq 0 ]; then - echo "patchless?"; exit 0; - else - echo "patchless? (did not find debian/patches/)"; exit 0; - fi -} -if [ "$VERBOSE" -eq 0 ]; then - echo "unknown patch system" -else - echo "unknown patch system (see debian/patches/ and debian/rules)" -fi