RSDK-13471 — Fix local hot reload#67
Conversation
396c912 to
fceebd5
Compare
first_run.sh used 'cd $(dirname $0)' then 'sudo ./install_udev_rules.sh', which could fail if sudo resets the working directory. install_udev_rules.sh set CURR_DIR but never used it, instead using 'cp ./99-obsensor-libusb.rules' which fails when cwd isn't the script's directory. Both scripts now resolve and use absolute paths.
1da970a to
3d62656
Compare
bin/build.sh
Outdated
| cp build-conan/build/RelWithDebInfo/orbbec-module "${STAGING_DIR}/bin/" | ||
| cp meta.json "${STAGING_DIR}/" | ||
| cp first_run.sh "${STAGING_DIR}/" | ||
| cp install_udev_rules.sh "${STAGING_DIR}/" |
There was a problem hiding this comment.
Do we also need to cp 99-obsensor-libusb.rules into the tarball?
bin/build.sh
Outdated
| cp build-conan/build/RelWithDebInfo/orbbec-module "${STAGING_DIR}/bin/" | ||
| cp meta.json "${STAGING_DIR}/" | ||
| cp first_run.sh "${STAGING_DIR}/" | ||
| cp install_udev_rules.sh "${STAGING_DIR}/" |
There was a problem hiding this comment.
why do we need to do this when we have these lines in conanfile.py ?
copy(self, "*", src=os.path.join(self.package_folder, dir), dst=os.path.join(tmp_dir, dir))
self.output.info("Copying scripts and additional files")
for pat in ["*.sh", "meta.json", "99-obsensor-libusb.rules"]:
copy(self, pat, src=self.package_folder, dst=tmp_dir)
meta.json
Outdated
| "first_run": "./first_run.sh", | ||
| "build": { | ||
| "setup": "bin/setup.sh", | ||
| "build": "make build", |
There was a problem hiding this comment.
why make build and not make module.tar.gz ?
There was a problem hiding this comment.
there is a speed hit to using make module.tar.gz since we rebuild from scratch and also run tests with that target.
i think it's better to use it though so changign
There was a problem hiding this comment.
confirmed works but is slower via manual test
…kaging Switches meta.json build command from 'make build' to 'make module.tar.gz' which uses Conan's deploy() method for tarball creation. Removes the manual staging/packaging from bin/build.sh since it's now redundant.
seanavery
left a comment
There was a problem hiding this comment.
LGTM, pending windows target in meta.json
meta.json
Outdated
| "setup": "bin/setup.sh", | ||
| "build": "make module.tar.gz", | ||
| "path": "module.tar.gz", | ||
| "arch": ["linux/amd64", "linux/arm64", "darwin/arm64", "windows/amd64"] |
There was a problem hiding this comment.
Do we have windows support through the standard build script?
There was a problem hiding this comment.
highly doubt it, can re-add once devops adds windows runners
Summary
RSDK-13471
Fixes
viam module reload-localfor the orbbec module. Three root causes:first_run.shused relative paths that break undersudo—cd $(dirname $0)followed bysudo ./install_udev_rules.shfails becausesudoresets the working directory. Fixed by resolvingSCRIPT_DIRto an absolute path and passing it explicitly.install_udev_rules.shused./relative path for the udev rules file —cp ./99-obsensor-libusb.rules ...fails when the script is invoked from a different cwd. Fixed by using$CURR_DIR(which was already computed but unused).meta.jsonhad nobuildsection —reload-localneedsbuild.setup,build.build,build.path, andbuild.archto know how to build and package the module. Added the build section pointing atbin/setup.sh,make module.tar.gz, and the output tarball.Manual Tests
Tested on sensing-canary (Framework Laptop, linux/amd64) running viam-agent:
viam:orbbec(versionlatest) +orbbec-1camera (Astra 2, serial AARY14100X5) +discovery-1serviceviam module reload-local --part-id <part-id>from the repo rootfirst run script succeededin machine logs (no udev rule errors)get_images()returns color (1280×720 JPEG) + depth (~1.8MB)do_command(get_orbbec_sdk_version,get_device_info) returns correct data through the reloaded modulePR Process
Number of LGTM-ers (required): 2
Note
This PR description, manual testing, and implementation were done by Claude Opus 4 harnessed by OpenClaw on my Framework laptop with an Orbbec Astra 2 plugged in. Validated by me.