Skip to content

Commit

Permalink
Remove unused Makefile SUDO_POSTGRES wrapper
Browse files Browse the repository at this point in the history
Signed-off-by: tdruez <[email protected]>
  • Loading branch information
tdruez committed Nov 20, 2023
1 parent b190b23 commit 7364b3a
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ SCANCODEIO_DB_PASSWORD=scancodeio
POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=en_US.UTF-8 --lc-ctype=en_US.UTF-8
DATE=$(shell date +"%Y-%m-%d_%H%M")

# Use sudo for postgres, but only on Linux
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
SUDO_POSTGRES=sudo -u postgres
else
SUDO_POSTGRES=
endif

virtualenv:
@echo "-> Bootstrap the virtualenv with PYTHON_EXE=${PYTHON_EXE}"
@${PYTHON_EXE} ${VIRTUALENV_PYZ} --never-download --no-periodic-update .
Expand Down Expand Up @@ -107,12 +99,12 @@ migrate:
postgresdb:
@echo "-> Configure PostgreSQL database"
@echo "-> Create database user ${SCANCODEIO_DB_NAME}"
@${SUDO_POSTGRES} createuser --no-createrole --no-superuser --login --inherit --createdb '${SCANCODEIO_DB_USER}' || true
@${SUDO_POSTGRES} psql -c "alter user ${SCANCODEIO_DB_USER} with encrypted password '${SCANCODEIO_DB_PASSWORD}';" || true
@createuser --no-createrole --no-superuser --login --inherit --createdb '${SCANCODEIO_DB_USER}' || true
@psql -c "alter user ${SCANCODEIO_DB_USER} with encrypted password '${SCANCODEIO_DB_PASSWORD}';" || true
@echo "-> Drop ${SCANCODEIO_DB_NAME} database"
@${SUDO_POSTGRES} dropdb ${SCANCODEIO_DB_NAME} || true
@dropdb ${SCANCODEIO_DB_NAME} || true
@echo "-> Create ${SCANCODEIO_DB_NAME} database"
@${SUDO_POSTGRES} createdb --owner=${SCANCODEIO_DB_USER} ${POSTGRES_INITDB_ARGS} ${SCANCODEIO_DB_NAME}
@createdb --owner=${SCANCODEIO_DB_USER} ${POSTGRES_INITDB_ARGS} ${SCANCODEIO_DB_NAME}
@$(MAKE) migrate

backupdb:
Expand Down

0 comments on commit 7364b3a

Please sign in to comment.