Skip to content

buildFromSdist: deal with breakage of removeReferencesTo#287

Merged
srid merged 2 commits intomasterfrom
buildFromSdist-removeReferencesTo
Mar 29, 2024
Merged

buildFromSdist: deal with breakage of removeReferencesTo#287
srid merged 2 commits intomasterfrom
buildFromSdist-removeReferencesTo

Conversation

@srid
Copy link
Copy Markdown
Owner

@srid srid commented Mar 29, 2024

buildFromSdist is fucked up for yet another reason. It breaks removeReferencesTo:

impl = disallowedReferences: drv:
drv.overrideAttrs (old: rec {
inherit disallowedReferences;
postInstall = (old.postInstall or "") + ''
${lib.concatStrings (map (e: "echo Removing reference to: ${e}\n") disallowedReferences)}
${lib.concatStrings (map (e: "remove-references-to -t ${e} $out/bin/*\n") disallowedReferences)}
'';
});

The solution here is to apply removeReferencesTo after buildFromSdist.

Incidentally, `buildFromSdist` hasn't been changed since 2018:

NixOS/nixpkgs#48699
@srid srid force-pushed the buildFromSdist-removeReferencesTo branch from 295c1d3 to 01fb3da Compare March 29, 2024 16:22
Also add a warning about potential issues.

The function hasn't been updated upstream since 2018

- NixOS/nixpkgs#48699
@srid srid merged commit 785956b into master Mar 29, 2024
@srid srid deleted the buildFromSdist-removeReferencesTo branch March 29, 2024 16:26
srid added a commit to srid/emanote that referenced this pull request Mar 29, 2024
srid added a commit that referenced this pull request Apr 15, 2026
Verifies that the removeReferencesTo setting correctly sets
disallowedReferences on the final package even when buildFromSdist
is enabled (the default). This catches ordering regressions like
the one fixed in PR #287.

Closes #288
srid added a commit that referenced this pull request Apr 15, 2026
Use drvAttrs.disallowedReferences presence check instead of grepping
the binary. This directly tests the PR #287 regression: if buildFromSdist
(overrideCabal) runs after removeReferencesTo (overrideAttrs), it creates
a new derivation that loses disallowedReferences. The current ordering
(removeReferencesTo after buildFromSdist) preserves it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant