FS#17175 - makepkg to remove src/ before building

Attached to Project: Pacman
Opened by Phillip Smith (fukawi2) - Tuesday, 17 November 2009, 09:31 GMT
Last edited by Allan McRae (Allan) - Tuesday, 15 October 2013, 04:26 GMT
Task Type Feature Request
Category makepkg
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version 3.3.2
Due in Version 4.2.0
Due Date Undecided
Percent Complete 100%
Votes 5
Private No

Details

When makepkg is called, can it please remove the src/ dir the same way it removes the pkg/ dir when the -R flag is used?

I've lost count of the amount of times I've had a build fail (especially with big packages like gcc, glibc and kernels) for one reason or another, fixed the PKGBUILD then had the build fail again because I forgot to remove the src/ dir and it's trying to compile an inconsistent source. Removing the src/ dir and starting the build a 3rd time works fine.

I understand why it doesn't (eg, for use with the -o flag) so perhaps a config option in /etc/makepkg.conf so users can select. I have builds fail due to this problem more often than I want to use the -o flag to manually change something before building (IMHO it should be done in the PKGBUILD anyway if you want to do that!)
This task depends upon

Closed by  Allan McRae (Allan)
Tuesday, 15 October 2013, 04:26 GMT
Reason for closing:  Implemented
Additional comments about closing:  makepkg -C/--cleanbuild
commit 043f250d
Comment by Dan McGee (toofishes) - Tuesday, 17 November 2009, 13:23 GMT
-1 to this. When I compile I rarely see this happen because I try to make sure my PKGBUILDs are reentrant. I also know I can compile a kernel without removing src/ because I do it all the time with my Eee kernel.
Comment by Allan McRae (Allan) - Tuesday, 17 November 2009, 21:24 GMT
I know I have struck this before with gcc snapshot builds where I have needed to apply/remove a patch to fix a build error. Gvien that is about the only package I build directly on my system, that is a 100% encounter rate for this bug...

However, I agree with Dan that automatically deleting that folder is probably not the best approach. I need to think about this some more.
Comment by Gavin Bisesi (Daenyth) - Tuesday, 17 November 2009, 21:54 GMT
This misfeature would be a massive pain in the ass for developing new packages IMO. I know I rely on src/ being there during testing, if I have to figure out some strange build process.

-1
Comment by Xavier (shining) - Tuesday, 17 November 2009, 23:06 GMT
Do you want makepkg to remove src/ at the beginning or at the end ? It probably has different impacts.

Anyway, I would also highly dislike src/ being removed, no matter when. I would actually like to investigate how to re-use a current src/ build more easily and safely. This is probably in line with Dan comments, trying to make pkgbuilds as reentrant as possible.

Anyway, as long as the removal of src/ is not enabled by default, we cannot complain.
Comment by Phillip Smith (fukawi2) - Tuesday, 17 November 2009, 23:11 GMT
I'd like to see it removed at the start - the same way it treats pkg/ when using the -R option.

I'd be happy with a non-default option on makepkg.conf or a command line switch that I can alias since I seem to be the minority here....
Comment by Allan McRae (Allan) - Tuesday, 17 November 2009, 23:43 GMT
Note the $pkgdir is only removed when there is a package() function.

Anyway, maybe this fits into the whole VCS package overhaul we have been talking about where we make better use of the prebuilt stuff in $srcdir instead of just deleting it all...
Comment by Techlive Zheng (techlive) - Thursday, 22 March 2012, 23:54 GMT
+1 for removing src before the extraction, or at less a command line switch is provided.

Sometimes, we need to apply a patch which would create a new file or rename an existing file, if we do not prune the exsiting src directory before the extraction and just overwrite the one in the src tarball, these newly created files by the patch applied in the previous building would cause the current patch failed to apply.

For a none vcs package, it is better remove the existing src directory before building, or at less the src tarball destination if it exists.

For a vcs package, the vcs-build directory need to be recreated before the building process.
Comment by Lara Maia (mrk3004) - Sunday, 20 May 2012, 00:54 GMT
+1

I've had several problems with packages that had the same name directory
Comment by Allan McRae (Allan) - Saturday, 09 February 2013, 09:32 GMT
Hmm... maybe we can do more towards this now with the prepare() function.
Comment by Phillip Smith (fukawi2) - Sunday, 10 February 2013, 21:58 GMT
Not sure exactly what ideas you have there Allan? According to the docs "This function is run after the source extraction and before the build() function and is skipped when source extraction is skipped."

If prepare() is happening after the source extraction (and skipped is source extraction doesn't happen), then how can it 'clean' src/?
Comment by Allan McRae (Allan) - Sunday, 10 February 2013, 22:35 GMT
My idea was coming up with a rule like - with a PKGBUILD with a prepare() function, we delete src/ anytime --noextract is not used. But I'm not sure we can come up with an automatic rule...
Comment by Phillip Smith (fukawi2) - Sunday, 10 February 2013, 22:45 GMT
Ah I see, so to obtain the functionality of this feature request, add a prepare() function to a PKGBUILD that extracts the source, then use the --noextract option?

That does seem a little backwards; almost "easter egg" like.

Loading...