resholve: 0.9.1 -> 0.10.2, ongoing cross fixes

This commit is contained in:
Travis A. Everett 2024-03-05 22:09:07 -06:00
parent 67d25591a0
commit 56d5b181c9
7 changed files with 50 additions and 95 deletions

View File

@ -1,42 +0,0 @@
diff -ur a/decoder.c b/decoder.c
--- a/decoder.c 1980-01-02 00:00:00.000000000 -0500
+++ b/decoder.c 2023-11-08 17:42:43.981838074 -0500
@@ -94,7 +94,7 @@
return PlaceObject(ctx, PyBool_FromLong((long)(value)));
}
-static int handle_number(void *ctx, const char *value, unsigned int length)
+static int handle_number(void *ctx, const char *value, size_t length)
{
//fprintf(stderr, "handle_number: ");
//fwrite(value, length, 1, stderr);
@@ -127,7 +127,7 @@
return status;
}
-static int handle_string(void *ctx, const unsigned char *value, unsigned int length)
+static int handle_string(void *ctx, const unsigned char *value, size_t length)
{
return PlaceObject(ctx, PyString_FromStringAndSize((char *)value, length));
}
@@ -142,7 +142,7 @@
return success;
}
-static int handle_dict_key(void *ctx, const unsigned char *value, unsigned int length)
+static int handle_dict_key(void *ctx, const unsigned char *value, size_t length)
{
PyObject *object = PyString_FromStringAndSize((const char *) value, length);
diff -ur a/yajl.c b/yajl.c
--- a/yajl.c 1980-01-02 00:00:00.000000000 -0500
+++ b/yajl.c 2023-11-08 17:41:18.781350335 -0500
@@ -161,7 +161,7 @@
}
static struct PyMethodDef yajl_methods[] = {
- {"dumps", (PyCFunctionWithKeywords)(py_dumps), METH_VARARGS | METH_KEYWORDS,
+ {"dumps", (PyCFunction)(py_dumps), METH_VARARGS | METH_KEYWORDS,
"yajl.dumps(obj [, indent=None])\n\n\
Returns an encoded JSON string of the specified `obj`\n\
\n\

View File

@ -52,13 +52,13 @@ Here's a simple example of how `resholve.mkDerivation` is already used in nixpkg
resholve.mkDerivation rec {
pname = "dgoss";
version = "0.4.1";
version = "0.4.2";
src = fetchFromGitHub {
owner = "goss-org";
repo = "goss";
rev = "refs/tags/v${version}";
hash = "sha256-dpMTUBMEG5tDi7E6ZRg1KHqIj5qDlvwfwJEgq/5z7RE=";
hash = "sha256-FDn1OETkYIpMenk8QAAHvfNZcSzqGl5xrD0fAZPVmRM=";
};
dontConfigure = true;
@ -87,6 +87,7 @@ resholve.mkDerivation rec {
license = licenses.asl20;
platforms = platforms.linux;
maintainers = with maintainers; [ hyzual anthonyroussel ];
mainProgram = "dgoss";
};
}
```

View File

@ -28,7 +28,7 @@ let
stripTests = true;
enableOptimizations = false;
};
callPackage = lib.callPackageWith (pkgs // { python27 = python27'; });
callPackage = lib.callPackageWith (pkgsBuildHost // { python27 = python27'; });
source = callPackage ./source.nix { };
deps = callPackage ./deps.nix { };
in

View File

@ -4,35 +4,15 @@
, callPackage
, fetchFromGitHub
, makeWrapper
, # py-yajl deps
git
, # oil deps
pkgsBuildBuild
, re2c
, # oil deps
glibcLocales
, file
, six
, typing
}:
rec {
py-yajl = python27.pkgs.buildPythonPackage rec {
pname = "oil-pyyajl-unstable";
version = "2022-09-01";
src = fetchFromGitHub {
owner = "oilshell";
repo = "py-yajl";
rev = "72686b0e2e9d13d3ce5fefe47ecd607c540c90a3";
hash = "sha256-H3GKN0Pq1VFD5+SWxm8CXUVO7zAyj/ngKVmDaG/aRT4=";
fetchSubmodules = true;
};
patches = [
# Fixes several incompatible function pointer conversions, which are errors in clang 16.
./0014-clang_incompatible_function_pointer_conversions.patch
];
# just for submodule IIRC
nativeBuildInputs = [ git ];
};
/*
Upstream isn't interested in packaging this as a library
(or accepting all of the patches we need to do so).
@ -40,14 +20,14 @@ rec {
*/
oildev = python27.pkgs.buildPythonPackage rec {
pname = "oildev-unstable";
version = "2021-07-14";
version = "2024-02-26";
src = fetchFromGitHub {
owner = "oilshell";
repo = "oil";
# rev == present HEAD of release/0.14.0
rev = "3d0427e222f7e42ae7be90c706d7fde555efca2e";
hash = "sha256-XMoNkBEEmD6AwNSu1uSh3OcWLfy4/ADtRckn/Pj2cP4=";
# rev == present HEAD of release/0.20.0
rev = "f730c79e2dcde4bc08e85a718951cfa42102bd01";
hash = "sha256-HBj3Izh1gD63EzbgZ/9If5vihR5L2HhnyCyMah6rMg4=";
/*
It's not critical to drop most of these; the primary target is
@ -58,7 +38,7 @@ rec {
hash on rev updates. Command will fail w/o and not print hash.
*/
postFetch = ''
rm -rf $out/{Python-2.7.13,metrics,py-yajl,rfc,gold,web,testdata,services,demo,devtools}
rm -rf $out/{Python-2.7.13,metrics,py-yajl,rfc,gold,web,testdata,services,demo}
'';
};
@ -66,13 +46,13 @@ rec {
patchSrc = fetchFromGitHub {
owner = "abathur";
repo = "nix-py-dev-oil";
rev = "v0.14.0.1";
hash = "sha256-47+986+SohdtoNzTYAgF2vPPWgakyg0VCmR+MgxMzTk=";
rev = "v0.20.0.0";
hash = "sha256-qoA54rnzAdnFZ3k4kRzQWEdgtEjraCT5+NFw8AWnRDk=";
};
patches = [
"${patchSrc}/0001-add_setup_py.patch"
"${patchSrc}/0002-add_MANIFEST_in.patch"
"${patchSrc}/0004-disable-internal-py-yajl-for-nix-built.patch"
"${patchSrc}/0006-disable_failing_libc_tests.patch"
"${patchSrc}/0007-namespace_via_init.patch"
"${patchSrc}/0009-avoid_nix_arch64_darwin_toolchain_bug.patch"
@ -80,37 +60,32 @@ rec {
"${patchSrc}/0011-disable-fanos.patch"
"${patchSrc}/0012-disable-doc-cmark.patch"
"${patchSrc}/0013-fix-pyverify.patch"
"${patchSrc}/0015-fix-compiled-extension-import-paths.patch"
];
configureFlags = [
"--without-readline"
];
depsBuildBuild = [ re2c ];
nativeBuildInputs = [ re2c file makeWrapper ];
nativeBuildInputs = [ file makeWrapper ];
propagatedBuildInputs = [ six typing py-yajl ];
propagatedBuildInputs = [ six typing ];
doCheck = true;
preBuild = ''
build/dev.sh all
build/py.sh all
'';
postPatch = ''
patchShebangs asdl build core doctools frontend pyext oil_lang
substituteInPlace pyext/fastlex.c --replace '_gen/frontend' '../_gen/frontend'
substituteInPlace core/main_loop.py --replace 'import fanos' '# import fanos'
patchShebangs asdl build core doctools frontend pyext oil_lang ysh
rm cpp/stdlib.h # keep modules from finding the wrong stdlib?
# work around hard parse failure documented in oilshell/oil#1468
substituteInPlace osh/cmd_parse.py --replace 'elif self.c_id == Id.Op_LParen' 'elif False'
# disable fragile libc tests
substituteInPlace build/py.sh --replace "py-ext-test pyext/libc_test.py" "#py-ext-test pyext/libc_test.py"
'';
# See earlier note on glibcLocales TODO: verify needed?
LOCALE_ARCHIVE = lib.optionalString (stdenv.buildPlatform.libc == "glibc") "${pkgsBuildBuild.glibcLocales}/lib/locale/locale-archive";
LOCALE_ARCHIVE = lib.optionalString (stdenv.buildPlatform.libc == "glibc") "${glibcLocales}/lib/locale/locale-archive";
# not exhaustive; sample what resholve uses as a sanity check
pythonImportsCheck = [
@ -121,7 +96,8 @@ rec {
"oil._devbuild"
"oil._devbuild.gen.id_kind_asdl"
"oil._devbuild.gen.syntax_asdl"
"oil.tools.osh2oil"
"oil.osh"
"oil.tools.ysh_ify"
];
meta = {

View File

@ -2,17 +2,31 @@
, stdenv
, callPackage
, python27
, fetchFromGitHub
, installShellFiles
, rSrc
, version
, oildev
, configargparse
, gawk
, binlore
, resholve
, resholve-utils
}:
python27.pkgs.buildPythonApplication {
let
sedparse = python27.pkgs.buildPythonPackage rec {
pname = "sedparse";
version = "0.1.2";
src = fetchFromGitHub {
owner = "aureliojargas";
repo = "sedparse";
rev = "0.1.2";
hash = "sha256-Q17A/oJ3GZbdSK55hPaMdw85g43WhTW9tuAuJtDfHHU=";
};
};
in python27.pkgs.buildPythonApplication {
pname = "resholve";
inherit version;
src = rSrc;
@ -22,6 +36,11 @@ python27.pkgs.buildPythonApplication {
propagatedBuildInputs = [
oildev
configargparse
sedparse
];
makeWrapperArgs = [
"--prefix PATH : ${lib.makeBinPath [ gawk ]}"
];
postPatch = ''

View File

@ -3,11 +3,11 @@
}:
rec {
version = "0.9.1";
version = "0.10.2";
rSrc = fetchFromGitHub {
owner = "abathur";
repo = "resholve";
rev = "v${version}";
hash = "sha256-hkLKQKhEMD1UQ9EunPmx5Tsh44q4+tYj820OXF2ueUo=";
hash = "sha256-QXIX3Ai9HUFosvhfYTUJILZ588cvxTzULUUp1LYkQ0A=";
};
}

View File

@ -1,7 +1,8 @@
{ lib
, fetchFromGitHub
, runCommand
, pkgsBuildBuild
, yallback
, yara
}:
/* TODO/CAUTION:
@ -29,8 +30,8 @@ let
src = fetchFromGitHub {
owner = "abathur";
repo = "binlore";
rev = "v0.2.0";
hash = "sha256-bBJky7Km+mieHTqoMz3mda3KaKxr9ipYpfQqn/4w8J0=";
rev = "v0.3.0";
hash = "sha256-4Fs6HThfDhKRskuDJx2+hucl8crMRm10K6949JdIwPY=";
};
/*
binlore has one one more yallbacks responsible for
@ -58,7 +59,7 @@ let
callback = lore: drv: overrides: ''
if [[ -d "${drv}/bin" ]] || [[ -d "${drv}/lib" ]] || [[ -d "${drv}/libexec" ]]; then
echo generating binlore for $drv by running:
echo "${pkgsBuildBuild.yara}/bin/yara --scan-list --recursive ${lore.rules} <(printf '%s\n' ${drv}/{bin,lib,libexec}) | ${pkgsBuildBuild.yallback}/bin/yallback ${lore.yallback}"
echo "${yara}/bin/yara --scan-list --recursive ${lore.rules} <(printf '%s\n' ${drv}/{bin,lib,libexec}) | ${yallback}/bin/yallback ${lore.yallback}"
else
echo "failed to generate binlore for $drv (none of ${drv}/{bin,lib,libexec} exist)"
fi
@ -83,7 +84,7 @@ let
((i--)) || true # don't break build
done # || true # don't break build
if [[ -d "${drv}/bin" ]] || [[ -d "${drv}/lib" ]] || [[ -d "${drv}/libexec" ]]; then
${pkgsBuildBuild.yara}/bin/yara --scan-list --recursive ${lore.rules} <(printf '%s\n' ${drv}/{bin,lib,libexec}) | ${pkgsBuildBuild.yallback}/bin/yallback ${lore.yallback} "$filter"
${yara}/bin/yara --scan-list --recursive ${lore.rules} <(printf '%s\n' ${drv}/{bin,lib,libexec}) | ${yallback}/bin/yallback ${lore.yallback} "$filter"
fi
'';
};