aboutsummaryrefslogtreecommitdiffstats
path: root/webmap-download
Commit message (Collapse)AuthorAgeFiles
* Set and restore umask to ensure lockfiles are atomically created with mode 0664.Guilhem Moulin2025-04-281
| | | | | Using the default 0022 yields lock files with g-w, so trying to flock(2) from a different user failed.
* webmap-download: Don't fail for sourceless layers.Guilhem Moulin2025-04-281
| | | | | Cf. for instance svk:transmissionsnatsprojekt. It has an import definition, but no source path/URL for webmap-download to operate on.
* webmap-import: Add a cache layer and store the source file's last ↵Guilhem Moulin2025-04-231
| | | | | | | | | | | | | | | | | | | | | | | | modification time. That way we can avoid the expensive unpack+import when the source file(s) have not been updated since the last run. The check can be bypassed with a new flag `--force`. We use a sequence for the FID:s (primary key) and a UNIQUE constraint on triplets (source_path, archive_member, layername) as GDAL doesn't support multicolumns primary keys. To avoid races between the stat(2) calls, gdal.OpenEx() and updates via `webmap-download` runs we place a shared lock on the downloaded files. One could resort to some tricks to eliminate the race between the first two, but there is also some value in having consistency during the entire execution of the script (a single source file can be used by multiple layers for instance, and it makes sense to use the very same file for all layers in that case). We also intersperse dso.FlushCache() calls between _importSource() calls in order to force the PG driver to call EndCopy() to detect errors and trigger a rollback when _importSource() fails.
* webmap-import: Major refactoring.Guilhem Moulin2025-04-191
|
* webmap-download: Add a --force flag to always download regardless of age.Guilhem Moulin2025-04-191
|
* Factor sources in config.yml.Guilhem Moulin2025-04-191
| | | | | | | | | This avoid duplications when the same source file is used multiple times (either by the same layer or by multiple layers). This change breaks webmap-import, but that one will be refactored shortly. It also breaks webmap-import-mrr.py, which is no longer used since mineralrattigheter.zip can be downloaded from SGU's site directly.
* Add type hints and refactor a bit to please pylint.Guilhem Moulin2025-04-191
|
* Add layers from Svenska Kraftnät (SvK).Guilhem Moulin2024-10-191
|
* Use systemd.journal to log to journald when sarted via .service files.Guilhem Moulin2024-06-111
| | | | This enables proper filtering by level etc. (incl. journald coloring).
* config.yml: Allow configuration setting at the layer root.Guilhem Moulin2024-06-091
| | | | | We'll need that for layer creation (description, fields, creation options, etc.).
* webmap-download*: Use +=.Guilhem Moulin2024-06-081
|
* webmap-download: Improve usage text.Guilhem Moulin2024-06-051
|
* webmap-download: Use sha256_hex() for lock file names.Guilhem Moulin2024-06-031
| | | | Instead of sha1_hex().
* webmap-download: Make --debug repeatable and skip HTTP debugging if it's ↵Guilhem Moulin2024-06-031
| | | | | | | passed only once. This makes --debug less verbose by default and is useful for modules that do lots of HTTP connections such as WMS probing.
* Add GPL-3+ license headers.Guilhem Moulin2024-06-031
|
* webmap-download: Move format_bytes() and format_time() to common.py.Guilhem Moulin2024-06-031
|
* webmap-download: Replace pathlib.as_posix() with str().Guilhem Moulin2024-06-031
| | | | | We most likely only support POSIX systems, but best to hard code the dependency.
* webmap-download: Improve comment.Guilhem Moulin2024-06-031
|
* webmap-download: Refactor download().Guilhem Moulin2024-06-031
|
* webmap-download: Fix check for download duplicates.Guilhem Moulin2024-06-021
| | | | dest needs to be stringified before the membership check.
* webmap-download: Add --quiet flag to always skip progress bars.Guilhem Moulin2024-06-021
|
* webmap-download: Set --exit-code by default.Guilhem Moulin2024-06-021
| | | | This can be turned off with --no-exit-code.
* webmap-download: Ensure we always call linkat() not link().Guilhem Moulin2024-06-021
| | | | | | | | | | | | | This costs an extra file descriptor when --cachedir is unsed, but os.link(f'/proc/self/fd/{fp.fileno()}', newpath, dst_dir_fd=None, follow_symlinks=True) calls link("/proc/self/fd/…", newpath) rather than linkat(AT_FDCWD, "/proc/self/fd/…", AT_FDCWD, newpath, AT_SYMLINK_FOLLOW) and the former fails with EXDEV (Invalid cross-device link).
* Rename script into module and run module.download().Guilhem Moulin2024-06-021
| | | | | Instead of using a dedicated executable. There is too much code duplicate otherwise.
* webmap-download: Simplify locking logic.Guilhem Moulin2024-06-021
| | | | | Don't use a lockdir by default, and always use lockfiles of the form ‘sha1_hex(path).lck’ if --lockdir is set.
* webmap-download: Add a progress bar.Guilhem Moulin2024-06-011
|
* Add `webmap-download` script.Guilhem Moulin2024-06-011