mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-27 16:15:05 +00:00
0eb1d070c8
https://github.com/ipfs/fs-repo-migrations/releases/tag/v2.0.2
This is pretty much a complete rewrite of the ipfs-migrator package.
In version 2.0.0 a major change was made to the way the migrator works. Before, there was one binary that contained every migration. Now every migration has its own binary. If fs-repo-migrations can't find a required binary in the PATH, it will download it off the internet. To prevent that, build every migration individually, symlink them all into one package and then wrap fs-repo-migrations so it finds the package with all the migrations.
The change to the IPFS NixOS module and the IPFS package is needed because without explicitly specifying a repo version to migrate to, fs-repo-migrations will query the internet to find the latest version. This fails in the sandbox, for example when testing the ipfs passthru tests.
While it may seem like the repoVersion and IPFS version are in sync and the code could be simplified, this is not the case. See https://github.com/ipfs/fs-repo-migrations#when-should-i-migrate for a table with the IPFS versions and corresponding repo versions.
Go 1.17 breaks the migrations, so use Go 1.16 instead. This is also the Go version used in their CI, see 3dc218e300/.github/workflows/test.yml (L4)
. See https://github.com/ipfs/fs-repo-migrations/pull/140#issuecomment-982715907 for a previous mention of this issue. The issue manifests itself when doing anything with a migration, for example `fs-repo-11-to-12 --help`:
```
panic: qtls.ClientHelloInfo doesn't match
goroutine 1 [running]:
github.com/marten-seemann/qtls-go1-15.init.0()
github.com/marten-seemann/qtls-go1-15@v0.1.1/unsafe.go:20 +0x132
```
Also add myself as a maintainer for this package.
This fixes the test failure discovered in https://github.com/NixOS/nixpkgs/pull/160914.
See https://github.com/ipfs/fs-repo-migrations/issues/148 to read some of my struggles with updating this package.
64 lines
2.1 KiB
Nix
64 lines
2.1 KiB
Nix
{ lib
|
|
, stdenv
|
|
, symlinkJoin
|
|
, buildGoModule
|
|
, ipfs-migrator-unwrapped
|
|
}:
|
|
|
|
# This package contains all the individual migrations in the bin directory.
|
|
# This is used by fs-repo-migrations and could also be used by IPFS itself
|
|
# when starting it like this: ipfs daemon --migrate
|
|
|
|
let
|
|
fs-repo-common = pname: version: buildGoModule {
|
|
inherit pname version;
|
|
inherit (ipfs-migrator-unwrapped) src;
|
|
sourceRoot = "source/${pname}";
|
|
vendorSha256 = null;
|
|
doCheck = false;
|
|
meta = ipfs-migrator-unwrapped.meta // {
|
|
mainProgram = pname;
|
|
description = "Individual migration for the filesystem repository of ipfs clients";
|
|
};
|
|
};
|
|
|
|
# Concatenation of the latest repo version and the version of that migration
|
|
version = "12.1.0.2";
|
|
|
|
fs-repo-11-to-12 = fs-repo-common "fs-repo-11-to-12" "1.0.2";
|
|
fs-repo-10-to-11 = fs-repo-common "fs-repo-10-to-11" "1.0.1";
|
|
fs-repo-9-to-10 = fs-repo-common "fs-repo-9-to-10" "1.0.1";
|
|
fs-repo-8-to-9 = fs-repo-common "fs-repo-8-to-9" "1.0.1";
|
|
fs-repo-7-to-8 = fs-repo-common "fs-repo-7-to-8" "1.0.1";
|
|
fs-repo-6-to-7 = fs-repo-common "fs-repo-6-to-7" "1.0.1";
|
|
fs-repo-5-to-6 = fs-repo-common "fs-repo-5-to-6" "1.0.1";
|
|
fs-repo-4-to-5 = fs-repo-common "fs-repo-4-to-5" "1.0.1";
|
|
fs-repo-3-to-4 = fs-repo-common "fs-repo-3-to-4" "1.0.1";
|
|
fs-repo-2-to-3 = fs-repo-common "fs-repo-2-to-3" "1.0.1";
|
|
fs-repo-1-to-2 = fs-repo-common "fs-repo-1-to-2" "1.0.1";
|
|
fs-repo-0-to-1 = fs-repo-common "fs-repo-0-to-1" "1.0.1";
|
|
|
|
all-migrations = [
|
|
fs-repo-11-to-12
|
|
fs-repo-10-to-11
|
|
fs-repo-9-to-10
|
|
fs-repo-8-to-9
|
|
fs-repo-7-to-8
|
|
] ++ lib.optional (!stdenv.isDarwin) # I didn't manage to fix this on macOS:
|
|
fs-repo-6-to-7 # gx/ipfs/QmSGRM5Udmy1jsFBr1Cawez7Lt7LZ3ZKA23GGVEsiEW6F3/eventfd/eventfd.go:27:32: undefined: syscall.SYS_EVENTFD2
|
|
++ [
|
|
fs-repo-5-to-6
|
|
fs-repo-4-to-5
|
|
fs-repo-3-to-4
|
|
fs-repo-2-to-3
|
|
fs-repo-1-to-2
|
|
fs-repo-0-to-1
|
|
];
|
|
|
|
in
|
|
|
|
symlinkJoin {
|
|
name = "ipfs-migrator-all-fs-repo-migrations-${version}";
|
|
paths = all-migrations;
|
|
}
|