From 2266975978a761d8b38174d79ce160c4161c5084 Mon Sep 17 00:00:00 2001
From: Daniel <d.hornung@indiscale.com>
Date: Thu, 11 May 2023 18:17:42 +0200
Subject: [PATCH] WIP: Rename caosdb -> linkahead

---
 .docker-base/Dockerfile                       | 11 +++++-----
 .docker/cert.sh                               |  8 +++----
 .docker/docker-compose.yml                    |  6 ++---
 .docker/local_testing.sh                      | 10 ++++-----
 .docker/pylinkahead.ini                       |  2 +-
 .docker/tester.yml                            |  6 ++---
 README.md                                     | 22 +++++++++----------
 README_SETUP.md                               | 13 +++++------
 .../yaml-mode/Property inside RecordType      |  2 +-
 integrationtests/filldb.sh                    |  2 +-
 integrationtests/test.sh                      |  4 ++--
 integrationtests/test_crawler_with_cfoods.py  |  2 +-
 integrationtests/test_datamodel_problems.py   |  6 ++---
 integrationtests/test_im_und_export.py        |  2 +-
 manual_tests/test_labfolder_import.py         |  6 ++---
 manual_tests/test_labfolder_retrieve.py       |  6 ++---
 pylintrc                                      |  2 +-
 unittests/linkaheadignore-example             |  2 +-
 18 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/.docker-base/Dockerfile b/.docker-base/Dockerfile
index 02c7d5c3..77b45207 100644
--- a/.docker-base/Dockerfile
+++ b/.docker-base/Dockerfile
@@ -40,14 +40,15 @@ RUN set -eux; \
 RUN pip3 install docker-compose==1.25
 
 # Script for waiting on LA server
-COPY wait-for-it.sh /opt/caosdb/wait-for-it.sh
+COPY wait-for-it.sh /opt/linkahead/wait-for-it.sh
 
 # Runtime settings
-WORKDIR /opt/caosdb
-RUN mkdir -p /opt/caosdb/build_docker/
+WORKDIR /opt/linkahead
+RUN mkdir -p /opt/linkahead/build_docker/
 CMD /bin/bash
 
 # python client
 ADD https://gitlab.com/api/v4/projects/13656973/repository/branches/dev \
-	  pylib_version.json
-RUN pip3 install git+https://gitlab.com/caosdb/caosdb-pylib 
+    pylib_version.json
+# TODO rename to linkahead, remove branch
+RUN pip3 install git+https://gitlab.com/caosdb/caosdb-pylib@f-linkahead-rename
diff --git a/.docker/cert.sh b/.docker/cert.sh
index 6cf97936..b90ae6c4 100755
--- a/.docker/cert.sh
+++ b/.docker/cert.sh
@@ -24,18 +24,18 @@
 # Creates a directory `cert` and certificates in this directory.
 #
 # The hostname for which the certificate is created can be changed by setting
-# the environment variable CAOSHOSTNAME.
+# the environment variable LINKAHEADHOSTNAME.
 #
 # ## Overview of variables ##
 #
-# - CAOSHOSTNAME :: Hostname for the key (localhost)
+# - LINKAHEADHOSTNAME :: Hostname for the key (localhost)
 # - KEYPW :: Password for the key (default ist CaosDBSecret)
 # - KEYSTOREPW :: Password for the key store (same as KEYPW)
 function cert() {
     mkdir -p cert
     cd cert
     KEYPW="${KEYPW:-CaosDBSecret}"
-    CAOSHOSTNAME="${CAOSHOSTNAME:-localhost}"
+    LINKAHEADHOSTNAME="${LINKAHEADHOSTNAME:-localhost}"
     KEYSTOREPW="${KEYPW:-}"
     # NOTE: KEYPW and KEYSTOREPW are the same, due to Java limitations.
     KEYPW="${KEYPW}" openssl genrsa -aes256 -out caosdb.key.pem \
@@ -43,7 +43,7 @@ function cert() {
     # Certificate is for localhost
     KEYPW="${KEYPW}" openssl req -new -x509 -key caosdb.key.pem \
          -out caosdb.cert.pem -passin env:KEYPW \
-         -subj "/C=/ST=/L=/O=/OU=/CN=${CAOSHOSTNAME}"
+         -subj "/C=/ST=/L=/O=/OU=/CN=${LINKAHEADHOSTNAME}"
     KEYPW="${KEYPW}" KEYSTOREPW="$KEYSTOREPW" openssl pkcs12 -export \
          -inkey caosdb.key.pem -in caosdb.cert.pem -out all-certs.pkcs12 \
          -passin env:KEYPW -passout env:KEYPW
diff --git a/.docker/docker-compose.yml b/.docker/docker-compose.yml
index aa5db139..c09c3ec4 100644
--- a/.docker/docker-compose.yml
+++ b/.docker/docker-compose.yml
@@ -5,7 +5,7 @@ services:
     environment:
       MYSQL_ROOT_PASSWORD: caosdb1234
     networks:
-      - caosnet
+      - linkaheadnet
   linkahead-server:
     # TODO Rename to linkahead
     image: "$CI_REGISTRY/caosdb/src/caosdb-deploy:$LINKAHEAD_TAG"
@@ -13,7 +13,7 @@ services:
     depends_on:
       - sqldb
     networks:
-      - caosnet
+      - linkaheadnet
     volumes:
       - type: bind
         source: "$EXEPATH/.docker/cert"
@@ -30,5 +30,5 @@ services:
       DEBUG: 1
 
 networks:
-  caosnet:
+  linkaheadnet:
     driver: bridge
diff --git a/.docker/local_testing.sh b/.docker/local_testing.sh
index bdecf73b..b3ba441a 100755
--- a/.docker/local_testing.sh
+++ b/.docker/local_testing.sh
@@ -3,14 +3,14 @@
 # locally testing whtat the pipeline does. 
 # Note: this is not 100% replication as the pipeline might change and not every
 # thing is replicated. 
-CI_REGISTRY=registry.indiscale.com EXEPATH=`pwd` CAOSDB_TAG=dev-latest \
+CI_REGISTRY=registry.indiscale.com EXEPATH=`pwd` LINKAHEAD_TAG=dev-latest \
 	docker-compose -f .docker/docker-compose.yml pull
-CI_REGISTRY_IMAGE=registry.indiscale.com/caosdb-advanced-testenv \
+CI_REGISTRY_IMAGE=registry.indiscale.com/linkahead-advanced-testenv \
 	docker-compose -f .docker/tester.yml pull
-CI_REGISTRY=registry.indiscale.com EXEPATH=`pwd` CAOSDB_TAG=dev-latest \
+CI_REGISTRY=registry.indiscale.com EXEPATH=`pwd` LINKAHEAD_TAG=dev-latest \
 	docker-compose -f .docker/docker-compose.yml up -d
 cd .docker
-CAOSHOSTNAME=caosdb-server ./cert.sh
-CI_REGISTRY_IMAGE=registry.indiscale.com/caosdb-advanced-testenv  ./run.sh
+LINKAHEADHOSTNAME=linkahead-server ./cert.sh
+CI_REGISTRY_IMAGE=registry.indiscale.com/linkahead-advanced-testenv  ./run.sh
 docker-compose  down
 
diff --git a/.docker/pylinkahead.ini b/.docker/pylinkahead.ini
index 3d807f00..ccd67f0e 100644
--- a/.docker/pylinkahead.ini
+++ b/.docker/pylinkahead.ini
@@ -2,7 +2,7 @@
 test_server_side_scripting.bin_dir=../linkahead-server/test_scripting/bin/
 
 [Connection]
-url=https://caosdb-server:10443
+url=https://linkahead-server:10443
 username=admin
 cacert=/opt/linkahead/cert/caosdb.cert.pem
 debug=0
diff --git a/.docker/tester.yml b/.docker/tester.yml
index 262ad378..24c6b73a 100644
--- a/.docker/tester.yml
+++ b/.docker/tester.yml
@@ -5,9 +5,9 @@ services:
     volumes:
       - type: bind
         source: ./cert
-        target: /opt/caosdb/cert
+        target: /opt/linkahead/cert
     networks:
-      - docker_caosnet
+      - docker_linkaheadnet
 networks:
-  docker_caosnet:
+  docker_linkaheadnet:
     external: true
diff --git a/README.md b/README.md
index ebda4f64..df085241 100644
--- a/README.md
+++ b/README.md
@@ -2,10 +2,10 @@
 
 ## Welcome
 
-This is the **CaosDB Advanced User Tools** repository and a part of the
-CaosDB project.
+This is the **LinkAhead Advanced User Tools** repository and a part of the
+LinkAhead project.
 This project contains tools that are beyond the typical use of
-the CaosDB python client. Especially, this includes the crawler which will
+the LinkAhead python client. Especially, this includes the crawler which will
 typically be used by a data curator.
 
 ## Setup
@@ -16,42 +16,42 @@ setup this code.
 ## Further Reading
 
 Please refer to the [official
-documentation](https://docs.indiscale.com/caosdb-advanced-user-tools/) for more
+documentation](https://docs.linkahead.org/linkahead-advanced-user-tools/) for more
 information.
 
 ## Contributing
 
 Thank you very much to all contributers—[past,
-present](https://gitlab.com/caosdb/caosdb/-/blob/dev/HUMANS.md), and prospective
+present](https://gitlab.com/linkahead/linkahead-meta/-/blob/dev/HUMANS.md), and prospective
 ones.
 
 ### Code of Conduct
 
 By participating, you are expected to uphold our [Code of
-Conduct](https://gitlab.com/caosdb/caosdb/-/blob/dev/CODE_OF_CONDUCT.md).
+Conduct](https://gitlab.com/linkahead/linkahead-meta/-/blob/dev/CODE_OF_CONDUCT.md).
 
 ### How to Contribute
 
 - You found a bug, have a question, or want to request a feature? Please [create
-  an issue](https://gitlab.com/caosdb/caosdb-advanced-user-tools/-/issues).
+  an issue](https://gitlab.com/linkahead/linkahead-advanced-user-tools/-/issues).
 - You want to contribute code? Please fork the repository and create a merge
   request in GitLab and choose this repository as target. Make sure to select
   "Allow commits from members who can merge the target branch" under
   Contribution when creating the merge request. This allows our team to work
   with you on your request.
 - If you have a suggestion for the
-  [documentation](https://docs.indiscale.com/caosdb-advanced-user-tools/), the
+  [documentation](https://docs.linkahead.org/linkahead-advanced-user-tools/), the
   preferred way is also a merge request as describe above (the documentation
   resides in `src/doc`). However, you can also create an issue for it.
-- You can also contact us at **info (AT) caosdb.org** and join the CaosDB
+- You can also contact us at **info (AT) linkahead.org** and join the LinkAhead
   community on
-  [#caosdb:matrix.org](https://matrix.to/#/!unwwlTfOznjEnMMXxf:matrix.org).
+  [#linkahead:matrix.org](https://matrix.to/#/!unwwlTfOznjEnMMXxf:matrix.org).
 
 ## License
 
 * Copyright (C) 2018 Research Group Biomedical Physics, Max Planck Institute
   for Dynamics and Self-Organization Göttingen.
-* Copyright (C) 2020-2021 Indiscale GmbH <info@indiscale.com>
+* Copyright (C) 2020-2023 Indiscale GmbH <info@indiscale.com>
 
 All files in this repository are licensed under a [GNU Affero General Public
 License](LICENCE.md) (version 3 or later).
diff --git a/README_SETUP.md b/README_SETUP.md
index 263cc967..7c9f5aff 100644
--- a/README_SETUP.md
+++ b/README_SETUP.md
@@ -4,13 +4,12 @@
 The recommended way is:
 ```
 # Clone the repository:
-git clone 'https://gitlab.com/caosdb/caosdb-advanced-user-tools'
+git clone 'https://gitlab.com/linkahead/linkahead-advanced-user-tools'
 ```
 
 ## Dependencies
-Dependencies will be installed automatically if you use the below described
-procedure.
-- `caosdb>=0.6.0`
+Dependencies will be installed automatically if you use the procedure described below.
+- `linkahead>=0.6.0`
 - `openpyxl>=3.0.7`
 - `xlrd>=1.2.0`
 - `pandas>=1.2.0`
@@ -38,11 +37,11 @@ Optional h5-crawler:
 
 1. Change directory to `integrationtests/`.
 2. Mount `extroot` to the folder that will be used as extroot. E.g. `sudo mount
-   -o bind extroot ../../caosdb-deploy/profiles/debug/paths/extroot` (or
+   -o bind extroot ../../linkahead-deploy/profiles/debug/paths/extroot` (or
    whatever path the extroot of the empty profile to be used is located at).
-3. Start (or restart) an empty (!) CaosDB instance (with the mounted
+3. Start (or restart) an empty (!) LinkAhead instance (with the mounted
    extroot). The database will be cleared during testing, so it's important to
-   use an empty instance. Make sure your configuration for the python caosdb
+   use an empty instance. Make sure your configuration for the LinkAhead python
    module is correct and allows to connect to the server.
 4. Run `test.sh`. Note that this may modify content of the
    `integrationtest/extroot/` directory.
diff --git a/extra/emacs/snippets/yaml-mode/Property inside RecordType b/extra/emacs/snippets/yaml-mode/Property inside RecordType
index 92769b78..9640a34e 100644
--- a/extra/emacs/snippets/yaml-mode/Property inside RecordType	
+++ b/extra/emacs/snippets/yaml-mode/Property inside RecordType	
@@ -1,5 +1,5 @@
 # -*- mode: snippet -*-
-# This file is a part of the CaosDB Project.
+# This file is a part of the LinkAhead Project.
 #
 # Copyright (C) 2022 IndiScale GmbH <info@indiscale.com>
 # Copyright (C) 2022 Daniel Hornung <d.hornung@indiscale.com>
diff --git a/integrationtests/filldb.sh b/integrationtests/filldb.sh
index 9c45d5fd..9bcf8287 100755
--- a/integrationtests/filldb.sh
+++ b/integrationtests/filldb.sh
@@ -5,7 +5,7 @@ python3 -m linkaheadadvancedtools.loadFiles /opt/linkahead/mnt/extroot/Experimen
 python3 -m linkaheadadvancedtools.loadFiles /opt/linkahead/mnt/extroot/DataAnalysis
 python3 -m linkaheadadvancedtools.loadFiles /opt/linkahead/mnt/extroot/SimulationData
 python3 -m linkaheadadvancedtools.loadFiles /opt/linkahead/mnt/extroot/Publications
-python3 -m linkaheadadvancedtools.loadFiles -c caosdbignore -l $PWD/extroot/Software /opt/linkahead/mnt/extroot/Software
+python3 -m linkaheadadvancedtools.loadFiles -c linkaheadignore -l $PWD/extroot/Software /opt/linkahead/mnt/extroot/Software
 python3 insert_model.py 
 python3 insert_some.py
 python3 crawl.py /
diff --git a/integrationtests/test.sh b/integrationtests/test.sh
index e5a87ae0..904fc5b3 100755
--- a/integrationtests/test.sh
+++ b/integrationtests/test.sh
@@ -15,8 +15,8 @@ then
 fi
 OUT=/tmp/crawler.output
 ls 
-cat pycaosdb.ini
-python3 -c "import linkahead; print('CaosDB Version:', caosdb.__version__)"
+cat pylinkahead.ini
+python3 -c "import linkahead; print('LinkAhead Version:', linkahead.__version__)"
 rm -rf /tmp/linkahead_identifiable_cache.db
 set -e
 echo "Clearing database"
diff --git a/integrationtests/test_crawler_with_cfoods.py b/integrationtests/test_crawler_with_cfoods.py
index 801bf4b3..d3783bb2 100755
--- a/integrationtests/test_crawler_with_cfoods.py
+++ b/integrationtests/test_crawler_with_cfoods.py
@@ -26,7 +26,7 @@ import os
 import unittest
 
 import linkahead as db
-from caosdb.apiutils import retrieve_entity_with_id
+from linkahead.apiutils import retrieve_entity_with_id
 
 
 def get_entity_with_id(eid):
diff --git a/integrationtests/test_datamodel_problems.py b/integrationtests/test_datamodel_problems.py
index 5c316b7b..4b9aad3a 100644
--- a/integrationtests/test_datamodel_problems.py
+++ b/integrationtests/test_datamodel_problems.py
@@ -30,9 +30,9 @@ class in crawler.py and cfood.py can be found in full-tests.
 import linkahead as db
 import pytest
 from linkaheadadvancedtools.datamodel_problems import DataModelProblems
-from caosdb.exceptions import (TransactionError,
-                               UnqualifiedParentsError,
-                               UnqualifiedPropertiesError)
+from linkahead.exceptions import (TransactionError,
+                                  UnqualifiedParentsError,
+                                  UnqualifiedPropertiesError)
 
 
 def setup_module():
diff --git a/integrationtests/test_im_und_export.py b/integrationtests/test_im_und_export.py
index f7c065ca..bdfc435a 100644
--- a/integrationtests/test_im_und_export.py
+++ b/integrationtests/test_im_und_export.py
@@ -19,7 +19,7 @@ if __name__ == "__main__":
     assert 0 == len(db.execute_query("FIND File which is stored at "
                                      "**/poster.pdf"))
     print("Importing stored elements")
-    import_xml(os.path.join(directory.name, "caosdb_data.xml"), interactive=False)
+    import_xml(os.path.join(directory.name, "linkahead_data.xml"), interactive=False)
 
     # The following tests the existence of some required entities.
     # However, this is not a full list.
diff --git a/manual_tests/test_labfolder_import.py b/manual_tests/test_labfolder_import.py
index 25253832..af8b7b53 100644
--- a/manual_tests/test_labfolder_import.py
+++ b/manual_tests/test_labfolder_import.py
@@ -24,10 +24,10 @@
 import argparse
 import sys
 
-import caosmodels
-from caosmodels.parser import parse_model_from_yaml
+import linkaheadmodels
+from linkaheadmodels.parser import parse_model_from_yaml
 
-from caosadvancedtools.converter import labfolder_export as labfolder
+from linkaheadadvancedtools.converter import labfolder_export as labfolder
 
 
 def main(args):
diff --git a/manual_tests/test_labfolder_retrieve.py b/manual_tests/test_labfolder_retrieve.py
index 3459ad7d..6b140f6c 100644
--- a/manual_tests/test_labfolder_retrieve.py
+++ b/manual_tests/test_labfolder_retrieve.py
@@ -23,10 +23,10 @@
 import argparse
 import sys
 
-import caosmodels
-from caosmodels.parser import parse_model_from_yaml
+import linkaheadmodels
+from linkaheadmodels.parser import parse_model_from_yaml
 
-from caosadvancedtools.converter.labfolder_api import Importer
+from linkaheadadvancedtools.converter.labfolder_api import Importer
 
 
 def main(args):
diff --git a/pylintrc b/pylintrc
index 625f83ce..76c6766e 100644
--- a/pylintrc
+++ b/pylintrc
@@ -14,6 +14,6 @@ ignored-modules=etree,h5py,labfolder
 # TODO: The max_inferred size is necessary for https://github.com/PyCQA/pylint/issues/4577,
 # otherwise pandas.read_csv's return value would be inferred as TextFileReader.
 init-hook=
-  import sys; sys.path.extend(["src/caosadvancedtools"]);
+  import sys; sys.path.extend(["src/linkaheadadvancedtools"]);
   import astroid; astroid.context.InferenceContext.max_inferred = 500;
 
diff --git a/unittests/linkaheadignore-example b/unittests/linkaheadignore-example
index 04500046..f9741065 100644
--- a/unittests/linkaheadignore-example
+++ b/unittests/linkaheadignore-example
@@ -1,2 +1,2 @@
 README.md
-.caosdbignore*
+.linkaheadignore*
-- 
GitLab