Skip to content

Comments

gitea: fix passthru.data-compressed#335670

Merged
philiptaron merged 1 commit intoNixOS:masterfrom
motiejus:gitea.passthru.data-compressed
Aug 19, 2024
Merged

gitea: fix passthru.data-compressed#335670
philiptaron merged 1 commit intoNixOS:masterfrom
motiejus:gitea.passthru.data-compressed

Conversation

@motiejus
Copy link
Contributor

@motiejus motiejus commented Aug 18, 2024

Fixes two bugs:

  • pass a forgotten {} to compressDrv.
  • remove incorrect usage of lndir in compressDrv. I added a brief comment on why, see this comment for more details.

Tested with:

$ nix build .#legacyPackages.x86_64-linux.gitea.passthru.data-compressed
$ ls -lh result/public/assets/licenses.txt*
lrwxrwxrwx 1 root root  90 Jan  1  1970 result/public/assets/licenses.txt -> /nix/store/p21irsr57hckd3x3ym18aa0cr9zmm3an-gitea-1.22.1-data/./public/assets/licenses.txt
-r--r--r-- 1 root root 30K Jan  1  1970 result/public/assets/licenses.txt.br
-r--r--r-- 1 root root 82K Jan  1  1970 result/public/assets/licenses.txt.gz

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@motiejus motiejus marked this pull request as ready for review August 18, 2024 19:45
@motiejus motiejus requested a review from philiptaron as a code owner August 18, 2024 19:45
Fixes two bugs:
- pass a forgotten `{}` to `compressDrv`.
- remove incorrect usage of `lndir` in `compressDrv`. I added a brief
  comment on why, see [this comment][1] for more details.

Tested with:

```
$ nix build .#legacyPackages.x86_64-linux.gitea.passthru.data-compressed
$ ls -lh result/public/assets/licenses.txt*
lrwxrwxrwx 1 root root  90 Jan  1  1970 result/public/assets/licenses.txt -> /nix/store/p21irsr57hckd3x3ym18aa0cr9zmm3an-gitea-1.22.1-data/./public/assets/licenses.txt
-r--r--r-- 1 root root 30K Jan  1  1970 result/public/assets/licenses.txt.br
-r--r--r-- 1 root root 82K Jan  1  1970 result/public/assets/licenses.txt.gz
```

[1]: NixOS#332752 (comment)
@motiejus motiejus force-pushed the gitea.passthru.data-compressed branch from e3918fc to 1bd3504 Compare August 18, 2024 19:47
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Aug 18, 2024
Comment on lines +72 to +75
# cannot use lndir here, because it also symlinks directories,
# which we do not need; we only need to symlink files.
(cd ${drv}; find -L -type d -exec mkdir -p $out/{} ';')
(cd ${drv}; find -L -type f -exec ln -s ${drv}/{} $out/{} ';')
Copy link
Contributor

Choose a reason for hiding this comment

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

I also just find this so much easier to reason about than lndir. I'm glad to see the return.

Copy link
Member

Choose a reason for hiding this comment

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

It is just how lndir functions, that it doesn't recurse into other symlinks. Probably mainly to avoid symlink loops?

@philiptaron philiptaron merged commit b7d9ab2 into NixOS:master Aug 19, 2024
mkdir $out
(cd $out; ${xorg.lndir}/bin/lndir ${drv})

# cannot use lndir here, because it also symlinks directories,
Copy link
Member

Choose a reason for hiding this comment

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

That comment is wrong. lndir never symlinks directories directly. Only if they are a symlink and then the input file is technically not a directory but a symlink to a directory.

@motiejus motiejus deleted the gitea.passthru.data-compressed branch August 19, 2024 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants