diff --git a/board-support/espressif-esp/extract-bsp-info.o b/board-support/espressif-esp/extract-bsp-info.o deleted file mode 100644 index 85f74f4..0000000 Binary files a/board-support/espressif-esp/extract-bsp-info.o and /dev/null differ diff --git a/tools/archive-info.zig b/tools/archive-info.zig index 049d981..33f8496 100644 --- a/tools/archive-info.zig +++ b/tools/archive-info.zig @@ -1,8 +1,9 @@ //! -//! Computes some meta information for packages and prints them as JSON. +//! Computes the hash and some meta information for package tar balls and prints them as JSON. +//! //! Usage: archive-info //! -//! Is used in `/tools/bundle.sh` to extend the `microzig-package.json` file. +//! Is used in `/tools/bundle.py` to extend the `microzig-package.json` file. //! const std = @import("std"); diff --git a/tools/bundle.py b/tools/bundle.py index 76c85c1..47761c1 100755 --- a/tools/bundle.py +++ b/tools/bundle.py @@ -1,8 +1,11 @@ #!/usr/bin/env python3 # # Prepares a full deployment of MicroZig. -# Creates all packages into /microzig-deploy with the final folder structure. +# Creates all packages into ${repo}/microzig-deploy with the final folder structure. # +# Just invoke this script to create a deployment structure for MicroZig. +# + import sys, os, subprocess,datetime, re, shutil, json, hashlib from pathlib import Path, PurePosixPath @@ -22,12 +25,6 @@ ALL_FILES_DIR=".data" REQUIRED_TOOLS = [ "zig", "git", - # "date", - # "find", - # "jq", - # "mkdir", - # "dirname", - # "realpath", ] DEPLOYMENT_BASE="https://download.microzig.tech/packages" diff --git a/tools/create-package.sh b/tools/create-package.sh deleted file mode 100755 index 1eaf96b..0000000 --- a/tools/create-package.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -set -eu - -# test for all required tools: -which tar gzip jq basename dirname realpath > /dev/null - -if [ "$#" -ne 2 ]; then - echo "usage: $(basename "$0") " >&2 - exit 1 -fi - -input_folder="$(realpath "$1")" -output_file="$(realpath "$2")" - -if [ ! -d "${input_folder}" ]; then - echo "${input_folder} does not exist or is not a directory!" >&2 - exit 1 -fi - - -if [ ! -f "${input_folder}/microzig-package.json" ]; then - echo "The input folder does not contain a microzig-package.json!" >&2 - exit 1 -fi - -if [ -e "${output_file}" ]; then - echo "${output_file} already exists, please delete first!" >&2 - exit 1 -fi - -if [ ! -d "$(dirname "${output_file}")" ]; then - echo "${output_file} does not point to a path where a file can be created!" >&2 - exit 1 -fi - -( - cd "${input_folder}" - # explanation on ls-files: - # https://stackoverflow.com/a/53083343 - tar -caf "${output_file}" $(git ls-files -- . ':!:microzig-package.json') -) diff --git a/tools/create-pkg-descriptor.zig b/tools/create-pkg-descriptor.zig index 26862f3..d41abeb 100644 --- a/tools/create-pkg-descriptor.zig +++ b/tools/create-pkg-descriptor.zig @@ -1,3 +1,17 @@ +//! +//! Creates a `build.zig.zon` based on a JSON array of `microzig-package.json` files. +//! +//! Usage: create-pkg-descriptor < all-packages.json > build.zig.zon +//! +//! Searches for a package called `` in the `microzig-package.json` descriptors +//! passed in on stdin. +//! +//! Those package descriptors must have `version`, `package_name`, `external_dependencies` and `inner_dependencies` set, +//! The inner dependencies must also have `download_url` and `package.hash` available. +//! +//! This program is intended for the use from the `tools/bundly.py` bundler. See this script for more usage information. +//! + const std = @import("std"); const eggzon = @import("eggzon"); @@ -56,7 +70,6 @@ fn renderDep(writer: anytype, name: []const u8, url: []const u8, hash: []const u try writer.writeAll(" },\n"); } -// create-pkg-descriptor pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); diff --git a/tools/demo-server.py b/tools/demo-server.py index 302edf5..68545df 100755 --- a/tools/demo-server.py +++ b/tools/demo-server.py @@ -1,5 +1,10 @@ #!/usr/bin/env python3 - +# +# A small web server that can serve the `${root}/microzig-deploy` folder for testing the package infrastructure. +# +# Basically `python -m http.server 8080`, but also hides folders starting with `.data` so the "internals" aren't shown +# to the user in the file listing. +# from pathlib import Path from http.server import HTTPServer,SimpleHTTPRequestHandler diff --git a/tools/extract-bsp-info.zig b/tools/extract-bsp-info.zig index 565c3d0..9d83f7d 100644 --- a/tools/extract-bsp-info.zig +++ b/tools/extract-bsp-info.zig @@ -1,5 +1,5 @@ //! -//! A tool that extracs which chips and boards are avaiilable from a board support package +//! A tool that extracs which chips and boards are available from a board support package //! and validates that the declarations conform //! @@ -62,7 +62,7 @@ fn renderMicroZigTarget(stream: anytype, key: []const u8, target: microzig.Targe for (target.chip.memory_regions) |reg| { switch (reg.kind) { .flash => jtarget.memory.flash += reg.length, - .ram => jtarget.memory.flash += reg.length, + .ram => jtarget.memory.ram += reg.length, else => {}, } } diff --git a/tools/lib/tar.zig b/tools/lib/tar.zig index 43c1b8d..c93684d 100644 --- a/tools/lib/tar.zig +++ b/tools/lib/tar.zig @@ -1,3 +1,7 @@ +//! +//! Extracted from https://github.com/mattnite/ezpkg. +//! + const std = @import("std"); const builtin = @import("builtin");