Skip to content

Ignore automatically generated directories #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

paultcochrane
Copy link
Contributor

When installing the dependencies with cpm I noticed that the local/
directory is created automatically and doesn't need to be checked in to
the repository, hence it can be ignored so that the working directory
remains clean. The same is for the cover_db/ directory which is
created when generating coverage information.

If you would like any changes, please let me know and I'll be happy to update the PR and resubmit as appropriate.

When installing the dependencies with `cpm` I noticed that the `local/`
directory is created automatically and doesn't need to be checked in to
the repository, hence it can be ignored so that the working directory
remains clean.  The same is for the `cover_db/` directory which is
created when generating coverage information.
@karenetheridge
Copy link
Member

I don't understand what workflow you're using where this happens? cpm should be pulling from a cpan mirror, and those directories don't exist in the cpan release (and I think the dist.ini would exclude them if they happened to be created during a build/release cycle).

@oalders
Copy link
Member

oalders commented Dec 26, 2021

If you cpm install from the repo root, it will create a ./local dir and git will show the folder as untracked. Similar issue if you run tests with coverage.

So, it would actually probably prevent dzil from releasing because of the untracked files. I think it makes sense to ignore those dirs by default.

@paultcochrane
Copy link
Contributor Author

I don't understand what workflow you're using where this happens? cpm should be pulling from a cpan mirror, and those directories don't exist in the cpan release (and I think the dist.ini would exclude them if they happened to be created during a build/release cycle).

I was using the workflow from the GitHub actions config which uses cpm to install the dependencies; I guessed that this was the preferred way to install deps. As @oalders surmised, I ran cpm from the repository's root directory, hence why the local/ dir is generated there.

To generate coverage information I used:

cover -delete
HARNESS_PERL_SWITCHES=-MDevel::Cover prove -lr t xt
cover

Is there a preferred way to build, test and install this dist from the repository? Unfortunately, I couldn't find any docs mentioning how this should be done in the standard case. Would such information be helpful? If so, I could write up my notes and submit them as a PR. Where would be the best place to put such documentation for this project? Perhaps a CONTRIBUTING file?

BTW: I also tried using dzil to install the dependencies and run the tests (I noticed the dzil.ini file and thought I'd try it out :-) ). I noticed some installation issues:

<snip>
! Installing the dependencies failed: Module
'Code::TidyAll::Plugin::SortLines::Naturally' is not installed, Module
'Test::Code::TidyAll' is not installed, Module
'Code::TidyAll::Config::INI::Reader' is not installed, Module
'Code::TidyAll::Plugin::UniqueLines' is not installed
! Bailing out the installation for
Dist-Zilla-PluginBundle-Author-OALDERS-0.000029.

The root cause of this issue seemed to be that the package php-xmlwriter was missing; installing it with

sudo apt install php-xmlwriter

allowed the missing dependencies to be installed on my system. I haven't had a chance to work out what the necessary package would be on a Windows system though. Anyway, I thought this might be useful information in case someone else tries to build the dist directly from the repo source.

@oalders
Copy link
Member

oalders commented Jan 5, 2022

Is there a preferred way to build, test and install this dist from the repository?

I usually just use dzil, but people should be able to install the deps in the cpanfile and then just use prove to run the tests. Something like that would be worth documenting.

Not sure what's in php-xmlwriter that satisfies the dependency requirements. 🤔

Copy link
Member

@oalders oalders left a comment

Choose a reason for hiding this comment

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

Thanks, @paultcochrane!

@oalders oalders merged commit c7f2e14 into libwww-perl:master Jan 5, 2022
@paultcochrane
Copy link
Contributor Author

Thanks for merging this @oalders! I'll try and work out where the php-xmlwriter dependency came from exactly. I admit that needing this package sounded ... odd, however I thought I'd document what I came across in the hope that it's helpful somewhere.

Where should information about the preferred way to build and test the dist from a repo clone be documented? Would a CONTRIBUTING.md file be a good idea?

@oalders
Copy link
Member

oalders commented Mar 7, 2022

Would a CONTRIBUTING.md file be a good idea?

Yes, I think that would be really helpful!

paultcochrane added a commit to paultcochrane/Net-HTTP that referenced this pull request Mar 31, 2022
This change documents some of the steps required in order to contribute
to `Net::HTTP` in the hope that it helps newcomers to the project create
their first submission(s) and is submitted in response to a discussion
in libwww-perl#76.  It includes a quick start guide for setting up a `perlbrew`
environment as well as how to install `Dist::Zilla` and how to use it to
install upstream dependencies.  The document also describes the steps
necessary to create a pull request from a feature branch in a user's
forked repository.
paultcochrane added a commit to paultcochrane/Net-HTTP that referenced this pull request Mar 31, 2022
This change documents some of the steps required in order to contribute
to `Net::HTTP` in the hope that it helps newcomers to the project create
their first submission(s) and is submitted in response to a discussion
in libwww-perl#76.  It includes a quick start guide for setting up a `perlbrew`
environment as well as how to install `Dist::Zilla` and how to use it to
install upstream dependencies.  The document also describes the steps
necessary to create a pull request from a feature branch in a user's
forked repository.
paultcochrane added a commit to paultcochrane/Net-HTTP that referenced this pull request Mar 31, 2022
This change documents some of the steps required in order to contribute
to `Net::HTTP` in the hope that it helps newcomers to the project create
their first submission(s) and is submitted in response to a discussion
in libwww-perl#76.  It includes a quick start guide for setting up a `perlbrew`
environment as well as how to install `Dist::Zilla` and how to use it to
install upstream dependencies.  The document also describes the steps
necessary to create a pull request from a feature branch in a user's
forked repository.
paultcochrane added a commit to paultcochrane/Net-HTTP that referenced this pull request Mar 31, 2022
This change documents some of the steps required in order to contribute
to `Net::HTTP` in the hope that it helps newcomers to the project create
their first submission(s) and is submitted in response to a discussion
in libwww-perl#76.  It includes a quick start guide for setting up a `perlbrew`
environment as well as how to install `Dist::Zilla` and how to use it to
install upstream dependencies.  The document also describes the steps
necessary to create a pull request from a feature branch in a user's
forked repository.
paultcochrane added a commit to paultcochrane/Net-HTTP that referenced this pull request Mar 31, 2022
This change documents some of the steps required in order to contribute
to `Net::HTTP` in the hope that it helps newcomers to the project create
their first submission(s) and is submitted in response to a discussion
in libwww-perl#76.  It includes a quick start guide for setting up a `perlbrew`
environment as well as how to install `Dist::Zilla` and how to use it to
install upstream dependencies.  The document also describes the steps
necessary to create a pull request from a feature branch in a user's
forked repository.
@paultcochrane
Copy link
Contributor Author

Not sure what's in php-xmlwriter that satisfies the dependency requirements.

Just so that it's documented somewhere: I've built and tested Net::HTTP within a fresh installation matching my dev box (Debian buster) and didn't run into the issue that the php-xmlwriter package was required. Dunno what was wrong with my system when I was first trying to get Net::HTTP going...

Here's the Dockerfile I used to set up the fresh test system:

FROM debian:buster
# ensure everything is up to date
RUN apt update && apt upgrade -y
# required for basic stuff (perlbrew, repo cloning, ...) to work
RUN apt install -y vim git build-essential curl
# needed for Net::SSLeay, which is needed for Dist::Zilla
RUN apt install -y libssl-dev zlib1g-dev

# create a non-root user for remaining tasks
RUN adduser --disabled-password --gecos "" nethttp
USER nethttp

WORKDIR /home/nethttp
COPY build-net-http.sh build-net-http.sh

Here's the shell script mentioned within the Dockerfile above to set up perlbrew, and build and test Net::HTTP within a Docker container:

#!/bin/bash

# install and set up perlbrew
curl -L https://install.perlbrew.pl | bash

# use bash and source scripts for perlbrew
source ~/perl5/perlbrew/etc/bashrc

perlbrew install-cpanm
perlbrew install -v 5.30.1
perlbrew use 5.30.1

# clone the dist repo
git clone https://github.com/libwww-perl/Net-HTTP.git
cd Net-HTTP

# install prereqs
cpanm --notest Dist::Zilla
dzil authordeps --missing | cpanm
dzil listdeps --missing | cpanm

# required for `dzil test` to work
# cpanm Pod::Coverage::TrustPod Test::Pod::Coverage

# test the dist
dzil test
dzil test --release --author

The commands I used to build and run everything were:

docker build --tag build-test-net-http .
docker run -it build-test-net-http:latest
nethttp@9fcc952c6d8c:~$ ./build-net-http.sh

Hope that helps!

@oalders
Copy link
Member

oalders commented Apr 1, 2022

Thanks very much for documenting this @paultcochrane! In case it's helpful at all, you can also find a bunch of Perls with pre-installed dzil at https://registry.hub.docker.com/r/perldocker/perl-tester They should be getting built nightly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants