Skip to content

Commit

Permalink
Attempted to find a way to download an MD5 of a file and compare it t…
Browse files Browse the repository at this point in the history
…o a local hash before downloading the full file.
  • Loading branch information
joeflack4 committed Apr 1, 2023
1 parent fa1c8a7 commit a5040b3
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion src/ontology/mondo-ingest.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,44 @@ $(TMPDIR)/ordo_relevant_signature.txt: component-download-ordo.owl | $(TMPDIR)
#######################################
### Ingest Components #################
#######################################

# This section is concerned with transforming the incoming sources into the
# Monarch Ingest schema.

# TODO: temporarily moved over from ODK Makefile as proof of concept for https://github.com/monarch-initiative/mondo-ingest/issues/256
OMIM_URI=https://github.com/monarch-initiative/omim/releases/latest/download/omim.ttl
.PHONY: component-download-omim.owl
component-download-omim.owl: | $(TMPDIR)
echo couldn't find a way that worked

# failed attempts
# https://stackoverflow.com/questions/2019989/how-to-assign-the-output-of-a-command-to-a-makefile-variable
# - i see DIFF=hi in terminal, but echo is blank
# DIFF=$(shell echo hi); echo $(DIFF)

# https://www.gnu.org/software/make/manual/html_node/Conditional-Example.html
#component-download-omim.owl: | $(TMPDIR)
# wget $(OMIM_URI).md5 -O $(TMPDIR)/tmp.md5
#ifeq ($(diff $(TMPDIR)/tmp.md5 $(TMPDIR)/omim.ttl.md5), "")
# echo hi
#endif

# https://stackoverflow.com/questions/3611846/bash-using-the-result-of-a-diff-in-a-if-statement
# - tried various ways. evaluated to "IFF", or results of variable not stored. tried with $(eval ...) too.
# if [ $(MIR) = true ] && [ $(COMP) = true ]; then wget $(OMIM_URI).md5 -O $(TMPDIR)/tmp.md5; \
# DIFF=$(diff $(TMPDIR)/tmp.md5 $(TMPDIR)/omim-bad.ttl.md5); \
# if [ "${DIFF}" == "" ]; \
# then echo "${DIFF}"; fi; fi

# https://stackoverflow.com/questions/3611846/bash-using-the-result-of-a-diff-in-a-if-statement
# - also tried with: $(shell diff $(TMPDIR)/tmp.md5 $(TMPDIR)/omim-bad.ttl.md5) &>/dev/null and got /bin/sh: 38141b8c7b3a1f769c997d22dc84e30b: No such file or directory . also tried "&>/dev/null" inside of $()
# if [ $(MIR) = true ] && [ $(COMP) = true ]; then wget $(OMIM_URI).md5 -O $(TMPDIR)/tmp.md5; \
# if [ ! diff $(TMPDIR)/tmp.md5 $(TMPDIR)/omim.ttl.md5 &>/dev/null ]; \
# then echo DOWNLOADING; fi; fi

# todo: also: instead of passing URI to robot, would need to DL and store md5 as <DOWNLOAD_NAME>.md5
# if [ $(MIR) = true ] && [ $(COMP) = true ]; then $(ROBOT) merge -I https://github.com/monarch-initiative/omim/releases/latest/download/omim.ttl \
# annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) -o $(TMPDIR)/[email protected]; fi

# Illegal punning on some properties #60: https://github.com/monarch-initiative/omim/issues/60
# todo: what does this have to do with #60 exactly? Does it address it? can that issue be closed?
$(COMPONENTSDIR)/omim.owl: $(TMPDIR)/omim_relevant_signature.txt | component-download-omim.owl
Expand Down

0 comments on commit a5040b3

Please sign in to comment.