Skip to content

Support compilation procedure in "dependencies" and "build" stages

Description

Onionspray compilation procedure should support two stages:

  1. Dependencies stage: when system-wide packages are installed. This requires superuser privileges.
  2. Build stage: when the sources are compiled. This can be run by a regular user.

Useful for installation procedures such as those using the Onionspray Ansible Role which can install dependencies by themselves (related to tpo/onion-services/ansible/onionspray-role#2).

Tasks

  • Option 1: add two flags:
    • --dependencies-only: when passed, only the system-wide requirements are installed.
    • --compilation-only: when passed, only the user-wide software is compiled.
  • Option 2: use an environment variable ONIONSPRAY_BUILD_PROCESS allowing three situations:
    • When set to "dependencies-only", only install the system-wide dependencies.
    • When set to "compilation-only", only compiles the user-wide software.
    • When unset, do both.
  • Option 3: split compilation procedure between "dependencies" and "build" scripts. Example:
    • Add a opt/deps-debian-13.0.sh that handles all the needed system-wide dependencies. This is script can be called alone and should detect whether it's being invoked by root or a regular user, to detect whether it needs sudo.
    • Add a opt/compile-debian-13.0.sh that handles all the needed compilation procedures.
    • Script opt/build-debian-13.0.sh should source opt/deps-debian-13.0.sh and opt/compile-debian-13.0.sh.
    • To avoid sourcing opt/lib.sh included twice, check for a variable set on lib.sh; if the variable is set, then lib.sh was already sourced.
    • Port this solution to other platforms.

Time estimation

  • Complexity: very small (0.5 day)
  • Uncertainty: low (x1.1)
  • Reference (adapted)
Edited by Silvio Rhatto