Skip to content

Commit

Permalink
feat: removed souffle usage in codebase as much as possible
Browse files Browse the repository at this point in the history
  • Loading branch information
mau5mat committed Jan 18, 2025
1 parent 2433afe commit 8e90f42
Show file tree
Hide file tree
Showing 16 changed files with 190 additions and 401 deletions.
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ The following Haskell command-line tools will have to be installed:

(Some of the above packages have incompatible dependencies, so don't try to install them all at once with `cabal install`)

* [Soufflé datalog engine v2.2](https://github.com/souffle-lang/souffle/releases/tag/2.2): The datalog engine for package classification
* `libsodium-1.0.18`: The system library that powers most of the cryptography happening in flora
* `yarn`: The tool that handles the JavaScript code bases
* `esbuild`: The tool that handles asset bundling
Expand Down
28 changes: 8 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# this is a pinned ubuntu:22.04 (newer versions have incomptible
# library versions for souffle)
# this is a pinned ubuntu:22.04
FROM ubuntu@sha256:67211c14fa74f070d27cc59d69a7fa9aeff8e28ea118ef3babc295a0428a6d21

ARG GID=1000
Expand All @@ -19,18 +18,18 @@ ARG POSTGRESQL_MIGRATION_VERSION=0.2.1.8
USER "root"
ARG USER="local"
RUN groupadd -g "$GID" -o "$USER" \
&& useradd -r -u "$UID" -g "$GID" -m -s /bin/zsh "$USER"
&& useradd -r -u "$UID" -g "$GID" -m -s /bin/zsh "$USER"

# We create the folder explicitly so that we can give nonprivileged user the appropriate access
RUN mkdir /flora-server
RUN chown $USER:$USER /flora-server

RUN mkdir /home/$USER/.cabal
RUN chown -R $USER:$USER /home/$USER/.cabal
WORKDIR /flora-server
WORKDIR /flora-server

RUN apt update && \
apt install -y build-essential curl libffi-dev libffi8 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5 git libsodium-dev pkg-config
apt install -y build-essential curl libffi-dev libffi8 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5 git libsodium-dev pkg-config

# install dependencies (pg_config, postgresql-client, yarn)
ENV BOOTSTRAP_HASKELL_NONINTERACTIVE="YES"
Expand All @@ -39,7 +38,7 @@ ENV BOOTSTRAP_HASKELL_INSTALL_NO_STACK_HOOK="YES"
ENV PATH="$PATH:/home/$USER/.ghcup/bin"
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt install -y nodejs libpq-dev mcpp wget zsh tmux postgresql-client
RUN corepack enable
USER ${USER}
Expand All @@ -48,18 +47,12 @@ RUN git config --global --add safe.directory "*"
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

RUN ghcup install hls $HLS_VERSION \
&& ghcup install ghc $GHC_VERSION \
&& ghcup set ghc $GHC_VERSION \
&& ghcup install cabal $CABAL_VERSION
&& ghcup install ghc $GHC_VERSION \
&& ghcup set ghc $GHC_VERSION \
&& ghcup install cabal $CABAL_VERSION

USER ${USER}

# install soufflé
USER "root"
RUN wget --content-disposition https://github.com/souffle-lang/souffle/releases/download/2.2/x86_64-ubuntu-2004-souffle-2.2-Linux.deb
RUN apt install -f -y ./x86_64-ubuntu-2004-souffle-2.2-Linux.deb
USER ${USER}

RUN echo $PATH

# install Haskell tooling (note that for cabal, it's probably better
Expand All @@ -83,11 +76,6 @@ COPY --chown=${USER} scripts/.zshrc /home/$USER/.zshrc
COPY --chown=${USER} cabal.project flora.cabal cabal.project.freeze ./
RUN cabal build --only-dependencies -j

# compile Souffle source files
COPY --chown=${USER} Makefile ./
COPY --chown=${USER} cbits ./cbits
RUN make souffle

# copy and build the assets
COPY --chown=${USER} assets ./assets
COPY --chown=${USER} docs ./docs
Expand Down
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ docker-enter: ## Enter the docker environment
start-tmux: ## Start a Tmux session with hot code reloading
./scripts/start-tmux.sh

soufflé: ## Generate C++ files from the Soufflé Datalog definitions
cd cbits ; souffle -g categorise.{cpp,dl}

tags: ## Generate ctags for the project with `ghc-tags`
@ghc-tags -c

Expand Down
6 changes: 0 additions & 6 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ allow-newer: hashable:filepath
, qrcode-juicypixels:bytestring
, qrcode-juicypixels:text
, servant-lucid:text
, souffle-haskell:text
, tasty-test-reporter:ansi-terminal
, tasty-test-reporter:tasty
, type-errors-pretty:base
Expand Down Expand Up @@ -78,11 +77,6 @@ source-repository-package
location: https://github.com/saurabhnanda/odd-jobs
tag: a159d7a17913725a0cb2a2251fa0b812acd3d160

source-repository-package
type: git
location: https://github.com/luc-tielen/souffle-haskell
tag: 268a11283ca9293b5eacabf7a0b79d9368232478

source-repository-package
type: git
location: https://github.com/goodlyrottenapple/tasty-test-reporter
Expand Down
1 change: 0 additions & 1 deletion cabal.project.freeze
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ constraints: any.Cabal ==3.10.3.0,
any.some ==1.0.6,
some +newtype-unsafe,
any.sop-core ==0.5.0.2,
any.souffle-haskell ==4.0.0,
any.split ==0.2.5,
any.splitmix ==0.1.1,
splitmix -optimised-mixer,
Expand Down
215 changes: 0 additions & 215 deletions cbits/categorise.dl

This file was deleted.

8 changes: 2 additions & 6 deletions flora.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ flag prod

common common-extensions
default-extensions:
NoStarIsType
DataKinds
DeriveAnyClass
DerivingStrategies
DerivingVia
DuplicateRecordFields
LambdaCase
NoStarIsType
OverloadedLabels
OverloadedRecordDot
OverloadedStrings
Expand Down Expand Up @@ -67,9 +67,6 @@ common common-rts-options
library
import: common-extensions
import: common-ghc-options
extra-libraries: stdc++
cxx-options: -std=c++17 -Wall -D__EMBEDDED_SOUFFLE__
cxx-sources: cbits/categorise.cpp
hs-source-dirs: ./src/core ./src/datatypes

-- cabal-fmt: expand src/core
Expand Down Expand Up @@ -99,7 +96,6 @@ library
Flora.Environment.Config
Flora.Environment.Env
Flora.Import.Categories
Flora.Import.Categories.Tuning
Flora.Import.Package
Flora.Import.Package.Bulk
Flora.Import.Package.Types
Expand Down Expand Up @@ -148,6 +144,7 @@ library
Flora.Model.User.Query
Flora.Model.User.Update
Flora.Monitoring
Flora.Normalise
Flora.QRCode
Flora.Tracing
JSON
Expand Down Expand Up @@ -213,7 +210,6 @@ library
, servant
, servant-server
, slugify
, souffle-haskell ==4.0.0
, streamly
, streamly-core
, tar
Expand Down
Loading

0 comments on commit 8e90f42

Please sign in to comment.