[Git][debian-gis-team/osm2pgsql][master] 4 commits: New upstream version 2.1.1+ds
Bas Couwenberg (@sebastic)
gitlab at salsa.debian.org
Mon Apr 14 14:45:13 BST 2025
Bas Couwenberg pushed to branch master at Debian GIS Project / osm2pgsql
Commits:
4d85e48d by Bas Couwenberg at 2025-04-14T15:29:37+02:00
New upstream version 2.1.1+ds
- - - - -
0e9bf4bb by Bas Couwenberg at 2025-04-14T15:29:40+02:00
Update upstream source from tag 'upstream/2.1.1+ds'
Update to upstream version '2.1.1+ds'
with Debian dir c521d5c6b475853413b3d013f86cf6df0362a397
- - - - -
43e27517 by Bas Couwenberg at 2025-04-14T15:29:50+02:00
New upstream release.
- - - - -
b6cbf7fb by Bas Couwenberg at 2025-04-14T15:30:35+02:00
Set distribution to unstable.
- - - - -
16 changed files:
- CMakeLists.txt
- CONTRIBUTING.md
- debian/changelog
- man/osm2pgsql-gen.1
- man/osm2pgsql-replication.1
- man/osm2pgsql.1
- scripts/osm2pgsql-replication
- src/flex-table.cpp
- src/middle-pgsql.cpp
- src/middle-ram.cpp
- src/node-persistent-cache.cpp
- src/node-persistent-cache.hpp
- + tests/bdd/flex/table-ids.feature
- tests/bdd/regression/properties.feature
- tests/bdd/steps/geometry_factory.py
- tests/test-persistent-cache.cpp
Changes:
=====================================
CMakeLists.txt
=====================================
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.10.0)
-project(osm2pgsql VERSION 2.1.0 LANGUAGES CXX C)
+project(osm2pgsql VERSION 2.1.1 LANGUAGES CXX C)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
=====================================
CONTRIBUTING.md
=====================================
@@ -213,7 +213,9 @@ the report.
* Decide on a new version. (See [semantic versioning](https://semver.org/).)
* Update version in [CMakeLists.txt](CMakeLists.txt), look for `project` function.
-* Build man page (`make man`) and copy it to `man/osm2pgsql.1`.
+* Update man pages
+ * Build man page: `make man`
+ * Copy to source: `cp man/*1 ../man/`
* Tag release with release notes in commit message and upload the tag to Github.
* Fill out release notes on Github.
* Copy Windows binaries and source tarball to osm2pgsql.org.
=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+osm2pgsql (2.1.1+ds-1) unstable; urgency=medium
+
+ * New upstream release.
+
+ -- Bas Couwenberg <sebastic at debian.org> Mon, 14 Apr 2025 15:30:22 +0200
+
osm2pgsql (2.1.0+ds-1) unstable; urgency=medium
* New upstream release.
=====================================
man/osm2pgsql-gen.1
=====================================
@@ -1,4 +1,4 @@
-.TH "OSM2PGSQL" "1" "2.1.0" "" ""
+.TH "OSM2PGSQL" "1" "2.1.1" "" ""
.SH NAME
.PP
osm2pgsql-gen - Generalize OpenStreetMap data - EXPERIMENTAL!
=====================================
man/osm2pgsql-replication.1
=====================================
@@ -1,4 +1,4 @@
-.TH "OSM2PGSQL-REPLICATION" "1" "2.1.0" "" ""
+.TH "OSM2PGSQL-REPLICATION" "1" "2.1.1" "" ""
.SH NAME
osm2pgsql-replication \- osm2pgsql database updater
.SH SYNOPSIS
=====================================
man/osm2pgsql.1
=====================================
@@ -1,4 +1,4 @@
-.TH "OSM2PGSQL" "1" "2.1.0" "" ""
+.TH "OSM2PGSQL" "1" "2.1.1" "" ""
.SH NAME
.PP
osm2pgsql - OpenStreetMap data to PostgreSQL converter
=====================================
scripts/osm2pgsql-replication
=====================================
@@ -676,7 +676,7 @@ def get_parser():
cmd.add_argument('--max-diff-size', type=int, default=500,
help='Maximum data to load in MB (default: 500MB)')
cmd.add_argument('--osm2pgsql-cmd', default=str(OSM2PGSQL_PATH),
- help=f'Path to osm2pgsql command (default: {OSM2PGSQL_PATH})')
+ help=f'Path to osm2pgsql command')
cmd.add_argument('--once', action='store_true',
help='Run updates only once, even when more data is available.')
cmd.add_argument('--post-processing', metavar='SCRIPT',
=====================================
src/flex-table.cpp
=====================================
@@ -76,8 +76,9 @@ bool flex_table_t::has_id_column() const noexcept
bool flex_table_t::matches_type(osmium::item_type type) const noexcept
{
- // This table takes any type -> okay
- if (m_id_type == flex_table_index_type::any_object) {
+ // This table takes any type or has no ids -> okay
+ if (m_id_type == flex_table_index_type::any_object ||
+ m_id_type == flex_table_index_type::no_index) {
return true;
}
=====================================
src/middle-pgsql.cpp
=====================================
@@ -1248,7 +1248,7 @@ middle_pgsql_t::middle_pgsql_t(std::shared_ptr<thread_pool_t> thread_pool,
} else {
m_store_options.use_flat_node_file = true;
m_persistent_cache = std::make_shared<node_persistent_cache>(
- options->flat_node_file, options->droptemp);
+ options->flat_node_file, !options->append, options->droptemp);
}
log_debug("Mid: pgsql, cache={}", options->cache);
=====================================
src/middle-ram.cpp
=====================================
@@ -80,7 +80,7 @@ middle_ram_t::middle_ram_t(std::shared_ptr<thread_pool_t> thread_pool,
if (!options->flat_node_file.empty()) {
m_persistent_cache = std::make_shared<node_persistent_cache>(
- options->flat_node_file, options->droptemp);
+ options->flat_node_file, !options->append, options->droptemp);
}
}
=====================================
src/node-persistent-cache.cpp
=====================================
@@ -29,15 +29,24 @@ osmium::Location node_persistent_cache::get(osmid_t id) const noexcept
}
node_persistent_cache::node_persistent_cache(std::string file_name,
- bool remove_file)
+ bool create_file, bool remove_file)
: m_file_name(std::move(file_name)), m_remove_file(remove_file)
{
assert(!m_file_name.empty());
log_debug("Loading persistent node cache from '{}'.", m_file_name);
- // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg, hicpp-signed-bitwise)
- m_fd = open(m_file_name.c_str(), O_RDWR | O_CREAT, 0644);
+ int flags = O_RDWR; // NOLINT(hicpp-signed-bitwise)
+ if (create_file) {
+ flags |= O_CREAT; // NOLINT(hicpp-signed-bitwise)
+ }
+
+#ifdef _WIN32
+ flags |= O_BINARY; // NOLINT(hicpp-signed-bitwise)
+#endif
+
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
+ m_fd = open(m_file_name.c_str(), flags, 0644);
if (m_fd < 0) {
throw std::system_error{
errno, std::system_category(),
=====================================
src/node-persistent-cache.hpp
=====================================
@@ -21,7 +21,8 @@
class node_persistent_cache
{
public:
- node_persistent_cache(std::string file_name, bool remove_file);
+ node_persistent_cache(std::string file_name, bool create_file,
+ bool remove_file);
~node_persistent_cache() noexcept;
node_persistent_cache(node_persistent_cache const &) = delete;
=====================================
tests/bdd/flex/table-ids.feature
=====================================
@@ -0,0 +1,57 @@
+Feature: Test for correct id column generation
+
+ Background:
+ Given the 0.1 grid
+ | 1 | | 2 |
+ | 3 | | 4 |
+
+ Scenario: Data can be inserted into tables without an iD column
+ Given the lua style
+ """
+ local simple = osm2pgsql.define_table{
+ name = 'simple',
+ columns = {{ column = 'id', type = 'bigint'}}
+ }
+
+ function osm2pgsql.process_node(object)
+ simple:insert{ id = object.id }
+ end
+
+ function osm2pgsql.process_way(object)
+ simple:insert{ id = object.id }
+ end
+
+ function osm2pgsql.process_relation(object)
+ simple:insert{ id = object.id }
+ end
+ """
+ And the OSM data
+ """
+ n1 Tp=1
+ n2 Tp=2
+ w10 Tp=10 Nn1,n2,n4
+ r100 Tp=100 Mn1@,n2@
+ """
+ When running osm2pgsql flex with parameters
+ | --slim |
+ Then table simple contains
+ | id |
+ | 1 |
+ | 2 |
+ | 10 |
+ | 100 |
+ Given the OSM data
+ """
+ n1 v2 dD
+ w11 Tp=11 Nn1,n3
+ """
+ When running osm2pgsql flex with parameters
+ | --slim | -a |
+ Then table simple contains
+ | id |
+ | 1 |
+ | 2 |
+ | 10 |
+ | 11 |
+ | 100 |
+
=====================================
tests/bdd/regression/properties.feature
=====================================
@@ -62,10 +62,25 @@ Feature: Updates to the test database with properties check
| | | Not using flat node file (same as on import). |
| --flat-nodes=x | | Using flat node file |
| --flat-nodes=x | --flat-nodes=x | Using flat node file |
- | --flat-nodes=x | --flat-nodes=y | Using the flat node file you specified |
| --prefix=abc | | Using prefix 'abc' (same as on import). |
+ Scenario: Create, then append with non-existent flat node file
+ When running osm2pgsql pgsql with parameters
+ | --slim |
+ | --flat-nodes=x |
+
+ Given the input file '000466354.osc.gz'
+ Then running osm2pgsql pgsql with parameters fails
+ | -a |
+ | --slim |
+ | --flat-nodes=y |
+ And the error output contains
+ """
+ Unable to open flatnode file
+ """
+
+
Scenario: Create with different output than append
When running osm2pgsql pgsql with parameters
| --slim |
=====================================
tests/bdd/steps/geometry_factory.py
=====================================
@@ -104,7 +104,7 @@ class GeometryFactory:
assert ' y' not in line
coords = self.grid_node(nid)
- assert coords is not None, f"Coordinates missing for node {node}"
+ assert coords is not None, f"Coordinates missing for node {nid}"
nodes[i] = f"{line} x{coords[0]:.{self.grid_precision}f} y{coords[1]:.{self.grid_precision}f}"
todos.discard(nid)
=====================================
tests/test-persistent-cache.cpp
=====================================
@@ -43,7 +43,7 @@ TEST_CASE("Persistent cache", "[NoDB]")
// create a new cache
{
- node_persistent_cache cache{flat_node_file, false};
+ node_persistent_cache cache{flat_node_file, true, false};
// write in order
write_and_read_location(&cache, 10, 10.01, -45.3);
@@ -66,7 +66,7 @@ TEST_CASE("Persistent cache", "[NoDB]")
// reopen the cache
{
- node_persistent_cache cache{flat_node_file, false};
+ node_persistent_cache cache{flat_node_file, false, false};
// read all previously written locations
read_location(cache, 10, 10.01, -45.3);
@@ -107,3 +107,12 @@ TEST_CASE("Persistent cache", "[NoDB]")
read_location(cache, 9934, -179.999, 89.1);
}
}
+
+TEST_CASE("Opening non-existent persistent cache should fail in append mode", "[NoDB]")
+{
+ std::string const flat_node_file =
+ "test_middle_flat.nonexistent.flat.nodes.bin";
+ testing::cleanup::file_t const flatnode_cleaner{flat_node_file};
+
+ REQUIRE_THROWS(node_persistent_cache(flat_node_file, false, false));
+}
View it on GitLab: https://salsa.debian.org/debian-gis-team/osm2pgsql/-/compare/6d04eaf8326b3cbcb71d52e896e6086f89f96798...b6cbf7fb643f096c3a3e805450cf9be4d3fde578
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/osm2pgsql/-/compare/6d04eaf8326b3cbcb71d52e896e6086f89f96798...b6cbf7fb643f096c3a3e805450cf9be4d3fde578
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20250414/02f44f09/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list