ports icon indicating copy to clipboard operation
ports copied to clipboard

could you generate package meta data file for Repology?

Open Dieken opened this issue 1 year ago • 1 comments

https://repology.org is a great web site to check package repositories of many Linux distributions and BSDs. Currently it has CRUX listed there: https://repology.org/repositories/statistics. Because VenomLinux has very similar package file format with CRUX, it would be very interesting if VenomLinux can be added to repology.org too.

I open a request at Repology issues, seems it's very easy to achieve:

  1. VenomLinux side: run a daily cron job to generate https://venomlinux.org/files/repology-4.0.json
  2. Repology side: copy repology-updater/repos.d/crux.yaml to repos.d/venomlinux.yaml and make some modifications

The code snippet for the cron job:

#/bin/bash

for p in /usr/ports/*/*/spkgbuild; do
  (
     . $p
    description=$(grep "^# description[[:blank:]]*:" $p | sed 's/^# description[[:blank:]]*:[[:blank:]]*//')
    homepage=$(grep "^# homepage[[:blank:]]*:" $p | sed 's/^# homepage[[:blank:]]*:[[:blank:]]*//')
    maintainer=$(grep "^# maintainer[[:blank:]]*:" $p | sed 's/^# maintainer[[:blank:]]*:[[:blank:]]*//')
    repository=${p#/usr/ports/}
    repository=${repository%%/*}
    echo -e "$name\t$version\t$description\t$nomepage\t$maintainer\t$repository\t" $(echo $source)
  )
done |
perl -F'\t' -ane '
  use JSON::PP;
  use Time::Piece;
  @sources = map { s/^[^:]*:://; $_ } grep /:\/\//, split /\s+/, $F[6];
  push @ports, {name => $F[0], version => $F[1], description => $F[2], url => $F[3],
                           maintainer => $F[4], repository => $F[5], sources => [@sources]};

  END { print encode_json {updated => gmtime->datetime . "+00:00", ports => \@ports} }
' > repology-4.0.json

Dieken avatar Mar 21 '23 08:03 Dieken

Hey, this is a good stuff. I never thinking to add venom linux to repology. I will try to do it.

emmett1 avatar Mar 24 '23 13:03 emmett1