File: new.in

package info (click to toggle)
quilt 0.65-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,980 kB
  • sloc: sh: 5,898; perl: 1,256; lisp: 492; makefile: 430
file content (118 lines) | stat: -rw-r--r-- 2,501 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#! @BASH@

#  This script is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License version 2 as
#  published by the Free Software Foundation.
#
#  See the COPYING and AUTHORS files for more details.

# Read in library functions
if [ "$(type -t patch_file_name)" != function ]
then
	if ! [ -r $QUILT_DIR/scripts/patchfns ]
	then
		echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2
		exit 1
	fi
	. $QUILT_DIR/scripts/patchfns
fi

usage()
{
	printf $"Usage: quilt new [-p n|-p ab] {patchname}\n"
	if [ x$1 = x-h ]
	then
		printf $"
Create a new patch with the specified file name, and insert it after the
topmost patch. The name can be prefixed with a sub-directory name, allowing
for grouping related patches together.

-p n	Create a -p n style patch (-p0 or -p1 are supported).

-p ab	Create a -p1 style patch, but use a/file and b/file as the
	original and new filenames instead of the default
	dir.orig/file and dir/file names.

Quilt can be used in sub-directories of a source tree. It determines the
root of a source tree by searching for a %s directory above the
current working directory. Create a %s directory in the intended root
directory if quilt chooses a top-level directory that is too high up
in the directory tree.
" "$QUILT_PATCHES" "$QUILT_PATCHES"
		exit 0
	else
		exit 1
	fi
}

options=`getopt -o p:h -- "$@"`

if [ $? -ne 0 ]
then
	usage
fi

eval set -- "$options"

while true
do
	case "$1" in
	-p)	opt_strip_level=$2
		shift 2 ;;
	-h)
		usage -h ;;
	--)
		shift
		break ;;
	esac
done

case "$opt_strip_level" in
'' | 1)
	opt_strip_level= ;;
0 | ab)
	;;
*)
	printf $"Cannot create patches with -p%s, please specify -p0, p1, or -pab instead\n" \
	       "$opt_strip_level" >&2
	exit 1
	;;
esac

if [ $# -ne 1 ]
then
	usage
fi

if [ "$QUILT_PATCHES" = "$QUILT_PC" ]
then
	printf $"QUILT_PATCHES(%s) must differ from QUILT_PC(%s)\n" "$QUILT_PATCHES" "$QUILT_PC"
	exit 1
fi

patch=${1#$QUILT_PATCHES/}

check_potential_patchname "$patch"

if patch_in_series $patch
then
	printf $"Patch %s exists already\n" "$(print_patch $patch)" >&2
	exit 1
fi

create_db
rm -rf "$QUILT_PC/$patch"
mkdir -p "$QUILT_PC/$patch"

if insert_in_series $patch ${opt_strip_level:+-p$opt_strip_level} && \
   add_to_db $patch
then
	printf $"Patch %s is now on top\n" "$(print_patch $patch)"
else
	printf $"Failed to create patch %s\n" "$(print_patch $patch)" >&2
	exit 1
fi
### Local Variables:
### mode: shell-script
### End:
# vim:filetype=sh