Skip to content

Instantly share code, notes, and snippets.

@popey
Created June 27, 2024 11:04
Show Gist options
  • Save popey/52b9b459d1757ad293d6b15215bc8802 to your computer and use it in GitHub Desktop.
Save popey/52b9b459d1757ad293d6b15215bc8802 to your computer and use it in GitHub Desktop.
Count how many public snaps are published in the store
name: 'snapcount'
base: core20
adopt-info: snapcount
summary: Count snaps per architecture
description: |
Count snaps by doing a word count of the locally cached list
of snaps in the store. Run this build on each architecture
and it will give you each snap with the version set to the
number of public snaps on that architecture. Roughly.
You will also get a log file which lists them all.
architectures:
- build-on: i386
- build-on: amd64
- build-on: arm64
- build-on: armhf
- build-on: s390x
- build-on: ppc64el
- build-on: riscv64
grade: stable
confinement: strict
parts:
snapcount:
plugin: nil
override-build: |
# The local cached list of snaps
catalog="/var/cache/snapd/names"
# Restart snap until the cached catalog exists
for _ in $(seq 60); do
echo $_
systemctl restart snapd.{socket,service}
if [ -f "$catalog" ]; then
break
fi
done
# Set version of this build to be the number of snaps in this arch
snapcraftctl set-version "$(wc -l < $catalog)"
# Take a copy of the list for posterity in the build log :D
####
cat "$catalog"
####
@popey
Copy link
Author

popey commented Jun 27, 2024

arch snaps
amd64 6439
arm64 2416
armhf 1898
ppc64el 1126
s390x 1061
riscv64 94

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