Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

ExtUtils::MakeMaker : how to ignore files and not add them

by bliako (Monsignor)
on Mar 17, 2020 at 13:45 UTC ( [id://11114382]=perlquestion: print w/replies, xml ) Need Help??

bliako has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I am using this very simple Makefile.PL (ExtUtils::MakeMaker):

use ExtUtils::MakeMaker; WriteMakefile( NAME => 'A::B', VERSION_FROM => 'lib/A/B.pm' );

The problem is that it adds a lot of files in the MANIFEST which are either transient (e.g. .lock files - my editor creates a lock file during editing so I end up with A.pm.lock when editing A.pm) or plain rubbish (e.g. *.log or data/). And if these files are later deleted, I need to remake the Makefile.

I have tried adding these file extensions and directories in a ignore.txt file but I still get the same behaviour. I could not see anything relevant in the documentation but I guess is something simple. Does anyone know?

thanks, bliako

ps. EDIT stupidly I omitted the relevant version information: ExtUtils/MakeMaker.pm 7.44 and perl v.5.28.2 in linux fedora 30 with latest updates

EDIT2: see Re: Making ExtUtils::MakeMaker ignore .swp files for a solution

Replies are listed 'Best First'.
Re: ExtUtils::MakeMaker : how to ignore files and not add them
by hippo (Bishop) on Mar 17, 2020 at 13:49 UTC
    I have tried adding these file extensions and directories in a ignore.txt file

    They need to go in the MANIFEST.SKIP file instead.

      Thanks for the pointer. It must contain regex right? but this .*.lock in a separate line does not have any effect.

      EDIT: no it DOES WORK, sorry (and in fact should be .*\.lock).

        What version of ExtUtils::MakeMaker do you have? The line works for me:

        $ touch .lock $ touch AB.lock $ perl -MExtUtils::MakeMaker -E 'say $ExtUtils::MakeMaker::VERSION' 7.24 $ perl Makefile.PL && make manifest "/home/steveb/perl5/perlbrew/perls/perl-5.26.1/bin/perl" "-MExtUtils:: +Manifest=mkmanifest" -e mkmanifest Added to MANIFEST: .lock Added to MANIFEST: AB.lock # Add entry to MANIFEST.SKIP $ tail -3 MANIFEST.SKIP .base$ main$ .*.lock $ make manifest "/home/steveb/perl5/perlbrew/perls/perl-5.26.1/bin/perl" "-MExtUtils:: +Manifest=mkmanifest" -e mkmanifest Removed from MANIFEST: .lock Removed from MANIFEST: AB.lock

        Yes, each line in MANIFEST.SKIP should be a regex. Full docs are here.

Re: ExtUtils::MakeMaker : how to ignore files and not add them
by bliako (Monsignor) on Mar 20, 2020 at 10:26 UTC

    I observed another problem: With the simple Makefile.PL I posted and the existence of a lock file, make complains.

    For example: create a lock file for a perl module file I am editing (so, B.pm.lock exists). While the lock file exists, run perl Makefile.PL which produces Makefile. Exit the editor, the lock file is removed. Finally, do make. It complains (for me) that it can not find the lock file as it thinks it depends on it. And true: grep lock Makefile finds traces of the lock filename in the Makefile.

    Any ideas?

    bw, bliako

    p.s. I have updated main post to include versions (ExtUtils/MakeMaker.pm 7.44 and perl v.5.28.2 in linux fedora 30 with latest updates)

      Confirmed here with version 7.04 of ExtUtils::MakeMaker. Here's a simple script to reproduce the error. Anything after the .pm in the module name will do.

      #!/bin/bash mkdir -p lib/A cat > lib/A/B.pm <<EOT package A::B; our \$VERSION = 0.01; 1; EOT cat > Makefile.PL <<EOT use ExtUtils::MakeMaker; WriteMakefile( NAME => 'A::B', VERSION_FROM => 'lib/A/B.pm' ); EOT ext=foo touch lib/A/B.pm$ext perl Makefile.PL rm lib/A/B.pm$ext make

      Certainly seems like a bug to me.

      Update: any file created anywhere within lib/ appears to trigger it.

Re: ExtUtils::MakeMaker : how to ignore files and not add them
by bliako (Monsignor) on Apr 14, 2020 at 10:49 UTC

    This problem still bothers me and became bigger because now I have a sub-directory containing the files to push to github in my main project dir. Makefile sucks those in, finds duplicate Makefile.PL and chaos ensues. I have found the answer here Re: Making ExtUtils::MakeMaker ignore .swp files, implement MY::libscan which decides what file or dir goes in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11114382]
Approved by Athanasius
Front-paged by haukex
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (8)
As of 2024-04-19 08:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found