Merge pull request #129 from jgouly/master
Fix #120 by stripping comments from the end of lines.
This commit is contained in:
commit
49bc92d0c8
@ -399,7 +399,7 @@ rcv_get_pkgver(rcv_t *rcv)
|
|||||||
size_t klen, vlen;
|
size_t klen, vlen;
|
||||||
map_item_t _item;
|
map_item_t _item;
|
||||||
map_item_t *item = NULL;
|
map_item_t *item = NULL;
|
||||||
char c, *ptr = rcv->ptr, *e, *p, *k, *v;
|
char c, *ptr = rcv->ptr, *e, *p, *k, *v, *comment;
|
||||||
uint8_t vars = 0;
|
uint8_t vars = 0;
|
||||||
|
|
||||||
while ((c = *ptr) != '\0') {
|
while ((c = *ptr) != '\0') {
|
||||||
@ -439,18 +439,22 @@ rcv_get_pkgver(rcv_t *rcv)
|
|||||||
if (v[vlen-1] == '"') {
|
if (v[vlen-1] == '"') {
|
||||||
vlen--;
|
vlen--;
|
||||||
}
|
}
|
||||||
|
comment = strchr(v, '#');
|
||||||
|
if (comment && comment < p) {
|
||||||
|
while (v[vlen-1] != '#') {
|
||||||
|
vlen--;
|
||||||
|
}
|
||||||
|
vlen--;
|
||||||
|
while (isspace(v[vlen-1])) {
|
||||||
|
vlen--;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (vlen == 0) {
|
if (vlen == 0) {
|
||||||
goto nextline;
|
goto nextline;
|
||||||
}
|
}
|
||||||
_item = map_add_n(rcv->env, k, klen, v, vlen);
|
_item = map_add_n(rcv->env, k, klen, v, vlen);
|
||||||
item = &rcv->env->items[_item.i];
|
item = &rcv->env->items[_item.i];
|
||||||
|
|
||||||
if (rcv->xhp.flags & XBPS_FLAG_DEBUG) {
|
|
||||||
printf("%s: %.*s %.*s\n", rcv->fname,
|
|
||||||
(int)item->k.len, item->k.s,
|
|
||||||
(int)item->v.len, item->v.s);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strchr(v, '$')) {
|
if (strchr(v, '$')) {
|
||||||
assert(item);
|
assert(item);
|
||||||
assert(item->v.s);
|
assert(item->v.s);
|
||||||
@ -462,6 +466,11 @@ rcv_get_pkgver(rcv_t *rcv)
|
|||||||
} else {
|
} else {
|
||||||
item->v.vmalloc = 0;
|
item->v.vmalloc = 0;
|
||||||
}
|
}
|
||||||
|
if (rcv->xhp.flags & XBPS_FLAG_DEBUG) {
|
||||||
|
printf("%s: %.*s %.*s\n", rcv->fname,
|
||||||
|
(int)item->k.len, item->k.s,
|
||||||
|
(int)item->v.len, item->v.s);
|
||||||
|
}
|
||||||
if (strncmp("pkgname", k, klen) == 0) {
|
if (strncmp("pkgname", k, klen) == 0) {
|
||||||
rcv->have_vars |= GOT_PKGNAME_VAR;
|
rcv->have_vars |= GOT_PKGNAME_VAR;
|
||||||
vars++;
|
vars++;
|
||||||
|
@ -305,7 +305,6 @@ srcpkg_with_a_ref_and_comment_head() {
|
|||||||
atf_set "descr" "xbps-checkvers(8): test when srcpkg does set a ref in pkgname/version/revision with a comment"
|
atf_set "descr" "xbps-checkvers(8): test when srcpkg does set a ref in pkgname/version/revision with a comment"
|
||||||
}
|
}
|
||||||
srcpkg_with_a_ref_and_comment_body() {
|
srcpkg_with_a_ref_and_comment_body() {
|
||||||
atf_expect_death "Known bug: see https://github.com/voidlinux/xbps/issues/120"
|
|
||||||
mkdir -p some_repo pkg_A void-packages/srcpkgs/foo
|
mkdir -p some_repo pkg_A void-packages/srcpkgs/foo
|
||||||
cat > void-packages/srcpkgs/foo/template <<EOF
|
cat > void-packages/srcpkgs/foo/template <<EOF
|
||||||
pkgname=foo #kajskajskajskajskajskjaksjaksjaks
|
pkgname=foo #kajskajskajskajskajskjaksjaksjaks
|
||||||
|
Loading…
Reference in New Issue
Block a user