internal/pkg: standardise artifact IR
All checks were successful
Test / Create distribution (push) Successful in 1m0s
Test / Sandbox (push) Successful in 2m41s
Test / Hakurei (push) Successful in 4m1s
Test / ShareFS (push) Successful in 4m1s
Test / Hpkg (push) Successful in 4m35s
Test / Sandbox (race detector) (push) Successful in 5m4s
Test / Hakurei (race detector) (push) Successful in 6m0s
Test / Flake checks (push) Successful in 1m46s
All checks were successful
Test / Create distribution (push) Successful in 1m0s
Test / Sandbox (push) Successful in 2m41s
Test / Hakurei (push) Successful in 4m1s
Test / ShareFS (push) Successful in 4m1s
Test / Hpkg (push) Successful in 4m35s
Test / Sandbox (race detector) (push) Successful in 5m4s
Test / Hakurei (race detector) (push) Successful in 6m0s
Test / Flake checks (push) Successful in 1m46s
This should hopefully provide good separation between the artifact curing backend implementation and the (still work in progress) language. Making the IR parseable also guarantees uniqueness of the representation. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -40,7 +40,7 @@ func TestTar(t *testing.T) {
|
||||
}, pkg.MustDecode(
|
||||
"cTw0h3AmYe7XudSoyEMByduYXqGi-N5ZkTZ0t9K5elsu3i_jNIVF5T08KR1roBFM",
|
||||
))
|
||||
}, pkg.MustDecode("nnOiyjjjvgZChsGtO4rA1JHckwYBBbxwNfecPJp62OFP6aoYUxHQ5UtYsrDpnwan")},
|
||||
}, pkg.MustDecode("NQTlc466JmSVLIyWklm_u8_g95jEEb98PxJU-kjwxLpfdjwMWJq0G8ze9R4Vo1Vu")},
|
||||
|
||||
{"http expand", nil, func(t *testing.T, base *check.Absolute, c *pkg.Cache) {
|
||||
checkTarHTTP(t, base, c, fstest.MapFS{
|
||||
@@ -51,7 +51,7 @@ func TestTar(t *testing.T) {
|
||||
}, pkg.MustDecode(
|
||||
"CH3AiUrCCcVOjOYLaMKKK1Da78989JtfHeIsxMzWOQFiN4mrCLDYpoDxLWqJWCUN",
|
||||
))
|
||||
}, pkg.MustDecode("bQVH19N7dX50SdQ6JNVYbFdDZV4t8IaM4dhxGvjACpdoEgJ2jZJfYKLH4ya7ZD_s")},
|
||||
}, pkg.MustDecode("hSoSSgCYTNonX3Q8FjvjD1fBl-E-BQyA6OTXro2OadXqbST4tZ-akGXszdeqphRe")},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -98,17 +98,36 @@ func checkTarHTTP(
|
||||
|
||||
wantIdent := func() pkg.ID {
|
||||
h := sha512.New384()
|
||||
|
||||
// kind uint64
|
||||
h.Write([]byte{byte(pkg.KindTar), 0, 0, 0, 0, 0, 0, 0})
|
||||
// deps_sz uint64
|
||||
h.Write([]byte{1, 0, 0, 0, 0, 0, 0, 0})
|
||||
|
||||
// kind uint64
|
||||
h.Write([]byte{byte(pkg.KindHTTPGet), 0, 0, 0, 0, 0, 0, 0})
|
||||
// ident ID
|
||||
h0 := sha512.New384()
|
||||
// kind uint64
|
||||
h0.Write([]byte{byte(pkg.KindHTTPGet), 0, 0, 0, 0, 0, 0, 0})
|
||||
h0.Write(testdataChecksum[:])
|
||||
// deps_sz uint64
|
||||
h0.Write([]byte{0, 0, 0, 0, 0, 0, 0, 0})
|
||||
// url string
|
||||
h0.Write([]byte{byte(pkg.IRKindString), 0, 0, 0})
|
||||
h0.Write([]byte{0x10, 0, 0, 0})
|
||||
h0.Write([]byte("file:///testdata"))
|
||||
// end(KnownChecksum)
|
||||
h0.Write([]byte{byte(pkg.IRKindEnd), 0, 0, 0})
|
||||
h0.Write([]byte{byte(pkg.IREndKnownChecksum), 0, 0, 0})
|
||||
// checksum Checksum
|
||||
h0.Write(testdataChecksum[:])
|
||||
h.Write(h0.Sum(nil))
|
||||
|
||||
h.Write(make([]byte, len(pkg.Checksum{})))
|
||||
h.Write([]byte{pkg.TarGzip, 0, 0, 0, 0, 0, 0, 0})
|
||||
// compression uint32
|
||||
h.Write([]byte{byte(pkg.IRKindUint32), 0, 0, 0})
|
||||
h.Write([]byte{pkg.TarGzip, 0, 0, 0})
|
||||
// end
|
||||
h.Write([]byte{byte(pkg.IRKindEnd), 0, 0, 0})
|
||||
h.Write([]byte{0, 0, 0, 0})
|
||||
|
||||
return pkg.ID(h.Sum(nil))
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user