Merge recent 'staging' into closure-size

Let's get rid of those merge conflicts.
This commit is contained in:
Vladimír Čunát
2016-02-03 16:57:19 +01:00
637 changed files with 123880 additions and 83341 deletions
@@ -1,237 +0,0 @@
--- cmake-2.8.10/Source/cmFileCommand.cxx 2012-10-31 10:32:06.000000000 -0500
+++ cmake-2.8.10/Source/cmFileCommand.cxx 2013-03-16 22:55:11.306681100 -0500
@@ -1002,7 +1002,7 @@ protected:
MatchProperties CollectMatchProperties(const char* file)
{
// Match rules are case-insensitive on some platforms.
-#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
+#if defined(_WIN32) || defined(__APPLE__)
std::string lower = cmSystemTools::LowerCase(file);
const char* file_to_match = lower.c_str();
#else
--- cmake-2.8.10/Source/cmInstallCommand.cxx 2012-10-31 10:32:06.000000000 -0500
+++ cmake-2.8.10/Source/cmInstallCommand.cxx 2013-03-16 22:56:21.008667800 -0500
@@ -1090,7 +1090,7 @@ cmInstallCommand::HandleDirectoryMode(st
{
literal_args += " REGEX \"";
// Match rules are case-insensitive on some platforms.
-#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
+#if defined(_WIN32) || defined(__APPLE__)
std::string regex = cmSystemTools::LowerCase(args[i]);
#else
std::string regex = args[i];
--- cmake-2.8.10/Source/kwsys/Glob.cxx 2012-10-31 10:32:06.000000000 -0500
+++ cmake-2.8.10/Source/kwsys/Glob.cxx 2013-03-16 22:58:54.192429400 -0500
@@ -37,7 +37,7 @@
#include <string.h>
namespace KWSYS_NAMESPACE
{
-#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
+#if defined(_WIN32) || defined(__APPLE__)
// On Windows and apple, no difference between lower and upper case
# define KWSYS_GLOB_CASE_INDEPENDENT
#endif
--- cmake-2.8.11/Source/kwsys/SystemInformation.cxx 2013-05-15 12:38:13.000000000 -0500
+++ cmake-2.8.11/Source/kwsys/SystemInformation.cxx 2013-07-08 01:57:31.216321800 -0500
@@ -888,7 +888,7 @@ void SystemInformation::RunMemoryCheck()
// Hide implementation details in an anonymous namespace.
namespace {
// *****************************************************************************
-#if defined(__linux) || defined(__APPLE__)
+#if defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__)
int LoadLines(
FILE *file,
kwsys_stl::vector<kwsys_stl::string> &lines)
@@ -918,7 +918,7 @@ int LoadLines(
return nRead;
}
-# if defined(__linux)
+# if defined(__linux) || defined(__CYGWIN__)
// *****************************************************************************
int LoadLines(
const char *fileName,
@@ -957,7 +957,7 @@ int NameValue(
}
#endif
-#if defined(__linux)
+#if defined(__linux) || defined(__CYGWIN__)
// ****************************************************************************
template<typename T>
int GetFieldsFromFile(
@@ -2869,7 +2869,6 @@ bool SystemInformationImplementation::Re
pos = buffer.find("processor\t",pos+1);
}
-#ifdef __linux
// Find the largest physical id.
int maxId = -1;
kwsys_stl::string idc =
@@ -2893,14 +2892,6 @@ bool SystemInformationImplementation::Re
this->NumberOfPhysicalCPU=static_cast<unsigned int>(
numberOfCoresPerCPU*(maxId+1));
-#else // __CYGWIN__
- // does not have "physical id" entries, neither "cpu cores"
- // this has to be fixed for hyper-threading.
- kwsys_stl::string cpucount =
- this->ExtractValueFromCpuInfoFile(buffer,"cpu count");
- this->NumberOfPhysicalCPU=
- this->NumberOfLogicalCPU = atoi(cpucount.c_str());
-#endif
// gotta have one, and if this is 0 then we get a / by 0n
// better to have a bad answer than a crash
if(this->NumberOfPhysicalCPU <= 0)
@@ -3086,7 +3077,7 @@ SystemInformationImplementation::GetHost
GlobalMemoryStatusEx(&statex);
return statex.ullTotalPhys/1024;
# endif
-#elif defined(__linux)
+#elif defined(__linux) || defined(__CYGWIN__)
SystemInformation::LongLong memTotal=0;
int ierr=GetFieldFromFile("/proc/meminfo","MemTotal:",memTotal);
if (ierr)
@@ -3217,7 +3208,7 @@ SystemInformationImplementation::GetHost
GlobalMemoryStatusEx(&statex);
return (statex.ullTotalPhys - statex.ullAvailPhys)/1024;
# endif
-#elif defined(__linux)
+#elif defined(__linux) || defined(__CYGWIN__)
const char *names[3]={"MemTotal:","MemFree:",NULL};
SystemInformation::LongLong values[2]={SystemInformation::LongLong(0)};
int ierr=GetFieldsFromFile("/proc/meminfo",names,values);
@@ -3276,7 +3267,7 @@ SystemInformationImplementation::GetProc
return -2;
}
return pmc.WorkingSetSize/1024;
-#elif defined(__linux)
+#elif defined(__linux) || defined(__CYGWIN__)
SystemInformation::LongLong memUsed=0;
int ierr=GetFieldFromFile("/proc/self/status","VmRSS:",memUsed);
if (ierr)
@@ -3328,7 +3319,7 @@ SystemInformationImplementation::GetProc
{
#if defined(_WIN32)
return GetCurrentProcessId();
-#elif defined(__linux) || defined(__APPLE__)
+#elif defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__)
return getpid();
#else
return -1;
--- cmake-2.8.10/Source/kwsys/SystemTools.cxx 2012-10-31 10:32:06.000000000 -0500
+++ cmake-2.8.10/Source/kwsys/SystemTools.cxx 2013-03-16 22:52:11.830415600 -0500
@@ -75,19 +75,12 @@
// Windows API.
#if defined(_WIN32)
# include <windows.h>
-#elif defined (__CYGWIN__)
-# include <windows.h>
-# undef _WIN32
#endif
#if !KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
extern char **environ;
#endif
-#ifdef __CYGWIN__
-extern "C" void cygwin_conv_to_win32_path(const char *path, char *win32_path);
-#endif
-
// getpwnam doesn't exist on Windows and Cray Xt3/Catamount
// same for TIOCGWINSZ
#if defined(_WIN32) || defined (__LIBCATAMOUNT__)
@@ -1068,7 +1061,7 @@ bool SystemTools::SameFile(const char* f
}
//----------------------------------------------------------------------------
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
static bool WindowsFileExists(const char* filename)
{
WIN32_FILE_ATTRIBUTE_DATA fd;
@@ -1083,7 +1076,7 @@ bool SystemTools::FileExists(const char*
{
return false;
}
-#if defined(__CYGWIN__)
+#if 0
// Convert filename to native windows path if possible.
char winpath[MAX_PATH];
if(SystemTools::PathCygwinToWin32(filename, winpath))
@@ -1111,7 +1104,7 @@ bool SystemTools::FileExists(const char*
}
//----------------------------------------------------------------------------
-#ifdef __CYGWIN__
+#if 0
bool SystemTools::PathCygwinToWin32(const char *path, char *win32_path)
{
SystemToolsTranslationMap::iterator i =
@@ -3894,7 +3887,7 @@ bool SystemTools::LocateFileInDir(const
bool SystemTools::FileIsFullPath(const char* in_name)
{
kwsys_stl::string name = in_name;
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
// On Windows, the name must be at least two characters long.
if(name.length() < 2)
{
@@ -4712,9 +4705,6 @@ bool SystemTools::ParseURL( const kwsys_
unsigned int SystemToolsManagerCount;
SystemToolsTranslationMap *SystemTools::TranslationMap;
SystemToolsTranslationMap *SystemTools::LongPathMap;
-#ifdef __CYGWIN__
-SystemToolsTranslationMap *SystemTools::Cyg2Win32Map;
-#endif
// SystemToolsManager manages the SystemTools singleton.
// SystemToolsManager should be included in any translation unit
@@ -4760,9 +4750,6 @@ void SystemTools::ClassInitialize()
// Allocate the translation map first.
SystemTools::TranslationMap = new SystemToolsTranslationMap;
SystemTools::LongPathMap = new SystemToolsTranslationMap;
-#ifdef __CYGWIN__
- SystemTools::Cyg2Win32Map = new SystemToolsTranslationMap;
-#endif
// Add some special translation paths for unix. These are not added
// for windows because drive letters need to be maintained. Also,
@@ -4817,9 +4804,6 @@ void SystemTools::ClassFinalize()
{
delete SystemTools::TranslationMap;
delete SystemTools::LongPathMap;
-#ifdef __CYGWIN__
- delete SystemTools::Cyg2Win32Map;
-#endif
}
--- cmake-2.8.10/Source/kwsys/SystemTools.hxx.in 2012-10-31 10:32:06.000000000 -0500
+++ cmake-2.8.10/Source/kwsys/SystemTools.hxx.in 2013-03-16 23:10:30.185237900 -0500
@@ -277,15 +277,6 @@ public:
static bool FileExists(const char* filename);
/**
- * Converts Cygwin path to Win32 path. Uses dictionary container for
- * caching and calls to cygwin_conv_to_win32_path from Cygwin dll
- * for actual translation. Returns true on success, else false.
- */
-#ifdef __CYGWIN__
- static bool PathCygwinToWin32(const char *path, char *win32_path);
-#endif
-
- /**
* Return file length
*/
static unsigned long FileLength(const char *filename);
@@ -887,9 +878,6 @@ private:
*/
static SystemToolsTranslationMap *TranslationMap;
static SystemToolsTranslationMap *LongPathMap;
-#ifdef __CYGWIN__
- static SystemToolsTranslationMap *Cyg2Win32Map;
-#endif
friend class SystemToolsManager;
};
@@ -1,11 +0,0 @@
--- ./Modules/FindOpenSSL.cmake
+++ ./Modules/FindOpenSSL.cmake
@@ -264,7 +264,7 @@
set(OPENSSL_VERSION "${_OPENSSL_VERSION}")
elseif(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
- REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
+ REGEX "^# *define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
# The version number is encoded as 0xMNNFFPPS: major minor fix patch status
# The status gives if this is a developer or prerelease and is ignored here.
@@ -1,10 +1,10 @@
{ stdenv, fetchgit, lib, python, which }:
let
version = "0.5.1";
version = "0.5.3";
src = fetchgit {
url = "https://github.com/gfxmonk/gup.git";
rev = "f185052e2177ed5e46720e6c6cfb529b96cd17e2";
sha256 = "c2e27cdba2231017ceb4868f58f5c3b224be0491b81558b4e59bb08a952ad1a5";
rev = "55ffd8828ddc28a2a786b75422d672d6569f961f";
sha256 = "7c2abbf5d3814c6b84da0de1c91f9f7d299c2362cf091da96f6a68d8fffcb5ce";
};
in
import ./build.nix
@@ -30,7 +30,6 @@ stdenv.mkDerivation rec {
'';
meta = with stdenv.lib; {
inherit version;
description = "A program maintenance (make) utility using a C-like grammar";
homepage = https://fbb-git.github.io/icmake/;
license = licenses.gpl3;
@@ -1,5 +1,5 @@
{ stdenv, writeText, callPackage, fetchurl,
fetchHex, erlang, rebar3-nix-bootstrap, tree, fetchFromGitHub }:
fetchHex, erlang, hermeticRebar3 ? true, rebar3-nix-bootstrap, tree, fetchFromGitHub }:
let
@@ -67,6 +67,12 @@ let
version = "0.2.0";
sha256 = "03kiszlbgzscfd2ns7na6bzbfzmcqdb5cx3p6qy3657jk2fai332";
};
# {eunit_formatters, "0.2.0"}
rebar3_hex = fetchHex {
pkg = "rebar3_hex";
version = "1.12.0";
sha256 = "45467e93ae8d776c6038fdaeaffbc55d8f2f097f300a54dab9b81c6d1cf21f73";
};
in
stdenv.mkDerivation {
@@ -78,7 +84,9 @@ stdenv.mkDerivation {
sha256 = "0px66scjdia9aaa5z36qzxb848r56m0k98g0bxw065a2narsh4xy";
};
patches = [ ./hermetic-bootstrap.patch ];
patches = if hermeticRebar3 == true
then [ ./hermetic-bootstrap.patch ./hermetic-rebar3.patch ]
else [];
buildInputs = [ erlang tree ];
propagatedBuildInputs = [ registrySnapshot rebar3-nix-bootstrap ];
@@ -88,6 +96,7 @@ stdenv.mkDerivation {
rebar3-nix-bootstrap registry-only
echo "$ERL_LIBS"
mkdir -p _build/default/lib/
mkdir -p _build/default/plugins
cp --no-preserve=mode -R ${erlware_commons} _build/default/lib/erlware_commons
cp --no-preserve=mode -R ${providers} _build/default/lib/providers
cp --no-preserve=mode -R ${getopt} _build/default/lib/getopt
@@ -98,6 +107,7 @@ stdenv.mkDerivation {
cp --no-preserve=mode -R ${eunit_formatters} _build/default/lib/eunit_formatters
cp --no-preserve=mode -R ${relx} _build/default/lib/relx
cp --no-preserve=mode -R ${ssl_verify_hostname} _build/default/lib/ssl_verify_hostname
cp --no-preserve=mode -R ${rebar3_hex} _build/default/plugins/rebar3_hex
'';
buildPhase = ''
@@ -0,0 +1,108 @@
diff --git a/src/rebar3.erl b/src/rebar3.erl
index 2b73844..af1d871 100644
--- a/src/rebar3.erl
+++ b/src/rebar3.erl
@@ -282,9 +282,11 @@ start_and_load_apps(Caller) ->
ensure_running(crypto, Caller),
ensure_running(asn1, Caller),
ensure_running(public_key, Caller),
- ensure_running(ssl, Caller),
- inets:start(),
- inets:start(httpc, [{profile, rebar}]).
+ ensure_running(ssl, Caller).
+%% Removed due to the hermicity requirements of Nix
+%%
+%% inets:start(),
+%% inets:start(httpc, [{profile, rebar}]).
ensure_running(App, Caller) ->
case application:start(App) of
@@ -339,4 +341,4 @@ safe_define_test_macro(Opts) ->
test_defined([{d, 'TEST'}|_]) -> true;
test_defined([{d, 'TEST', true}|_]) -> true;
test_defined([_|Rest]) -> test_defined(Rest);
-test_defined([]) -> false.
\ No newline at end of file
+test_defined([]) -> false.
diff --git a/src/rebar_hermicity.erl b/src/rebar_hermicity.erl
new file mode 100644
index 0000000..d814e2a
--- /dev/null
+++ b/src/rebar_hermicity.erl
@@ -0,0 +1,42 @@
+%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
+%% ex: ts=4 sw=4 et
+%% -------------------------------------------------------------------
+%%
+%% rebar: Erlang Build Tools
+%%
+%% Copyright (c) 2016 Eric Merritt (eric@merritt.tech)
+%%
+%% Permission is hereby granted, free of charge, to any person obtaining a copy
+%% of this software and associated documentation files (the "Software"), to deal
+%% in the Software without restriction, including without limitation the rights
+%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+%% copies of the Software, and to permit persons to whom the Software is
+%% furnished to do so, subject to the following conditions:
+%%
+%% The above copyright notice and this permission notice shall be included in
+%% all copies or substantial portions of the Software.
+%%
+%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+%% THE SOFTWARE.
+%% -------------------------------------------------------------------
+-module(rebar_hermicity).
+
+-export([request/5]).
+
+-include("rebar.hrl").
+
+%% ====================================================================
+%% Public API
+%% ====================================================================
+
+request(Method, {Url, _Headers}, _HTTPOptions, _Options, _Profile) ->
+ ?ERROR("A request is being made that violates Nix hermicity "
+ "This request has been stopped. Details of the request "
+ "are as follows:", []),
+ ?ERROR("Requesnt: ~p ~s", [Method, Url]),
+ erlang:halt(1).
diff --git a/src/rebar_pkg_resource.erl b/src/rebar_pkg_resource.erl
index 4f55ad1..f76fd5d 100644
--- a/src/rebar_pkg_resource.erl
+++ b/src/rebar_pkg_resource.erl
@@ -100,10 +100,10 @@ make_vsn(_) ->
{error, "Replacing version of type pkg not supported."}.
request(Url, ETag) ->
- case httpc:request(get, {Url, [{"if-none-match", ETag} || ETag =/= false]},
- [{ssl, ssl_opts(Url)}, {relaxed, true}],
- [{body_format, binary}],
- rebar) of
+ case rebar_hermicity:request(get, {Url, [{"if-none-match", ETag} || ETag =/= false]},
+ [{ssl, ssl_opts(Url)}, {relaxed, true}],
+ [{body_format, binary}],
+ rebar) of
{ok, {{_Version, 200, _Reason}, Headers, Body}} ->
?DEBUG("Successfully downloaded ~s", [Url]),
{"etag", ETag1} = lists:keyfind("etag", 1, Headers),
diff --git a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl
index 6637ebe..d82c1d8 100644
--- a/src/rebar_prv_update.erl
+++ b/src/rebar_prv_update.erl
@@ -44,8 +44,8 @@ do(State) ->
TmpFile = filename:join(TmpDir, "packages.gz"),
Url = rebar_state:get(State, rebar_packages_cdn, ?DEFAULT_HEX_REGISTRY),
- case httpc:request(get, {Url, []},
- [], [{stream, TmpFile}, {sync, true}],
+ case rebar_hermicity:request(get, {Url, []},
+ [], [{stream, TmpFile}, {sync, true}],
rebar) of
{ok, saved_to_file} ->
{ok, Data} = file:read_file(TmpFile),