diff options
author | Timo Teräs <timo.teras@iki.fi> | 2012-01-16 09:53:22 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2012-01-16 09:53:22 +0200 |
commit | 9e10a7e929717793efe85444b56da6af63cf40db (patch) | |
tree | d77b70b82260f90ff1f20cdf2f9e763304f95de2 /main/asterisk | |
parent | 381434cdf487d9bbab0940fd5b8dc78c37aaf473 (diff) | |
download | aports-9e10a7e929717793efe85444b56da6af63cf40db.tar.bz2 aports-9e10a7e929717793efe85444b56da6af63cf40db.tar.xz |
main/asterisk: cherry-pick #tryinclude from Asterisk 11
Instead of using the obsolete #-include patch from Asterisk JIRA.
Diffstat (limited to 'main/asterisk')
-rw-r--r-- | main/asterisk/900-tryinclude.patch | 71 | ||||
-rw-r--r-- | main/asterisk/APKBUILD | 6 | ||||
-rw-r--r-- | main/asterisk/ASTERISK-19107.patch | 60 |
3 files changed, 74 insertions, 63 deletions
diff --git a/main/asterisk/900-tryinclude.patch b/main/asterisk/900-tryinclude.patch new file mode 100644 index 0000000000..8bcfc24f27 --- /dev/null +++ b/main/asterisk/900-tryinclude.patch @@ -0,0 +1,71 @@ +------------------------------------------------------------------------ +r345735 | pabelanger | 2011-11-21 18:40:17 +0200 (Mon, 21 Nov 2011) | 7 lines + +Add #tryinclude statement + +This provides the same functionality as #include however an asterisk module will +still load if the filename does not exist. + +Review: https://reviewboard.asterisk.org/r/1476/ + + +diff --git a/CHANGES b/CHANGES +index 4d106f6..bfc7301 100644 +--- a/CHANGES ++++ b/CHANGES +@@ -389,6 +389,12 @@ SIP Changes + * Addition of the 'auth_options_requests' option for turning on and off + authentication for OPTIONS requests in chan_sip. + ++Configuration files ++------------------- ++ * Add #tryinclude statement for config files. This provides the same ++ functionality as the #include statement however an asterisk module will ++ still load if the filename does not exist. Using the #include statement ++ Asterisk will not allow the module to load. + + IAX2 Changes + ----------- +diff --git a/main/config.c b/main/config.c +index 498ae99..e76a43f 100644 +--- a/main/config.c ++++ b/main/config.c +@@ -1202,6 +1202,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat, + char *cur2; + char real_inclusion_name[256]; + int do_include = 0; /* otherwise, it is exec */ ++ int try_include = 0; + + cur++; + c = cur; +@@ -1221,6 +1222,9 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat, + } + if (!strcasecmp(cur, "include")) { + do_include = 1; ++ } else if (!strcasecmp(cur, "tryinclude")) { ++ do_include = 1; ++ try_include = 1; + } else if (!strcasecmp(cur, "exec")) { + if (!ast_opt_exec_includes) { + ast_log(LOG_WARNING, "Cannot perform #exec unless execincludes option is enabled in asterisk.conf (options section)!\n"); +@@ -1232,8 +1236,8 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat, + } + + if (c == NULL) { +- ast_log(LOG_WARNING, "Directive '#%s' needs an argument (%s) at line %d of %s\n", +- do_include ? "include" : "exec", ++ ast_log(LOG_WARNING, "Directive '#%s' needs an argument (%s) at line %d of %s\n", ++ do_include ? "include / tryinclude" : "exec", + do_include ? "filename" : "/path/to/executable", + lineno, + configfile); +@@ -1278,7 +1282,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat, + do_include = ast_config_internal_load(cur, cfg, flags, real_inclusion_name, who_asked) ? 1 : 0; + if (!ast_strlen_zero(exec_file)) + unlink(exec_file); +- if (!do_include) { ++ if (!do_include && !try_include) { + ast_log(LOG_ERROR, "The file '%s' was listed as a #include but it does not exist.\n", cur); + return -1; + } +------------------------------------------------------------------------ diff --git a/main/asterisk/APKBUILD b/main/asterisk/APKBUILD index c0e2e5c64f..31e37ee434 100644 --- a/main/asterisk/APKBUILD +++ b/main/asterisk/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Timo Teras <timo.teras@iki.fi> pkgname=asterisk pkgver=10.0.0 -pkgrel=3 +pkgrel=4 pkgdesc="Asterisk: A Module Open Source PBX System" url="http://www.asterisk.org/" arch="all" @@ -20,12 +20,12 @@ source="http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-$ 100-uclibc-daemon.patch 101-caps-uclibc.patch 400-bug-227.patch + 900-tryinclude.patch ASTERISK-18976.patch ASTERISK-18977.patch ASTERISK-18994.patch ASTERISK-18995.patch ASTERISK-19106.patch - ASTERISK-19107.patch ASTERISK-19109.patch asterisk.initd asterisk.confd @@ -170,12 +170,12 @@ md5sums="6b52336b9dc01eeecb9de2eb2818e127 asterisk-10.0.0.tar.gz b00c9d98ce2ad445501248a197c6e436 100-uclibc-daemon.patch 6e1129e30c4fd2c25c86c81685a485a9 101-caps-uclibc.patch 79e9634b5054bceb3b8dc246654bb243 400-bug-227.patch +b794636266cc573f0dda730fba634567 900-tryinclude.patch da5a3c500192dee4275aae5235d25f97 ASTERISK-18976.patch 1ddadef41aa7120e168738b6f3ed8917 ASTERISK-18977.patch 0af5e797f0a99d0f81f95e3710baf5b6 ASTERISK-18994.patch bc6713f5434e07b79d3afdd155461d72 ASTERISK-18995.patch fee11ba2f6518462ea6dde4039f9d8fa ASTERISK-19106.patch -90e6c516b55245f4ff4a995b6f36a6b7 ASTERISK-19107.patch a59d61843a44d5a72da401218dcf6588 ASTERISK-19109.patch 86c7589e906102869d67f7f8bc82ca4b asterisk.initd ed31d7ba37bcf8b0346dcf8593c395f0 asterisk.confd diff --git a/main/asterisk/ASTERISK-19107.patch b/main/asterisk/ASTERISK-19107.patch deleted file mode 100644 index cb43615b24..0000000000 --- a/main/asterisk/ASTERISK-19107.patch +++ /dev/null @@ -1,60 +0,0 @@ -diff --git a/main/config.c b/main/config.c -index 498ae99..0f5f0e2 100644 ---- a/main/config.c -+++ b/main/config.c -@@ -1199,9 +1199,11 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat, - if (newcat) - ast_category_append(cfg, *cat); - } else if (cur[0] == '#') { /* A directive - #include or #exec */ -+ struct ast_config *res; - char *cur2; - char real_inclusion_name[256]; - int do_include = 0; /* otherwise, it is exec */ -+ int quiet = 0; - - cur++; - c = cur; -@@ -1221,6 +1223,9 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat, - } - if (!strcasecmp(cur, "include")) { - do_include = 1; -+ } else if (!strcasecmp(cur, "-include")) { -+ do_include = 1; -+ quiet = 1; - } else if (!strcasecmp(cur, "exec")) { - if (!ast_opt_exec_includes) { - ast_log(LOG_WARNING, "Cannot perform #exec unless execincludes option is enabled in asterisk.conf (options section)!\n"); -@@ -1233,7 +1238,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat, - - if (c == NULL) { - ast_log(LOG_WARNING, "Directive '#%s' needs an argument (%s) at line %d of %s\n", -- do_include ? "include" : "exec", -+ cur, - do_include ? "filename" : "/path/to/executable", - lineno, - configfile); -@@ -1275,10 +1280,13 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat, - /* record this inclusion */ - ast_include_new(cfg, cfg->include_level == 1 ? "" : configfile, cur, !do_include, cur2, lineno, real_inclusion_name, sizeof(real_inclusion_name)); - -- do_include = ast_config_internal_load(cur, cfg, flags, real_inclusion_name, who_asked) ? 1 : 0; -+ res = ast_config_internal_load(cur, cfg, flags, real_inclusion_name, who_asked); - if (!ast_strlen_zero(exec_file)) - unlink(exec_file); -- if (!do_include) { -+ if (res == CONFIG_STATUS_FILEINVALID) { -+ ast_log(LOG_ERROR, "The file '%s' was listed as a #include but it failed to load.\n", cur); -+ return -1; -+ } else if (res == CONFIG_STATUS_FILEMISSING && !quiet) { - ast_log(LOG_ERROR, "The file '%s' was listed as a #include but it does not exist.\n", cur); - return -1; - } -@@ -1643,7 +1651,7 @@ static struct ast_config *config_text_file_load(const char *database, const char - } - - if (count == 0) -- return NULL; -+ return CONFIG_STATUS_FILEMISSING; - - return cfg; - } |