#include <ccan/talloc/talloc.h>
#include <ccan/str/str.h>
-struct ccanlint has_license;
-
static struct doc_section *find_license(const struct manifest *m)
{
struct doc_section *d;
|| streq(d->lines[0], "LGPLv2 (or later)")
|| streq(d->lines[0], "LGPL (2 or any later version)"))
return "../../licenses/LGPL-2.1";
- if (streq(d->lines[0], "BSD")
- || streq(d->lines[0], "BSD-MIT")
+ if (streq(d->lines[0], "BSD-MIT")
|| streq(d->lines[0], "MIT"))
return "../../licenses/BSD-MIT";
+ if (streq(d->lines[0], "BSD (3 clause)"))
+ return "../../licenses/BSD-3CLAUSE";
return NULL;
}
}
}
+extern struct ccanlint license_exists;
+
static void check_has_license(struct manifest *m,
bool keep,
unsigned int *timeleft, struct score *score)
d = find_license(m);
if (!d) {
- score->error = "No License: tag in _info";
+ score->error = talloc_strdup(score, "No License: tag in _info");
return;
}
+ /* If they have a license tag at all, we pass. */
+ score->pass = true;
+
expected = expected_link(m, d);
len = readlink(license, buf, sizeof(buf));
return;
}
if (errno == ENOENT) {
- score->error = "LICENSE does not exist";
+ score->error = talloc_strdup(score,
+ "LICENSE does not exist");
if (expected)
- has_license.handle = handle_license_link;
+ license_exists.handle = handle_license_link;
return;
}
err(1, "readlink on %s", license);
.check = check_has_license,
.needs = "info_exists"
};
-
REGISTER_TEST(license_exists);