View | Details | Raw Unified | Return to bug 204725 | Differences between
and this patch

Collapse All | Expand All

(-)Mk/Scripts/smart_makepatch.sh (-10 / +19 lines)
Lines 58-65 Link Here
58
}
58
}
59
59
60
std_patch_filename() {
60
std_patch_filename() {
61
	local sans_cwd=$(echo $1 | sed 's|^\.\/||')
61
	local sans_cwd
62
	local raw_name=$(strip_path ${sans_cwd})
62
	local raw_name
63
	sans_cwd=$(echo $1 | sed 's|^\.\/||')
64
	raw_name=$(strip_path ${sans_cwd})
63
	echo patch-$(echo ${raw_name} | sed -e 's|_|&&|g; s|/|_|g')
65
	echo patch-$(echo ${raw_name} | sed -e 's|_|&&|g; s|/|_|g')
64
}
66
}
65
67
Lines 74-83 Link Here
74
76
75
valid_name() {
77
valid_name() {
76
	local current_patch_name=$1
78
	local current_patch_name=$1
77
	local first_target=$(echo $2 | sed 's|^\.\/||')
78
	local result=$3
79
	local result=$3
80
	local first_target
79
	local testres
81
	local testres
80
	local lps
82
	local lps
83
	first_target=$(echo $2 | sed 's|^\.\/||')
81
	for lps in __ - + ; do
84
	for lps in __ - + ; do
82
		testres=patch-$(echo ${first_target} | sed -e "s|/|${lps}|g")
85
		testres=patch-$(echo ${first_target} | sed -e "s|/|${lps}|g")
83
		if [ "${testres}" = "${current_patch_name}" ]; then
86
		if [ "${testres}" = "${current_patch_name}" ]; then
Lines 122-131 Link Here
122
125
123
extract_comment_from_patch() {
126
extract_comment_from_patch() {
124
	local existing_patch=${PATCHDIR}/$1
127
	local existing_patch=${PATCHDIR}/$1
125
	local contains=$(grep "^+++ " ${existing_patch} | awk '{x++; print x}')
128
	local contains
126
	local rawname
129
	local rawname
127
	local fname
130
	local fname
128
	local num
131
	local num
132
	contains=$(grep "^+++ " ${existing_patch} | awk '{x++; print x}')
129
	for num in ${contains}; do
133
	for num in ${contains}; do
130
		rawname=$(grep "^+++ " ${existing_patch} | \
134
		rawname=$(grep "^+++ " ${existing_patch} | \
131
			awk -v num=${num} '{x++; if (x==num) print $2}')
135
			awk -v num=${num} '{x++; if (x==num) print $2}')
Lines 135-147 Link Here
135
		{ \
139
		{ \
136
		    if (!done) { \
140
		    if (!done) { \
137
		        if ($1 == "@@") { \
141
		        if ($1 == "@@") { \
138
		            split ($3,a,","); \
142
		            split ($2,a,","); \
139
		            hc = a[2]; \
143
		            split ($3,b,","); \
144
		            hca = a[2];
145
		            hcb = a[3];
140
		            hunk = 1;
146
		            hunk = 1;
141
		        } else if (hunk) { \
147
		        } else if (hunk) { \
142
		            first=substr($1,1,1); \
148
		            first=substr($1,1,1); \
143
		            if (first == "-") { hc++ } else { hc-- } \
149
		            if (first == "-") { hca-- } \
144
		            if (hc == 0) {hunk = 0} \
150
		            else if (first == "+") { hcb-- } \
151
		            else {hca--; hcb--} \
152
		            if (hca == 0 && hcb == 0) {hunk = 0} \
145
		        } \
153
		        } \
146
			if ($1 == "---") { \
154
			if ($1 == "---") { \
147
			   x++; \
155
			   x++; \
Lines 175-181 Link Here
175
	local NEW
183
	local NEW
176
	local OUT
184
	local OUT
177
	local ORIG
185
	local ORIG
178
	local new_list=
186
	local new_list
179
	new_list=$(cd ${PATCH_WRKSRC} && \
187
	new_list=$(cd ${PATCH_WRKSRC} && \
180
		find -s * -type f -name '*.orig' 2>/dev/null)
188
		find -s * -type f -name '*.orig' 2>/dev/null)
181
	(cd ${PATCH_WRKSRC} && for F in ${new_list}; do
189
	(cd ${PATCH_WRKSRC} && for F in ${new_list}; do
Lines 206-212 Link Here
206
	rm -f ${DESTDIR}/*
214
	rm -f ${DESTDIR}/*
207
	local P
215
	local P
208
	local name
216
	local name
209
	local patch_list=$(cd ${REGENNED} && find * -name "patch-*" 2>/dev/null)
217
	local patch_list
218
	patch_list=$(cd ${REGENNED} && find * -name "patch-*" 2>/dev/null)
210
	for P in ${patch_list}; do
219
	for P in ${patch_list}; do
211
		name=$(get_patch_name ${P})
220
		name=$(get_patch_name ${P})
212
		[ -e ${COMMENTS}/${P} ] && cat ${COMMENTS}/${P} \
221
		[ -e ${COMMENTS}/${P} ] && cat ${COMMENTS}/${P} \

Return to bug 204725