|
| 1 | +Run ScanCode.io Mapping Script |
| 2 | +================================ |
| 3 | + |
| 4 | +This script executes the ``map_deploy_to_develop`` mapping workflow from |
| 5 | +ScanCode.io inside a Docker container. It optionally spins up a temporary |
| 6 | +PostgreSQL instance when needed. The script copies the specified input files to |
| 7 | +a working directory, runs the mapping, writes the output to a file, and cleans |
| 8 | +up afterward. |
| 9 | + |
| 10 | +Usage |
| 11 | +----- |
| 12 | + |
| 13 | +.. code-block:: bash |
| 14 | +
|
| 15 | + ./map-deploy-to-develop.sh <from-path> <to-path> <output-file> [options] <spin-db> [db-port] |
| 16 | +
|
| 17 | +Arguments |
| 18 | +--------- |
| 19 | + |
| 20 | ++-----------------+-------------------------------------------------------------+ |
| 21 | +| Argument | Description | |
| 22 | ++=================+=============================================================+ |
| 23 | +| ``from-path`` | Path to the base deployment/scan file | |
| 24 | ++-----------------+-------------------------------------------------------------+ |
| 25 | +| ``to-path`` | Path to the target deployment/scan file | |
| 26 | ++-----------------+-------------------------------------------------------------+ |
| 27 | +| ``options`` | D2D pipeline parameters (can be empty ``""``) | |
| 28 | ++-----------------+-------------------------------------------------------------+ |
| 29 | +| ``output-file`` | File where ScanCode.io output will be written | |
| 30 | ++-----------------+-------------------------------------------------------------+ |
| 31 | +| ``spin-db`` | ``true`` = spin temp DB container, ``false`` = skip | |
| 32 | ++-----------------+-------------------------------------------------------------+ |
| 33 | +| ``db-port`` | Port to bind Postgres (default: ``5432``) | |
| 34 | ++-----------------+-------------------------------------------------------------+ |
| 35 | + |
| 36 | + |
| 37 | +Example |
| 38 | +------- |
| 39 | + |
| 40 | +Run mapping without database: |
| 41 | + |
| 42 | +.. code-block:: bash |
| 43 | +
|
| 44 | + ./map-deploy-to-develop.sh ./from.tar.gz ./to.whl results.json |
| 45 | +
|
| 46 | +Run mapping with database on a custom port: |
| 47 | + |
| 48 | +.. code-block:: bash |
| 49 | +
|
| 50 | + ./map-deploy-to-develop.sh ./from.tar.gz ./to.whl output.json --options "Python,Java" --spin-db --port 5433 |
| 51 | +
|
| 52 | +Script Actions |
| 53 | +-------------- |
| 54 | + |
| 55 | +1. Validates required arguments |
| 56 | +2. Starts PostgreSQL in Docker (if ``spin-db=true``) |
| 57 | +3. Creates a temporary working directory: ``./d2d`` |
| 58 | +4. Copies input files into working directory |
| 59 | +5. Runs ScanCode.io mapping step: |
| 60 | + |
| 61 | + .. code-block:: text |
| 62 | +
|
| 63 | + run map_deploy_to_develop:<D2D_OPTIONS> \ |
| 64 | + "/code/<from-file>:from,/code/<to-file>:to" |
| 65 | +
|
| 66 | +6. Writes mapping output into ``output-file`` |
| 67 | +7. Cleans up temp directory |
| 68 | +8. Stops DB container if it was started |
| 69 | + |
| 70 | +Dependencies |
| 71 | +------------ |
| 72 | + |
| 73 | +* Bash |
| 74 | +* Docker |
| 75 | +* Local filesystem permissions for creating ``./d2d`` and writing output |
| 76 | + |
| 77 | + |
| 78 | +Before running the script: |
| 79 | +---------------------------------- |
| 80 | + |
| 81 | +Ensure the script has execute permissions: |
| 82 | + |
| 83 | +.. code-block:: bash |
| 84 | +
|
| 85 | + sudo su - |
| 86 | + chmod +x map-deploy-to-develop.sh |
| 87 | +
|
| 88 | +Then execute: |
| 89 | + |
| 90 | +.. code-block:: bash |
| 91 | +
|
| 92 | + ./map-deploy-to-develop.sh ... |
0 commit comments