aboutsummaryrefslogtreecommitdiffstats
path: root/package/utils/lua/patches/200-lua-path.patch
blob: 054457744aad08fd88ab97619720f01ecd532273 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
--- a/src/luaconf.h
+++ b/src/luaconf.h
@@ -95,9 +95,9 @@
 	".\\?.dll;"  LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
 
 #else
-#define LUA_ROOT	"/usr/local/"
-#define LUA_LDIR	LUA_ROOT "share/lua/5.1/"
-#define LUA_CDIR	LUA_ROOT "lib/lua/5.1/"
+#define LUA_ROOT	"/usr/"
+#define LUA_LDIR	LUA_ROOT "share/lua/"
+#define LUA_CDIR	LUA_ROOT "lib/lua/"
 #define LUA_PATH_DEFAULT  \
 		"./?.lua;"  LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
 		            LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua"
ighlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#!/usr/bin/env bash
BASE=$1; shift

usage() {
	echo "Usage: $0 NNN <file>..."
	exit 1
}

check_number() {
	case "$1" in
		[0-9][0-9][0-9]) return 0;;
	esac
	return 1;
}

patch_header()
{
	awk '
	/^(---|\*\*\*|Index:)[ \t][^ \t]|^diff -/ \
		{ exit }
		{ print }
	'
}

strip_diffstat()
{
	awk '
	/#? .* \| / \
		{ eat = eat $0 "\n"
		  next }
	/^#? .* files? changed(, .* insertions?\(\+\))?(, .* deletions?\(-\))?/ \
		{ eat = ""
		  next }
		{ print eat $0
		  eat = "" }
	'
}

strip_trailing_whitespace() {
	sed -e 's:[ '$'\t'']*$::'
}

fixup_header() {
	awk '
		/^From / { next }
		/^Subject: / {
			sub("Subject: \\[[^\]]*\\]", "Subject: [PATCH]")
		}
		{ print }
	'
}

check_number "$BASE" || usage

quilt series > /dev/null || {
	echo "Not in quilt directory"
	exit 2
}

get_next() {
	NEW=$BASE
	quilt series | while read CUR; do
		[ -n "$CUR" ] || break
		CUR=${CUR%%-*}
		check_number "$CUR" || continue
		[ "$CUR" -lt "$NEW" ] && continue
		[ "$CUR" -ge "$(($BASE + 100))" ] && continue
		NEW="$(($CUR + 1))"
		echo $NEW
	done | tail -n1
}

CUR=`get_next`
CUR="${CUR:-$BASE}"

while [ -n "$1" ]; do
	FILE="$1"; shift
	NAME="$(basename $FILE)"
	NAME="${NAME#[0-9]*-}"
	echo -n "Processing patch $NAME: "

	[ -e "$FILE" ] || {
		echo "file $FILE not found"
		exit 1
	}

	grep -qE "$NAME$" patches/series && {
		echo "already applied"
		continue
	}

	quilt new "$CUR-$NAME" || exit 1
	patch_header < "$FILE" |
		strip_diffstat |
		strip_trailing_whitespace |
		fixup_header > "patches/$CUR-$NAME"

	quilt fold < "$FILE" || {
		cp "$FILE" ./cur_patch
		echo "patch $FILE failed to apply, copied to ./cur_patch"
		exit 1
	}

	quilt refresh -p ab --no-index --no-timestamps

	CUR="$(($CUR + 1))"
done

exit 0