FS#18831 - "makepkg --source" does not add .install files from package_...() function

Attached to Project: Pacman
Opened by Vlad George (DonVla) - Thursday, 25 March 2010, 16:14 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 0
Private No

Details

Summary and Info:
"makepkg --source" does not add .install files from package_...() functions

Steps to Reproduce:
run for example "makepkg --source" on the gcc PKGBUILD:
"
$ makepkg --source
==> Making package: gcc 4.4.3-1 x86_64 (Do 25. Mär 17:08:55 CET 2010)
==> Retrieving Sources...
-> Found gcc-core-4.4.3.tar.bz2 in build dir
-> Found gcc-g++-4.4.3.tar.bz2 in build dir
-> Found gcc-fortran-4.4.3.tar.bz2 in build dir
-> Found gcc-objc-4.4.3.tar.bz2 in build dir
-> Found gcc-ada-4.4.3.tar.bz2 in build dir
-> Found libstdc++-man.4.4.0.tar.bz2 in build dir
-> Found gcc_pure64.patch in build dir
-> Found gcc-hash-style-both.patch in build dir
==> Validating source files with md5sums...
gcc-core-4.4.3.tar.bz2 ... Passed
gcc-g++-4.4.3.tar.bz2 ... Passed
gcc-fortran-4.4.3.tar.bz2 ... Passed
gcc-objc-4.4.3.tar.bz2 ... Passed
gcc-ada-4.4.3.tar.bz2 ... Passed
libstdc++-man.4.4.0.tar.bz2 ... Passed
gcc_pure64.patch ... Passed
gcc-hash-style-both.patch ... Passed
==> Creating source package...
-> Adding PKGBUILD...
-> Adding gcc_pure64.patch...
-> Adding gcc-hash-style-both.patch...
-> Compressing source package...
==> Source package created: gcc (Do 25. Mär 17:08:57 CET 2010)
"
Though there are .install files in the directory:
"$ ls *install
gcc-ada.install gcc-fortran.install gcc.install gcc-libs.install"
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 Ionut Biru (wonder) - Thursday, 25 March 2010, 16:41 GMT
makepkg will parse PKGBUILD and if there is an install declared it will use it. look inside the tarball and see that they are there.
Comment by Vlad George (DonVla) - Thursday, 25 March 2010, 16:52 GMT
Hello ionut,

No there are not _all_ install files. As I said, if the install files are defined _inside_ a package function (like "
package_gcc-libs()
{
pkgdesc="Runtime libraries shipped by GCC for C and C++ languages"
groups=('base')
depends=('glibc>=2.10.1-5')
install=gcc-libs.install
...
}
")
the gcc-libs.install file is not inside the src.tar.gz.
Here is the archive output after running "makepkg --source":
"
$ tar -tf gcc-4.4.3-1.src.tar.gz
gcc/
gcc/gcc_pure64.patch
gcc/gcc-hash-style-both.patch
gcc/PKGBUILD
"
I don't think I missed smth.
Vlad
Comment by Gavin Bisesi (Daenyth) - Thursday, 25 March 2010, 22:22 GMT
Here's a patch that should fix it. I haven't had a chance to test it yet.
Comment by christopher rogers (godane) - Tuesday, 13 April 2010, 07:57 GMT
@Daenyth
Your patch didn't work. I got this with gcc package:
/usr/bin/makepkg: eval: line 1074: syntax error: unexpected end of file

I hope it helps fix this bug.
Comment by Vlad George (DonVla) - Tuesday, 13 April 2010, 09:25 GMT
I guess that should be:
"
if [[ -n $installfile ]]; then
installfiles+=("$installfile")
fi
"
The parentheses are missing.
Comment by Allan McRae (Allan) - Tuesday, 13 April 2010, 10:30 GMT
No, the eval line is just wrong... It just resources the function so is no improvement over just sourcing the PKGBUILD.

We will actually want something like:
installfiles=$(grep "^[[:space:]]*install=" PKGBUILD | sed "s#install=##")

And we need the same for changelogs. And we need this done early so the PKGBUILD can check for their existence at the start. I have the workings of a complete patch that will appear before 3.4 is release.

Comment by christopher rogers (godane) - Tuesday, 13 April 2010, 20:33 GMT
i got it working but I could use the -n $install if statement

#if [[ -n $install ]]; then
msg2 "$(gettext "Adding install script...")"
local installfiles=$(grep "^[[:space:]]*install=" PKGBUILD | sed "s#install=##")
for installfile in ${installfiles}; do
if [[ -f $installfile ]]; then
ln -s "${startdir}/$installfile" "${srclinks}/${pkgbase}/$installfile"
else
error "$(gettext "Install scriptlet (%s) does not exist.")" "$installfile"
fi
done
#fi
I have all .install files for gcc in source package now. I also could "" to ${installfiles} since that would put string into the loop. Not exch file you want ln -s too.
Comment by Vlad George (DonVla) - Thursday, 15 April 2010, 22:51 GMT
I think the "eval" cmd is needed for ${pkgname}.install files.
Comment by Vlad George (DonVla) - Thursday, 15 April 2010, 22:51 GMT
Pls delete. Thanks
Comment by Vlad George (DonVla) - Friday, 16 April 2010, 03:13 GMT
Hi all. Here is an excerpt from pkgman which is used to get all install files:
"
local __INSTALLFILES=( $(grep "^[[:space:]]*install=" ${_BuildScript} | sed "s#install=##") )
if [[ -n ${__INSTALLFILES[0]} ]]; then
local __FILE
for __FILE in "${__INSTALLFILES[@]}"; do
eval __FILE=${__FILE}
if [[ -f ${__FILE} ]]; then
msg "Adding install script..."
/bin/ln -s "${__STARTDIR}/${__FILE}" "${__LOCALDIR}/"
else
error "Install script "${__FILE}" not found."
fi
done
fi
"
As I said above "eval __FILE=${__FILE}" is needed for ${pkgname}.install files.
Comment by Allan McRae (Allan) - Monday, 26 April 2010, 09:01 GMT

Loading...