r = uuid_parse(id, build->id);
if (r) {
ERROR(build->pakfire, "Could not parse build ID '%s'\n", id);
- errno = EINVAL;
- return r;
+ return -EINVAL;
}
// Otherwise initialize the Build ID with something random
return 0;
// Check that the path is set
- if (!*build->ccache_path) {
- errno = ENOTSUP;
- return 1;
- }
+ if (!*build->ccache_path)
+ return -ENOTSUP;
// Make sure the path exists
r = pakfire_mkdir(build->ccache_path, 0755);
PAKFIRE_EXPORT int pakfire_build_set_ccache_path(
struct pakfire_build* build, const char* path) {
// Check if this can be called
- if (pakfire_build_has_flag(build, PAKFIRE_BUILD_DISABLE_CCACHE)) {
- errno = EPERM;
- return 1;
- }
+ if (pakfire_build_has_flag(build, PAKFIRE_BUILD_DISABLE_CCACHE))
+ return -EPERM;
// Check input value
- if (!path || !*path) {
- errno = EINVAL;
- return 1;
- }
+ if (!path || !*path)
+ return -EINVAL;
// Store the path
return pakfire_string_set(build->ccache_path, path);
const char* target = (const char*)p;
- if (!target) {
- errno = EINVAL;
- return 1;
- }
+ if (!target)
+ return -EINVAL;
// Fetch the package filename
const char* filename = pakfire_package_get_string(pkg, PAKFIRE_PKG_FILENAME);
int r;
// Check inputs
- if (!type || !f) {
- errno = EINVAL;
- return 1;
- }
+ if (!type || !f)
+ return -EINVAL;
// Create a path inside the build environment
r = pakfire_path(build->pakfire, path, "%s",
struct pakfire_build* build = NULL;
// Try to create a build with an invalid UUID
- ASSERT_ERRNO(pakfire_build_create(&build, t->pakfire, "ABC", 0), EINVAL);
+ ASSERT(pakfire_build_create(&build, t->pakfire, "ABC", 0) == -EINVAL);
// Try to create a build with an empty UUID
- ASSERT_ERRNO(pakfire_build_create(&build, t->pakfire, "", 0), EINVAL);
+ ASSERT(pakfire_build_create(&build, t->pakfire, "", 0) == -EINVAL);
return EXIT_SUCCESS;