FS#12399 - [patch] add !perlinfo to remove perllocal.pod and .packlist files

Attached to Project: Pacman
Opened by tdy (tdy) - Wednesday, 10 December 2008, 11:00 GMT
Last edited by Dan McGee (toofishes) - Saturday, 17 January 2009, 17:09 GMT
Task Type Feature Request
Category makepkg
Status Closed
Assigned To Allan McRae (Allan)
Architecture All
Severity Low
Priority Normal
Reported Version 3.2.1
Due in Version 3.3.0
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

A small patch for a !perlinfo option:
- removes perllocal.pod and .packlist files
- performs !emptydirs

I wasn't sure if !emptydirs here would be desirable, but I included it for now anyway. Maybe it would be preferred to have the user call !emptydirs explicitly.

I couldn't find any discussion/reports about adding such an option to makepkg, so apologies in advance if this has already been brought up and deemed unnecessary/useless/undesirable/etc.

-- Tim
This task depends upon

Closed by  Dan McGee (toofishes)
Saturday, 17 January 2009, 17:09 GMT
Reason for closing:  Implemented
Additional comments about closing:  See commit 9a7f68317aa652cbc89e7fa69381d6239a63a6e7
Comment by Allan McRae (Allan) - Wednesday, 10 December 2008, 11:23 GMT
I not sure about adding an option specifically for perl packages. We could eventually end up with far to many options...

Maybe it would be best to take something this patch (http://archlinux.org/pipermail/pacman-dev/2008-December/007758.html) and make it more general so files did not have to be given a full path in order to be removed.
Comment by Dan McGee (toofishes) - Wednesday, 10 December 2008, 13:14 GMT
I'm with Allan- I'm not sure how to implement it, but some more general "remove files" type option would be great- this could take care of the info index, these perl files, etc.
Comment by tdy (tdy) - Wednesday, 10 December 2008, 13:32 GMT
Somehow it never occurred to me to merge this feature with the restrict patch, but I agree that it would be better to implement it there. Here's a quick patch I threw together.. there are probably some holes I overlooked, but I can't stay up any longer.

I renamed the option/array to purge/PURGE_TARGETS, but feel free to stick with 'restrict' or some other name. It treats 'file:path/to/foo' as a hardcoded path and defaults to a regex if 'file:' isn't specified.
Comment by Dan McGee (toofishes) - Wednesday, 10 December 2008, 14:41 GMT
+ if [[ "$pt" =~ "file:" ]]; then
You can do that in bash? I had no idea. And remember globbing and regexes are completely different things- "*.pod" wouldn't even compile as a regex.
Comment by Aaron Griffin (phrakture) - Wednesday, 10 December 2008, 16:34 GMT
I like the naming of "purge" over "restrict" 8) You have my vote!
Comment by tdy (tdy) - Thursday, 11 December 2008, 02:15 GMT
@glob vs regex: Thanks for pointing this out. I wasn't aware of the terminology and clear-cut distinction before.

If I'm understanding globs correctly, I should have either 1) used 'find -regex' in the code or 2) replaced "regex patterns" with something like "wildcard patterns" or "patterns" in the comments.
Comment by Aaron Griffin (phrakture) - Thursday, 11 December 2008, 20:55 GMT
Just a small note, you probably don't want double quotes around the $pt var in find, as it will glob first.... might cause issues
Comment by Gavin Bisesi (Daenyth) - Friday, 12 December 2008, 13:52 GMT
I'm undecided. On the one hand, just about every perl PKGBUILD needs that code. On the other hand, it's not KISS IMO to have a ton of specific makepkg options for this and for that and for whatever else. I'd hate to see PKGBUILDS become more like ebuilds.

So to sum up, I'd rather not have the !perlinfo option.
Comment by Allan McRae (Allan) - Friday, 12 December 2008, 14:00 GMT
Daenyth, did you actually read any of the comments and progress in this bug report before commenting?

On topic, I was wondering if instead of an if splitting values with file: in front and those without, we could just use two find statements like:

find . -type f -name "$pt" -exec rm -f -- '{}' \;
find . -samefile "$pt" -exec rm -f -- '{}' \;

That way we could have:

PURGE_TARGETS=(usr/share/info/dir .packlist *.pod)

which I think is nice and clean.
Comment by Aaron Griffin (phrakture) - Friday, 12 December 2008, 16:51 GMT
@Daenyth:
I think the proposed idea is to create a list, in makepkg.conf, of files and patterns we remove from _all_ packages. This would make the setting at the _distro_ level, not the _package_ level. This list would include info/dir files, packlist files, pod files, and others...
Comment by Gavin Bisesi (Daenyth) - Saturday, 13 December 2008, 00:41 GMT
You're right, I didn't read closely. I do like the purge proposal.
Comment by Allan McRae (Allan) - Sunday, 21 December 2008, 03:42 GMT
Patch pulled onto my working branch:
http://dev.archlinux.org/~allan/gitweb/gitweb.cgi?p=pacman.git;a=commitdiff;h=3dbd12b4

This allows the specification of
PURGE_TARGETS=(usr/share/info/dir .packlist *.pod)

Anythinig with a "/" in the file name is removed using rm while others are removed using find.
Comment by tdy (tdy) - Sunday, 21 December 2008, 08:51 GMT
Nice, a slash search is much simpler than my draft.

I couldn't seem to get the find-x2 to work in my test dirs, so I was just waiting for some gurus to comment on it. In any case, I like this newest implementation.
Comment by Aaron Griffin (phrakture) - Wednesday, 24 December 2008, 17:48 GMT
Allan, you're my hero

Loading...