Skip to content

Commit d2dd263

Browse files
committed
Merge remote-tracking branch 'upstream/master' into inputmasking
2 parents 0b2c609 + c008e97 commit d2dd263

File tree

97 files changed

+1374
-315
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1374
-315
lines changed

.github/workflows/code_checks.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,17 @@ jobs:
235235
git diff
236236
git diff --quiet || (echo "You need to run scripts/collect_config_options to update port/cpl_known_config_options.h" && /bin/false)
237237
238+
check-driver-connection-prefix:
239+
runs-on: ubuntu-latest
240+
steps:
241+
- name: Checkout
242+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
243+
- name: Set up Python
244+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
245+
with:
246+
python-version: 3.8
247+
- name: Check cmakelist
248+
run: |
249+
python scripts/collect_driver_connection_prefix.py
250+
git diff
251+
git diff --quiet || (echo "You need to run scripts/collect_driver_connection_prefix.py to update gcore/gdal_known_connection_prefixes.h" && /bin/false)

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
# We do that after running CMake to avoid CodeQL to trigger during CMake time,
109109
# in particular during HDF5 detection which is terribly slow (https://github.com/OSGeo/gdal/issues/9549)
110110
- name: Initialize CodeQL
111-
uses: github/codeql-action/init@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
111+
uses: github/codeql-action/init@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
112112
with:
113113
languages: ${{ matrix.language }}
114114
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -128,6 +128,6 @@ jobs:
128128
cmake --build build -j$(nproc)
129129
130130
- name: Perform CodeQL Analysis
131-
uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
131+
uses: github/codeql-action/analyze@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
132132
with:
133133
category: "/language:${{matrix.language}}"

.github/workflows/delete_untagged_containers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
if: github.repository == 'OSGeo/gdal'
2020
steps:
2121
- name: Delete all containers from gdal-deps without tags
22-
uses: Chizkiyahu/delete-untagged-ghcr-action@4a33ce3cf2456d2aef98a1b6c60a12dad56cffd9 # v6.0.0
22+
uses: Chizkiyahu/delete-untagged-ghcr-action@68758dd8caf1d9dbaed1fe9cc1a1f8fcea1c4cf0 # v6.1.0
2323
with:
2424
token: ${{ secrets.PAT_TOKEN_DELETE_UNTAGGED_CONTAINERS }}
2525
repository_owner: ${{ github.repository_owner }}

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ jobs:
7171

7272
# Upload the results to GitHub's code scanning dashboard.
7373
- name: "Upload to code-scanning"
74-
uses: github/codeql-action/upload-sarif@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
74+
uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
7575
with:
7676
sarif_file: results.sarif

.github/workflows/ubuntu_24.04/Dockerfile.ci

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ RUN apt-get update \
9999
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 unixodbc-dev
100100

101101
# Build mongo-c-driver
102-
ARG MONGO_C_DRIVER_VERSION=1.24.4
102+
ARG MONGO_C_DRIVER_VERSION=2.0.2
103103
RUN mkdir mongo-c-driver \
104104
&& wget -q https://github.com/mongodb/mongo-c-driver/releases/download/${MONGO_C_DRIVER_VERSION}/mongo-c-driver-${MONGO_C_DRIVER_VERSION}.tar.gz -O - \
105105
| tar xz -C mongo-c-driver --strip-components=1 \
@@ -113,7 +113,7 @@ RUN mkdir mongo-c-driver \
113113
&& rm -rf mongo-c-driver
114114

115115
# Build mongocxx
116-
ARG MONGOCXX_VERSION=3.8.1
116+
ARG MONGOCXX_VERSION=4.1.1
117117
RUN mkdir mongocxx \
118118
&& wget -q https://github.com/mongodb/mongo-cxx-driver/archive/r${MONGOCXX_VERSION}.tar.gz -O - \
119119
| tar xz -C mongocxx --strip-components=1 \

apps/gdalalg_abstract_pipeline.h

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ class GDALPipelineStepAlgorithm /* non final */ : public GDALAlgorithm
281281
std::vector<std::string> m_inputLayerNames{};
282282

283283
// Output arguments
284+
bool m_stdout = false;
285+
std::string m_output{};
284286
GDALArgDatasetValue m_outputDataset{};
285287
std::string m_format{};
286288
std::vector<std::string> m_creationOptions{};
@@ -678,12 +680,19 @@ bool GDALAbstractPipelineAlgorithm<StepAlgorithm>::RunStep(
678680
{
679681
stepCtxt.m_poNextUsableStep = m_steps[i + 1].get();
680682
}
683+
if (i + 1 == m_steps.size() && StepAlgorithm::m_stdout &&
684+
step->GetArg("stdout") != nullptr)
685+
{
686+
step->m_stdout = true;
687+
}
681688
if (!step->ValidateArguments() || !step->RunStep(stepCtxt))
682689
{
683690
return false;
684691
}
685692
poCurDS = step->m_outputDataset.GetDatasetRef();
686-
if (!poCurDS)
693+
if (!poCurDS &&
694+
!(i + 1 == m_steps.size() &&
695+
(!step->m_output.empty() || step->GetArg("stdout") != nullptr)))
687696
{
688697
StepAlgorithm::ReportError(
689698
CE_Failure, CPLE_AppDefined,
@@ -698,10 +707,17 @@ bool GDALAbstractPipelineAlgorithm<StepAlgorithm>::RunStep(
698707
}
699708
}
700709

701-
if (ctxt.m_pfnProgress)
710+
if (ctxt.m_pfnProgress &&
711+
m_steps.back()->GetArg("output-string") == nullptr)
702712
ctxt.m_pfnProgress(1.0, "", ctxt.m_pProgressData);
703713

704-
if (!StepAlgorithm::m_outputDataset.GetDatasetRef())
714+
if (!m_steps.back()->m_output.empty())
715+
{
716+
auto outputStringArg = StepAlgorithm::GetArg("output-string");
717+
if (outputStringArg && outputStringArg->GetType() == GAAT_STRING)
718+
outputStringArg->Set(m_steps.back()->m_output);
719+
}
720+
else if (!StepAlgorithm::m_outputDataset.GetDatasetRef())
705721
{
706722
StepAlgorithm::m_outputDataset.Set(poCurDS);
707723
}

apps/gdalalg_dispatcher.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ class GDALDispatcherAlgorithm : public GDALAlgorithm
3333
const std::string &helpURL)
3434
: GDALAlgorithm(name, description, helpURL),
3535
m_rasterDispatcher(std::make_unique<RasterDispatcher>(
36-
/* openForMixedRasterVector = */ true)),
37-
m_vectorDispatcher(std::make_unique<VectorDispatcher>())
36+
/* standalone = */ true, /* openForMixedRasterVector = */ true)),
37+
m_vectorDispatcher(
38+
std::make_unique<VectorDispatcher>(/* standalone = */ true))
3839
{
3940
// A "info" dispacher command is a shortcut for something like
4041
// "raster info", "vector info". Best to expose the latter.

apps/gdalalg_pipeline.cpp

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
#include "gdalalg_raster_contour.h"
2929
#include "gdalalg_raster_footprint.h"
3030
#include "gdalalg_raster_polygonize.h"
31+
#include "gdalalg_raster_info.h"
3132
#include "gdalalg_vector_grid.h"
33+
#include "gdalalg_vector_info.h"
3234
#include "gdalalg_vector_rasterize.h"
3335

3436
#include <algorithm>
@@ -219,9 +221,19 @@ bool GDALPipelineStepAlgorithm::RunImpl(GDALProgressFunc pfnProgress,
219221

220222
std::unique_ptr<GDALPipelineStepAlgorithm> writeAlg;
221223
if (GetOutputType() == GDAL_OF_RASTER)
222-
writeAlg = std::make_unique<GDALRasterWriteAlgorithm>();
224+
{
225+
if (GetName() == GDALRasterInfoAlgorithm::NAME)
226+
writeAlg = std::make_unique<GDALRasterInfoAlgorithm>();
227+
else
228+
writeAlg = std::make_unique<GDALRasterWriteAlgorithm>();
229+
}
223230
else
224-
writeAlg = std::make_unique<GDALVectorWriteAlgorithm>();
231+
{
232+
if (GetName() == GDALVectorInfoAlgorithm::NAME)
233+
writeAlg = std::make_unique<GDALVectorInfoAlgorithm>();
234+
else
235+
writeAlg = std::make_unique<GDALVectorWriteAlgorithm>();
236+
}
225237
for (auto &arg : writeAlg->GetArgs())
226238
{
227239
auto stepArg = GetArg(arg->GetName());
@@ -252,8 +264,9 @@ bool GDALPipelineStepAlgorithm::RunImpl(GDALProgressFunc pfnProgress,
252264
}
253265
else if (readAlg->Run())
254266
{
267+
auto outputArg = GetArg(GDAL_ARG_NAME_OUTPUT);
255268
const bool bOutputSpecified =
256-
GetArg(GDAL_ARG_NAME_OUTPUT)->IsExplicitlySet();
269+
outputArg && outputArg->IsExplicitlySet();
257270

258271
m_inputDataset.clear();
259272
m_inputDataset.resize(1);
@@ -402,6 +415,14 @@ class GDALPipelineAlgorithm final
402415
.SetHiddenForCLI()
403416
.SetPositional();
404417

418+
AddOutputStringArg(&m_output).SetHiddenForCLI();
419+
AddArg(
420+
"stdout", 0,
421+
_("Directly output on stdout (format=text mode only). If enabled, "
422+
"output-string will be empty"),
423+
&m_stdout)
424+
.SetHidden();
425+
405426
GDALRasterPipelineAlgorithm::RegisterAlgorithms(m_stepRegistry, true);
406427
GDALVectorPipelineAlgorithm::RegisterAlgorithms(m_stepRegistry, true);
407428
m_stepRegistry.Register<GDALRasterContourAlgorithm>();
@@ -618,24 +639,28 @@ bool GDALPipelineAlgorithm::ParseCommandLineArguments(
618639
if (!CheckFirstStep(stepAlgs))
619640
return false; // CheckFirstStep emits an error
620641

621-
if (steps.back().alg->GetName() != GDALRasterWriteAlgorithm::NAME)
642+
if (steps.back().alg->GetName() != GDALRasterWriteAlgorithm::NAME &&
643+
steps.back().alg->GetName() != GDALRasterInfoAlgorithm::NAME)
622644
{
623645
if (helpRequested)
624646
{
625647
steps.back().alg->ParseCommandLineArguments(steps.back().args);
626648
return false;
627649
}
628-
ReportError(CE_Failure, CPLE_AppDefined, "Last step should be '%s'",
629-
GDALRasterWriteAlgorithm::NAME);
650+
ReportError(
651+
CE_Failure, CPLE_AppDefined, "Last step should be '%s' or '%s'",
652+
GDALRasterWriteAlgorithm::NAME, GDALRasterInfoAlgorithm::NAME);
630653
return false;
631654
}
632655
for (size_t i = 0; i < steps.size() - 1; ++i)
633656
{
634-
if (steps[i].alg->GetName() == GDALRasterWriteAlgorithm::NAME)
657+
if (steps[i].alg->GetName() == GDALRasterWriteAlgorithm::NAME ||
658+
steps[i].alg->GetName() == GDALRasterInfoAlgorithm::NAME)
635659
{
636660
ReportError(CE_Failure, CPLE_AppDefined,
637-
"Only last step can be '%s'",
638-
GDALRasterWriteAlgorithm::NAME);
661+
"Only last step can be '%s' or '%s'",
662+
GDALRasterWriteAlgorithm::NAME,
663+
GDALRasterInfoAlgorithm::NAME);
639664
return false;
640665
}
641666
}
@@ -764,6 +789,8 @@ bool GDALPipelineAlgorithm::ParseCommandLineArguments(
764789
steps[i].alg->SetCallPath({steps[i].alg->GetName()});
765790
steps[i].alg->SetReferencePathForRelativePaths(
766791
GetReferencePathForRelativePaths());
792+
if (IsCalledFromCommandLine())
793+
steps[i].alg->SetCalledFromCommandLine();
767794
steps[i].alreadyChangedType = true;
768795
}
769796
else if (steps[i].alg->GetInputType() != nLastStepOutputType)
@@ -896,17 +923,18 @@ GDALPipelineAlgorithm::GetUsageForCLI(bool shortUsage,
896923
ret += alg->GetUsageForCLI(shortUsage, stepUsageOptions);
897924
}
898925
}
926+
for (const std::string &name :
927+
{std::string(GDALRasterInfoAlgorithm::NAME) + RASTER_SUFFIX,
928+
std::string(GDALRasterWriteAlgorithm::NAME) + RASTER_SUFFIX,
929+
std::string(GDALVectorInfoAlgorithm::NAME) + VECTOR_SUFFIX,
930+
std::string(GDALVectorWriteAlgorithm::NAME) + VECTOR_SUFFIX})
899931
{
900932
ret += '\n';
901-
auto alg = std::make_unique<GDALRasterWriteAlgorithm>();
902-
alg->SetCallPath({alg->GetName()});
903-
ret += alg->GetUsageForCLI(shortUsage, stepUsageOptions);
904-
}
905-
{
906-
ret += '\n';
907-
auto alg = std::make_unique<GDALVectorWriteAlgorithm>();
933+
auto alg = GetStepAlg(name);
908934
assert(alg);
909-
alg->SetCallPath({alg->GetName()});
935+
alg->SetCallPath({CPLString(alg->GetName())
936+
.replaceAll(RASTER_SUFFIX, "")
937+
.replaceAll(VECTOR_SUFFIX, "")});
910938
ret += alg->GetUsageForCLI(shortUsage, stepUsageOptions);
911939
}
912940

apps/gdalalg_raster.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class GDALRasterAlgorithm final : public GDALAlgorithm
7777

7878
AddOutputStringArg(&m_output);
7979

80-
RegisterSubAlgorithm<GDALRasterInfoAlgorithm>();
80+
RegisterSubAlgorithm<GDALRasterInfoAlgorithmStandalone>();
8181
RegisterSubAlgorithm<GDALRasterAspectAlgorithmStandalone>();
8282
RegisterSubAlgorithm<GDALRasterCalcAlgorithmStandalone>();
8383
RegisterSubAlgorithm<GDALRasterCleanCollarAlgorithm>();

apps/gdalalg_raster_convert.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
/************************************************************************/
2828

2929
GDALRasterConvertAlgorithm::GDALRasterConvertAlgorithm(
30-
bool openForMixedRasterVector)
30+
bool /* standalone */, bool openForMixedRasterVector)
3131
: GDALAlgorithm(NAME, DESCRIPTION, HELP_URL)
3232
{
3333
AddProgressArg();

0 commit comments

Comments
 (0)