pkglist-query
ALT repository metadata can be accessed directly, like:
wget -qO- http://ftp.altlinux.org/pub/distributions/ALTLinux/p9/branch/x86_64/base/pkglist.classic.xz | unxz > pkglist.classic wget -qO- http://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus/aarch64/base/srclist.classic.xz | unxz > srclist.classic pkglist-query '%{name}-%{version}-%{release}.%{arch}.rpm\n' pkglist.classic pkglist-query '%{name}-%{version}-%{release}.src.rpm\n' srclist.classic
The source for pkglist-query utility follows, it should build against any librpm version available (thanks at@, legion@, glebfm@):
// g++ pkglist-query.cc -o pkglist-query -lrpm -lrpmio #include <stdio.h> #include <rpm/header.h> int main(int argc, char *argv[]) { const char *progname = argv[0]; if (argc < 3) { fprintf(stderr, "Usage: %s <format> <pkglist>...\n", progname); return 2; } const char *format = argv[1]; int rc = 0; const char *pkglist; int ix = 2; while ((pkglist = argv[ix++]) != NULL) { FD_t Fd = Fopen(pkglist, "r.ufdio"); if (Ferror(Fd)) { fprintf(stderr, "%s: %s: %s\n", progname, pkglist, Fstrerror(Fd)); rc = 1; continue; } Header h; while ((h = headerRead(Fd, HEADER_MAGIC_YES)) != NULL) { const char *err = "unknown error"; char *str = headerFormat(h, format, &err); if (str == NULL) { rc = 1; fprintf(stderr, "%s: %s: %s\n", progname, pkglist, err); } else { fputs(str, stdout); free(str); } headerFree(h); } Fclose(Fd); } return rc; } // ex:set ts=8 sts=4 sw=4 noet: