Skip to content

remap custom repos to the same format as the standard repo - #84

Closed
benjaminlevine wants to merge 1 commit into
efahl:mainfrom
benjaminlevine:main
Closed

benjaminlevine wants to merge 1 commit into
efahl:mainfrom
benjaminlevine:main

Conversation

@benjaminlevine

Copy link
Copy Markdown

Convert the formatting of custom repositories into the same format as used by the upstream server.

@efahl

efahl commented Sep 10, 2026 •

Copy link
Copy Markdown
Owner

owut shouldn't be special casing every odd file formatting quirk, this belongs upstream on the system building the index.json. All index files should have the same format as the OpenWrt upstream ones, like https://downloads.openwrt.org/snapshots/targets/gemini/generic/packages/index.json

@efahl

efahl commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Belay that, I just read through your forum thread. Let's find all the various formats and consolidate all of them into a simple "read an index".

(My main goal is to keep the code as small as possible these days, adding features has made it grow too big for tiny devices and I'd like to combat that and add some shrinkage.)

@benjaminlevine

benjaminlevine commented Sep 11, 2026 •

Copy link
Copy Markdown
Author

Maybe the solution can be pushed to the user when setting up their custom server.

At the moment my index.json is generated as (as described here):

apk adbdump --format json packages.adb > index.json

Comparing the format of the upstream index with my generated index:

{ "packages": [ { "name": "apcontroller", "version": "20260506-r1", "hashes": "1ac08f12676bfa4fd840d559db26296f954bbfbe8916e6b3329bed48ef367b9b", "description": "Simple AP management system", "arch": "noarch", "origin": "feeds/base/apcontroller/apcontroller", "maintainer": "Cezary Jackiewicz <cezary@eko.one.pl>", "installed-size": 20732, "file-size": 7024, "depends": [ "libc", "sshpass" ], "provides": [ "apcontroller-any" ] },

Don't we just need a local script to do the conversion between formats and output a local json in the same format as the upstream one? Not sure how to document it though.
E.g.:
jq '{ packages: [.packages[] | {(.name): .version}] | add | to_entries | sort_by(.key) | from_entries}' index.json > index.json

@efahl

efahl commented Sep 12, 2026

Copy link
Copy Markdown
Owner

At the moment my index.json is generated as (as described here):

apk adbdump --format json packages.adb > index.json

Aha! The index should be auto-generated during the package build by the scripts/make-index-json.py script. What are you using to create your packages, the SDK? If so, we need to fix it there.

Here's where it happens in full buildroot:

$ git grep make-index-json.py
package/Makefile:                       $(SCRIPT_DIR)/make-index-json.py -f apk -a "$(ARCH_PACKAGES)" - > index.json; \
package/Makefile:               $(SCRIPT_DIR)/make-index-json.py -f opkg -a "$(ARCH_PACKAGES)" Packages > index.json; \
target/imagebuilder/files/Makefile:             $(SCRIPT_DIR)/make-index-json.py -a $(ARCH_PACKAGES) -f apk --manifest -

@efahl

efahl commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Here's what I see in my buildroot currently, just the junk laying around after test builds:

$ for s in $(find bin/ -iname index.json); do echo $s; cat $s | jq | head -5; done
bin/packages/riscv64_generic/base/index.json
{
  "version": 2,
  "architecture": "riscv64_generic",
  "packages": {
    "apk-mbedtls": "3.0.5-r3",
bin/packages/riscv64_generic/luci/index.json
{
  "version": 2,
  "architecture": "riscv64_generic",
  "packages": {
    "liblucihttp-ucode": "2023.03.15~9b5b683f-r1",
bin/packages/riscv64_generic/packages/index.json
{
  "version": 2,
  "architecture": "riscv64_generic",
  "packages": {
    "adblock": "4.5.7-r4",
bin/packages/mipsel_24kc/base/index.json
{
  "version": 2,
  "architecture": "mipsel_24kc",
  "packages": {
    "apk-mbedtls": "3.0.5-r3",
bin/packages/mipsel_24kc/luci/index.json
{
  "version": 2,
  "architecture": "mipsel_24kc",
  "packages": {
    "liblucihttp-ucode": "2023.03.15~9b5b683f-r1",
bin/packages/mipsel_24kc/packages/index.json
{
  "version": 2,
  "architecture": "mipsel_24kc",
  "packages": {
    "adblock": "4.5.8-r2",
bin/targets/spacemit/k1/packages/index.json
{
  "version": 2,
  "architecture": "riscv64_generic",
  "packages": {
    "base-files": "1706~7b396007440c",
bin/targets/ramips/mt7620/packages/index.json
{
  "version": 2,
  "architecture": "mipsel_24kc",
  "packages": {
    "base-files": "1706~f0d3e332e5f8",

@benjaminlevine

Copy link
Copy Markdown
Author

OK! That works now when I run:
adb adbdump --format json packages.adb | python sdk/scripts/make-index-json.py -a aarch64_cortex-a53 -f apk - > index.json

This isn't being autogenerated because I'm not running a whole buildroot - just compiling individual packages.

Thanks for the help. I'll close the pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants