diff options
| -rw-r--r-- | include/vars.h | 1 | ||||
| -rw-r--r-- | src/create_pkg.c | 8 | ||||
| -rw-r--r-- | src/lua_state.c | 4 |
3 files changed, 13 insertions, 0 deletions
diff --git a/include/vars.h b/include/vars.h index d635b07..1a58f0d 100644 --- a/include/vars.h +++ b/include/vars.h @@ -32,6 +32,7 @@ typedef struct { typedef struct { char *source_key; char *source_value; + char *version; Dependency *dependencies; size_t dep_count; int build_ref; diff --git a/src/create_pkg.c b/src/create_pkg.c index 5bd91fa..4f4781e 100644 --- a/src/create_pkg.c +++ b/src/create_pkg.c @@ -14,6 +14,14 @@ Pkg create_pkg(const char *arg, const char *target) { pkg.ver = "HEAD"; pkg.is_local = false; + cache_repos(); + for (int i = 0; i < cached_repos_count; i++) { + if (strcmp(cached_repos[i].source_key, arg) == 0) { + pkg.ver = cached_repos[i].version; + printf("THIS IS THE VERSION NUMBER: %s\n", pkg.ver); + } + } + char* argver = strchr(arg, '@'); char* new_arg = strdup(arg); if (argver) { diff --git a/src/lua_state.c b/src/lua_state.c index 6d3d023..24a9db6 100644 --- a/src/lua_state.c +++ b/src/lua_state.c @@ -193,6 +193,10 @@ void cache_repos() { const char *url = lua_tostring(L, -1); repo->source_value = url ? strdup(url) : strdup(""); lua_pop(L, 1); + lua_getfield(L, -1, "version"); + const char* version = lua_tostring(L, -1); + repo->version = version ? strdup(version) : strdup("HEAD"); + lua_pop(L, 1); lua_getfield(L, -1, "dependencies"); if (!lua_istable(L, -1)) { lua_pop(L, 2); |
