system/nxpkg: Add network sync and harden package lifecycle. - #3642
Open
aviralgarg05 wants to merge 1 commit into
Open
system/nxpkg: Add network sync and harden package lifecycle.#3642aviralgarg05 wants to merge 1 commit into
aviralgarg05 wants to merge 1 commit into
Conversation
This was referenced Jul 16, 2026
aviralgarg05
force-pushed
the
gsoc/nxpkg-sync-lifecycle-hardening-pr5
branch
2 times, most recently
from
July 17, 2026 19:47
d33ae3b to
c4f639c
Compare
acassis
reviewed
Jul 21, 2026
linguini1
requested changes
Jul 21, 2026
halyssonJr
reviewed
Jul 23, 2026
halyssonJr
reviewed
Jul 23, 2026
halyssonJr
reviewed
Jul 23, 2026
halyssonJr
reviewed
Jul 23, 2026
halyssonJr
reviewed
Jul 23, 2026
aviralgarg05
force-pushed
the
gsoc/nxpkg-sync-lifecycle-hardening-pr5
branch
from
July 24, 2026 10:01
c4f639c to
f363a8f
Compare
This was referenced Jul 24, 2026
This was referenced Jul 24, 2026
Complete the package manager beyond the initial local-only slice: fetch a catalog and artifacts over HTTP, verify every payload against the SHA-256 recorded in its manifest, and wire update, remove, rollback and available into the CLI alongside install. Make the on-disk state safe to interrupt. Installs stage into temporary paths and reclaim state left behind by a previous interrupted attempt. The installed-packages database is committed before the current/previous pointer files are refreshed and before any payload directory is removed, so a crash can leave reclaimable orphaned files but never leaves the database pointing at a payload that is already gone. Serialize concurrent operations with three lock kinds: a per-package install lock, the installed-database lock and a synchronization lock that covers the whole read-fetch-write sequence, so a catalog and the source URL it was fetched from are always committed as a pair. Each lock records a per-boot token and its owner PID, and a contender honors a lock whose owner task is still alive rather than trusting file modification times; targets whose mounted filesystem clock does not track CLOCK_REALTIME would otherwise mistake a just-created lock for a decades-old stale one. Locks are renewed as data actually arrives, so a slow download is not reclaimed while it is still progressing. Treat catalog and database contents as untrusted: reject path-traversal sequences in manifest and installed-entry name/version fields before they reach the filesystem, require that the current and previous versions appear in the recorded version list, apply explicit size limits, and report a zero-byte write as an error instead of looping on it. Compare versions by numeric prefix without overflowing, falling back to a lexical comparison of the remainder so that versions sharing a numeric prefix are not treated as identical. Add an optional manifest icon field and pkg_metadata_load_manifest_path() for a GUI frontend that needs the manifest recorded for one specific installed version, which can differ from the catalog's current entry after a rollback. Default the storage root to /var/lib/nxpkg, overridable via CONFIG_SYSTEM_NXPKG_ROOT. Fix a build break on custom boards: pkg_runtime_compat() referenced CONFIG_ARCH_BOARD, which has no default under ARCH_BOARD_CUSTOM and is therefore undefined rather than empty; fall back to CONFIG_ARCH_BOARD_CUSTOM_NAME. Route diagnostics through syslog, since stdio is not visible to a supervisor with no attached console. Assisted-by: OpenAI Codex:gpt-5.6-sol Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
aviralgarg05
force-pushed
the
gsoc/nxpkg-sync-lifecycle-hardening-pr5
branch
from
August 6, 2026 16:35
f363a8f to
45a9292
Compare
Contributor
Author
|
Rebased onto current The squash also removes an artefact of the previous history: the first commit added The diff is limited to |
aviralgarg05
marked this pull request as ready for review
August 7, 2026 14:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: Please adhere to Contributing Guidelines.
Summary
Complete the network and package-lifecycle work started by #3474.
This adds:
netutils/webclient;sync,available,update,remove, androllbackcommands;that do not depend on filesystem timestamp accuracy;
version fields;
frontends; and
CONFIG_ARCH_BOARDis not defined.The synchronized catalog records its source in the same atomically replaced
file. This keeps relative artifact resolution consistent with the catalog
under concurrent synchronization. The previous
repo.urlsidecar is stillread for migration from development images.
User documentation is in apache/nuttx#18875. #3643 is the graphical frontend
that depends on the APIs added here.
Impact
nxpkggains repository synchronization and theinstall/update/remove/rollback lifecycle described above.
/var/lib/nxpkg; boards must mount persistent storage there or overrideCONFIG_SYSTEM_NXPKG_ROOT.they use the selected
netutils/webclientHTTP/TLS facilities.to the downloaded catalog, but is not package signing. Plain HTTP does not
authenticate the repository.
CONFIG_SYSTEM_NXPKGdisabledare unaffected. The legacy
repo.urlsidecar remains readable formigration.
rewritten.
Testing
Build host:
xtensa-esp-elf-gcc 14.2.0(
esp-14.2.0_20251107)Target:
Verification:
nxstyleon all changed C sourcesgit diff --checksystem/nxpkgsources cross-compiled for ESP32-S3system/nxpkgsources compiled in the simulator configurationpersistence, rollback, remove, and relative-artifact execution
committed exactly one install
-EBUSYtransaction file
Testing logs before change:
Testing logs after change:
These are the
nxpkgdiagnostic lines observed on the target, grouped bycheck. They are not one continuous console session: the checks were run
separately.
Catalog load and parse:
Install, update, rollback and remove:
Lock contention and reclaim:
Checksum rejection, which left behind no database entry, version directory,
lock or transaction file:
The lifecycle transcript above was captured against a repository served from
the SD card, which exercises the same
pkg_sync()/pkg_install()paths thatthe HTTP source feeds. The HTTP transport itself has been exercised on this
board through the companion store frontend, which synchronizes its catalog
over Wi-Fi at boot; I can attach a dedicated
nxpkg sync http://...transcripton request.
PR verification Self-Check