FS#18394 - makepkg --source fails if install file is in source array

Attached to Project: Pacman
Opened by Rorschach (Rorschach) - Thursday, 18 February 2010, 23:29 GMT
Last edited by Allan McRae (Allan) - Tuesday, 11 May 2010, 22:58 GMT
Task Type Bug Report
Category makepkg
Status Closed
Assigned To Allan McRae (Allan)
Architecture All
Severity High
Priority Normal
Reported Version 3.3.3
Due in Version 3.4.0
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Summary and Info:
------------------------

There's a bug in the function create_srcpackage() in the makepkg script. It first adds the install file to the sourcepackage-dir and after that all files in the source array (expect the url-ones..).

line 1056ff.:
if [ -n "$install" ]; then
if [ -f $install ]; then
msg2 "$(gettext "Adding install script...")"
ln -s "${startdir}/$install" "${srclinks}/${pkgbase}/"
else
error "$(gettext "Install script %s not found.")" "$install"
fi
fi

[...]

local netfile
for netfile in "${source[@]}"; do
local file=$(get_filename "$netfile")
if [ -f "$netfile" ]; then
msg2 "$(gettext "Adding %s...")" "$netfile"
ln -s "${startdir}/$netfile" "${srclinks}/${pkgbase}"
elif [ "$SOURCEONLY" -eq 2 -a -f "$SRCDEST/$file" ]; then
msg2 "$(gettext "Adding %s...")" "$file"
ln -s "$SRCDEST/$file" "${srclinks}/${pkgbase}/"
fi
done


The problem now is that if we add the .install file to the source-array because we want to have it md5sum checked like every other file, the function tries to link to it a second time with all the other sourcefiles and fails because the symlink has already created before. This results in makepkg aborting.


Steps to Reproduce:
------------------------

Create a PKGBUILD which has an install file and specify it in the source array too:
[..]
install=test.install
source=(test.install)
[..]
and try to create a source-package with makepkg --source.


Fix:
------------------------
If we have already successfully created the symlink for the install file it's safe to remove it from the source-array before the source-array is used to symlink all the other files. Patch is attached.
This task depends upon

Closed by  Allan McRae (Allan)
Tuesday, 11 May 2010, 22:58 GMT
Reason for closing:  Fixed
Additional comments about closing:  In git: http://projects.archlinux.org/pacman.git /commit/?id=64c3255b
Comment by Allan McRae (Allan) - Friday, 19 February 2010, 09:30 GMT
I'm sure there has been a discussion about this but I can not find a reference to it... maybe it was on IRC.

from man PKGBUILD:
It does not need to be included in the source array (e.g. install=pkgname.install).

So either the documentation needs changed or we need to allow adding the install file to the source array. A fix for this should also consider how we are going to fix creating source packages with install files overrides in split packages.

Some things to think about: We do not checksum PKGBUILDs and install files are really just extensions of the PKGBUILD. If we allow install files to be in the source array, should we also allow changelogs (which are handled like install files in the future)?
Comment by Rorschach (Rorschach) - Friday, 19 February 2010, 11:07 GMT
Hi,
could you provide me with an example of what you described here: "A fix for this should also consider how we are going to fix creating source packages with install files overrides in split packages." because I don't understand what you mean and would like to look at this.

And would there be any reason not to include changelogs in the source-array?
Comment by Rorschach (Rorschach) - Friday, 19 February 2010, 12:37 GMT
Comment by Gavin Bisesi (Daenyth) - Wednesday, 17 March 2010, 04:03 GMT
I don't think we should support putting the install file in the source array. They serve different purposes.
Comment by Rorschach (Rorschach) - Wednesday, 17 March 2010, 08:37 GMT
I think all files of a package, remote or shipped with the package itselfl, should be in the md5-array. That is also usefull for adding package signing. In this way you just have to sign the PKGBUILD or even just a hash of it, to ensure the integritiy of the whole package. This can make package signing faster than signing the tar-archives and things like that.
Comment by Allan McRae (Allan) - Monday, 26 April 2010, 09:02 GMT

Loading...