Commit Graph

475 Commits

Author SHA1 Message Date
Michael Hirsch
87a40b720a
file(DOWNLOAD): Fix message for existing file with matching hash
file(DOWNLOAD STATUS) docs say the return list is of
length 2. However, when an already downloaded file
hash matches EXPECTED_HASH, the return message had
a semicolon that made the return list length 3.
Adjust the message to no longer contain the extra semicolon
and to more clearly describe the situation.
2022-08-23 22:40:28 +10:00
Brad King
6ecd741b5f cmFileCommand: Capture list of parsed keywords via binding 2022-07-25 13:52:11 -04:00
Brad King
f95a5832c7 cmArgumentParser: Drop unused keywordsMissingValue argument to Parse()
All clients have been converted to encoding this requirement in their
bindings.
2022-07-25 13:51:43 -04:00
Brad King
74ec6b63c2 cmFileCommand: Report keyword errors via argument parser results 2022-07-22 10:32:24 -04:00
Brad King
e98fd9d87e cmFileCommand: Use cm::optional for keyword argument presence 2022-07-20 16:03:12 -04:00
Brad King
f46b2e9142 cmArgumentParser: Model maybe-missing string with wrapper type
Bindings to `std::string` require one value.  Some clients have been
filtering `keywordsMissingValue` to support keywords that tolerate a
missing value.  Offer them a type-safe way to achieve this instead.
2022-07-07 09:49:04 -04:00
Brad King
e6d1e29ffa cmArgumentParser: Model maybe-empty and non-empty lists with wrapper types
Previously bindings to `std::vector<std::string>` required at least one
value.  Some clients have been filtering `keywordsMissingValue` to
support keywords followed by empty lists.  Instead, require clients to
specify whether a keyword's list can be empty as part of the binding
type.
2022-07-07 09:48:58 -04:00
Brad King
d21b391cde Merge topic 'file-TIMESTAMP-relative-path'
733801b57f file(TIMESTAMP): Interpret relative paths w.r.t. the source tree

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7440
2022-07-07 09:22:11 -04:00
TheBrokenRail
733801b57f file(TIMESTAMP): Interpret relative paths w.r.t. the source tree
Fixes: #23610
2022-07-06 09:28:21 -04:00
Brad King
bff468c988 cmFileCommand: Use cm::optional for keyword argument presence 2022-07-05 16:56:06 -04:00
Brad King
2873f41bd9 cmArgumentParser: Require callers to consider unparsed arguments 2022-07-05 16:35:01 -04:00
Brad King
1ee5a4a548 cmArgumentParser: Avoid allocating copies of keyword strings 2022-07-05 16:34:57 -04:00
Brad King
7c83265e59 file(ARCHIVE*): Simplify acceptance of empty list arguments
In `cmArgumentParser`, a keyword bound to a `std::vector<std::string>`
value is reported in the list of keywords with missing values if the
keyword appears followed by an empty list.  For cases where we want to
tolerate empty lists, clients need to filter out such keywords
themselves before producing an error message.  This may be improved in
the future, but that is out of scope here.

In commit c7e1198a23 (file: Add ARCHIVE_{CREATE|EXTRACT} subcommands,
2020-03-13, v3.18.0-rc1~530^2), a pattern for filtering out keywords
that accept empty lists was copied from commit c998c8d560
(file(GET_RUNTIME_DEPENDENCIES): Tolerate empty list arguments,
2020-01-22, v3.17.0-rc1~111^2~1) incorrectly in two ways:

* Keywords were included in the filter that do not accept empty lists.
* Keywords were not in sorted order, breaking the filter operation.

Those two bugs mostly canceled each other out, and the resulting
behavior was to correctly report keywords with missing values.
However, the `MTIME` keyword was accidentally accepted with no value
by pretending the keyword was not given at all.

Simplify the logic by removing keywords from the filters that should not
be there.  Leave `MTIME` in the filter for compatibility.
2022-06-29 17:43:41 -04:00
FeRD (Frank Dana)
98a10290a8 cmSystemTools: Fix 'ErrorOccurred' spelling
Rename the booleans 's_ErrorOccured' and 's_FatalErrorOccured' to
's_ErrorOccurred' and 's_FatalErrorOccurred', respectively.

Rename the getters and setters to 'Get[Fatal]ErrorOccurred' and
'Set[Fatal]ErrorOccurred', and fix all uses across the codebase.
2022-06-13 09:05:24 -04:00
Brad King
7c3169417d Merge topic 'curl-debug-callback'
e243b379ca cmFileCommand: Fix signature of CURLOPT_DEBUGFUNCTION callback

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7288
2022-05-24 10:09:35 -04:00
Ben Boeckel
16e6e4e7dd cmFileCommand: remove an unnecessary cast
`cmCryptoHash::New` already returns a `unique_ptr`.
2022-05-24 09:09:44 -04:00
Ben Boeckel
aa3649eb04 clang-tidy: fix performance-unnecessary-copy-initialization lints 2022-05-24 09:09:44 -04:00
Brad King
e243b379ca cmFileCommand: Fix signature of CURLOPT_DEBUGFUNCTION callback
Curl documents that the callback should return type `int`.
2022-05-23 10:05:06 -04:00
Kasper Laudrup
0b7fd783f8 cmake -E tar: Add --touch option
Similar to GNU tar add a --touch option to the tar extract command to
skip extracting the timestamps from the files in the archive
effectively touching them as if they were just created.

Issue: #22746
2022-03-23 14:41:34 +01:00
m.klimenko
231872ddb0 file(DOWNLOAD): Add options to download a range 2022-02-15 22:08:06 +03:00
Alexey Edelev
fd0c285b12 file: Fix types of the OFFSET and LIMIT arguments
OFFSET argument cannot handle offsets bigger than INT_MAX because of
the atoi function, which is used to convert the argument string to integer.
Same applies for the LIMIT argument.
Use the steam based reading and 64-bit types to convert and store arguments
to avoid invalid values stored in the corresponding variables.

Fixes: #23076
2022-01-13 11:56:49 +01:00
Brad King
d009622769 Merge topic 'file-READ_ELF-capture-error'
41bebbe50a file: Restore error capture in undocumented READ_ELF mode

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6853
2022-01-12 09:45:07 -05:00
Brad King
41bebbe50a file: Restore error capture in undocumented READ_ELF mode
Revise the error message added by commit 115ff6a347 (cmELF: Include the
ELF parsing code unconditionally, 2021-06-17, v3.22.0-rc1~557^2) to
honor the `CAPTURE_ERROR` option.  This is needed by the call site in
`BundleUtilities` to suppress errors on non-ELF files.

Fixes: #23074
2022-01-11 12:46:06 -05:00
Brad King
0d37dae5f9 cmFileCommand: Update for new signature of GetLineFromStream 2022-01-11 11:09:53 -05:00
Sean McBride
5ba6e8ac59 Source: Replace most calls to sprintf with snprintf 2021-10-25 18:23:13 -04:00
Seth R Johnson
fc92d6640b cmFileCommand: improve error message
Print full list of unresolved dependencies and a phrase that indicates
what about the file is unresolved.
2021-10-12 11:40:45 -04:00
Sean McBride
37859e3244 Source: Fix clang -Wimplicit-fallthrough warnings 2021-09-28 10:53:54 -04:00
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Marc Chevrier
062432a6bc cmCurlSetCAInfo: use std::string as argument 2021-09-19 19:10:59 +02:00
Brad King
63b5a6869e cmCurl: Adopt helper to fix file:// URLs
Migrate and generalize the helper added by commit e63dcb1378 (Encoding:
Use encoding libcurl expects with file: urls., 2014-11-05,
v3.2.0-rc1~420^2).
2021-09-15 15:03:22 -04:00
Marc Chevrier
e5cd39ca80 cmProp: refactoring: transform alias in class
To handle safely the values used by CMake variables and properties,
introduce the class cmProp as a replacement from the simple pointer
to std::string instance.
2021-08-08 16:19:08 +02:00
Alex Richardson
115ff6a347 cmELF: Include the ELF parsing code unconditionally
Now that the ELF definitions are provided on all platforms there is no
need to keep the CMake_USE_ELF_PARSER option.
2021-06-24 10:57:51 -04:00
Kyle Edwards
ed3633d88c install(TARGETS): Add RUNTIME_DEPENDENCIES option 2021-06-04 08:52:02 -04:00
Kyle Edwards
9f6cfe7169 file: Add undocumented RPATH_SET command 2021-06-04 08:52:01 -04:00
Kyle Edwards
fac22d6596 Refactor: Modify file(RPATH_*) to use cmArgumentParser 2021-06-04 08:52:01 -04:00
Kyle Edwards
2ef3ea394f file(GET_RUNTIME_DEPENDENCIES): Add undocumented RPATH_PREFIX option 2021-06-04 08:52:01 -04:00
Kyle Edwards
a12639e658 file(GET_RUNTIME_DEPENDENCIES): Add POST_{IN,EX}CLUDE_FILES arguments 2021-06-01 09:02:33 -04:00
Brad King
1898f9dd82 cmFileCommand: Remove unused local variable 2021-04-28 10:09:52 -04:00
Marc Chevrier
e4b793c614 file(REAL_PATH): add option EXPAND_TILDE
This option enables the replacement of any leading tilde with the path
to the user's home directory.
2021-04-22 08:08:47 +10:00
Brad King
7f89053953 cmSystemTools: Return KWSys Status from CreateLink and CreateSymlink 2021-04-15 12:40:37 -04:00
Brad King
ec1b6157cb Update CMake code using KWSys to account for Status return values
KWSys as of 2021-04-14 changed the return type of `SystemTools`
operations from `bool` to `Status`.  Update our call sites.
This may improve error reporting accuracy in a few places.
2021-04-14 13:14:09 -04:00
Brad King
75dd9b6c97 Merge topic 'commands-file-permissions'
769ff05483 Help: Clarify permission-related command options
900184616a Cleanup: Fix misspelt name of local C++ variable
635431a0c9 Tests: Check host platform instead of target for running stat
4ceb0ca59e Tests: Remove redundant files for configure_file() tests

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5945
2021-03-29 09:32:09 -04:00
Craig Scott
900184616a Cleanup: Fix misspelt name of local C++ variable 2021-03-26 22:17:57 +11:00
Ben Boeckel
088444211e file: add COPY_FILE subcommand
The `file(COPY)` subcommand is overloaded and busy for such a simple
operation. Instead, make a simpler subcommand with error handling
support.
2021-03-10 10:43:18 -05:00
Brad King
9bf40d8027 file(RENAME): Add option to not replace existing path
Add a `NO_REPLACE` option that prevents overwriting `<newname>`
if it exists.
2021-03-04 08:49:48 -05:00
Brad King
3600c6cd8c cmSystemTools: Add RenameFile option to not replace destination 2021-03-04 08:47:31 -05:00
Brad King
c61292726c file(RENAME): Add option to capture error message on failure 2021-03-04 08:44:06 -05:00
Brad King
b6071c93f5 Rename CMAKE_USE_ELF_PARSER to CMake_USE_ELF_PARSER
We use the `CMake_` prefix for options affecting CMake itself.
2021-02-03 11:35:31 -05:00
Cristian Adam
05f16ca7ee file(CONFIGURE): Use text mode for default OUTPUT content
This affects only Windows where \n will be translated as \r\n

Fixes: #21769
2021-02-02 15:18:48 +01:00
Brad King
8387aa20f2 Merge topic 'issue-19198'
255df8622b file(GENERATE): Support new line style

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Brad King <brad.king@kitware.com>
Merge-request: !5649
2021-02-02 08:53:07 -05:00