Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Shafer committed Jul 12, 2013
2 parents 8fe747a + 21af76b commit cfaf508
Show file tree
Hide file tree
Showing 12 changed files with 285 additions and 33 deletions.
14 changes: 12 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,20 @@ upload: dist
@echo " gt tag ${PACKAGE_VERSION}"

pkgconfigdir=$(libdir)/pkgconfig
pkgconfig_DATA = ${PACKAGE_NAME}.pc
pkgconfig_DATA = packaging/${PACKAGE_NAME}.pc

get-wiki:
git clone https://github.com/Juniper/${PACKAGE_NAME}.wiki.git wiki

get-gh-pages:
git clone https://github.com/Juniper/${PACKAGE_NAME}.git gh-pages -b gh-pages
git clone https://github.com/Juniper/${PACKAGE_NAME}.git \
gh-pages -b gh-pages

UPDATE_PACKAGE_FILE = -e "s/__SHA1__/$$SHA1/"

packages:
@-[ -d ${GH_PAGES_DIR} ] && set -x \
&& echo "Updating packages on gh-pages ..." \
&& SHA1=`openssl sha1 ${PACKAGE_FILE} | awk '{print $$2}'` \
&& sed ${UPDATE_PACKAGE_FILE} packaging/libslax.rb.base \
> packaging/libslax.rb
41 changes: 41 additions & 0 deletions bin/get-release-url.slax
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/local/bin/slaxproc -E -n
version 1.1;

/*
* github puts a number in the URLs for the "releases"
* feature. It seems to be a monotonically increasing
* number in a global namespace. We need to find the
* url for the latest release and report it.
*/

ns curl extension = "http://xml.libslax.org/curl";
ns os extension = "http://xml.libslax.org/os";

param $user = "Juniper";
param $project = "libslax";

var $base = "https://github.com";
var $url = $base _ "/" _ $user _ "/" _ $project _ "/releases";

output-method text;

match / {
var $options = {
<insecure>;
<format> "html";
<errors> "ignore";
}
var $results = curl:single($url, $options);

var $href = $results/data//ul[@class == "release-downloads"][1]
/li[1]/a/@href;
var $link = string($href);
if ($link == "") {
expr os:exit-code(1);
} else {
if (not(starts-with($link, $base))) {
expr $base;
}
expr $link _ "\n";
}
}
42 changes: 33 additions & 9 deletions bin/gt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ function check_in_details () {
}

function push_to_branch () {
set_branch
echo "Pushing to $branch ..."
git push origin $branch
}
Expand All @@ -67,7 +66,7 @@ case "$op" in
fi
;;

checkin|ci|check|checkpoint)
checkin|check|checkpoint)
git diff $file
git status -s "$@"

Expand All @@ -85,19 +84,16 @@ case "$op" in
fi
;;

check-in-details|cid)
check-in-details|ci|cid)
check_in_details
;;

commit)
set_branch
check_in_details
push_to_branch
;;

ctag|current-tag)
git tag -l '*' | sed 's/^v//'
;;

diff|dif|delta)
git diff "$@"
;;
Expand All @@ -111,13 +107,40 @@ case "$op" in
git master --set-upstream gh-pages origin/gh-pages
;;

merge-to)
set_branch
to=$1
echo "Merging $branch into $to ..."
echo "Switching to $to ..."
git checkout $to
if [ $status -eq 0 ]; then
git merge --no-ff $branch
if [ $status -eq 0 ]; then
echo "Pushing to $to ..."
git push origin $to
fi
git checkout $branch
fi
;;

merge-from)
set_branch
from=$1
echo "Merging $from into $branch ..."
git merge --no-ff $from
if [ $status -eq 0 ]; then
push_to_branch
fi
;;

outstanding|out|what)
set_branch
git diff origin/$branch $branch
;;

push|pu|pom|pob)
# Push all local changes to the origin/repo server
set_branch
push_to_branch
;;

Expand Down Expand Up @@ -145,9 +168,10 @@ case "$op" in
git push origin --tags $branch
;;

up|update)
pull|up|update)
# Update working copy with repo's changes
git pull -v "$@"
set_branch
git pull -v origin $branch
;;

*)
Expand Down
9 changes: 5 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#

AC_PREREQ(2.2)
AC_INIT([libslax], [0.16.10], [[email protected]])
AC_INIT([libslax], [0.16.11], [[email protected]])
AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability])
AC_DISABLE_SHARED

Expand Down Expand Up @@ -430,7 +430,7 @@ if test -d $ac_abs_confdir/.git ; then
extra=`git branch | awk '/\*/ { print $2 }'`
if test "$extra" != "" -a "$extra" != "master"
then
LIBJUISE_VERSION_EXTRA="-git-$extra"
LIBSLAX_VERSION_EXTRA="-git-$extra"
fi
fi

Expand Down Expand Up @@ -460,8 +460,9 @@ AC_CONFIG_FILES([
bin/Makefile
doc/Makefile
doc/oxtradoc/oxtradoc
libslax.pc
libslax.spec
packaging/libslax.pc
packaging/libslax.spec
packaging/libslax.rb.base
])
AC_OUTPUT

Expand Down
31 changes: 31 additions & 0 deletions doc/slax.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3514,6 +3514,37 @@ payload.
SYNTAX::
<content-type> "mime/type";

**** <errors>

The <errors> element controls how HTML and XML parsing errors are
handled. The default (display them on stderr) is often not
attractive. Instead errors can be ignored, logged, or recorded, based
on the contents of the <errors> element:

|---------+-----------------------------------|
| Value | Special behavior |
|---------+-----------------------------------|
| default | Errors are displayed on stderr |
| ignore | Errors are discarded |
| log | Errors are logged (via slaxLog()) |
| record | Errors are recorded |
|---------+-----------------------------------|

When <errors> is set to "record", all errors appear in a string under
the <errors> element in the XML node (as returned by
e.g. curl:perform). If no errors are generated, the <errors> element
will not be present, allowing it to be used as a test for errors:

var $opt = {
<url> $url;
<format> "html";
<errors> "record";
}
var $res = curl:single($opts);
if ($res/errors) {
terminate "failure: " _ $res/errors;
}

**** <fail-on-error>

The <fail-on-error> element indicates that the transfer should fail if
Expand Down
33 changes: 30 additions & 3 deletions extensions/curl/ext_curl.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ typedef struct curl_opts_s {
u_int8_t co_verbose; /* Verbose (debug) output */
u_int8_t co_insecure; /* Allow insecure SSL certs */
u_int8_t co_secure; /* Use SSL-enabled version of protocol */
int co_errors; /* How to handle errors (SLAX_ERROR_*) */
long co_timeout; /* Operation timeout */
long co_connect_timeout; /* Connect timeout */
char *co_username; /* Value for CURLOPT_USERNAME */
Expand Down Expand Up @@ -147,6 +148,7 @@ extCurlOptionsCopy (curl_opts_t *top, curl_opts_t *fromp)
COPY_FIELD(co_verbose);
COPY_FIELD(co_insecure);
COPY_FIELD(co_secure);
COPY_FIELD(co_errors);
COPY_STRING(co_username);
COPY_STRING(co_password);
COPY_STRING(co_content_type);
Expand Down Expand Up @@ -289,6 +291,8 @@ extCurlParseNode (curl_opts_t *opts, xmlNodePtr nodep)
opts->co_insecure = TRUE;
else if (streq(key, "secure"))
opts->co_secure = TRUE;
else if (streq(key, "errors"))
opts->co_errors = slaxErrorValue(xmlNodeValue(nodep));
else if (streq(key, "timeout"))
opts->co_timeout = atoi(xmlNodeValue(nodep));
else if (streq(key, "connect-timeout"))
Expand Down Expand Up @@ -936,7 +940,7 @@ extCurlBuildDataParsed (curl_handle_t *curlp UNUSED, curl_opts_t *opts,
const char *cp, *ep, *sp;
char *nbuf = NULL, *vbuf = NULL;
ssize_t nbufsiz = 0, vbufsiz = 0;

xmlNodePtr errp = NULL;
xmlNodePtr nodep = xmlNewDocNode(docp, NULL,
(const xmlChar *) "data", NULL);
if (nodep == NULL)
Expand All @@ -946,6 +950,14 @@ extCurlBuildDataParsed (curl_handle_t *curlp UNUSED, curl_opts_t *opts,
xmlSetProp(nodep, (const xmlChar *) "format",
(const xmlChar *) opts->co_format);


if (opts->co_errors) {
if (opts->co_errors == SLAX_ERROR_RECORD)
errp = xmlNewDocNode(docp, NULL, (const xmlChar *) "errors", NULL);
if (opts->co_errors != SLAX_ERROR_RECORD || errp)
slaxCatchErrors(opts->co_errors, errp);
}

if (streq(opts->co_format, "name")) {
for (cp = raw_data; *cp; cp = ep + 1) {
sp = strchr(cp, '=');
Expand Down Expand Up @@ -1031,7 +1043,7 @@ extCurlBuildDataParsed (curl_handle_t *curlp UNUSED, curl_opts_t *opts,
xmlp = xmlReadMemory(raw_data, strlen(raw_data), "raw_data", NULL,
XML_PARSE_NOENT);
if (xmlp == NULL)
return;
goto bail;

xmlNodePtr childp = xmlDocGetRootElement(xmlp);
if (childp) {
Expand All @@ -1048,7 +1060,7 @@ extCurlBuildDataParsed (curl_handle_t *curlp UNUSED, curl_opts_t *opts,
xmlp = htmlReadMemory(raw_data, strlen(raw_data), "raw_data", NULL,
XML_PARSE_NOENT);
if (xmlp == NULL)
return;
goto bail;

xmlNodePtr childp = xmlDocGetRootElement(xmlp);
if (childp) {
Expand All @@ -1059,6 +1071,21 @@ extCurlBuildDataParsed (curl_handle_t *curlp UNUSED, curl_opts_t *opts,

xmlFreeDoc(xmlp);
}

bail:
if (opts->co_errors) {
slaxCatchErrors(SLAX_ERROR_DEFAULT, NULL);
if (errp) {
/*
* If we have errors, record them; otherwise free the empty
* "errors" node.
*/
if (errp->children)
xmlAddChild(parent, errp);
else
xmlFreeNode(errp);
}
}
}

/*
Expand Down
Loading

0 comments on commit cfaf508

Please sign in to comment.