aboutsummaryrefslogtreecommitdiff
path: root/spm.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2019-12-18 21:57:51 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2019-12-18 21:57:51 -0500
commit534657dd6fc2ee98159e41d2700554fed0da2c4e (patch)
treed9316757b060d68e5640ea9ecb56b29c62adedfc /spm.c
parent3166627f1485e2f05421fe874b2236852fe5d017 (diff)
downloadspmc-534657dd6fc2ee98159e41d2700554fed0da2c4e.tar.gz
Refactor project structure
Diffstat (limited to 'spm.c')
-rw-r--r--spm.c60
1 files changed, 0 insertions, 60 deletions
diff --git a/spm.c b/spm.c
deleted file mode 100644
index 3607117..0000000
--- a/spm.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * SPM - Simple Package Manager
- * @file spm.c
- */
-#include "spm.h"
-
-int main(int argc, char *argv[]) {
- // not much to see here yet
- // at the moment this will all be random tests, for better or worse
- // everything here is subject to change without notice
-
- // Initialize configuration data
- init_config_global();
- show_global_config();
-
- // Ensure external programs are available for use.
- check_runtime_environment();
-
- // Install a package to test things out
- char *match;
- char *package;
- const char *root = "/tmp/root";
- if ((match = find_package("python")) == NULL) {
- fprintf(SYSERROR);
- exit(1);
- }
- if ((package = basename(match)) == NULL) {
- fprintf(stderr, "Unable to derive package name from package path:\n\t-> %s\n", match);
- exit(1);
- }
-
- Dependencies *deps = NULL;
- dep_init(&deps);
-
- if (dep_all(&deps, package) < 0) {
- dep_free(&deps);
- free_global_config();
- exit(1);
- }
-
- printf("%s requires:\n", package);
- dep_show(&deps);
-
- // Install dependencies first
- for (int i = 0; i < deps->records; i++) {
- if (install(root, deps->list[i]) < 0) {
- fprintf(SYSERROR);
- exit(errno);
- }
- }
- // Install package
- if (install(root, package) < 0) {
- fprintf(SYSERROR);
- exit(errno);
- }
-
- dep_free(&deps);
- free_global_config();
- return 0;
-}