diff options
| author | Jack Jamison <jackqjamison@gmail.com> | 2026-07-22 11:14:54 -0400 |
|---|---|---|
| committer | Jack Jamison <jackqjamison@gmail.com> | 2026-07-22 11:14:54 -0400 |
| commit | c293d3cc413991e4fb18b963427a6e55afd2b5c0 (patch) | |
| tree | 0adc4aba00d9f6497e09c4b77b6017d2cd3bb54a | |
| parent | 5365f8fa8d6ebfbf3ba92816abe55a99feff6f25 (diff) | |
organization and url stuff
| -rw-r--r-- | packages/swenu/swenu.sh | 4 | ||||
| -rwxr-xr-x | snag/configure | 1 | ||||
| -rw-r--r-- | snag/ideas.txt | 5 | ||||
| -rw-r--r-- | snag/readme.txt | 11 | ||||
| -rwxr-xr-x | snag/scripts/get_pkg_attrs.sh | 2 | ||||
| -rw-r--r-- | snag/src/main.c | 7 | ||||
| -rw-r--r-- | snag/src/package.h | 16 | ||||
| -rw-r--r-- | snag/src/package_db.c (renamed from snag/src/pkg_db.c) | 8 | ||||
| -rw-r--r-- | snag/src/package_db.h (renamed from snag/src/pkg_db.h) | 17 | ||||
| -rw-r--r-- | snag/src/util.h | 2 |
10 files changed, 44 insertions, 29 deletions
diff --git a/packages/swenu/swenu.sh b/packages/swenu/swenu.sh index bfc5ebe..42e61c4 100644 --- a/packages/swenu/swenu.sh +++ b/packages/swenu/swenu.sh @@ -4,8 +4,8 @@ pkg_desc="Simple Wayland ENU" pkg_webpage="https://github.com/NAHTAIV3L/swenu" pkg_license="GPL-3.0" pkg_version=1.1.0 -pkg_source_url="https://github.com/NAHTAIV3L/swenu/archive/refs/tags/$version.tar.gz" -pkg_source_hash="https://github.com/NAHTAIV3L/swenu/archive/refs/tags/$version.tar.gz" +pkg_source_url="https://github.com/NAHTAIV3L/swenu/archive/refs/tags/$pkg_version.tar.gz" +pkg_source_hash="123456789" configure() { echo "configuring swenu..." diff --git a/snag/configure b/snag/configure index 9b73f97..757df3a 100755 --- a/snag/configure +++ b/snag/configure @@ -37,7 +37,6 @@ for target in $(echo "debug release"); do write ' description = CC $out' write " command = gcc -MD -MF \$out.d \$cflags_$target -c \$in -o \$out" - files="$(find . -name '*.c')" sedstr=$(printf 's,^\./\(.*\)\.c$,%s\/%s\/\\1.o,g' ${builddir} ${target}) ofiles=$(echo "$files" | sed ${sedstr}) diff --git a/snag/ideas.txt b/snag/ideas.txt index 5bfe899..2044da6 100644 --- a/snag/ideas.txt +++ b/snag/ideas.txt @@ -1,4 +1,7 @@ - system that allows multiple different downloads for a package, each with a hash and location. it could also handle submodules somehow - sepration of (program/lib package, app package, admin package) - developer tools for creating and updating packages -- snag shell api +- selectively choose static and dynamic linking for certain libraries. +- allow a package/bin to be recompiled to be totally portable + +- easy bootstrapping and cross compilation diff --git a/snag/readme.txt b/snag/readme.txt index 33938d6..53df374 100644 --- a/snag/readme.txt +++ b/snag/readme.txt @@ -27,16 +27,16 @@ Install Database - the directory containing information on installed packag Install Description - the data stored about a package in the install database Download Database - the directory where package downloads are stored and cached +## Interesting Features +- switch between cli and tui mode mid run +- build packages that aren't in the database + ## Package Description Format Each package has a directory in the package database, named by its `id`. Inside each package directory is the description script named `{id}.sh` The description script should have functions for `configure`, `build`, and `install` The description script should define variables for attributes with the name `pkg_{attr}` -## Interesting Features -- switch between cli and tui mode mid run -- build packages that aren't in the database - Packages have the following attributes: id - the identifier name of the package. everything uses this name - the display name of package @@ -45,6 +45,9 @@ webpage - url to home website license - spdx identifer for package license (https://spdx.org/licenses/) version - software version, in whatever format is needed. commit hashes are allowed +### Snag Shell API +TBD + ## Install Description Format TBD. Will contain at least: - date installed diff --git a/snag/scripts/get_pkg_attrs.sh b/snag/scripts/get_pkg_attrs.sh index 25f9177..932c79c 100755 --- a/snag/scripts/get_pkg_attrs.sh +++ b/snag/scripts/get_pkg_attrs.sh @@ -20,3 +20,5 @@ echoatt d "$pkg_desc" echoatt w "$pkg_webpage" echoatt l "$pkg_license" echoatt v "$pkg_version" +echoatt u "$pkg_source_url" +echoatt h "$pkg_source_hash" diff --git a/snag/src/main.c b/snag/src/main.c index 0429fda..7d5ea58 100644 --- a/snag/src/main.c +++ b/snag/src/main.c @@ -2,7 +2,7 @@ #include "util.h" #include "libargs/args.h" -#include "pkg_db.h" +#include "package_db.h" int cmd_install(char* cmd_name, ArgParser* parser); @@ -37,13 +37,14 @@ int cmd_install(char* cmd_name, ArgParser* parser) { // install each package specified for (int i = 0; i < ap_count_args(parser); i++) { - if (i != 0) printf("\n"); + if (i != 0) print("\n"); // load package description char* pkgid = ap_get_arg_at_index(parser, i); package_info_t info; if (load_package_info(pkgid, &info)) { - printf("Installing %s - %s\n", info.attrs.name, info.attrs.desc); + print("Installing %s - %s\n", info.attrs.name, info.attrs.desc); + print("Downloading '%s'\n", info.attrs.source_url); run_package_install(&info); } } diff --git a/snag/src/package.h b/snag/src/package.h new file mode 100644 index 0000000..3ff58b6 --- /dev/null +++ b/snag/src/package.h @@ -0,0 +1,16 @@ +typedef struct { + char* id; + char* name; + char* desc; + char* webpage; + char* license; + char* version; + char* source_url; + char* source_hash; + char buffer[4069]; +} package_attrs_t; + +typedef struct { + char* script_path; + package_attrs_t attrs; +} package_info_t; diff --git a/snag/src/pkg_db.c b/snag/src/package_db.c index c35e47b..0bae257 100644 --- a/snag/src/pkg_db.c +++ b/snag/src/package_db.c @@ -1,12 +1,12 @@ -#include "pkg_db.h" +#include "package_db.h" #include "util.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <errno.h> #include <sys/wait.h> +#include <errno.h> #define PKG_INFO_CMD "./scripts/get_pkg_attrs.sh" #define PKG_INST_CMD "./scripts/run_pkg_install.sh" @@ -106,6 +106,10 @@ bool load_package_info(char* pkgid, package_info_t* info) { info->attrs.license = &info->attrs.buffer[i]; break; case 'v': info->attrs.version = &info->attrs.buffer[i]; break; + case 'u': + info->attrs.source_url = &info->attrs.buffer[i]; break; + case 'h': + info->attrs.source_hash = &info->attrs.buffer[i]; break; } for(;info->attrs.buffer[i] && i < bytes_read; i++); i++; diff --git a/snag/src/pkg_db.h b/snag/src/package_db.h index 0d34a61..bae1cdd 100644 --- a/snag/src/pkg_db.h +++ b/snag/src/package_db.h @@ -3,24 +3,11 @@ #include <stdbool.h> +#include "package.h" + // loads and allocates package attributes for the info struct. does not do // excessive validation, so this should be fine when loading lots of package // data -typedef struct { - char* id; - char* name; - char* desc; - char* webpage; - char* license; - char* version; - char buffer[4069]; -} package_attrs_t; - -typedef struct { - char* script_path; - package_attrs_t attrs; -} package_info_t; - bool load_package_info(char* pkgid, package_info_t* info); void run_package_install(const package_info_t* info); diff --git a/snag/src/util.h b/snag/src/util.h index 3813903..eca4e4d 100644 --- a/snag/src/util.h +++ b/snag/src/util.h @@ -25,7 +25,7 @@ #define print(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__) // string functions -char* vastrcat_(int dummy, ...); #define vastrcat(...) vastrcat_(0, __VA_ARGS__, NULL) +char* vastrcat_(int dummy, ...); #endif |
