foliage icon indicating copy to clipboard operation
foliage copied to clipboard

Fix #42: use patches for revisions

Open yvan-sraka opened this issue 2 years ago • 8 comments

yvan-sraka avatar Apr 17 '23 14:04 yvan-sraka

I tested this PR against CHaP and it looks like there are some issues.

❯ diff -r _repo _repo_old/
Binary files _repo/01-index.tar and _repo_old/01-index.tar differ
Binary files _repo/01-index.tar.gz and _repo_old/01-index.tar.gz differ
...
❯ diff -u <(tar tv --utc --full-time -f _repo/01-index.tar)  <(tar tv --utc --full-time -f _repo_old/01-index.tar) 
--- /dev/fd/63	2023-05-03 16:45:40.965278579 +0800
+++ /dev/fd/62	2023-05-03 16:45:40.965278579 +0800
@@ -586,7 +586,7 @@
 -rw-r--r-- foliage/foliage   243 2023-02-21 23:26:04 cardano-crypto-praos/2.1.1.0/package.json
 -rw-r--r-- foliage/foliage   242 2023-02-21 23:26:04 cardano-crypto-tests/2.1.0.0/package.json
 -rw-r--r-- foliage/foliage   247 2023-02-21 23:26:04 cardano-strict-containers/0.1.2.0/package.json
--rw-r--r-- foliage/foliage 21816 2023-02-22 19:09:40 plutus-core/1.1.1.0/plutus-core.cabal
+-rw-r--r-- foliage/foliage 21826 2023-02-22 19:09:40 plutus-core/1.1.1.0/plutus-core.cabal
 -rw-r--r-- foliage/foliage 20226 2023-02-23 15:00:31 ouroboros-consensus/0.2.1.0/ouroboros-consensus.cabal
 -rw-r--r-- foliage/foliage   242 2023-02-23 15:00:31 ouroboros-consensus/0.2.1.0/package.json
 -rw-r--r-- foliage/foliage  3430 2023-02-23 15:00:35 ouroboros-consensus-mock/0.2.1.0/ouroboros-consensus-mock.cabal
@@ -701,56 +701,56 @@
 -rw-r--r-- foliage/foliage   234 2023-03-10 07:05:55 freer-extras/1.2.0.0/package.json
 -rw-r--r-- foliage/foliage   235 2023-03-10 07:05:55 plutus-ledger/1.2.0.0/package.json
 -rw-r--r-- foliage/foliage   241 2023-03-10 07:05:55 plutus-script-utils/1.2.0.0/package.json
--rw-r--r-- foliage/foliage  2728 2023-03-13 06:49:06 freer-extras/1.2.0.0/freer-extras.cabal
--rw-r--r-- foliage/foliage  5537 2023-03-13 07:04:28 plutus-ledger/1.2.0.0/plutus-ledger.cabal
--rw-r--r-- foliage/foliage  3743 2023-03-13 07:15:21 plutus-script-utils/1.2.0.0/plutus-script-utils.cabal
--rw-r--r-- foliage/foliage  3650 2023-03-15 16:30:48 cardano-crypto-class/2.0.0.1/cardano-crypto-class.cabal
+-rw-r--r-- foliage/foliage  3007 2023-03-13 06:49:06 freer-extras/1.2.0.0/freer-extras.cabal
+-rw-r--r-- foliage/foliage  6363 2023-03-13 07:04:28 plutus-ledger/1.2.0.0/plutus-ledger.cabal
+-rw-r--r-- foliage/foliage  3876 2023-03-13 07:15:21 plutus-script-utils/1.2.0.0/plutus-script-utils.cabal
+-rw-r--r-- foliage/foliage  3600 2023-03-15 16:30:48 cardano-crypto-class/2.0.0.1/cardano-crypto-class.cabal
 -rw-r--r-- foliage/foliage  2290 2023-03-21 09:28:25 cardano-ping/0.1.0.0/cardano-ping.cabal
...

@yvan-sraka can you have a look?

andreabedini avatar May 03 '23 08:05 andreabedini

I tested this PR against CHaP and it looks like there are some issues.

I encountered another set of issues:

yvan@X230 ~/GitHub/foliage (git)-[patches-revisions] % nix run ".#" -- build --current-time 2023-05-05T07:16:57Zwarning: Git tree '/home/yvan/GitHub/foliage' is dirty
warning: Using saved setting for 'extra-substituters = https://cache.iog.io https://foliage.cachix.org https://cache.zw3rk.com' from ~/.local/share/nix/trusted-settings.json.
warning: Using saved setting for 'extra-trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= foliage.cachix.org-1:kAFyYLnk8JcRURWReWZCatM9v3Rk24F5wNMpEj14Q/g= loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk=' from ~/.local/share/nix/trusted-settings.json.
🌿 Foliage
# buildAction
Current time set to 2023-05-05T07:16:57Z.
# curl (for RemoteAsset https://github.com/input-output-hk/ouroboros-network/tarball/fa10cb4eef1e7d3e095cec3c2bb1210774b7e5fa)
# _sources/typed-protocols/0.1.0.0/revisions/2.cabal
foliage: Error when running Shake build system:
  at want, called at app/Foliage/CmdBuild.hs:45:7 in main:Foliage.CmdBuild
* Depends on: buildAction
  at need, called at app/Foliage/Shake.hs:38:3 in main:Foliage.Shake
* Depends on: _sources/typed-protocols/0.1.0.0/revisions/2.cabal
  at error, called at src/Development/Shake/Internal/Rules/File.hs:179:58 in shake-0.19.7-GFPtSLQxwCcJDXDlNacG7C:Development.Shake.Internal.Rules.File
* Raised the exception:
Error, file does not exist and no rule available:
  _sources/typed-protocols/0.1.0.0/revisions/2.cabal

https://github.com/andreabedini/foliage/pull/51/files#diff-1d7875671c3268865954e891560603f56d5f27866a54862952968dda690026efR85-R107

I'm struggling to determine the best strategy to fix this, knowing that using temporary files is unlikely to work… I was considering constructing files, e.g., 2.cabal (from 1.cabal and 2.patch) while generating the _repo and then removing the files from _source, so they don't bother the user. However, this approach seems hacky and might not even work since Shake need, AFAIU, is resolved very early, before our CmdBuild routine is run… WDYT?

yvan-sraka avatar May 05 '23 15:05 yvan-sraka

I'm a bit confused: in that example, have you modified CHaP? At least in current CHaP that file exists, so it's weird that shake would say that it doesn't.

michaelpj avatar May 05 '23 17:05 michaelpj

I'm a bit confused: in that example, have you modified CHaP? At least in current CHaP that file exists, so it's weird that shake would say that it doesn't.

My answer was confusing: I didn't test it against CHaP (that doesn't use yet the new revision format) but rather on the README Quickstart example + 2 revisions (1.cabal and 2.patch)!

yvan-sraka avatar May 06 '23 21:05 yvan-sraka

@yvan-sraka how are you going with this?

andreabedini avatar May 15 '23 07:05 andreabedini

@yvan-sraka how are you going with this?

I just returned from my time-off yesterday, and I was able to merge the changes with the main branch. I will now work on addressing the remaining FIXME/TODO comments in the code. Additionally, I'll be determining an appropriate method to test this feature. :)

yvan-sraka avatar May 23 '23 08:05 yvan-sraka

Marking this as draft

andreabedini avatar Aug 11 '23 05:08 andreabedini

@yvan-sraka are you still interested in finishing this?

andreabedini avatar Sep 05 '23 05:09 andreabedini

Is there some fundamental problem with this approach, or do you just don't have time to work on it ATM? @yvan-sraka I would like to try to pick this up in case of the latter.

amesgen avatar Jun 13 '24 19:06 amesgen

Is there some fundamental problem with this approach, or do you just don't have time to work on it ATM? @yvan-sraka I would like to try to pick this up in case of the latter.

Yes! It's unlikely I'll have time to work on it before leaving IOG at the end of the month, feel free to give it a try :)

yvan-sraka avatar Jun 14 '24 11:06 yvan-sraka