aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-09-09 20:00:02 -0400
committerB. Stack <bgstack15@gmail.com>2022-09-09 20:00:02 -0400
commitea966ba7e9a4cb9e28b863bc25a5893199f8b316 (patch)
treeb5f2b5a096dd9335166f17b16855c3a8575e3404
parentadd web app (diff)
downloadcoupons-ea966ba7e9a4cb9e28b863bc25a5893199f8b316.tar.gz
coupons-ea966ba7e9a4cb9e28b863bc25a5893199f8b316.tar.bz2
coupons-ea966ba7e9a4cb9e28b863bc25a5893199f8b316.zip
add makefile, and partial rpm spec
-rw-r--r--Makefile111
-rw-r--r--README.md6
-rw-r--r--coupons.spec39
3 files changed, 156 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..a0635fb
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,111 @@
+# File: Makefile for coupons
+# Location: coupons source package
+# Author: bgstack15
+# Startdate: 2022-09-09
+# Title: Makefile for coupons source package
+# Purpose: To use traditional Unix make utility
+# History:
+# Usage:
+# Reference:
+# bgscripts Makefile
+# Improve:
+# Document:
+# Dependencies:
+# build-devuan: txt2man
+
+APPNAME = coupons
+APPVERSION = 0.0.1
+SRCDIR = $(CURDIR)
+prefix = /usr
+BINDIR = $(DESTDIR)$(prefix)/bin
+LIBEXECDIR = $(DESTDIR)$(prefix)/libexec
+# for debian use /var/cache/apache2
+CACHEDIR = $(DESTDIR)/var/cache/httpd
+# for debian use /etc/apache2/sites-available
+APACHEDIR = $(DESTDIR)/etc/httpd/conf.d
+
+# variables for deplist
+DEPTYPE = dep
+SEPARATOR = ,
+
+awkbin :=$(shell which awk)
+chmodbin :=$(shell which chmod)
+cpbin :=$(shell which cp)
+echobin :=$(shell which echo)
+falsebin :=$(shell which false)
+findbin :=$(shell which find)
+grepbin :=$(shell which grep)
+gzipbin :=$(shell which gzip)
+installbin :=$(shell which install)
+rmbin :=$(shell which rm)
+rmdirbin :=$(shell which rmdir)
+sedbin :=$(shell which sed)
+sortbin :=$(shell which sort)
+truebin :=$(shell which true)
+txt2manwrapper :=usr/bin/txt2man-wrapper
+uniqbin :=$(shell which uniq)
+xargsbin :=$(shell which xargs)
+
+with_man ?= YES
+with_httpd ?= YES
+
+all: build_man
+
+ifeq ($(with_man),YES)
+install: build_man install_files
+else
+install: install_files
+endif
+
+.PHONY: clean install install_files build_man uninstall list deplist deplist_opts
+
+list:
+ @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | ${awkbin} -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | ${sortbin} | ${grepbin} -E -v -e '^[^[:alnum:]]' -e '^$@$$'
+
+deplist:
+ @# deplist 2020-04-18 input must be comma separated
+ @# DEPTYPE( dep , rec , sug ) for depends, recommends, or suggests
+ @if test -z "${DISTRO}" ; then ${echobin} "Please run \`make deplist\` with DISTRO= one of: `make deplist_opts 2>&1 1>/dev/null | ${xargsbin}`. Aborted." 1>&2 ; exit 1 ; fi
+ @if ! ${echobin} "${DEPTYPE}" | grep -qE "^(dep|rec|sug)$$" ; then ${echobin} "Please run \`make deplist\` with DEPTYPE= one of: dep, rec, sug. Undefined will use \`dep\`. Aborted." 1>&2 ; exit 1; fi
+ @${grepbin} -h --exclude-dir='doc' -riIE "\<${DEPTYPE}-" ${SRCDIR} | ${awkbin} -v "domain=${DISTRO}" -v "deptype=${DEPTYPE}" 'tolower($$2) ~ deptype"-"domain {$$1="";$$2="";print}' | tr ',' '\n' | ${sortbin} | ${uniqbin} | ${sedbin} -r -e 's/^\s*//' -e "s/\s*\$$/${SEPARATOR}/" | ${xargsbin}
+
+deplist_opts:
+ @# deplist_opts 2020-04-18 find all available dependency domains
+ @${grepbin} -h -o -riIE '\<(dep|rec|sug)-[^\ :]+:' ${SRCDIR} | ${sedbin} -r -e 's/(dep|rec|sug)-//;' -e 's/:$$//;' | ${sortbin} | ${uniqbin} 1>&2
+
+install_files:
+ @ls usr/share/man/man*/*gz 1>/dev/null 2>&1 && echo "Including man pages." || :
+ @${echobin} Installing files to ${DESTDIR}
+ ${installbin} -m 0755 -d ${LIBEXECDIR}/${APPNAME} \
+ ${LIBEXECDIR}/${APPNAME}/static/images \
+ ${LIBEXECDIR}/${APPNAME}/templates \
+ ${CACHEDIR}/${APPNAME} ${BINDIR}
+ ${installbin} -m 0755 -t ${LIBEXECDIR}/${APPNAME} coupons.py coupons_web.py
+ ${installbin} -m 0644 -t ${LIBEXECDIR}/${APPNAME}/static static/*.*
+ ${installbin} -m 0644 -t ${LIBEXECDIR}/${APPNAME}/static/images static/images/*
+ ${installbin} -m 0644 -t ${LIBEXECDIR}/${APPNAME}/templates templates/*
+ifeq ($(with_httpd),YES)
+ ${installbin} -m 0755 -d ${APACHEDIR}
+ ${installbin} -m 0644 -t ${APACHEDIR} extra/wsgi-coupons.conf
+ @# substitute variables in the apache config file
+ ${sedbin} -i -r -e "/XDG_CACHE_HOME/{s@(XDG_CACHE_HOME )[^ ]+@\1${CACHEDIR}/coupons_web.py@}" -e "/WSGIScriptAlias|\<Directory/{s@\/usr\/libexec\/coupons@${LIBEXECDIR}/${APPNAME}@};" ${APACHEDIR}/wsgi-coupons.conf
+endif
+
+MAN_TXT:=$(wildcard usr/share/man/man*/*.txt)
+MAN_GZ:= $(subst .txt,.gz,$(MAN_TXT))
+
+build_man: $(MAN_GZ)
+
+$(MAN_GZ): %.gz: %.txt
+ ${txt2manwrapper} - < $< | ${gzipbin} > $@
+
+uninstall:
+ @${echobin} SRCDIR=${SRCDIR}
+ # remove all installed files
+ ${rmbin} -rf ${LIBEXECDIR}/${APPNAME} \
+ ${CACHEDIR}/${APPNAME} \
+ ${APACHEDIR}/wsgi-coupons.conf
+
+clean:
+ -@#${echobin} "target $@ not implemented yet! Gotta say unh." && ${falsebin}
+ -${rmbin} -f usr/share/man/man*/*.gz || :
diff --git a/README.md b/README.md
index 8d6f1e1..4797e11 100644
--- a/README.md
+++ b/README.md
@@ -75,6 +75,12 @@ For the web app:
* apache with `mod_wsgi`
* python3-flask
+For AlmaLinux 8:
+
+* python3-flask
+* python3-mod_wsgi
+* httpd
+
## Building or changing
Only a few stores are currently supported. The southernsavers.com website lists other stores that are probably drop-in capable. To learn the widgets.json path needed, use Developer Tools in a web browser to capture the full widgets.json path and add it to the **stores_url** dict.
diff --git a/coupons.spec b/coupons.spec
new file mode 100644
index 0000000..eaa8e51
--- /dev/null
+++ b/coupons.spec
@@ -0,0 +1,39 @@
+# INCOMPLETE!
+# Commit may be branch, tag, or commit hash
+%define commit master
+Name: coupons
+Version: 0.0.1
+Release: 1
+Summary: view salepapers for select grocery stores
+
+License: GPL3
+URL: https://bgstack15.ddns.net/
+Source0: %{URL}/cgit/%{name}/snapshot/%{name}-%{commit}.tar.gz
+
+#BuildRequires:
+Requires: python3-flask
+Recommends: httpd
+
+%description
+Cli and web interfaces for checking current sale paper
+ads from select grocery stores.
+
+%prep
+%setup -q
+:
+
+%build
+%configure
+:
+
+%install
+%make_install APACHEDIR=/etc/httpd/conf.d
+
+
+%files
+%doc
+
+
+
+%changelog
+
bgstack15