Skip to content

core: tools: install-system-tools: Remove apt cache after install#3761

Merged
joaoantoniocardoso merged 1 commit intobluerobotics:masterfrom
patrickelectric:clean-missing-stuff
Feb 4, 2026
Merged

core: tools: install-system-tools: Remove apt cache after install#3761
joaoantoniocardoso merged 1 commit intobluerobotics:masterfrom
patrickelectric:clean-missing-stuff

Conversation

@patrickelectric
Copy link
Member

@patrickelectric patrickelectric commented Feb 4, 2026

Removes around 110MB

Summary by Sourcery

Enhancements:

  • Clean APT cache and remove package list files after system tool installation to reduce disk usage.

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
@sourcery-ai
Copy link

sourcery-ai bot commented Feb 4, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a post-installation cleanup step to remove cached APT package data after installing system tools, reducing disk usage on the target system.

Flow diagram for install-system-tools post-install APT cleanup

flowchart TD
    A[Start install-system-tools.sh] --> B[Run parallel bootstrap scripts for tools]
    B --> C[Run apt update]
    C --> D[Run apt install dhcpcd5 iptables iproute2 isc-dhcp-client nmap systemd]
    D --> E[Run apt clean]
    E --> F[Remove /var/lib/apt/lists/*]
    F --> G[End script]
Loading

File-Level Changes

Change Details Files
Add APT cache cleanup after system package installation to reduce disk usage.
  • Append a cleanup command to run apt clean after installing required packages.
  • Remove residual APT cache data by deleting /var/lib/apt/lists/*.
  • Ensure cleanup runs in the same script section immediately following the apt install command.
core/tools/install-system-tools.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `core/tools/install-system-tools.sh:21` </location>
<code_context>
 # APT is terrible like pip and don't know how to handle parallel installation
 # These should periodically be moved onto the base image
 apt update && apt install -y --no-install-recommends dhcpcd5 iptables iproute2 isc-dhcp-client nmap systemd
+apt clean && rm -rf /var/lib/apt/lists/*
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Chain cleanup to the install command so it only runs on success and keeps failure context intact.

As written, cleanup runs even if `apt install` fails (unless `set -e` is in effect), which can hide the failure context and still mutate the system after an error. Please chain these commands, e.g. `apt update && apt install ... && apt clean && rm -rf /var/lib/apt/lists/*`, so cleanup only occurs on successful install.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@joaoantoniocardoso
Copy link
Member

Just need to test whether it doesn't break apt in runtime

Copy link
Member

@joaoantoniocardoso joaoantoniocardoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good

@joaoantoniocardoso joaoantoniocardoso merged commit 08ed02b into bluerobotics:master Feb 4, 2026
6 checks passed
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

Comments