Skip to content

Commit

Permalink
made basic dependency check
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksArt000 committed Nov 24, 2023
1 parent b60f84f commit 02c65ae
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/deps.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ int check_dependencies(char **dependencies, int dependenciesCount) {

for (int i = 0; i < dependenciesCount; i++) {
dbg(3, "Checking if %s is installed", dependencies[i]);

if (!is_installed(dependencies[i])) {
dbg(3, "Dependency %s is not installed", dependencies[i]);
// TODO: We need to install the dependency
Expand All @@ -44,6 +43,22 @@ int check_dependencies(char **dependencies, int dependenciesCount) {
continue;
}

struct package* pkg = calloc(1, sizeof(struct package));
pkg->name = dependencies[i];

char* format = get(pkg, pkg->name);

if (format == NULL) {
msg(ERROR, "Failed to download package %s", pkg->name);
return 1;
}

f_install_package_source(pkg->name, 0, format);

remove(pkg->name);

/*
TODO: make gud
char dep_path[PATH_MAX];
snprintf(dep_path, PATH_MAX, "/tmp/%s-dep.tmp", dependencies[i]);
Expand All @@ -57,14 +72,12 @@ int check_dependencies(char **dependencies, int dependenciesCount) {
msg(ERROR, "Failed to get dependency %s", dependencies[i]);
return -1;
}

*/
// Install the dependency
/*
TODO: Find a clever way to implement automatic dependency installing
In the meantime, I'll implement no dependency checking.
*/

return 0;
} else {
dbg(3, "Dependency %s is installed", dependencies[i]);
}
Expand Down

1 comment on commit 02c65ae

@AleksArt000
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wait why did it commit here

Please sign in to comment.