forked from repology/repology-updater
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start of work to add spack. It was difficult to develop, so I am also…
… add a simple docker compose setup with a database and application container to handle installing dependencies and more easily running a development server Signed-off-by: vsoch <vsoch@users.noreply.github.com>
- Loading branch information
Showing
9 changed files
with
236 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM python:3.9 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && apt-get install -y \ | ||
python3-pip \ | ||
postgresql \ | ||
postgresql-contrib \ | ||
pkg-config \ | ||
wget \ | ||
yajl-tools \ | ||
libyajl-dev \ | ||
cmake \ | ||
libpq-dev | ||
|
||
WORKDIR /opt | ||
RUN wget https://github.com/repology/libversion/archive/refs/tags/3.0.1.tar.gz && \ | ||
tar -xzvf 3.0.1.tar.gz && \ | ||
cd libversion-3.0.1 && \ | ||
mkdir build && \ | ||
cmake . && \ | ||
cd build && \ | ||
cmake --build ../ && \ | ||
cd ../ && \ | ||
make install && \ | ||
ldconfig | ||
|
||
WORKDIR /code | ||
COPY . /code | ||
RUN pip install -r requirements.txt && pip install -r requirements-dev.txt && \ | ||
# import rpm required, not clear which is needed | ||
pip install rpm | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
version: "3.9" | ||
services: | ||
db: | ||
# Important! Do not use this in production without changing credentials | ||
env_file: | ||
- postgres.env | ||
|
||
restart: always | ||
build: | ||
context: docker/ | ||
dockerfile: Dockerfile.db | ||
|
||
|
||
repology: | ||
entrypoint: ["tail", "-f", "/dev/null"] | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
|
||
# For development so changes to local files can be propograted with restart | ||
volumes: | ||
- ./:/code | ||
links: | ||
- db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
FROM postgres:13.3 | ||
|
||
# docker build -t repology-db . | ||
|
||
# NOTE: this is for development only! These are the development credentials | ||
# defined in the README.md and default configuration file. You should | ||
# absolutely not use this in a production setting. | ||
|
||
RUN apt-get update && apt-get install -y git \ | ||
build-essential \ | ||
postgresql-server-dev-13 \ | ||
wget \ | ||
pkg-config \ | ||
cmake | ||
|
||
WORKDIR /opt | ||
RUN wget https://github.com/repology/libversion/archive/refs/tags/3.0.1.tar.gz && \ | ||
tar -xzvf 3.0.1.tar.gz && \ | ||
cd libversion-3.0.1 && \ | ||
mkdir build && \ | ||
cmake . && \ | ||
cd build && \ | ||
cmake --build ../ && \ | ||
cd ../ && \ | ||
make install && \ | ||
ldconfig | ||
|
||
WORKDIR /opt | ||
RUN git clone https://github.com/repology/postgresql-libversion && \ | ||
cd postgresql-libversion && \ | ||
make && \ | ||
make install && \ | ||
ldconfig | ||
|
||
WORKDIR /docker-entrypoint-initdb.d | ||
RUN echo 'psql --username ${POSTGRES_USER} --dbname ${POSTGRES_DB} -c "CREATE EXTENSION pg_trgm"' > extension1.sh && \ | ||
echo 'psql --username ${POSTGRES_USER} --dbname ${POSTGRES_DB} -c "CREATE EXTENSION libversion"' > extension2.sh && \ | ||
chmod +x extension*.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
POSTGRES_DB=repology | ||
POSTGRES_USER=repology | ||
POSTGRES_PASSWORD=repology |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,6 +106,7 @@ | |
'scoop', | ||
'sisyphus', | ||
'slackbuilds', | ||
'spack', | ||
'tinycore', | ||
'slackware', | ||
'slitaz', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright (C) 2021 Dmitry Marakasov <amdmi3@amdmi3.ru> | ||
# | ||
# This file is part of repology | ||
# | ||
# repology is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# repology is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with repology. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
from typing import Iterable | ||
|
||
from repology.packagemaker import NameType, PackageFactory, PackageMaker | ||
from repology.parsers import Parser | ||
from repology.parsers.json import iter_json_list | ||
from repology.transformer import PackageTransformer | ||
import json | ||
|
||
class SpackJsonParser(Parser): | ||
def iter_parse(self, path: str, factory: PackageFactory, transformer: PackageTransformer) -> Iterable[PackageMaker]: | ||
with open(path, 'r') as fd: | ||
data = json.loads(fd.read()) | ||
for package_name, packagedata in data['packages'].items(): | ||
with factory.begin() as pkg: | ||
|
||
# I'm not sure what this is? It's a number? | ||
pkg.add_name(package_name, NameType.SPACK) | ||
pkg.set_version(packagedata['version']) | ||
# We don't currently have good keywords, could in the future! | ||
# pkg.add_categories(packagedata['keywords']) | ||
pkg.add_homepages(packagedata['homepages']) | ||
pkg.add_downloads(packagedata['downloads']) | ||
pkg.set_summary(packagedata['summary']) | ||
pkg.add_maintainers(packagedata['maintainers']) | ||
pkg.set_extra_field('dependencies', packagedata['dependencies']) | ||
yield pkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
########################################################################### | ||
# Spack | ||
########################################################################### | ||
- name: spack | ||
type: repository | ||
desc: Spack | ||
family: spack | ||
color: "0f3a80" | ||
minpackages: 5000 | ||
default_maintainer: fallback-mnt-spack@repology | ||
sources: | ||
- name: repology.json | ||
fetcher: | ||
class: FileFetcher | ||
url: https://raw.githubusercontent.com/spack/packages/main/data/repology.json | ||
allow_zero_size: false | ||
parser: | ||
class: SpackJsonParser | ||
repolinks: | ||
- desc: Spack Catalog | ||
url: https://spack.github.io/packages/ | ||
- desc: Spack GitHub repository | ||
url: https://github.com/spack/spack | ||
packagelinks: | ||
- type: PACKAGE_HOMEPAGE | ||
url: 'https://spack.github.io/packages/package.html?name={name}' | ||
- type: PACKAGE_SOURCES | ||
url: 'https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/{name}/package.py' | ||
- type: PACKAGE_RECIPE | ||
url: 'https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/{name}/package.py' | ||
- type: PACKAGE_RECIPE_RAW | ||
url: 'https://raw.githubusercontent.com/spack/spack/develop/var/spack/repos/builtin/packages/{name}/package.py' | ||
tags: [ all, production, spack ] |