Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions src/common/clib-package.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
#include "parse-repo/parse-repo.h"
#include "parson/parson.h"
#include "path-join/path-join.h"
#include "rimraf/rimraf.h"
#include "strdup/strdup.h"
#include "substr/substr.h"
#include "tempdir/tempdir.h"
#include "rimraf/rimraf.h"
#include <curl/curl.h>
#include <libgen.h>
#include <limits.h>
Expand Down Expand Up @@ -324,7 +324,7 @@ static inline list_t *parse_package_deps(JSON_Object *obj) {
if (!(dep = clib_package_dependency_new(name, version)))
goto loop_cleanup;

list_node_t* dep_node = list_node_new(dep);
list_node_t *dep_node = list_node_new(dep);
// note: if we fail to allocate the node itself,
// `dep` will never be pushed on the list
if (!dep_node) {
Expand Down Expand Up @@ -704,26 +704,26 @@ clib_package_new_from_slug_with_package_name(const char *slug, int verbose,

// force version number
if (pkg->version) {
if (version) {
if (0 != strcmp(version, DEFAULT_REPO_VERSION)) {
_debug("forcing version number: %s (%s)", version, pkg->version);
free(pkg->version);
pkg->version = version;
} else {
free(version);
}
if (0 != strcmp(version, DEFAULT_REPO_VERSION)) {
_debug("forcing version number: %s (%s)", version, pkg->version);
free(pkg->version);
pkg->version = version;
} else {
free(version);
version = NULL;
}
} else {
pkg->version = version;
}

// force package author (don't know how this could fail)
if (author && pkg->author) {
if (pkg->author) {
if (0 != strcmp(author, pkg->author)) {
free(pkg->author);
pkg->author = author;
} else {
free(author);
author = NULL;
}
} else {
pkg->author = strdup(author);
Expand Down Expand Up @@ -1544,7 +1544,7 @@ int clib_package_install(clib_package_t *pkg, const char *dir, int verbose) {
#ifdef HAVE_PTHREADS
// Here there are i-1 threads running.
for (int j = 0; j < i; j++) {
fetch_package_file_thread_data_t *data = fetchs[j];
fetch_package_file_thread_data_t *data = fetchs[j];
int *status;

pthread_join(data->thread, (void **)&status);
Expand All @@ -1566,7 +1566,6 @@ int clib_package_install(clib_package_t *pkg, const char *dir, int verbose) {
}
#endif


install:
if (pkg->configure) {
E_FORMAT(&command, "cd %s/%s && %s", dir, pkg->name, pkg->configure);
Expand Down Expand Up @@ -1597,7 +1596,6 @@ int clib_package_install(clib_package_t *pkg, const char *dir, int verbose) {
pthread_mutex_unlock(&lock.mutex);
#endif


cleanup:
if (pkg_dir) {
if (0 != rc) {
Expand Down Expand Up @@ -1629,7 +1627,8 @@ int clib_package_install(clib_package_t *pkg, const char *dir, int verbose) {
#endif
if (0 != rc && pkg) {
clib_cache_delete_json(pkg->author, pkg->name, pkg->version);
_debug("deleted json cache: %s/%s@%s", pkg->author, pkg->name, pkg->version);
_debug("deleted json cache: %s/%s@%s", pkg->author, pkg->name,
pkg->version);
}
#ifdef HAVE_PTHREADS
pthread_mutex_unlock(&lock.mutex);
Expand Down