Merge remote-tracking branch 'origin/retrofit' into retrofit-redefault

This commit is contained in:
C. Guy Yarvin 2017-12-06 16:38:40 -08:00
commit 7cebac8144
3 changed files with 40 additions and 33 deletions

View File

@ -25,4 +25,14 @@ addons:
- re2c
- libcurl4-gnutls-dev
- python
# before_deploy: "make deb" # TODO
deploy:
skip_cleanup: true
provider: releases
prerelease: true # turn this off for official releases
api_key:
secure: V4E7784ECSS3MO6ZIRtang9XwibDyvDYGb0MoSaP2CTlmzIAhdokr4KJFM0qM4KRaaajCdQuqi0lojgOjwdxs7e0GkAwScb33LFxQ7Chj/QkFOY7V1AnSRLR5OsXnazB0nur5aSwvcvnggQ2XW3OeF7zIvGfs9aR97SEz/xCrVE=
file: bin/urbit # TODO upload package from before_deploy
on:
repo: urbit/urbit
tags: true

View File

@ -1500,10 +1500,10 @@ u3m_init(c3_o chk_o)
/* _get_cmd_output(): Run a shell command and capture its output.
Exits with an error if the command fails or produces no output.
The 'out_c' parameter should be an array of sufficient length to hold
the command's output, up to a max of 2048 characters.
the command's output, up to a max of len_c characters.
*/
static void
_get_cmd_output(c3_c *cmd_c, c3_c *out_c)
_get_cmd_output(c3_c *cmd_c, c3_c *out_c, c3_w len_c)
{
FILE *fp = popen(cmd_c, "r");
if ( NULL == fp ) {
@ -1511,7 +1511,7 @@ _get_cmd_output(c3_c *cmd_c, c3_c *out_c)
exit(1);
}
if ( NULL == fgets(out_c, 2048, fp) ) {
if ( NULL == fgets(out_c, len_c, fp) ) {
fprintf(stderr, "'%s' produced no output\n", cmd_c);
exit(1);
}
@ -1519,30 +1519,19 @@ _get_cmd_output(c3_c *cmd_c, c3_c *out_c)
pclose(fp);
}
/* _arvo_hash(): retrieve git hash of arvo directory.
hax_c must be an array with length >= 41.
/* _arvo_hash(): get a shortened hash of the last git commit
that modified the sys/ directory in arvo.
hax_c must be an array with length >= 11.
*/
static void
_arvo_hash(c3_c *out_c, c3_c *arv_c)
{
c3_c cmd_c[2048];
sprintf(cmd_c, "git -C %s rev-parse HEAD", arv_c);
_get_cmd_output(cmd_c, out_c);
sprintf(cmd_c, "git -C %s log -1 HEAD --format=%H -- sys/", arv_c);
_get_cmd_output(cmd_c, out_c, 11);
out_c[strcspn(out_c, "\r\n")] = 0; /* strip newline */
}
/* _git_branch(): retrieve the current git branch */
static void
_git_branch(c3_c *out_c, c3_c *arv_c)
{
c3_c cmd_c[2048];
sprintf(cmd_c, "git -C %s rev-parse --abbrev-ref HEAD", arv_c);
_get_cmd_output(cmd_c, out_c);
out_c[strcspn(out_c, "\r\n")] = 0; /* strip newline */
out_c[10] = 0; // end with null-byte
}
/* _git_pill_url(): produce a URL from which to download a pill
@ -1551,6 +1540,8 @@ _git_branch(c3_c *out_c, c3_c *arv_c)
static void
_git_pill_url(c3_c *out_c, c3_c *arv_c)
{
c3_c hax_c[11];
assert(NULL != arv_c);
if ( 0 != system("which git >> /dev/null") ) {
@ -1558,15 +1549,8 @@ _git_pill_url(c3_c *out_c, c3_c *arv_c)
exit(1);
}
{
c3_c hax_c[2048];
c3_c bra_c[2048];
_git_branch(bra_c, arv_c);
_arvo_hash(hax_c, arv_c);
sprintf(out_c, "https://bootstrap.urbit.org/%s-%s.pill", hax_c, bra_c);
}
_arvo_hash(hax_c, arv_c);
sprintf(out_c, "https://bootstrap.urbit.org/git-%s.pill", hax_c);
}
/* _boot_home(): create ship directory. */
@ -1619,6 +1603,7 @@ _boot_home(c3_c *dir_c, c3_c *pil_c, c3_c *url_c, c3_c *arv_c)
CURLcode result;
FILE *file;
c3_c pil_c[2048];
long cod_l;
/* use arvo git hash and branch for pill url unless overridden */
if ( NULL == url_c ) {
@ -1639,14 +1624,21 @@ _boot_home(c3_c *dir_c, c3_c *pil_c, c3_c *url_c, c3_c *arv_c)
curl_easy_setopt(curl, CURLOPT_URL, url_c);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, file);
result = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &cod_l);
fclose(file);
if ( result != CURLE_OK ) {
if ( CURLE_OK != result ) {
fprintf(stderr, "failed to fetch %s: %s\n",
url_c, curl_easy_strerror(result));
fprintf(stderr,
"please fetch it manually and specify the location with -B\n");
exit(1);
}
if ( 300 <= cod_l ) {
fprintf(stderr, "error fetching %s: HTTP %ld\n", url_c, cod_l);
fprintf(stderr,
"please fetch it manually and specify the location with -B\n");
exit(1);
}
curl_easy_cleanup(curl);
}
}

View File

@ -52,7 +52,6 @@ _ames_czar(c3_y imp_y, c3_s* por_s)
if ( c3n == u3_Host.ops_u.net ) {
*por_s = 31337 + imp_y;
uL(fprintf(uH, "ames: czar: localhost-only mode\n"));
return 0x7f000001;
}
else {
@ -327,7 +326,13 @@ u3_ames_io_init()
num_y = u3r_byte(0, u3t(num));
_ames_czar(num_y, &por_s);
uL(fprintf(uH, "ames: czar: %s on %d\n", u3_Host.ops_u.imp_c, por_s));
if ( c3y == u3_Host.ops_u.net ) {
uL(fprintf(uH, "ames: czar: %s on %d\n", u3_Host.ops_u.imp_c, por_s));
}
else {
uL(fprintf(uH, "ames: czar: %s on %d (localhost only)\n",
u3_Host.ops_u.imp_c, por_s));
}
u3z(num);
}