Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnupatch: 2.7.6 -> 2.7.6-unstable-2024-08-25 #337961

Draft
wants to merge 5 commits into
base: staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions pkgs/build-support/setup-hooks/gnulib-bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
preConfigurePhases+=(gnulibBootstrapPhase)

gnulibBootstrapPhase() {
runHook preGnulibBootstrap

local -a flagsArray=()
concatTo flagsArray gnulibBootstrapFlags

# For Gnulib’s build-aux/git-version-gen.
if [[ -z ${gnulibBootstrapDontWriteTarballVersion-} && -n ${version-} ]]; then
printf %s "$version" >.tarball-version
fi

cp @gnulib@/build-aux/bootstrap .
GNULIB_SRCDIR=@gnulib@ sh bootstrap \
--bootstrap-sync --no-git --gen \
"${flagsArray[@]}"

runHook postGnulibBootstrap
}
63 changes: 63 additions & 0 deletions pkgs/by-name/gn/gnupatch/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
lib,
stdenv,
testers,
fetchFromSavannah,
unstableGitUpdater,
gnulibBootstrapHook,
bison,
ed,
}:
let
canExecute = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
in
stdenv.mkDerivation (finalAttrs: {
pname = "patch";
version = "2.7.6-unstable-2024-08-25";

# This used to be fetchurl from GNU mirror, but mirrors don’t have Git
# snapshots and GNU patch had no releases in almost a decade.
# fetchurl { url = "mirror://gnu/patch/patch-${version}.tar.xz"; hash = ""; };
src = fetchFromSavannah {
repo = "patch";
rev = "abf6fb176bcd95e72ffb3ff85e6132d18cd77e75";
hash = "sha256-eqYTvBjjFsxe2WOeFgFMKpVWFYDiyigzc4gTdhFQrfg=";
};

nativeBuildInputs = [
gnulibBootstrapHook
bison
];

nativeCheckInputs = [ ed ];

doCheck = canExecute;

passthru.tests = lib.optionalAttrs canExecute {
version = testers.testVersion { package = finalAttrs.finalPackage; };
};

# nix develop --file maintainers/scripts/update.nix --argstr package gnupatch2
passthru.updateScript = unstableGitUpdater {
url = "https://git.savannah.gnu.org/git/patch.git";
tagPrefix = "v";
};

meta = {
description = "GNU Patch, a program to apply differences to files";
mainProgram = "patch";

longDescription = ''
GNU Patch takes a patch file containing a difference listing
produced by the diff program and applies those differences to one or
more original files, producing patched versions.
'';

homepage = "https://savannah.gnu.org/projects/patch";

license = lib.licenses.gpl3Plus;

maintainers = [ ];
platforms = lib.platforms.all;
};
})
4 changes: 2 additions & 2 deletions pkgs/development/libraries/openssl/default.nix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can merge this separate from this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was planning to do this 👍

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ lib, stdenv, fetchurl, buildPackages, perl, coreutils, writeShellScript
, makeWrapper
, makeBinaryWrapper
, withCryptodev ? false, cryptodev
, withZlib ? false, zlib
, enableSSL2 ? false
Expand Down Expand Up @@ -70,7 +70,7 @@ let
stdenv.cc.isGNU;

nativeBuildInputs =
lib.optional (!stdenv.hostPlatform.isWindows) makeWrapper
lib.optional (!stdenv.hostPlatform.isWindows) makeBinaryWrapper
++ [ perl ]
++ lib.optionals static [ removeReferencesTo ];
buildInputs = lib.optional withCryptodev cryptodev
Expand Down
10 changes: 5 additions & 5 deletions pkgs/development/tools/gnulib/default.nix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can merge this separate from this PR, and since it's a version bump, I'd prefer that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we? I thought the change to python3Minimal would be load‐bearing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not really sure if gnulib even uses/needs python3, i.e. by default gnulib-tool does a PATH lookup before using Python implementation (unless GNULIB_TOOL_IMPL is explicitly set).

https://github.com/coreutils/gnulib/blob/6e95321249ae6986c3df764a6e539f8b5be13948/gnulib-tool#L161

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{ lib, stdenv, fetchFromSavannah, python3, perl }:
{ lib, stdenv, fetchFromSavannah, python3Minimal, perl }:

stdenv.mkDerivation rec {
pname = "gnulib";
version = "20231109";
version = "1.0";

src = fetchFromSavannah {
repo = "gnulib";
rev = "2dd1a7984c6b3e6056cef7e3f9933e0039c21634";
hash = "sha256-QtWf3mljEnr0TTogkoKN63Y5HTm14A2e/sIXX3xe2SE=";
rev = "v${version}";
hash = "sha256-8c/qz58w93PU4EiEKRLeSBLQ6eA6o1BdIOtiM9fs5g4=";
};

postPatch = ''
Expand All @@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
--replace-fail 'exec perl' 'exec ${lib.getExe perl}'
'';

buildInputs = [ python3 ];
buildInputs = [ python3Minimal ];

installPhase = ''
mkdir -p $out/bin
Expand Down
21 changes: 15 additions & 6 deletions pkgs/stdenv/linux/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,11 @@ let
isFromBootstrapFiles = true;
};

getLibc = stage: stage.${localSystem.libc};
fetchurlBoot = import ../../build-support/fetchurl/boot.nix {
inherit system;
};

getLibc = stage: stage.${localSystem.libc};

# This function builds the various standard environments used during
# the bootstrap. In all stages, we build an stdenv and the package
Expand All @@ -173,9 +176,7 @@ let
shell = "${bootstrapTools}/bin/bash";
initialPath = [bootstrapTools];

fetchurlBoot = import ../../build-support/fetchurl/boot.nix {
inherit system;
};
inherit fetchurlBoot;

cc = if prevStage.gcc-unwrapped == null
then null
Expand All @@ -202,7 +203,7 @@ let
'';
});

overrides = self: super: (overrides self super) // { fetchurl = thisStdenv.fetchurlBoot; };
inherit overrides;
};

in {
Expand Down Expand Up @@ -268,6 +269,7 @@ in
};
coreutils = bootstrapTools;
gnugrep = bootstrapTools;
fetchurl = fetchurlBoot;
};
})

Expand Down Expand Up @@ -309,6 +311,8 @@ in
# won't be included in the final stdenv and won't be exported to
# top-level pkgs as an override either.
perl = super.perl.override { enableThreading = false; enableCrypt = false; };

fetchurl = fetchurlBoot;
};

# `gettext` comes with obsolete config.sub/config.guess that don't recognize LoongArch64.
Expand Down Expand Up @@ -397,6 +401,8 @@ in
find $lib/lib/ -name \*.so\* -exec patchelf --shrink-rpath {} \; || true
'';
});

fetchurl = fetchurlBoot;
};

# `gettext` comes with obsolete config.sub/config.guess that don't recognize LoongArch64.
Expand Down Expand Up @@ -481,6 +487,7 @@ in
NIX_CFLAGS_COMPILE = (previousAttrs.NIX_CFLAGS_COMPILE or "") + " -static-libstdc++";
});

fetchurl = fetchurlBoot;
};

# `gettext` comes with obsolete config.sub/config.guess that don't recognize LoongArch64.
Expand Down Expand Up @@ -522,6 +529,7 @@ in
# so we can add them to allowedRequisites below
passthru = a.passthru // { inherit (self) gmp mpfr libmpc isl; };
});
fetchurl = fetchurlBoot;
};
extraNativeBuildInputs = [
prevStage.patchelf
Expand Down Expand Up @@ -601,6 +609,7 @@ in
assert isBuiltByNixpkgsCompiler prevStage.patchelf;
{
inherit config overlays;

stdenv = import ../generic rec {
name = "stdenv-linux";

Expand All @@ -624,7 +633,7 @@ in

shell = cc.shell;

inherit (prevStage.stdenv) fetchurlBoot;
inherit fetchurlBoot;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this need to change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason in particular, it was easier to remove all fetchurl/fetchurlBoot instances in stdenv/linux and rewrite it from scratch to when working on this PR, and I haven’t minimized the diff yet because some commits should be split into separate PRs (e.g. openssl stuff).


extraAttrs = {
inherit bootstrapTools;
Expand Down
51 changes: 0 additions & 51 deletions pkgs/tools/text/gnupatch/Abort_when_cleaning_up_fails.patch

This file was deleted.

This file was deleted.

Loading
Loading