Commit Graph

206 Commits

Author SHA1 Message Date
Ruslan Baratov 97841dad2b file: Use 'long' to represent the parsed LOCK TIMEOUT value
Convert the StringToInt helper into a StringToLong helper with a 'long'
result type.  This will make the helper more useful to other callers
that want to use strtol.

While at it, also check errno after calling strtol in case the
conversion fails with a range error.
2014-12-05 12:59:37 -05:00
Ruslan Baratov e6db4c5a4e file: Add LOCK subcommand to do file and directory locking
Provide options to fail without blocking or to block up to a timeout.
Provide options to specify the scope containing the lock so it can be
released automatically at the end of a function, file, or process.

Extend the RunCMake.file test with cases covering the file(LOCK) command
usage and error cases.
2014-12-03 09:47:44 -05:00
Stephen Kelly 5eb4d7590e Remove some unneeded c_str calls. 2014-11-23 11:09:54 +01:00
Clinton Stimpson e63dcb1378 Encoding: Use encoding libcurl expects with file: urls.
For unescaped file: URLs on Windows, libcurl expects
the ANSI code page.

This fixes the CMake.FileUpload test when CMake is configured
to use UTF-8 internally with a non-ascii build directory name.
2014-11-05 07:20:21 -07:00
Brad King 210230e216 Merge topic 'remove-borland-build'
2db55ffa Remove borland workarounds.
2014-10-21 15:08:03 -04:00
Stephen Kelly 2db55ffa56 Remove borland workarounds.
CMake 3.0 is the last release to require to be able to build with
Borland.
2014-10-15 23:16:44 +02:00
Nils Gladitz cc1139cc30 strings: Remove redundant calls to std::string::c_str()
Replacements were detected and performed by the clang tool
remove-cstr-calls on a linux build.
2014-10-15 14:54:05 +02:00
Clinton Stimpson 5b30ec28f9 file: Add ENCODING option to file(STRINGS) command (#10519)
Support extraction of UTF-8 strings.
2014-08-06 09:23:47 -04:00
Clinton Stimpson ffa373e711 file: Refactor internal implementation of file(STRINGS)
Make room for encoding support.
2014-08-06 09:23:15 -04:00
Clinton Stimpson 9571214e55 Encoding: Replace some system calls with kwsys calls which handle unicode. 2014-07-01 06:38:35 -06:00
Brad King abebcd235c file(INSTALL): Add undocumented options to control output verbosity
Create options "MESSAGE_ALWAYS", "MESSAGE_LAZY", and "MESSAGE_NEVER" to
specify whether to print the "Installing" and "Up-to-date" messages.
Extend the RunCMake.file test with cases covering these options.
2014-06-24 13:11:45 -04:00
Brad King 464567a577 file(INSTALL): Report existing DIRECTORY as Up-to-date
Teach cmFileCopier::InstallDirectory to detect whether the destination
directory exists.  If so, report it as "Up-to-date" instead of
"Installing".  This resolves message asymmetry with file installations.

Extend the RunCMake.file and RunCMake.install tests to check the
installation output on both the first and second run.

Suggested-by: J Decker <d3ck0r@gmail.com>
2014-06-24 12:52:11 -04:00
Brad King f701b0b7f7 file(INSTALL): Do not pre-create DESTINATION for DIRECTORY
When installing a DIRECTORY, do not pre-create the DESTINATION.  The
cmFileCopier::InstallDirectory method will create the directory anyway.
Give it a chance to detect whether the directory already exists or not.
2014-06-24 12:52:11 -04:00
Ben Boeckel a08292059e genex: remove the need for backtraces
Rather than making dummy backtraces and passing them around, just make
backtraces optional.
2014-06-05 12:44:18 -04:00
Ben Boeckel d46c650d67 cmMakefile: return a backtrace
This allows backtraces to be fully controlled by the makefile rather
than externally (and makes changing how they are manipulated easier).
2014-06-05 12:44:04 -04:00
Brad King 2c448dbfe7 file: Report system error on failure to open file 2014-05-20 11:07:51 -04:00
Brad King 413282c0cf file: Avoid runaway DOWNLOAD/UPLOAD progress reports (#14807)
Curl makes progress callbacks frequently but we round to the nearest
percent and report only when that changes so that we make at most 101
progress reports.  However, when unexpected data beyond the total are
transferred the progress can get beyond 100% and lead to unlimited
reports.  Avoid this case by capping the reported progress to 100%.
2014-03-17 11:05:34 -04:00
Stephen Kelly 21c573f682 Remove some c_str() calls.
Use the clang RemoveCStrCalls tool to automatically migrate the
code. This was only run on linux, so does not have any positive or
negative effect on other platforms.
2014-03-11 15:03:50 +01:00
Matt McCormick a432b93b79 file DOWNLOAD: Display the curl result status when a hash mismatch occurs. 2014-01-15 20:08:44 -05:00
Clinton Stimpson 5730710c86 Use cmsys::[io]fstream instead of cmsys_ios::[io]fstream.
Also use SystemTools::Fopen() instead of fopen().
This is to eventually support utf-8 filenames.
2014-01-07 09:27:44 -05:00
Sean McBride 1399825cf9 Remove some uses of obsolete 'register' storage specifier
Remove the keyword from all Source/* files outside of KWSys.
2013-06-28 16:37:49 -04:00
Brad King be85fa4a89 Merge topic 'genex-generate-file'
b983a58 file: Add GENERATE command to produce files at generate time
2013-05-28 10:42:18 -04:00
Stephen Kelly b983a58bdf file: Add GENERATE command to produce files at generate time
The idea is to write to a temp file which contains generator
expressions, and at generate time, evaluate the generator expressions,
and write the result to a file.

Because executables on Windows are limited in the length of command line
it is possible to use, it is common to write command line arguments to a
file instead and specify the file as a source of arguments.

This new FILE(GENERATE) subcommand allows the use of generator
expressions to create such files so that they can be used with
add_custom_command for example.
2013-05-24 09:02:45 -04:00
Andreas Mohr ddac8d3d2d Fix spelling and typos (affecting binary data / module messages) 2013-05-07 08:39:19 -04:00
Brad King f123367254 file: Do not remove symlinked directories recursively (#10538)
If a symlink points at a directory the symlink should be removed but not
the content of the directory.
2013-02-13 10:00:50 -05:00
David Cole 354ecc1e1f CMake: Fix dashboard warnings
...in the new file and string TIMESTAMP sub-commands
2012-12-05 13:19:09 -05:00
Nils Gladitz 711e2b3b5c CMake: Add TIMESTAMP subcommand to string and file commands 2012-12-05 10:39:10 -05:00
Amine Chadly c2a6cb64af file: remove dead code
The file command requires at least two arguments, so guarding the GLOB and
MAKE_DIRECTORY command is not necessary. Changed it for an assert to keep the
protection.
2012-11-02 17:10:06 +01:00
David Cole 998a17d098 Merge topic 'file-DOWNLOAD-EXPECTED_HASH'
95a0011 file(DOWNLOAD): Change EXPECTED_HASH to take ALGO=value
2012-09-25 15:17:01 -04:00
Brad King 03077c9cbc Merge topic 'file-DOWNLOAD-user-agent'
14aff4d file(DOWNLOAD): Add HTTP User-Agent string
2012-09-19 13:58:01 -04:00
Brad King 95a0011604 file(DOWNLOAD): Change EXPECTED_HASH to take ALGO=value
Make the EXPECTED_HASH option take only a single value instead of two to
avoid handling sub-keyword arguments.  This is also consistent with
URL_HASH in ExternalProject.
2012-09-19 11:31:36 -04:00
Brad King 14aff4daf4 file(DOWNLOAD): Add HTTP User-Agent string
Some servers require a User-Agent string.  The curl command-line tool
just sends "curl/$curlver", so do the same.

Suggested-by: Fredrik Ehnbom <fehnbom@nvidia.com>
2012-09-18 14:53:07 -04:00
Brad King 7369a8faee file(DOWNLOAD): Make TLS options behave as documented
The logic added in commit e1c89f08 (file(DOWNLOAD): Add options for SSL,
2012-08-21) did not actually provide the documented behavior.  Simplify
the implementation to read the variable values first and then replace
them with the explicit argument values if encountered.  Always set the
curl option CURLOPT_SSL_VERIFYPEER to either on or off explicitly
instead of depending on the curl default behavior.
2012-09-17 09:03:45 -04:00
Brad King 131d91a1f9 Rename SSL terminology to TLS
TLS has superseded SSL so rename the recently added file(DOWNLOAD) and
ExternalProject options using the newer terminology.  Drop "CURLOPT"
from names because curl is an implementation detail.
2012-09-14 15:40:09 -04:00
Bill Hoffman e1c89f08bb file(DOWNLOAD): Add options for SSL
Add the ability to request that downloads disable or enable Certificate
Authority checking with https ssl downloads.  When the option to verify
the servers CA is disabled, one may verify download contents with SHA
hashes.
2012-09-11 15:34:54 -04:00
Bill Hoffman 34567dfc0d file(DOWNLOAD): Generalize EXPECTED_MD5 to EXPECTED_HASH
Add support for SHA algorithms.
2012-09-11 08:58:29 -04:00
Kitware Robot 7bbaa4283d Remove trailing whitespace from most CMake and C/C++ code
Our Git commit hooks disallow modification or addition of lines with
trailing whitespace.  Wipe out all remnants of trailing whitespace
everywhere except third-party code.

Run the following shell code:

git ls-files -z -- \
 bootstrap doxygen.config '*.readme' \
 '*.c' '*.cmake' '*.cpp' '*.cxx' \
 '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \
 '*.mm' '*.pike' '*.py' '*.txt' '*.vim' |
egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' |
egrep -z -v '^(Modules/CPack\..*\.in)' |
xargs -0 sed -i 's/ \+$//'
2012-08-13 14:18:39 -04:00
David Cole 2d1c25d179 Merge topic 'install-case-sensitive-mac'
a41557a install: Fix FILES_MATCHING on case-sensitive Mac filesystems (#13177)
2012-06-14 16:28:54 -04:00
Brad King a41557a2c8 install: Fix FILES_MATCHING on case-sensitive Mac filesystems (#13177)
Windows and Apple machines have predominantly used case-insensitive
filesystems so our file(INSTALL) command uses case-insensitive pattern
matching.  It is implemented by converting the pattern and file path to
lower case before matching.  The FILES_MATCHING option is implemented by
excluding a path that does not match any pattern unless it is a
directory that must be searched recursively.  However, the test that an
excluded path is a directory is executed on the lower-case path and
therefore fails on mixed-case input paths on case-sensitive filesystems.
Fix the file(INSTALL) implementation to use the lower-case path only for
pattern matching and preserve the original path for tests against the
real filesystem.
2012-06-13 08:50:44 -04:00
Jim Hague b3c77889e4 Workaround IBM XL v6 streams seekg bug (#13149)
It seems that file.seekg(0) will, in some circumstances, cause the next
file.getline() to omit the first character it reads.  Workaround the
bug by seeking from ios::beg explicitly.
2012-04-19 14:27:43 -04:00
Brad King 573fa3bf13 Factor cmInstallType out of cmTarget::TargetType
The purpose of the TargetType enumeration was overloaded for install
type because install rules were once recorded as targets.  Factor the
install types out into their own enumeration.
2012-02-27 13:19:57 -05:00
Brad King b0853b5fae Disable file() and string() hash commands during bootstrap
We do not compile support for the cryptographic hashes during bootstrap.
Disable the APIs that use them.
2011-11-16 11:03:30 -05:00
Brad King 293a7f4e2a cmCryptoHash: Provide factory "New" method
Construct a cmCryptoHash subclass instance based on the name of the
desired hash algorithm.
2011-11-16 10:15:44 -05:00
Brad King 38771d3bdf Add file(SHA*) commands to compute cryptographic hashes
Add a file() command API for SHA1, SHA224, SHA256, SHA384, and SHA512.
2011-11-16 10:15:44 -05:00
Brad King 042f7965c3 Add file(MD5) command to compute cryptographic hash
Provide a CMake-language binding to the md5sum function previously
available only by "cmake -E md5sum".
2011-11-16 10:15:01 -05:00
Brad King 09817e91f9 Make file(DOWNLOAD) fail on http error
If a http server responds with a result code greater than 400 then the
data returned from the download probably do not match that expected.
Teach file(DOWNLOAD) to fail with an error in this case instead of
silently pretending that the download worked.  The file(UPLOAD) command
already does this.
2011-09-19 17:41:48 -04:00
Thomas Jarosch 4868921bc2 Fix file() command descriptor leak on error
Credit goes to "cppcheck".

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
2011-09-02 11:15:26 -04:00
Brad King faa7ec6e18 Teach file(DOWNLOAD|UPLOAD) to timeout after inactivity
Add option INACTIVITY_TIMEOUT to terminate the operation if there is no
progress for more than a given amount of time.
2011-06-01 09:55:42 -04:00
Brad King 9a7c6a3cc4 Merge topic 'require-cmake-2.6.3'
c3e452e Require at least CMake 2.6.3 to build current CMake
2011-03-01 15:30:38 -05:00
David Cole 61a83f955a Fix KWStyle line too long error (#11286) 2011-02-28 10:47:23 -05:00