<commit_before>### -*-Makefile-*-
CHROOT=/plc/root
PORT=5432
SITEDIR=/etc/planetlab/configs
SITE=site.xml
RPM=$(shell ls -rt /root/myplc*rpm | tail -1)
APIDIR=/usr/share/plc_api

PLC1=lurch.cs.princeton.edu
PLC2=planetlab-devbox.inria.fr

all:help

####################
PUSH=pclean pplc2 papi2 pplc1 papi1

push:$(PUSH)

papi: pclean papi1 papi2
pplc: pclean pplc1 pplc2

pclean:
	-find . '(' -name '*.pyc' -o -name '*~' ')' | xargs rm
papi1:
	rsync -a -v -C ./ root@$(PLC1):new_plc_api/
pplc1:
	rsync -a -v -C ./PLC/ root@$(PLC1):$(CHROOT)$(APIDIR)/PLC/
	rsync -a -v -C ./planetlab4.sql root@$(PLC1):$(CHROOT)$(APIDIR)/planetlab4.sql
papi2:
	rsync -a -v -C ./ root@$(PLC2):new_plc_api/
pplc2:
	rsync -a -v -C ./PLC/ root@$(PLC2):$(CHROOT)$(APIDIR)/PLC/
	rsync -a -v -C ./planetlab4.sql root@$(PLC2):$(CHROOT)$(APIDIR)/planetlab4.sql

####################
DB=install-schema stop-clients clean-db restart
WEB=install-api restart

db: $(DB)
	@date

db-dump:
	chroot $(CHROOT) pg_dump -U pgsqluser planetlab4 > planetlab4.dump

web: $(WEB)

install-schema:
	@echo 'installing schema'
	@rsync -a -v planetlab4.sql $(CHROOT)$(APIDIR)/planetlab4.sql

install-api:
	find . -name '*.py' | xargs tar cf - | ( cd $(CHROOT)$(APIDIR) ; tar xf -)
	-find $(CHROOT)$(APIDIR) -name '*pyc' | xargs rm

stop-clients:
	@echo 'pkilling psql'
	@-pkill psql
	@echo 'pkilling Shell.py'
	@-pkill Shell.py
	@echo stopping httpd
	@chroot $(CHROOT) /etc/plc.d/httpd stop

clean-db:
	@echo 'dropping db'
	@chroot $(CHROOT) psql -U postgres --port $(PORT) template1 -c 'drop database planetlab4'

restart:
	@echo 'Restarting PLC'
	@chroot $(CHROOT) service plc restart

http:
	@echo 'Restarting httpd'
	@chroot $(CHROOT) /etc/plc.d/httpd stop ; chroot $(CHROOT) /etc/plc.d/httpd start

####################
UPGRADE=down up reconfig restart

upgrade: $(UPGRADE)

rpm:
	@echo latest rpm is $(RPM)

down:
	cp $(SITEDIR)/$(SITE) .
	rpm -e myplc
up:
	rpm -i $(RPM)

reconfig:
	service plc mount
	mkdir -p $(SITEDIR)
	cp $(SITE) $(SITEDIR)
	(echo w; echo q) | chroot $(CHROOT) plc-config-tty

####################
RUN=api sql log
api:
	chroot $(CHROOT) /usr/share/plc_api/Shell.py

sql:
	chroot $(CHROOT) psql -U pgsqluser planetlab4

log:
	emacs /plc/data/var/log/httpd/error_log /plc/data/var/log/boot.log

####################
normalize= sed -ibkp "s|'expires':.*,|'expires': normalized,|"

TEST=run checkpoint diff
run: run-only normalize
run-only:
	python -u ./TestPeers.py > TestPeers.out 2>&1
normalize:
	$(normalize) TestPeers.out
diff:
	@echo '<< REF OUT>>'
	diff TestPeers.ref TestPeers.out

checkpoint:
	@echo adopting latest run as reference
	cp TestPeers.out TestPeers.ref

#######
HELP=rpm db-dump http

help:
	@echo known targets:
	@echo push: $(PUSH) 
	@echo db: $(DB) 
	@echo web: $(WEB) 
	@echo upgrade: $(UPGRADE)
	@echo test: $(TEST)
	@echo run: $(RUN)
	@echo OTHERS: $(HELP)
<commit_msg>frun to run fast (1x1x1x1) test<commit_after>### -*-Makefile-*-
CHROOT=/plc/root
PORT=5432
SITEDIR=/etc/planetlab/configs
SITE=site.xml
RPM=$(shell ls -rt /root/myplc*rpm | tail -1)
APIDIR=/usr/share/plc_api

PLC1=lurch.cs.princeton.edu
PLC2=planetlab-devbox.inria.fr

all:help

####################
PUSH=pclean pplc2 papi2 pplc1 papi1

push:$(PUSH)

papi: pclean papi1 papi2
pplc: pclean pplc1 pplc2

pclean:
	-find . '(' -name '*.pyc' -o -name '*~' ')' | xargs rm
papi1:
	rsync -a -v -C ./ root@$(PLC1):new_plc_api/
pplc1:
	rsync -a -v -C ./PLC/ root@$(PLC1):$(CHROOT)$(APIDIR)/PLC/
	rsync -a -v -C ./planetlab4.sql root@$(PLC1):$(CHROOT)$(APIDIR)/planetlab4.sql
papi2:
	rsync -a -v -C ./ root@$(PLC2):new_plc_api/
pplc2:
	rsync -a -v -C ./PLC/ root@$(PLC2):$(CHROOT)$(APIDIR)/PLC/
	rsync -a -v -C ./planetlab4.sql root@$(PLC2):$(CHROOT)$(APIDIR)/planetlab4.sql

####################
DB=install-schema stop-clients clean-db restart
WEB=install-api restart

db: $(DB)
	@date

db-dump:
	chroot $(CHROOT) pg_dump -U pgsqluser planetlab4 > planetlab4.dump

web: $(WEB)

install-schema:
	@echo 'installing schema'
	@rsync -a -v planetlab4.sql $(CHROOT)$(APIDIR)/planetlab4.sql

install-api:
	find . -name '*.py' | xargs tar cf - | ( cd $(CHROOT)$(APIDIR) ; tar xf -)
	-find $(CHROOT)$(APIDIR) -name '*pyc' | xargs rm

stop-clients:
	@echo 'pkilling psql'
	@-pkill psql
	@echo 'pkilling Shell.py'
	@-pkill Shell.py
	@echo stopping httpd
	@chroot $(CHROOT) /etc/plc.d/httpd stop

clean-db:
	@echo 'dropping db'
	@chroot $(CHROOT) psql -U postgres --port $(PORT) template1 -c 'drop database planetlab4'

restart:
	@echo 'Restarting PLC'
	@chroot $(CHROOT) service plc restart

http:
	@echo 'Restarting httpd'
	@chroot $(CHROOT) /etc/plc.d/httpd stop ; chroot $(CHROOT) /etc/plc.d/httpd start

####################
UPGRADE=down up reconfig restart

upgrade: $(UPGRADE)

rpm:
	@echo latest rpm is $(RPM)

down:
	cp $(SITEDIR)/$(SITE) .
	rpm -e myplc
up:
	rpm -i $(RPM)

reconfig:
	service plc mount
	mkdir -p $(SITEDIR)
	cp $(SITE) $(SITEDIR)
	(echo w; echo q) | chroot $(CHROOT) plc-config-tty

####################
RUN=api sql log
api:
	chroot $(CHROOT) /usr/share/plc_api/Shell.py

sql:
	chroot $(CHROOT) psql -U pgsqluser planetlab4

log:
	emacs /plc/data/var/log/httpd/error_log /plc/data/var/log/boot.log

####################
normalize= sed -ibkp "s|'expires':.*,|'expires': normalized,|"

TEST=run checkpoint diff
run: run-only normalize
run-only:
	python -u ./TestPeers.py > TestPeers.out 2>&1
normalize:
	$(normalize) TestPeers.out
diff:
	@echo '<< REF OUT>>'
	diff TestPeers.ref TestPeers.out

checkpoint:
	@echo adopting latest run as reference
	cp TestPeers.out TestPeers.ref

frun:
	python -u ./TestPeers.py -f > TestPeers.fout 2>&1
#######
HELP=rpm db-dump http

help:
	@echo known targets:
	@echo push: $(PUSH) 
	@echo db: $(DB) 
	@echo web: $(WEB) 
	@echo upgrade: $(UPGRADE)
	@echo test: $(TEST)
	@echo run: $(RUN)
	@echo OTHERS: $(HELP)

{'fraction_non_alphanumeric': 0.20340147740937983, 'fraction_numerical': 0.014086926644906373, 'mean_word_length': 4.067014795474326, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2074093', 'n_tokens_mistral': 2639, 'n_tokens_neox': 2539, 'n_words': 608}