Skip to content

Commit

Permalink
Create archivematica package
Browse files Browse the repository at this point in the history
  • Loading branch information
replaceafill committed Oct 21, 2024
1 parent ccaa7f0 commit a6e8bb4
Show file tree
Hide file tree
Showing 901 changed files with 98 additions and 93 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
!/TRADEMARK

# Exclude
src/dashboard/frontend/node_modules
src/dashboard/media/js/build
src/archivematica/dashboard/frontend/node_modules
src/archivematica/dashboard/media/js/build
**/*~
**/*.log
**/node_modules
Expand Down
8 changes: 4 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*.py ident
*.sh ident
src/dashboard/frontend/app/locale/*.po linguist-generated=true
src/dashboard/frontend/app/locale/*.pot linguist-generated=true
src/dashboard/frontend/app/locale/translations.json linguist-generated=true
src/dashboard/frontend/package-lock.json linguist-generated=true
src/archivematica/dashboard/frontend/app/locale/*.po linguist-generated=true
src/archivematica/dashboard/frontend/app/locale/*.pot linguist-generated=true
src/archivematica/dashboard/frontend/app/locale/translations.json linguist-generated=true
src/archivematica/dashboard/frontend/package-lock.json linguist-generated=true
2 changes: 1 addition & 1 deletion .github/workflows/generate-sbom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/cache@v4
with:
path: .trivycache/
key: ${{ runner.os }}-trivy-${{ hashFiles('requirements*.txt', 'src/dashboard/frontend/package-lock.json') }}
key: ${{ runner.os }}-trivy-${{ hashFiles('requirements*.txt', 'src/archivematica/dashboard/frontend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-trivy-
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
runs-on: "ubuntu-22.04"
defaults:
run:
working-directory: "./src/dashboard/frontend/"
working-directory: "./src/archivematica/dashboard/frontend/"
steps:
- name: "Check out repository"
if: "${{ github.event_name != 'workflow_dispatch' }}"
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
.tox/

# frontend builds
src/dashboard/static/
src/dashboard/media/js/build
src/archivematica/dashboard/static/
src/archivematica/dashboard/media/js/build
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ repos:
args: [--no-ensure-ascii, --autofix]
files: |
(?x)^(
src/MCPServer/assets/.*\.json|
src/(MCPClient/MCPServer|dashboard)/install/.*\.json
src/archivematica/MCPServer/assets/.*\.json|
src/archivematica/(MCPClient/MCPServer|dashboard)/install/.*\.json
)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
Expand All @@ -27,7 +27,7 @@ repos:
exclude: |
(?x)^(
ISSUE_TEMPLATE\.md|
src/dashboard/(frontend/app|media)/vendor/.*
src/archivematica/dashboard/(frontend/app|media)/vendor/.*
)
- repo: https://github.com/thlorenz/doctoc
rev: v2.2.0
Expand All @@ -37,7 +37,7 @@ repos:
(?x)^(
(CONTRIBUTING|SECURITY).*\.md|
hack/README\.md|
src/(MCPServer|MCPClient|dashboard)/install/README\.md
src/archivematica/(MCPServer|MCPClient|dashboard)/install/README\.md
)
- repo: https://github.com/citation-file-format/cffconvert
# Current "2.0.0" git tag does not work because of
Expand All @@ -61,5 +61,5 @@ repos:
args: [--quiet, --config, .markdown-link-check.json]
exclude: |
(?x)^(
src/dashboard/media/vendor/.*\.md
src/archivematica/dashboard/media/vendor/.*\.md
)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ see the [getting started] page.
[Developer guide]: https://github.com/artefactual/archivematica/blob/qa/1.x/hack/README.md
[Development installation]: https://github.com/artefactual/archivematica/tree/qa/1.x/hack
[documentation update]: https://github.com/artefactual/archivematica-docs/wiki
[Format Policy Registry]: https://github.com/artefactual/archivematica/tree/qa/1.x/src/dashboard/fpr
[Format Policy Registry]: https://github.com/artefactual/archivematica/tree/qa/1.x/src/archivematica/dashboard/fpr
[getting started]: https://wiki.archivematica.org/Getting_started#Projects
[GitHub CI]: https://github.com/artefactual/archivematica/actions/workflows/test.yml/badge.svg
[Issues]: https://github.com/archivematica/Issues
Expand Down
46 changes: 23 additions & 23 deletions hack/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ RUN set -ex \

FROM node:${NODE_VERSION} AS archivematica-dashboard-frontend-builder

COPY --link src/dashboard/frontend /src/src/dashboard/frontend
COPY --link src/archivematica/dashboard/frontend /src/src/archivematica/dashboard/frontend

WORKDIR /src/src/dashboard/frontend
WORKDIR /src/src/archivematica/dashboard/frontend

RUN set ex \
&& npm install --no-package-lock
Expand Down Expand Up @@ -139,10 +139,10 @@ RUN set -ex \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*

COPY --chown=${USER_ID}:${GROUP_ID} --from=browsers-builder --link ${SELENIUM_DIR} ${SELENIUM_DIR}
COPY --chown=${USER_ID}:${GROUP_ID} --from=archivematica-dashboard-frontend-builder --link /src/src/dashboard/frontend/node_modules /src/src/dashboard/frontend/node_modules
COPY --link src/dashboard/frontend /src/src/dashboard/frontend
COPY --chown=${USER_ID}:${GROUP_ID} --from=archivematica-dashboard-frontend-builder --link /src/src/archivematica/dashboard/frontend/node_modules /src/src/archivematica/dashboard/frontend/node_modules
COPY --link src/dashboard/frontend /src/src/archivematica/dashboard/frontend

WORKDIR /src/src/dashboard/frontend
WORKDIR /src/src/archivematica/dashboard/frontend

ENTRYPOINT ["npm", "run", "test-single-run"]

Expand Down Expand Up @@ -224,26 +224,26 @@ COPY --chown=${USER_ID}:${GROUP_ID} --link . /src
FROM base AS archivematica-mcp-client

ENV DJANGO_SETTINGS_MODULE=settings.common
ENV PYTHONPATH=/src/src/MCPClient/:/src/src/MCPClient/clientScripts:/src/src/common/:/src/src/dashboard/
ENV ARCHIVEMATICA_MCPCLIENT_ARCHIVEMATICACLIENTMODULES=/src/src/MCPClient/archivematicaClientModules
ENV ARCHIVEMATICA_MCPCLIENT_CLIENTASSETSDIRECTORY=/src/src/MCPClient/assets/
ENV ARCHIVEMATICA_MCPCLIENT_CLIENTSCRIPTSDIRECTORY=/src/src/MCPClient/clientScripts/
ENV PYTHONPATH=/src/src/archivematica/MCPClient/:/src/src/archivematica/MCPClient/clientScripts:/src/src/archivematica/common/:/src/src/archivematica/dashboard/
ENV ARCHIVEMATICA_MCPCLIENT_ARCHIVEMATICACLIENTMODULES=/src/src/archivematica/MCPClient/archivematicaClientModules
ENV ARCHIVEMATICA_MCPCLIENT_CLIENTASSETSDIRECTORY=/src/src/archivematica/MCPClient/assets/
ENV ARCHIVEMATICA_MCPCLIENT_CLIENTSCRIPTSDIRECTORY=/src/src/archivematica/MCPClient/clientScripts/

# Some scripts in archivematica-fpr-admin executed by MCPClient rely on certain
# files being available in this image (e.g. see https://git.io/vA1wF).
COPY --link src/common/externals/fido/ /usr/lib/archivematica/common/externals/fido/
COPY --link src/common/externals/fiwalk_plugins/ /usr/lib/archivematica/common/externals/fiwalk_plugins/
COPY --link src/archivematica/common/externals/fido/ /usr/lib/archivematica/common/externals/fido/
COPY --link src/archivematica/common/externals/fiwalk_plugins/ /usr/lib/archivematica/common/externals/fiwalk_plugins/

ENTRYPOINT ["pyenv", "exec", "python3", "/src/src/MCPClient/archivematicaClient.py"]
ENTRYPOINT ["pyenv", "exec", "python3", "/src/src/archivematica/MCPClient/archivematicaClient.py"]

# -----------------------------------------------------------------------------

FROM base AS archivematica-mcp-server

ENV DJANGO_SETTINGS_MODULE=settings.common
ENV PYTHONPATH=/src/src/MCPServer/:/src/src/common/:/src/src/dashboard/
ENV PYTHONPATH=/src/src/archivematica/MCPServer/:/src/src/archivematica/common/:/src/src/archivematica/dashboard/

ENTRYPOINT ["pyenv", "exec", "python3", "/src/src/MCPServer/archivematicaMCP.py"]
ENTRYPOINT ["pyenv", "exec", "python3", "/src/src/archivematica/MCPServer/archivematicaMCP.py"]

# -----------------------------------------------------------------------------

Expand All @@ -257,23 +257,23 @@ USER root

RUN set -ex \
&& internalDirs=' \
/src/src/dashboard/frontend \
/src/src/dashboard/static \
/src/src/dashboard/media \
/src/src/archivematica/dashboard/frontend \
/src/src/archivematica/dashboard/static \
/src/src/archivematica/dashboard/media \
' \
&& mkdir -p $internalDirs \
&& chown -R archivematica $internalDirs

USER archivematica

COPY --chown=${USER_ID}:${GROUP_ID} --from=archivematica-dashboard-frontend-builder --link /src/src/dashboard/media/js/ /src/src/dashboard/media/js
COPY --chown=${USER_ID}:${GROUP_ID} --from=archivematica-dashboard-frontend-builder --link /src/src/archivematica/dashboard/media/js/ /src/src/archivematica/dashboard/media/js

WORKDIR /src/src/dashboard
WORKDIR /src/src/archivematica/dashboard

ENV DJANGO_SETTINGS_MODULE=settings.local
ENV PYTHONPATH=/src/src/dashboard/:/src/src/common/
ENV PYTHONPATH=/src/src/archivematica/dashboard/:/src/src/archivematica/common/
ENV AM_GUNICORN_BIND=0.0.0.0:8000
ENV AM_GUNICORN_CHDIR=/src/src/dashboard
ENV AM_GUNICORN_CHDIR=/src/src/archivematica/dashboard
ENV FORWARDED_ALLOW_IPS=*

RUN set -ex \
Expand All @@ -284,7 +284,7 @@ ENV DJANGO_SETTINGS_MODULE=settings.production

EXPOSE 8000

ENTRYPOINT ["pyenv", "exec", "python3", "-m", "gunicorn", "--config=/src/src/dashboard/install/dashboard.gunicorn-config.py", "wsgi:application"]
ENTRYPOINT ["pyenv", "exec", "python3", "-m", "gunicorn", "--config=/src/src/archivematica/dashboard/install/dashboard.gunicorn-config.py", "wsgi:application"]

# -----------------------------------------------------------------------------

Expand All @@ -305,7 +305,7 @@ RUN set -ex \
&& mkdir -p /var/archivematica/.cache/ms-playwright \
&& python3 -m playwright install firefox

ENV PYTHONPATH=/src/src/dashboard/:/src/src/common/
ENV PYTHONPATH=/src/src/archivematica/dashboard/:/src/src/archivematica/common/

# -----------------------------------------------------------------------------

Expand Down
12 changes: 6 additions & 6 deletions hack/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ manage-dashboard: ## Run Django /manage.py on Dashboard, suppling <command> [op
--user $(CALLER_UID):$(CALLER_GID) \
--rm \
--no-deps \
--entrypoint /src/src/dashboard/manage.py \
--entrypoint /src/src/archivematica/dashboard/manage.py \
archivematica-dashboard \
$(ARG)

Expand All @@ -152,13 +152,13 @@ bootstrap-dashboard-db: ## Bootstrap Dashboard (new database).
docker compose run \
--rm \
--no-deps \
--entrypoint /src/src/dashboard/manage.py \
--entrypoint /src/src/archivematica/dashboard/manage.py \
archivematica-dashboard \
migrate --noinput
docker compose run \
--rm \
--no-deps \
--entrypoint /src/src/dashboard/manage.py \
--entrypoint /src/src/archivematica/dashboard/manage.py \
archivematica-dashboard \
install \
--username="test" \
Expand All @@ -182,7 +182,7 @@ bootstrap-dashboard-frontend: ## Build front-end assets.
-e HOME=/tmp/npm-config \
--rm \
--user $(CALLER_UID):$(CALLER_GID) \
--volume "$(SRCDIR)/dashboard:/src/src/dashboard" \
--volume "$(SRCDIR)/dashboard:/src/src/archivematica/dashboard" \
--entrypoint npm \
archivematica-dashboard-frontend-builder \
install --no-package-lock
Expand Down Expand Up @@ -400,13 +400,13 @@ test-frontend: ## Run Dashboard JS tests.
-e HOME=/tmp/npm-config \
--rm \
--user $(CALLER_UID):$(CALLER_GID) \
--volume "$(SRCDIR)/dashboard:/src/src/dashboard" \
--volume "$(SRCDIR)/dashboard:/src/src/archivematica/dashboard" \
--entrypoint npm \
archivematica-dashboard-testing \
install
docker run \
--rm \
--volume "$(SRCDIR)/dashboard/frontend:/src/src/dashboard/frontend" \
--volume "$(SRCDIR)/dashboard/frontend:/src/src/archivematica/dashboard/frontend" \
archivematica-dashboard-testing

stop: # Stop all containers.
Expand Down
4 changes: 2 additions & 2 deletions hack/helpers/compile-i18n-messages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ function dashboard::manage {
docker compose run \
--user=$(id -u):$(id -g) \
--rm --no-deps \
--workdir=/src/src/dashboard \
--entrypoint=/src/src/dashboard/manage.py \
--workdir=/src/src/archivematica/dashboard \
--entrypoint=/src/src/archivematica/dashboard/manage.py \
archivematica-dashboard "$@"
}

Expand Down
6 changes: 3 additions & 3 deletions hack/helpers/extract-i18n-messages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ function dashboard::manage {
docker compose run \
--user=$(id -u):$(id -g) \
--rm --no-deps \
--workdir=/src/src/dashboard \
--entrypoint=/src/src/dashboard/manage.py \
--workdir=/src/src/archivematica/dashboard \
--entrypoint=/src/src/archivematica/dashboard/manage.py \
archivematica-dashboard "$@"
}

Expand All @@ -46,7 +46,7 @@ dashboard::manage makemessages --all --domain djangojs --ignore build/*
docker compose run \
--user=$(id -u):$(id -g) \
--rm --no-deps \
--workdir=/src/src/dashboard/frontend \
--workdir=/src/src/archivematica/dashboard/frontend \
--entrypoint=yarn \
archivematica-dashboard run extract-messages

Expand Down
29 changes: 13 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ norecursedirs = ".svn _build tmp* node_modules bower_components share .tox"

[tool.coverage.run]
omit = [
"**/src/common/externals/*",
"**/src/archivematica/common/externals/*",
"**/migrations/*",
"**/south_migrations/*",
"**/management/commands/*",
Expand All @@ -15,10 +15,7 @@ omit = [
"**/manage.py",
]
include = [
"**/src/common/*",
"**/src/dashboard/*",
"**/src/MCPClient/*",
"**/src/MCPServer/*",
"**/src/archivematica/*",
]
branch = true

Expand All @@ -43,7 +40,7 @@ ignore = [

[tool.ruff.lint.per-file-ignores]
"src/*/settings/*" = ["F403"]
"src/dashboard/settings/*" = ["F405"]
"src/*/dashboard/settings/*" = ["F405"]

[tool.ruff.lint.isort]
force-single-line = true
Expand All @@ -55,15 +52,15 @@ warn_unused_configs = true

[[tool.mypy.overrides]]
module = [
"src.common.executeOrRunSubProcess",
"src.MCPClient.client.*",
"src.MCPClient.clientScripts.characterize_file",
"src.MCPClient.clientScripts.has_packages",
"src.MCPClient.clientScripts.identify_file_format",
"src.MCPClient.clientScripts.normalize",
"src.MCPClient.clientScripts.policy_check",
"src.MCPClient.clientScripts.transcribe_file",
"src.MCPClient.clientScripts.validate_file",
"src.archivematica.common.executeOrRunSubProcess",
"src.archivematica.MCPClient.client.*",
"src.archivematica.MCPClient.clientScripts.characterize_file",
"src.archivematica.MCPClient.clientScripts.has_packages",
"src.archivematica.MCPClient.clientScripts.identify_file_format",
"src.archivematica.MCPClient.clientScripts.normalize",
"src.archivematica.MCPClient.clientScripts.policy_check",
"src.archivematica.MCPClient.clientScripts.transcribe_file",
"src.archivematica.MCPClient.clientScripts.validate_file",
"tests.common.test_execute_functions",
"tests.dashboard.fpr.test_views",
"tests.dashboard.test_oidc",
Expand Down Expand Up @@ -115,7 +112,7 @@ legacy_tox_ini = """
LOGNAME = user
DJANGO_SETTINGS_MODULE = {env:DJANGO_SETTINGS_MODULE:settings.test}
PYTEST_ADDOPTS = {env:PYTEST_ADDOPTS:}
SRC_DIR = {toxinidir}/src
SRC_DIR = {toxinidir}/src/archivematica
HACK_DIR = {toxinidir}/hack
# Archivematica Common
ARCHIVEMATICA_COMMON_DIR = {env:SRC_DIR}/common
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@
from typing import Union

import gearman
from django.conf import settings
from gearman.job import GearmanJob
from gearman_encoder import JSONDataEncoder

from client import metrics
from client.job import Job
from client.loader import load_job_modules
from client.utils import parse_command_line
from client.utils import replace_task_arguments
from client.worker import run_task
from django.conf import settings
from gearman.job import GearmanJob
from gearman_encoder import JSONDataEncoder

# This is how `gearman_job.data["tasks"]` looks in the `_prepare_jobs`` method
# below:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@

django.setup()

from django import db
from django.conf import settings

from client import loader
from client import metrics
from client.gearman import MCPGearmanWorker
from django import db
from django.conf import settings

T = TypeVar("T")

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
from types import ModuleType
from typing import List

from dbconns import auto_close_old_connections

from client import metrics
from client.job import Job
from dbconns import auto_close_old_connections

logger = logging.getLogger("archivematica.mcp.client.worker")

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit a6e8bb4

Please sign in to comment.