From fb00440464ab61a8703e9ddb429d8298582d4fba Mon Sep 17 00:00:00 2001 From: Jeffrey Aven Date: Tue, 26 Dec 2023 15:54:54 +1100 Subject: [PATCH] added homebrew provider --- .../src/homebrew/v00.00.00000/provider.yaml | 16 + .../v00.00.00000/services/formula.yaml | 578 ++++++++++++++++++ 2 files changed, 594 insertions(+) create mode 100644 providers/src/homebrew/v00.00.00000/provider.yaml create mode 100644 providers/src/homebrew/v00.00.00000/services/formula.yaml diff --git a/providers/src/homebrew/v00.00.00000/provider.yaml b/providers/src/homebrew/v00.00.00000/provider.yaml new file mode 100644 index 00000000..df3c4857 --- /dev/null +++ b/providers/src/homebrew/v00.00.00000/provider.yaml @@ -0,0 +1,16 @@ +id: homebrew +name: homebrew +version: v00.00.00000 +providerServices: + formula: + id: 'formula:v00.00.00000' + name: formula + preferred: true + service: + $ref: homebrew/v00.00.00000/services/formula.yaml + title: Homebrew Formulae API + version: v00.00.00000 + description: API For Accessing Homebrew Formulae Information. +config: + auth: + type: null_auth diff --git a/providers/src/homebrew/v00.00.00000/services/formula.yaml b/providers/src/homebrew/v00.00.00000/services/formula.yaml new file mode 100644 index 00000000..d74c441b --- /dev/null +++ b/providers/src/homebrew/v00.00.00000/services/formula.yaml @@ -0,0 +1,578 @@ +openapi: 3.0.0 +info: + title: Homebrew Formulae API + description: API for accessing Homebrew formulae information. + version: 1.0.0 +servers: + - url: 'https://formulae.brew.sh/api/formula' +paths: + '/{formula_name}.json': + get: + summary: Get formula details + description: Retrieve detailed information about a specific Homebrew formula. + operationId: getFormula + parameters: + - in: path + name: formula_name + required: true + schema: + type: string + description: The name of the formula. + responses: + '200': + description: A JSON object containing the formula details. + content: + application/json: + schema: + $ref: '#/components/schemas/Formula' +components: + schemas: + Formula: + type: object + properties: + name: + type: string + description: The name of the formula. + full_name: + type: string + description: 'The full, qualified name of the formula including the tap name (if applicable).' + tap: + type: string + description: The GitHub repository (tap) where the formula is located. + oldname: + type: string + nullable: true + description: 'Previous name for the formula, if it was renamed.' + oldnames: + type: array + description: All previous names the formula had. + items: + type: string + aliases: + type: array + description: Alternative names or aliases for the formula. + items: + type: string + versioned_formulae: + type: array + description: Other versions of the formula available as separate formulae. + items: + type: string + desc: + type: string + description: | + A short description of the formula. + license: + type: string + description: | + The license under which the formula is distributed. + homepage: + type: string + description: | + URL to the formula's homepage or project page. + versions: + type: object + description: | + The version numbers of the formula, including the stable, head, and bottle versions. + properties: + stable: + type: string + head: + type: string + bottle: + type: boolean + urls: + type: object + description: | + URLs related to the formula, such as the source URL. + properties: + stable: + type: object + properties: + url: + type: string + tag: + type: string + nullable: true + revision: + type: string + nullable: true + using: + type: string + nullable: true + checksum: + type: string + head: + type: object + properties: + url: + type: string + branch: + type: string + nullable: true + using: + type: string + nullable: true + revision: + type: integer + description: | + The package revision number, used for versioning beyond the version number. + version_scheme: + type: integer + description: | + Versioning scheme used by the formula. + bottle: + type: object + description: | + Details about the precompiled binary packages (bottles) for the formula, including URLs and checksums. + additionalProperties: + type: object + properties: + cellar: + type: string + url: + type: string + sha256: + type: string + keg_only: + type: boolean + description: | + Whether the formula is keg-only, meaning it is not symlinked into the Homebrew prefix and can be accessed only by its fully qualified name. + keg_only_reason: + type: string + description: | + The reason why the formula is keg-only, if it is keg-only. + nullable: true + options: + type: array + description: | + Options that can be passed to the formula when installing it. + items: + type: string + build_dependencies: + type: array + description: | + Dependencies required to build the formula from source. + items: + type: string + dependencies: + type: array + description: | + Dependencies required to run the formula. + items: + type: string + test_dependencies: + type: array + description: | + Dependencies required for running the formulas tests. + items: + type: string + recommended_dependencies: + type: array + description: | + Dependencies that are recommended, meaning they are not required to run the formula but are suggested for additional functionality. + items: + type: string + optional_dependencies: + type: array + description: | + Dependencies that are optional, meaning they are not required to run the formula. + items: + type: string + uses_from_macos: + type: array + description: | + Dependencies that are provided by macOS, which the formula can use. + items: + type: string + uses_from_macos_bounds: + type: array + description: | + The minimum and maximum macOS versions that the formula can use. + items: + type: string + requirements: + type: array + description: | + Non-formula requirements for the formula, such as specific hardware or software conditions. + items: + type: string + conflicts_with: + type: array + description: | + Formula names that conflict with this formula, meaning they cannot be installed simultaneously. + items: + type: string + conflicts_with_reasons: + type: array + description: | + Reasons why the formula conflicts with other formulae. + items: + type: string + link_overwrite: + type: array + description: | + File paths that this formula might request to overwrite during installation. + items: + type: string + caveats: + type: string + description: | + Special instructions or warnings about the formula that users should be aware of. + nullable: true + installed: + type: array + description: | + Versions of the formula that are currently installed. + items: + type: object + properties: + version: + type: string + used_options: + type: array + items: + type: string + built_as_bottle: + type: boolean + poured_from_bottle: + type: boolean + time: + type: integer + runtime_dependencies: + type: array + items: + type: object + properties: + full_name: + type: string + version: + type: string + revision: + type: integer + pkg_version: + type: string + declared_directly: + type: boolean + linked_keg: + type: string + description: | + The version of the formula that is currently linked into Homebrews prefix. + pinned: + type: boolean + description: | + Whether the formula is pinned, meaning it is not upgraded when running `brew upgrade`. + outdated: + type: boolean + description: | + Whether the formula is outdated, meaning a newer version is available. + deprecated: + type: boolean + description: | + Whether the formula is deprecated, meaning it is no longer supported or maintained. + deprecation_date: + type: string + description: | + The date on which the formula was deprecated, if it is deprecated. + nullable: true + deprecation_reason: + type: string + description: | + The reason why the formula was deprecated, if it is deprecated. + nullable: true + disabled: + type: boolean + description: | + Whether the formula is disabled, meaning it is not available to install or use. + disable_date: + type: string + description: | + The date on which the formula was disabled, if it is disabled. + nullable: true + disable_reason: + type: string + description: | + The reason why the formula was disabled, if it is disabled. + nullable: true + post_install_defined: + type: boolean + description: | + Whether a post-installation script is defined for the formula. + service: + type: object + description: | + Details if the formula can run as a service or background process. + nullable: true + tap_git_head: + type: string + description: | + The latest commit SHA of the tap repository containing the formula. + ruby_source_path: + type: string + description: | + The file path to the Ruby source code of the formula. + ruby_source_checksum: + type: object + description: | + Checksum details for the Ruby source code of the formula. + properties: + sha256: + type: string + head_dependencies: + type: object + description: | + Dependencies required for installing the HEAD version (directly from the source repository). + properties: + build_dependencies: + type: array + items: + type: string + dependencies: + type: array + items: + type: string + test_dependencies: + type: array + items: + type: string + recommended_dependencies: + type: array + items: + type: string + optional_dependencies: + type: array + items: + type: string + uses_from_macos: + type: array + items: + type: string + uses_from_macos_bounds: + type: array + items: + type: string + variations: + type: object + description: | + Different variations of the formula, potentially for different operating systems or configurations. + additionalProperties: + type: object + properties: + dependencies: + type: array + items: + type: string + head_dependencies: + type: object + properties: + build_dependencies: + type: array + items: + type: string + dependencies: + type: array + items: + type: string + test_dependencies: + type: array + items: + type: string + recommended_dependencies: + type: array + items: + type: string + optional_dependencies: + type: array + items: + type: string + uses_from_macos: + type: array + items: + type: string + uses_from_macos_bounds: + type: array + items: + type: string + analytics: + type: object + description: | + Analytics data related to the formula, such as download counts or build errors. + properties: + install: + type: object + additionalProperties: + type: object + additionalProperties: + type: integer + install_on_request: + type: object + additionalProperties: + type: object + additionalProperties: + type: integer + build_error: + type: object + additionalProperties: + type: object + additionalProperties: + type: integer + generated_date: + type: string + description: | + The date when the formula information was last generated or updated. + format: date + x-stackQL-resources: + formula: + id: homebrew.formula.formula + name: formula + title: Formula + methods: + get_formula: + operation: + $ref: '#/paths/~1{formula_name}.json/get' + response: + mediaType: application/json + openAPIDocKey: '200' + sqlVerbs: + select: + - $ref: '#/components/x-stackQL-resources/formula/methods/get_formula' + insert: [] + update: [] + delete: [] + info: + name: info + id: homebrew.formula.info + config: + views: + select: + predicate: sqlDialect == "sqlite3" + ddl: |- + SELECT + name as formula_name, + full_name, + generated_date, + --desc as description, + homepage, + JSON_EXTRACT(versions, '$.stable') as latest_version, + license, + deprecated, + disabled + FROM + homebrew.formula.formula + WHERE formula_name = 'stackql' + build_errors: + name: build_errors + id: homebrew.formula.build_errors + config: + views: + select: + predicate: sqlDialect == "sqlite3" + ddl: |- + SELECT + formula_name as name, + JSON_EXTRACT(JSON_EXTRACT(analytics, '$.build_error.30d'), '$.' || formula_name) as build_errors_30d + FROM + homebrew.formula.formula + WHERE formula_name = 'stackql' + usage_metrics: + name: usage_metrics + id: homebrew.formula.usage_metrics + config: + views: + select: + predicate: sqlDialect == "sqlite3" + ddl: "SELECT\nformula_name as name,\nJSON_EXTRACT(JSON_EXTRACT(analytics, '$.install.30d'), '$.' || formula_name) as installs_30d,\nJSON_EXTRACT(JSON_EXTRACT(analytics, '$.install.90d'), '$.' || formula_name) as installs_90d,\nJSON_EXTRACT(JSON_EXTRACT(analytics, '$.install.365d'), '$.' || formula_name) as installs_365d,\nJSON_EXTRACT(JSON_EXTRACT(analytics, '$.install_on_request.30d'), '$.' || formula_name) as install_on_requests_30d,\nJSON_EXTRACT(JSON_EXTRACT(analytics, '$.install_on_request.90d'), '$.' || formula_name) as install_on_requests_90d,\nJSON_EXTRACT(JSON_EXTRACT(analytics, '$.install_on_request.365d'), '$.' || formula_name) as install_on_requests_365d\t\nFROM\nhomebrew.formula.formula\nWHERE formula_name = 'stackql'" + dependencies: + name: dependencies + id: homebrew.formula.dependencies + config: + views: + select: + predicate: sqlDialect == "sqlite3" + ddl: |- + SELECT + name as formula_name, + JSON_EXTRACT(dependencies, '$') as dependencies, + JSON_EXTRACT(head_dependencies, '$') as head_dependencies, + JSON_EXTRACT(build_dependencies, '$') as build_dependencies, + JSON_EXTRACT(test_dependencies, '$') as test_dependencies, + JSON_EXTRACT(optional_dependencies, '$') as optional_dependencies, + JSON_EXTRACT(recommended_dependencies, '$') as recommended_dependencies + FROM + homebrew.formula.formula + WHERE formula_name = 'stackql' + conflicts: + name: conflicts + id: homebrew.formula.conflicts + config: + views: + select: + predicate: sqlDialect == "sqlite3" + ddl: |- + SELECT + name as formula_name, + JSON_EXTRACT(conflicts_with, '$') as conflicts_with, + JSON_EXTRACT(conflicts_with_reasons, '$') as conflicts_with_reasons + FROM + homebrew.formula.formula + WHERE formula_name = 'stackql' + lifecycle: + name: lifecycle + id: homebrew.formula.lifecycle + config: + views: + select: + predicate: sqlDialect == "sqlite3" + ddl: |- + SELECT + name as formula_name, + deprecated, + deprecation_date, + deprecation_reason, + disabled, + disable_date, + disable_reason + FROM + homebrew.formula.formula + WHERE formula_name = 'stackql' + urls: + name: urls + id: homebrew.formula.urls + config: + views: + select: + predicate: sqlDialect == "sqlite3" + ddl: |- + SELECT + name as formula_name, + homepage, + JSON_EXTRACT(urls, '$.stable.url') as stable_url, + JSON_EXTRACT(urls, '$.head.url') as head_url, + JSON_EXTRACT(urls, '$.stable.tag') as stable_tag, + JSON_EXTRACT(urls, '$.stable.revision') as stable_revision, + JSON_EXTRACT(urls, '$.stable.using') as stable_using, + JSON_EXTRACT(urls, '$.stable.checksum') as stable_checksum, + JSON_EXTRACT(urls, '$.head.url') as head_branch, + JSON_EXTRACT(urls, '$.head.url') as head_using + FROM + homebrew.formula.formula + WHERE formula_name = 'stackql' + versions: + name: versions + id: homebrew.formula.versions + config: + views: + select: + predicate: sqlDialect == "sqlite3" + ddl: |- + SELECT + name as formula_name, + JSON_EXTRACT(versions, '$.stable') as stable_version, + JSON_EXTRACT(versions, '$.head') as head_version, + CASE + WHEN JSON_EXTRACT(versions, '$.bottle') = 1 THEN 'true' + ELSE 'false' + END as bottle_available + FROM + homebrew.formula.formula + WHERE formula_name = 'stackql'