10

I've installed Time::Duration and it failed most of its tests. I want to be able to rebuild the module - with my edits - from the locally stored module.

I edited the file that contains the module (that corresponds to Duration.pm6):

~/.perl6/sources/D00C101A0157E3EAC494310C9961F299240423E7

And then try building via it's json file:

zef --debug build ~/.perl6/dist/83839D8D315EEDEDFEAF211EE42E8D936ACE29CB

This returns:

===> # SKIP: No need to build Time::Duration:ver<2.00>
!!!> Build failure: ~/.perl6/dist/83839D8D315EEDEDFEAF211EE42E8D936ACE29CB at ~/.perl6/dist

I was hoping that this would rebuild the module with the change I made to the source.

Have I done this wrong, or am I going about this entirely wrong?

ugexe
  • 5,297
  • 1
  • 28
  • 49
MorayJ
  • 537
  • 2
  • 8

2 Answers2

12

As it has been noted already you should not modify installed files. However, the workflow for testing changes of some module is pretty straight forward.

First:

# Fetch and extract the distribution, then change into its directory.
# If the distribution is still in zef's local file cache then it will
# skip the fetch and extraction steps.

zef look Time::Duration

Then:

At this point you can edit any of the files you wish.

Finally:

# test your changes without reinstalling (assumes all dependencies are installed)
zef test .

# Reinstall the modified version of Time::Duration using one of the following:
zef install . --force-install
zef uninstall Time::Duration && zef install .
ugexe
  • 5,297
  • 1
  • 28
  • 49
  • 3
    Then submit a Pull Request with your changes to the main repo? ;) – Scimon Proctor Jan 03 '19 at 19:15
  • 3
    @Scimon that does not fit into this workflow because what is fetched is not necessarily a git repo. Additionally the extract phase for a git repository does a `git checkout` from a temp directory into the zef store cache, which does not setup the e.g. `.git/` directory (nor do we really want `.git/` folders in the zef store cache). `zef browse zef bugtracker` and `zef browse zef source` sort of help, but only if the target distribution has the appropriate meta fields filled out (`Time::Duration` does not). – ugexe Jan 03 '19 at 19:25
  • Please note that you don't need to do --force-install if you change the version in META6.json. – jjmerelo Jan 04 '19 at 09:08
6

You should git clone the code or download the zip package, edit the code you want, then zef install . if the current directory have a META6.json file.

chenyf
  • 5,048
  • 1
  • 12
  • 35