p≡p engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
844 B

fix ENGINE-956 It is now possible to use shell environment variables in PER_USER_DIRECTORY and PER_MACHINE_DIRECTORY, expanded at *run* time. This is meant to allow more freedom to the deployment engineer, without affecting development. Notice that, when PER_USER_DIRECTORY and PER_MACHINE_DIRECTORY are defined in the Makefile, dollar signs must be escaped (a dollar becomes a double dollar) because of *make* syntax: this has nothing to do with pEp engine code. Expansion follows the Unix shell $VARIABLE syntax: ${VARIABLE} is not supported. See _expand_variables. src/platform_unix.c contained some duplicated logic about caching path results into static variables; this change set would have added to the complexity by calling the new path expansion function, in many different places. Seize the occasion for factoring. Do not change the meaning of PER_USER_DIRECTORY yet; I would like to do it, since it is confusing and inconsistent with per_user_directory (PER_USER_DIRECTORY is a relative path on Unix, while per_user_directory is absolute), but the actual semantics with respect to $HOME and $PEP_HOME is complicated and I do not want to break it. New API function per_user_relative_directory. Remove the ugly "reset" argument from unix_local_db (which was conditionally defined according to NDEBUG!), used to force path re-computation in the test suite after changing an environment variable so as to work in a new "home" directory. In the place of this reset argument add clear API functions to the engine for handling the cache. My quick grapping and IRC interaction confirm that nobody was using the functionality out of the engine test suite. Adapt the test suite to use the new API. Tentatively add caching and expansion functionality to android_system_db as well.
9 months ago
  1. # Copyright 2017, pEp Foundation
  2. # This file is part of pEpEngine
  3. # This file may be used under the terms of the GNU General Public License version 3
  4. # see LICENSE.txt
  5. include ../Makefile.conf
  6. .PHONY: db
  7. db: system.db
  8. DICOS = $(wildcard *.csv)
  9. # The 'mv' keeps a backup db around
  10. system.db: create_system_db.sql $(DICOS)
  11. -mv -f $@ $@~
  12. sqlite3 -batch $@ < $<
  13. for c in $(DICOS) ; do echo "$$c" ; echo .import "$$c" wordlist | sqlite3 -batch -csv $@ ; done
  14. .PHONY: install
  15. install: system.db
  16. # Notice that the expansion of these make variables may still contain
  17. # shell variable occurrences, to be expanded in their turn. This
  18. # serves to leave more freedom to the deployment engineer.
  20. cp system.db "$(DESTDIR)$(PER_MACHINE_DIRECTORY)"
  21. .PHONY: clean
  22. clean:
  23. rm -f system.db system.db~