Merge pull request #298515 from abathur/resholve_0.10.1

resholve: 0.9.1 -> 0.10.2, ongoing cross fixes
This commit is contained in:
Thiago Kenji Okada 2024-03-30 15:35:04 +00:00 committed by GitHub
commit e94a1e91f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 53 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 { resholve.mkDerivation rec {
pname = "dgoss"; pname = "dgoss";
version = "0.4.1"; version = "0.4.2";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "goss-org"; owner = "goss-org";
repo = "goss"; repo = "goss";
rev = "refs/tags/v${version}"; rev = "refs/tags/v${version}";
hash = "sha256-dpMTUBMEG5tDi7E6ZRg1KHqIj5qDlvwfwJEgq/5z7RE="; hash = "sha256-FDn1OETkYIpMenk8QAAHvfNZcSzqGl5xrD0fAZPVmRM=";
}; };
dontConfigure = true; dontConfigure = true;
@ -87,6 +87,7 @@ resholve.mkDerivation rec {
license = licenses.asl20; license = licenses.asl20;
platforms = platforms.linux; platforms = platforms.linux;
maintainers = with maintainers; [ hyzual anthonyroussel ]; maintainers = with maintainers; [ hyzual anthonyroussel ];
mainProgram = "dgoss";
}; };
} }
``` ```

View File

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

View File

@ -4,35 +4,15 @@
, callPackage , callPackage
, fetchFromGitHub , fetchFromGitHub
, makeWrapper , makeWrapper
, # py-yajl deps
git
, # oil deps
pkgsBuildBuild
, re2c , re2c
, # oil deps
glibcLocales
, file , file
, six , six
, typing , typing
}: }:
rec { 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 Upstream isn't interested in packaging this as a library
(or accepting all of the patches we need to do so). (or accepting all of the patches we need to do so).
@ -40,14 +20,14 @@ rec {
*/ */
oildev = python27.pkgs.buildPythonPackage rec { oildev = python27.pkgs.buildPythonPackage rec {
pname = "oildev-unstable"; pname = "oildev-unstable";
version = "2021-07-14"; version = "2024-02-26";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "oilshell"; owner = "oilshell";
repo = "oil"; repo = "oil";
# rev == present HEAD of release/0.14.0 # rev == present HEAD of release/0.20.0
rev = "3d0427e222f7e42ae7be90c706d7fde555efca2e"; rev = "f730c79e2dcde4bc08e85a718951cfa42102bd01";
hash = "sha256-XMoNkBEEmD6AwNSu1uSh3OcWLfy4/ADtRckn/Pj2cP4="; hash = "sha256-HBj3Izh1gD63EzbgZ/9If5vihR5L2HhnyCyMah6rMg4=";
/* /*
It's not critical to drop most of these; the primary target is 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. hash on rev updates. Command will fail w/o and not print hash.
*/ */
postFetch = '' 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 { patchSrc = fetchFromGitHub {
owner = "abathur"; owner = "abathur";
repo = "nix-py-dev-oil"; repo = "nix-py-dev-oil";
rev = "v0.14.0.1"; rev = "v0.20.0.0";
hash = "sha256-47+986+SohdtoNzTYAgF2vPPWgakyg0VCmR+MgxMzTk="; hash = "sha256-qoA54rnzAdnFZ3k4kRzQWEdgtEjraCT5+NFw8AWnRDk=";
}; };
patches = [ patches = [
"${patchSrc}/0001-add_setup_py.patch" "${patchSrc}/0001-add_setup_py.patch"
"${patchSrc}/0002-add_MANIFEST_in.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}/0006-disable_failing_libc_tests.patch"
"${patchSrc}/0007-namespace_via_init.patch" "${patchSrc}/0007-namespace_via_init.patch"
"${patchSrc}/0009-avoid_nix_arch64_darwin_toolchain_bug.patch" "${patchSrc}/0009-avoid_nix_arch64_darwin_toolchain_bug.patch"
@ -80,37 +60,32 @@ rec {
"${patchSrc}/0011-disable-fanos.patch" "${patchSrc}/0011-disable-fanos.patch"
"${patchSrc}/0012-disable-doc-cmark.patch" "${patchSrc}/0012-disable-doc-cmark.patch"
"${patchSrc}/0013-fix-pyverify.patch" "${patchSrc}/0013-fix-pyverify.patch"
"${patchSrc}/0015-fix-compiled-extension-import-paths.patch"
]; ];
configureFlags = [ configureFlags = [
"--without-readline" "--without-readline"
]; ];
depsBuildBuild = [ re2c ]; nativeBuildInputs = [ re2c file makeWrapper ];
nativeBuildInputs = [ file makeWrapper ]; propagatedBuildInputs = [ six typing ];
propagatedBuildInputs = [ six typing py-yajl ];
doCheck = true; doCheck = true;
preBuild = '' preBuild = ''
build/dev.sh all build/py.sh all
''; '';
postPatch = '' postPatch = ''
patchShebangs asdl build core doctools frontend pyext oil_lang patchShebangs asdl build core doctools frontend pyext oil_lang ysh
substituteInPlace pyext/fastlex.c --replace '_gen/frontend' '../_gen/frontend'
substituteInPlace core/main_loop.py --replace 'import fanos' '# import fanos'
rm cpp/stdlib.h # keep modules from finding the wrong stdlib? rm cpp/stdlib.h # keep modules from finding the wrong stdlib?
# work around hard parse failure documented in oilshell/oil#1468 # 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' 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? # 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 # not exhaustive; sample what resholve uses as a sanity check
pythonImportsCheck = [ pythonImportsCheck = [
@ -121,7 +96,8 @@ rec {
"oil._devbuild" "oil._devbuild"
"oil._devbuild.gen.id_kind_asdl" "oil._devbuild.gen.id_kind_asdl"
"oil._devbuild.gen.syntax_asdl" "oil._devbuild.gen.syntax_asdl"
"oil.tools.osh2oil" "oil.osh"
"oil.tools.ysh_ify"
]; ];
meta = { meta = {

View File

@ -2,17 +2,31 @@
, stdenv , stdenv
, callPackage , callPackage
, python27 , python27
, fetchFromGitHub
, installShellFiles , installShellFiles
, rSrc , rSrc
, version , version
, oildev , oildev
, configargparse , configargparse
, gawk
, binlore , binlore
, resholve , resholve
, resholve-utils , 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"; pname = "resholve";
inherit version; inherit version;
src = rSrc; src = rSrc;
@ -22,6 +36,11 @@ python27.pkgs.buildPythonApplication {
propagatedBuildInputs = [ propagatedBuildInputs = [
oildev oildev
configargparse configargparse
sedparse
];
makeWrapperArgs = [
"--prefix PATH : ${lib.makeBinPath [ gawk ]}"
]; ];
postPatch = '' postPatch = ''

View File

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

View File

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

View File

@ -180,6 +180,9 @@ let
"$MV" = true; "$MV" = true;
"$XPROP" = true; "$XPROP" = true;
}; };
execer = [
"cannot:${perl}/bin/perl"
];
prologue = "${writeText "xdg-screensaver-prologue" '' prologue = "${writeText "xdg-screensaver-prologue" ''
export PERL5LIB=${with perlPackages; makePerlPath [ NetDBus XMLTwig XMLParser X11Protocol ]} export PERL5LIB=${with perlPackages; makePerlPath [ NetDBus XMLTwig XMLParser X11Protocol ]}
export PATH=$PATH:${coreutils}/bin export PATH=$PATH:${coreutils}/bin