Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add subcommand to cleanup images? #760

Closed
1 of 2 tasks
Alexhuszagh opened this issue Jun 6, 2022 · 5 comments · Fixed by #767
Closed
1 of 2 tasks

Add subcommand to cleanup images? #760

Alexhuszagh opened this issue Jun 6, 2022 · 5 comments · Fixed by #767
Assignees

Comments

@Alexhuszagh
Copy link
Contributor

Alexhuszagh commented Jun 6, 2022

Checklist

Describe your request

Currently, users have to be proficient with docker or podman to cleanup images, when we should be able to remove any installed images if desired from a cross subcommand.

For example:

cross remove-images

This would then filter for all images starting with ghcr.io/cross-rs, and rustembedded/cross, and then remove all the matching images. We could also accept a list of targets, or empty for all, to remove all matching targets. For the former, we would want to filter for those matching main or edge, to avoid removing local images.

For example:

cross remove-images aarch64-unknown-linux-gnu arm-unknown-linux-gnueabi mips-unknown-linux-gnu

We could probably at the same time provide a list-images subcommand, to list what images have been previously installed, using the same syntax.

$ cross list-images
aarch64-unknown-linux-gnu
arm-unknown-linux-gnueabi
mips-unknown-linux-gnu

Describe why this would be a good inclusion for cross

This would further simplify using cross as a "zero-setup" cross-compilation tool, and also avoid users having to manually cleanup numerous images or write a script to automatically remove all images to reduce the storage requirements of cross.

@Emilgardis
Copy link
Member

Emilgardis commented Jun 7, 2022

I think to avoid clashes with cargo (not likely), this should be a cross-dev tool, I've been thinking about something for that with gated features to also replace the bash scripts (that are used in CI)

@Alexhuszagh
Copy link
Contributor Author

I think to avoid clashes with cargo (not likely), this should be a cross-dev tool, I've been thinking about something for that with gated features to also replace the bash scripts (that are used in CI)

That sounds good, so that would also work for the target info and build-docker-image.sh or so? I think probably cross-dev maybe should just be for maintainers though, and we should have another tool for client utilities/extensions (like what's mentioned here)?

@Emilgardis
Copy link
Member

That sounds fair.

We can bundle the extra tool with a [[bin]] target. Maybe cross-util?

@Alexhuszagh Alexhuszagh self-assigned this Jun 7, 2022
@Alexhuszagh
Copy link
Contributor Author

I think that sounds perfect. I'll start migrating things over after I finish the workspaces stuff, which I think has higher priority.

@Emilgardis
Copy link
Member

Emilgardis commented Jun 7, 2022

Actually, I don't think the build script should be replaced with a rust program, we should instead use a docker bake definition (which can possibly be improved with a rust program).

bors bot added a commit that referenced this issue Jun 8, 2022
767: Add cross-dev and cross-util commands. r=Emilgardis a=Alexhuszagh

The cross-dev command has the `target-info` subcommand, which target information (libc, compiler, C++, qemu version) for a given target.

```bash
cross-dev target-info
cross-dev target-info arm-unknown-linux-gnueabihf
```

The cross-util command has the `list-images` and `remove-images` subcommands. `list-images` lists all cross images, including local development files. `remove-images` removes cross images.

```bash
cross-util list-images
cross-util remove-images
cross-util remove-images arm-unknown-linux-gnueabihf
```

Closes #760.

Co-authored-by: Alex Huszagh <[email protected]>
@bors bors bot closed this as completed in 0b3abed Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants