sapling: init at 0.1.20221118-210929-cfbb68aa (#201798)
This commit is contained in:
parent
e17c929c1f
commit
47dfc53fea
|
@ -10664,6 +10664,12 @@
|
||||||
githubId = 84886;
|
githubId = 84886;
|
||||||
name = "Paul Baecher";
|
name = "Paul Baecher";
|
||||||
};
|
};
|
||||||
|
pbar = {
|
||||||
|
email = "piercebartine@gmail.com";
|
||||||
|
github = "pbar1";
|
||||||
|
githubId = 26949935;
|
||||||
|
name = "Pierce Bartine";
|
||||||
|
};
|
||||||
pbogdan = {
|
pbogdan = {
|
||||||
email = "ppbogdan@gmail.com";
|
email = "ppbogdan@gmail.com";
|
||||||
github = "pbogdan";
|
github = "pbogdan";
|
||||||
|
|
7768
pkgs/applications/version-management/sapling/Cargo.lock
generated
Normal file
7768
pkgs/applications/version-management/sapling/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
141
pkgs/applications/version-management/sapling/default.nix
Normal file
141
pkgs/applications/version-management/sapling/default.nix
Normal file
|
@ -0,0 +1,141 @@
|
||||||
|
{ lib, stdenv, python3Packages, fetchFromGitHub, fetchurl, sd, curl, pkg-config, openssl, rustPlatform, fetchYarnDeps, yarn, nodejs, fixup_yarn_lock }:
|
||||||
|
|
||||||
|
let
|
||||||
|
deps = import ./deps.nix { inherit lib fetchurl; };
|
||||||
|
version = deps.version;
|
||||||
|
versionHash = deps.versionHash;
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "facebook";
|
||||||
|
repo = "sapling";
|
||||||
|
rev = version;
|
||||||
|
hash = "sha256-IzbUaFrsSMojhsbpnRj1XLkhO9V2zYdmmZls4mtZquw=";
|
||||||
|
};
|
||||||
|
|
||||||
|
addonsSrc = "${src}/addons";
|
||||||
|
|
||||||
|
# Fetches the Yarn modules in Nix to to be used as an offline cache
|
||||||
|
yarnOfflineCache = fetchYarnDeps {
|
||||||
|
yarnLock = "${addonsSrc}/yarn.lock";
|
||||||
|
sha256 = "sha256-B61T0ReZPRfrRjBC3iHLVkVYiifhzOXlaG1YL6rgmj4=";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Builds the NodeJS server that runs with `sl web`
|
||||||
|
isl = stdenv.mkDerivation {
|
||||||
|
pname = "sapling-isl";
|
||||||
|
src = addonsSrc;
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
fixup_yarn_lock
|
||||||
|
nodejs
|
||||||
|
yarn
|
||||||
|
];
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
|
||||||
|
export HOME=$(mktemp -d)
|
||||||
|
fixup_yarn_lock yarn.lock
|
||||||
|
yarn config --offline set yarn-offline-mirror ${yarnOfflineCache}
|
||||||
|
yarn install --offline --frozen-lockfile --ignore-engines --ignore-scripts --no-progress
|
||||||
|
patchShebangs node_modules
|
||||||
|
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p $out
|
||||||
|
cd isl
|
||||||
|
node release.js $out
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Builds the main `sl` binary and its Python extensions
|
||||||
|
sapling = python3Packages.buildPythonPackage {
|
||||||
|
pname = "sapling-main";
|
||||||
|
inherit src version;
|
||||||
|
|
||||||
|
sourceRoot = "source/eden/scm";
|
||||||
|
|
||||||
|
# Upstream does not commit Cargo.lock
|
||||||
|
cargoDeps = rustPlatform.importCargoLock {
|
||||||
|
lockFile = ./Cargo.lock;
|
||||||
|
outputHashes = {
|
||||||
|
"cloned-0.1.0" = "sha256-c3CPWVjOk+VKBLD6WuaYZvBoKi5PwgXmiwxKoCk0bsI=";
|
||||||
|
"deltae-0.3.0" = "sha256-a9Skaqs+tVTw8x83jga+INBr+TdaMmo35Bf2wbfR6zs=";
|
||||||
|
"fb303_core-0.0.0" = "sha256-yoKKSBwqufFayLef2rRpX5oV1j8fL/kRkXBXIC++d7Q=";
|
||||||
|
"fbthrift-0.0.1+unstable" = "sha256-jtsDE5U/OavDUXRAE1N8/nujSPrWltImsFLzHaxfeM0=";
|
||||||
|
"reqwest-0.11.11" = "sha256-uhc8XhkGW22XDNo0qreWdXeFF2cslOOZHfTRQ30IBcE=";
|
||||||
|
"serde_bser-0.3.1" = "sha256-KCAC+rbczroZn/oKYTVpAPJl40yMrszt/PGol+JStDU=";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
postPatch = ''
|
||||||
|
cp ${./Cargo.lock} Cargo.lock
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Since the derivation builder doesn't have network access to remain pure,
|
||||||
|
# fetch the artifacts manually and link them. Then replace the hardcoded URLs
|
||||||
|
# with filesystem paths for the curl calls.
|
||||||
|
postUnpack = ''
|
||||||
|
mkdir $sourceRoot/hack_pydeps
|
||||||
|
( cd $sourceRoot/hack_pydeps
|
||||||
|
${deps.links}
|
||||||
|
)
|
||||||
|
sed -i "s|https://files.pythonhosted.org/packages/[[:alnum:]]*/[[:alnum:]]*/[[:alnum:]]*/|file://$NIX_BUILD_TOP/$sourceRoot/hack_pydeps/|g" $sourceRoot/setup.py
|
||||||
|
'';
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
curl
|
||||||
|
pkg-config
|
||||||
|
] ++ (with rustPlatform; [
|
||||||
|
cargoSetupHook
|
||||||
|
rust.cargo
|
||||||
|
rust.rustc
|
||||||
|
]);
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
openssl
|
||||||
|
];
|
||||||
|
|
||||||
|
doCheck = false;
|
||||||
|
|
||||||
|
HGNAME = "sl";
|
||||||
|
SAPLING_OSS_BUILD = "true";
|
||||||
|
SAPLING_VERSION = version;
|
||||||
|
SAPLING_VERSION_HASH = versionHash;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
pname = "sapling";
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
dontUnpack = true;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p $out
|
||||||
|
|
||||||
|
cp -r ${sapling}/* $out
|
||||||
|
|
||||||
|
sitepackages=$out/lib/${python3Packages.python.libPrefix}/site-packages
|
||||||
|
chmod +w $sitepackages
|
||||||
|
cp -r ${isl} $sitepackages/edenscm-isl
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "A Scalable, User-Friendly Source Control System";
|
||||||
|
homepage = "https://sapling-scm.com";
|
||||||
|
license = licenses.gpl2Only;
|
||||||
|
maintainers = with maintainers; [ pbar ];
|
||||||
|
platforms = platforms.linux;
|
||||||
|
mainProgram = "sl";
|
||||||
|
};
|
||||||
|
}
|
104
pkgs/applications/version-management/sapling/deps.nix
generated
Normal file
104
pkgs/applications/version-management/sapling/deps.nix
generated
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# Generated by `gen-deps`
|
||||||
|
|
||||||
|
{ lib, fetchurl }:
|
||||||
|
let
|
||||||
|
ptyprocess = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/22/a6/858897256d0deac81a172289110f31629fc4cee19b6f01283303e18c8db3/ptyprocess-0.7.0-py2.py3-none-any.whl";
|
||||||
|
sha256 = "0dgg5x4nvdpfiz552diy11xg72y14s38hjz9qxygafnfgybg6hab";
|
||||||
|
};
|
||||||
|
pexpect = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/39/7b/88dbb785881c28a102619d46423cb853b46dbccc70d3ac362d99773a78ce/pexpect-4.8.0-py2.py3-none-any.whl";
|
||||||
|
sha256 = "0dq9f7irmml1nm9a2rx8dd6m2dqmzjj1x40mk0rg619wrdfsaj0b";
|
||||||
|
};
|
||||||
|
ipython = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/23/6a/210816c943c9aeeb29e4e18a298f14bf0e118fe222a23e13bfcc2d41b0a4/ipython-7.16.1-py3-none-any.whl";
|
||||||
|
sha256 = "0r4xy2sqwyhwlwj81zvhzbnx7a7r4xdz9xyzzkjczlx7gk1cig1d";
|
||||||
|
};
|
||||||
|
simplegeneric = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/3d/57/4d9c9e3ae9a255cd4e1106bb57e24056d3d0709fc01b2e3e345898e49d5b/simplegeneric-0.8.1.zip";
|
||||||
|
sha256 = "0wwi1c6md4vkbcsfsf8dklf3vr4mcdj4mpxkanwgb6jb1432x5yw";
|
||||||
|
};
|
||||||
|
toml = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/44/6f/7120676b6d73228c96e17f1f794d8ab046fc910d781c8d151120c3f1569e/toml-0.10.2-py2.py3-none-any.whl";
|
||||||
|
sha256 = "16sgpg57kxx5jh467d9qwc2hwshfvdbl0xkafdp3qspvbfp46qc0";
|
||||||
|
};
|
||||||
|
colorama = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/44/98/5b86278fbbf250d239ae0ecb724f8572af1c91f4a11edf4d36a206189440/colorama-0.4.4-py2.py3-none-any.whl";
|
||||||
|
sha256 = "1qn3bnyd7gdwkyk8nvlhiy3c6zbwjd49fjxj0gp8xxi9faiysiwz";
|
||||||
|
};
|
||||||
|
backcall = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/4c/1c/ff6546b6c12603d8dd1070aa3c3d273ad4c07f5771689a7b69a550e8c951/backcall-0.2.0-py2.py3-none-any.whl";
|
||||||
|
sha256 = "0mfj5d1bgpy1clfgwrkmjqm2pv70pm01jp4iyyhphc96kyifdg7v";
|
||||||
|
};
|
||||||
|
setuptools = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/4e/78/56aa1b5f4d8ac548755ae767d84f0be54fdd9d404197a3d9e4659d272348/setuptools-57.0.0-py3-none-any.whl";
|
||||||
|
sha256 = "0yxz45fzjsq6zh5f9cjl0gf4vfg1l7rd79zyb3ih544layjg3ff8";
|
||||||
|
};
|
||||||
|
wcwidth = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/59/7c/e39aca596badaf1b78e8f547c807b04dae603a433d3e7a7e04d67f2ef3e5/wcwidth-0.2.5-py2.py3-none-any.whl";
|
||||||
|
sha256 = "1177pfa343r378020a85l3b16ak479qgyvh8k5719fgbkhm81d5y";
|
||||||
|
};
|
||||||
|
prompt_toolkit = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/87/61/2dfea88583d5454e3a64f9308a686071d58d59a55db638268a6413e1eb6d/prompt_toolkit-2.0.10-py3-none-any.whl";
|
||||||
|
sha256 = "1r55ffffaq4q3dpvha7iipgxlqwvjg5cklf9izr42xj5rr226r26";
|
||||||
|
};
|
||||||
|
decorator = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/6a/36/b1b9bfdf28690ae01d9ca0aa5b0d07cb4448ac65fb91dc7e2d094e3d992f/decorator-5.0.9-py3-none-any.whl";
|
||||||
|
sha256 = "08v36wa0kckc892bk4nypl6sszbysarm8jhslviz1agp2sf1jp3f";
|
||||||
|
};
|
||||||
|
pickleshare = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whl";
|
||||||
|
sha256 = "0mnzcb714ynl1qlv9dwnh50rv75mmj18ywaxbl8xzm3l9m0syjcn";
|
||||||
|
};
|
||||||
|
Pygments = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/a6/c9/be11fce9810793676017f79ffab3c6cb18575844a6c7b8d4ed92f95de604/Pygments-2.9.0-py3-none-any.whl";
|
||||||
|
sha256 = "13iv73575lilrm01ffhr8y8sxn8kxhvfqsgwckbr919725280vnn";
|
||||||
|
};
|
||||||
|
traitlets = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/ca/ab/872a23e29cec3cf2594af7e857f18b687ad21039c1f9b922fac5b9b142d5/traitlets-4.3.3-py2.py3-none-any.whl";
|
||||||
|
sha256 = "0i7ycyjad9kq6lgq5ih7j8xsm639z24250s6d17pp781v6hwdd3h";
|
||||||
|
};
|
||||||
|
six = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl";
|
||||||
|
sha256 = "0m02dsi8lvrjf4bi20ab6lm7rr6krz7pg6lzk3xjs2l9hqfjzfwa";
|
||||||
|
};
|
||||||
|
ipython_genutils = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/fa/bc/9bd3b5c2b4774d5f33b2d544f1460be9df7df2fe42f352135381c347c69a/ipython_genutils-0.2.0-py2.py3-none-any.whl";
|
||||||
|
sha256 = "1f7sc4ydjj33gadcgfz8fcx02d1wm2frlqwzdik1krlr6wikgpbj";
|
||||||
|
};
|
||||||
|
ipdb = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/fc/56/9f67dcd4a4b9960373173a31be1b8c47fe351a1c9385677a7bdd82810e57/ipdb-0.13.9.tar.gz";
|
||||||
|
sha256 = "1ibql99agjf2gj7y0svzd5m0h81hailf4p3sj3yl9i1i8ykdj6wm";
|
||||||
|
};
|
||||||
|
Cython = fetchurl {
|
||||||
|
url = "https://files.pythonhosted.org/packages/bc/fa/8604d92ef753e0036d807f1b3179813ab2fa283e3b19c926e11673c8205b/Cython-0.29.26.tar.gz";
|
||||||
|
sha256 = "04m31z011arz2b70rwwkhvzkb9d4yxcfbxpw27d6fa3n79a7sdxg";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
links = ''
|
||||||
|
ln -s ${ptyprocess} ptyprocess-0.7.0-py2.py3-none-any.whl
|
||||||
|
ln -s ${pexpect} pexpect-4.8.0-py2.py3-none-any.whl
|
||||||
|
ln -s ${ipython} ipython-7.16.1-py3-none-any.whl
|
||||||
|
ln -s ${simplegeneric} simplegeneric-0.8.1.zip
|
||||||
|
ln -s ${toml} toml-0.10.2-py2.py3-none-any.whl
|
||||||
|
ln -s ${colorama} colorama-0.4.4-py2.py3-none-any.whl
|
||||||
|
ln -s ${backcall} backcall-0.2.0-py2.py3-none-any.whl
|
||||||
|
ln -s ${setuptools} setuptools-57.0.0-py3-none-any.whl
|
||||||
|
ln -s ${wcwidth} wcwidth-0.2.5-py2.py3-none-any.whl
|
||||||
|
ln -s ${prompt_toolkit} prompt_toolkit-2.0.10-py3-none-any.whl
|
||||||
|
ln -s ${decorator} decorator-5.0.9-py3-none-any.whl
|
||||||
|
ln -s ${pickleshare} pickleshare-0.7.5-py2.py3-none-any.whl
|
||||||
|
ln -s ${Pygments} Pygments-2.9.0-py3-none-any.whl
|
||||||
|
ln -s ${traitlets} traitlets-4.3.3-py2.py3-none-any.whl
|
||||||
|
ln -s ${six} six-1.16.0-py2.py3-none-any.whl
|
||||||
|
ln -s ${ipython_genutils} ipython_genutils-0.2.0-py2.py3-none-any.whl
|
||||||
|
ln -s ${ipdb} ipdb-0.13.9.tar.gz
|
||||||
|
ln -s ${Cython} Cython-0.29.26.tar.gz
|
||||||
|
'';
|
||||||
|
|
||||||
|
version = "0.1.20221118-210929-cfbb68aa";
|
||||||
|
|
||||||
|
versionHash = "5535144625961033752";
|
||||||
|
}
|
87
pkgs/applications/version-management/sapling/gen-deps
Executable file
87
pkgs/applications/version-management/sapling/gen-deps
Executable file
|
@ -0,0 +1,87 @@
|
||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#!nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ requests ])" nixpkgs-fmt
|
||||||
|
|
||||||
|
# vim: set syntax=python:
|
||||||
|
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
import struct
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
|
gen_file = "deps.nix"
|
||||||
|
repo = "facebook/sapling"
|
||||||
|
source_file = "eden/scm/setup.py"
|
||||||
|
|
||||||
|
# Fetch the latest stable release metadata from GitHub
|
||||||
|
latest = requests.get(f"https://api.github.com/repos/{repo}/releases/latest").text
|
||||||
|
latest = json.loads(latest)
|
||||||
|
|
||||||
|
# Find latest's git tag which corresponds to the Sapling version. Also needed
|
||||||
|
# is a hash of the version, so calculate that here. Taken from Sapling source
|
||||||
|
# `$root/eden/scm/setup_with_version.py`.
|
||||||
|
version = str(latest["tag_name"])
|
||||||
|
version_hash = str(
|
||||||
|
struct.unpack(">Q", hashlib.sha1(version.encode("ascii")).digest()[:8])[0]
|
||||||
|
)
|
||||||
|
|
||||||
|
# Fetch the `setup.py` source and look for instances of assets being downloaded
|
||||||
|
# from files.pythonhosted.org.
|
||||||
|
source = requests.get(
|
||||||
|
f"https://raw.githubusercontent.com/{repo}/{version}/{source_file}"
|
||||||
|
).text
|
||||||
|
matches = re.findall(
|
||||||
|
r'(https://files\.pythonhosted\.org/packages/.*?/.*?/.*?/)(.*?)(-.*?)"', source
|
||||||
|
)
|
||||||
|
|
||||||
|
# For each matched asset URL, prefetch said asset and build the corresponding
|
||||||
|
# Nix code needed to call `fetchurl` and perform symlinks in the actual build.
|
||||||
|
assets = ""
|
||||||
|
links = ""
|
||||||
|
for m in matches:
|
||||||
|
sha256 = (
|
||||||
|
subprocess.Popen(
|
||||||
|
["nix-prefetch-url", "--type", "sha256", f"{m[0]}{m[1]}{m[2]}"],
|
||||||
|
text=True,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
)
|
||||||
|
.stdout.read()
|
||||||
|
.strip()
|
||||||
|
)
|
||||||
|
assets += """ {} = fetchurl {{
|
||||||
|
url = "{}{}{}";
|
||||||
|
sha256 = "{}";
|
||||||
|
}};\n""".format(
|
||||||
|
m[1], m[0], m[1], m[2], sha256
|
||||||
|
)
|
||||||
|
links += " ln -s ${{{}}} {}{}\n".format(m[1], m[1], m[2])
|
||||||
|
assets = assets.strip()
|
||||||
|
links = links.strip()
|
||||||
|
|
||||||
|
# Render an autogenerated Nix file with the fetched dependency and version
|
||||||
|
# information for import in the main derivation.
|
||||||
|
out = f"""
|
||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# Generated by `gen-deps`
|
||||||
|
|
||||||
|
{{ lib, fetchurl }}:
|
||||||
|
let
|
||||||
|
{assets}
|
||||||
|
in
|
||||||
|
{{
|
||||||
|
links = ''
|
||||||
|
{links}
|
||||||
|
'';
|
||||||
|
|
||||||
|
version = "{version}";
|
||||||
|
|
||||||
|
versionHash = "{version_hash}";
|
||||||
|
}}
|
||||||
|
"""
|
||||||
|
with open(gen_file, "w+") as f:
|
||||||
|
f.write(out.strip())
|
||||||
|
|
||||||
|
# Formamt the generated Nix file, which also serves as a syntax sanity check.
|
||||||
|
subprocess.run(["nixpkgs-fmt", gen_file], check=True)
|
|
@ -30355,6 +30355,8 @@ with pkgs;
|
||||||
inherit (darwin.apple_sdk.frameworks) ApplicationServices;
|
inherit (darwin.apple_sdk.frameworks) ApplicationServices;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sapling = callPackage ../applications/version-management/sapling { };
|
||||||
|
|
||||||
mercurialFull = mercurial.override { fullBuild = true; };
|
mercurialFull = mercurial.override { fullBuild = true; };
|
||||||
|
|
||||||
merkaartor = libsForQt5.callPackage ../applications/misc/merkaartor { };
|
merkaartor = libsForQt5.callPackage ../applications/misc/merkaartor { };
|
||||||
|
|
Loading…
Reference in a new issue