aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-07-12 17:51:51 +0300
committerBonfaceKilz2024-07-12 17:58:15 +0300
commit98eaa9602dd742b3f25d031bc2f3c56d56104ce5 (patch)
treec51ce223cf39970af8e4f68a4e672d8296906a71 /scripts
parentbb82331010954863998ecc615a85dda348f18c85 (diff)
downloadgenenetwork3-98eaa9602dd742b3f25d031bc2f3c56d56104ce5.tar.gz
Rename hash_rdf_graph -> md5hash_ttl_dir.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/index-genenetwork6
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/index-genenetwork b/scripts/index-genenetwork
index 8e16543..2779abc 100755
--- a/scripts/index-genenetwork
+++ b/scripts/index-genenetwork
@@ -240,7 +240,7 @@ def build_rdf_cache(sparql_uri: str, query: str, remove_common_words: bool = Fal
return smaller_cache
-def hash_rdf_graph(ttl_dir: pathlib.Path) -> str:
+def md5hash_ttl_dir(ttl_dir: pathlib.Path) -> str:
if not ttl_dir.exists():
return "-1"
ttl_hash = hashlib.new("md5")
@@ -530,7 +530,7 @@ def is_data_modified(xapian_directory: str,
# Return a zero exit status code when the data has changed;
# otherwise exit with a 1 exit status code.
generif = pathlib.Path("/var/lib/data/")
- if (db.get_metadata("generif-checksum").decode() == hash_rdf_graph(generif) and
+ if (db.get_metadata("generif-checksum").decode() == md5hash_ttl_dir(generif) and
db.get_metadata("checksums").decode() == checksums):
sys.exit(1)
sys.exit(0)
@@ -587,7 +587,7 @@ def create_xapian_index(xapian_directory: str, sql_uri: str,
logging.info("Writing generif checksums into index")
db.set_metadata(
"generif-checksum",
- hash_rdf_graph(pathlib.Path("/var/lib/data/")).encode())
+ md5hash_ttl_dir(pathlib.Path("/var/lib/data/")).encode())
for child in combined_index.iterdir():
shutil.move(child, xapian_directory)
logging.info("Index built")