diff options
| author | Jack Jamison <jackqjamison@gmail.com> | 2026-07-21 14:07:23 -0400 |
|---|---|---|
| committer | Jack Jamison <jackqjamison@gmail.com> | 2026-07-21 17:12:14 -0400 |
| commit | feef592b397f6ec6b8b848d93b0cea9b9800f955 (patch) | |
| tree | 6e30f3eec127eba0bd646d74cc11c9aef88d7c1f /snag | |
| parent | df1e0af03db13339add48a9bc6350eedb30775ff (diff) | |
add more package attributes
Diffstat (limited to 'snag')
| -rwxr-xr-x | snag/get_pkg_attrs.sh | 3 | ||||
| -rw-r--r-- | snag/ideas.txt | 4 | ||||
| -rw-r--r-- | snag/main.c | 3 | ||||
| -rw-r--r-- | snag/pkg_db.c | 15 | ||||
| -rw-r--r-- | snag/pkg_db.h | 3 | ||||
| -rw-r--r-- | snag/readme.txt | 26 |
6 files changed, 36 insertions, 18 deletions
diff --git a/snag/get_pkg_attrs.sh b/snag/get_pkg_attrs.sh index bb80418..25f9177 100755 --- a/snag/get_pkg_attrs.sh +++ b/snag/get_pkg_attrs.sh @@ -17,3 +17,6 @@ echoatt() { [ -n "$2" ] && printf "$1$2\0"; } echoatt i "$pkg_id" echoatt n "$pkg_name" echoatt d "$pkg_desc" +echoatt w "$pkg_webpage" +echoatt l "$pkg_license" +echoatt v "$pkg_version" diff --git a/snag/ideas.txt b/snag/ideas.txt new file mode 100644 index 0000000..5bfe899 --- /dev/null +++ b/snag/ideas.txt @@ -0,0 +1,4 @@ +- 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 diff --git a/snag/main.c b/snag/main.c index c6abcb1..4f6aa44 100644 --- a/snag/main.c +++ b/snag/main.c @@ -37,9 +37,10 @@ int cmd_install(char* cmd_name, ArgParser* parser) { // install each package specified for (int i = 0; i < ap_count_args(parser); i++) { - char* pkgid = ap_get_arg_at_index(parser, i); + if (i != 0) printf("\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); diff --git a/snag/pkg_db.c b/snag/pkg_db.c index a02fe93..3ed36cf 100644 --- a/snag/pkg_db.c +++ b/snag/pkg_db.c @@ -95,14 +95,17 @@ bool load_package_info(char* pkgid, package_info_t* info) { i++; switch (atype) { case 'i': - info->attrs.id = &info->attrs.buffer[i]; - break; + info->attrs.id = &info->attrs.buffer[i]; break; case 'n': - info->attrs.name = &info->attrs.buffer[i]; - break; + info->attrs.name = &info->attrs.buffer[i]; break; case 'd': - info->attrs.desc = &info->attrs.buffer[i]; - break; + info->attrs.desc = &info->attrs.buffer[i]; break; + case 'w': + info->attrs.webpage = &info->attrs.buffer[i]; break; + case 'l': + info->attrs.license = &info->attrs.buffer[i]; break; + case 'v': + info->attrs.version = &info->attrs.buffer[i]; break; } for(;info->attrs.buffer[i] && i < bytes_read; i++); i++; diff --git a/snag/pkg_db.h b/snag/pkg_db.h index 0a67043..0d34a61 100644 --- a/snag/pkg_db.h +++ b/snag/pkg_db.h @@ -10,6 +10,9 @@ typedef struct { char* id; char* name; char* desc; + char* webpage; + char* license; + char* version; char buffer[4069]; } package_attrs_t; diff --git a/snag/readme.txt b/snag/readme.txt index 5e3fd9a..33938d6 100644 --- a/snag/readme.txt +++ b/snag/readme.txt @@ -13,7 +13,8 @@ why - list why this package is installed (manually installed, as a depe ## Important Directories Package Database - /var/snag/pkgs/ -Install Database - /var/snag/install/ +Install Database - /var/snag/state/ +Download Database - /var/snag/downloads/ Logs/In Progress Builds - /var/snag/builds/ SNAG Configuration - /etc/snag/ @@ -24,6 +25,7 @@ Package Info/Metadata - the metadata encoded in the package description Package Attribute - a single key value property of the package info Install Database - the directory containing information on installed package Install Description - the data stored about a package in the install database +Download Database - the directory where package downloads are stored and cached ## Package Description Format Each package has a directory in the package database, named by its `id`. @@ -31,21 +33,23 @@ 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}` -## Install Description Format -TBD. Will contain at least: -- date installed -- flists -- install reason - - ## 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 -`desc` - the short description of the package +id - the identifier name of the package. everything uses this +name - the display name of package +desc - the short description of the package +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 + +## Install Description Format +TBD. Will contain at least: +- date installed +- flists +- install reason ## Developer Subcommands `validate` - check a package description and check for format errors or warnings |
