diff --git a/bin/swh-loader-dir b/bin/swh-loader-dir new file mode 100755 index 0000000..0d4be19 --- /dev/null +++ b/bin/swh-loader-dir @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2015 The Software Heritage developers +# See the AUTHORS file at the top-level directory of this distribution +# License: GNU General Public License version 3, or any later version +# See top-level LICENSE file for more information + +import logging +import sys + +from swh.core.logger import PostgresHandler +from swh.loader.dir import DirLoader + + +ADDITIONAL_CONFIG = { + 'dir_path': ('str', None), + + # origin information + 'origin_url': ('str', 'file:///dev/null'), + # occurrence information + 'branch': ('str', 'master'), + 'authority': ('int', 1), + 'validity': ('str', '2015-01-01 00:00:00+00'), + # revision information + 'revision_date': ('str', '2015-01-01 00:00:00+00'), + 'revision_offset': ('str', '2'), + 'revision_committer_date': ('str', '2015-01-01 00:00:00+00'), + 'revision_committer_offset': ('str', '2'), + 'revision_type': ('str', 'dir'), + 'revision_message': ('str', 'synthetic revision message'), + 'revision_author': ('str', 'swh author'), + 'revision_committer': ('str', 'swh committer') +} + + +my_config = BulkLoader.parse_config_file(config_filename=sys.argv[1], + additional_configs=[ADDITIONAL_CONFIG]) + + +logging.basicConfig( + level=logging.DEBUG, + format='%(asctime)s %(name)s %(levelname)s %(message)s', + handlers=[ + logging.StreamHandler(), + PostgresHandler(my_config['log_db']), + ], +) + +requests_log = logging.getLogger("requests") +requests_log.setLevel(logging.CRITICAL) + + + +loader = DirLoader(my_config) +loader.process(my_config['dir_path'])