FS#15946 - [devtools] makechrootpkg does not always copy all necessary files to /build directory
Attached to Project:
Arch Linux
Opened by Krzysztof Raczkowski (raku) - Saturday, 15 August 2009, 21:05 GMT
Last edited by Allan McRae (Allan) - Saturday, 05 September 2009, 02:34 GMT
Opened by Krzysztof Raczkowski (raku) - Saturday, 15 August 2009, 21:05 GMT
Last edited by Allan McRae (Allan) - Saturday, 05 September 2009, 02:34 GMT
|
Details
Description:
I work with makechrootpkg while compiling AUR packages. I noticed, that it doesn't handle copying of additional files needed for building a package (foo.install, etc). They are copied to /srcdir, but sometimes, they (also) need to be placed directly in /build directory. The problem occurs when: -) PKGBUILD has a variable install=${package}.install instead of install=foo.install -) there are obsolete paths to files in build() function, for example: cp ${startdir}/foo.desktop (copy file directly from main PKGBUILD directory) instead of cp ${srcdir}/foo.desktop (copy from symlink pointing to file from main PKGBUILD directory). Here's an example when makechrootpkg fails (splashy package from AUR): $ ls PKGBUILD splash splashy-0.3.13-2-x86_64.pkg.tar.gz splashy.initcpio_hook splashy.install PKGBUILD~ splash.conf splashy-functions splashy.initcpio_install $ grep install= PKGBUILD install=${pkgname}.install $ sudo makechrootpkg -c -r /var/cache/chroots/arch64/ -- --noconfirm building union chroot moving build files to chroot Setting PKGDEST in makepkg.conf Setting SRCDEST in makepkg.conf allowing 'nobody' sudo rights in the chroot mounting sysfs : /sys mounting procfs : /proc binding device nodes : /dev binding pacman cache : /var/cache/pacman copying mtab : /etc/mtab copying resolv.conf : /etc/resolv.conf starting chroot (/chrootbuild) ==> ERROR: Install scriptlet (splashy.install) does not exist. cleaning up mounts Build failed, check /var/cache/chroots/arch64/rw/build cleaning up unioned mounts I know, that should be fixed in PKGBUILD, but there are so many broken PKGBUILDs, that I think it would be better to add one additional line to makechrootpkg script (included in attachment) which fix this issue. Additional info: * package version(s): - devtools 0.6.4-1 - devtools-git 20090815-1 |
This task depends upon
Closed by Allan McRae (Allan)
Saturday, 05 September 2009, 02:34 GMT
Reason for closing: Fixed
Additional comments about closing: commit f9aa28f8
Saturday, 05 September 2009, 02:34 GMT
Reason for closing: Fixed
Additional comments about closing: commit f9aa28f8
Maybe a workaround in makechrootpkg would be a better solution?
instead of copying files to /build it would be better to symlink them from /srcdir:
ln -s "/srcdest/$basef" "$uniondir/build/$basef"
BTW, things like cp ${startdir}/foo.desktop are totally incorrect (namcap even throughs a warning or error). In this case, the PKGBUILD must be fixed.
install_files=$(grep "install=" PKGBUILD)
For unknow reasons, after doing that there is no variable substitutions possible, i.e. ${pkgname} is treated litterally. Even if we fix that, there is the problem that splitted packages use an array for the pkgname, so what value of ${pkgname} it to be used? I don't know how to do this.
An easy fix would be to simply copy all the *.install files in the build root: cp *.install "$uniondir/build/"
This will break for install scriptlets that don't use the .install extension but, in my experience, everyone uses this extension. So the number of users affected will be minimal if not zero.
> install_files=$(grep "install=" PKGBUILD)
> For unknow reasons, after doing that there is no variable substitutions possible, i.e. ${pkgname} is treated litterally.
Try this code:
source PKGBUILD
install_files=$(grep "install=" PKGBUILD)
install_files=$(eval echo $install_files)
> Even if we fix that, there is the problem that splitted packages use an array for the pkgname, so what value of ${pkgname}
> it to be used? I don't know how to do this.
My code should substitute all variables with their values, so - no matter how you prefix .install file, if it is a variable used in PKGBUILD, it would work.
You know what would solve this? Simply putting the install files in the sources array. This would give us file checksums as well...
If we want to start putting the install file in the source array, we'll need to fix makepkg. It currently treat .install files differently than source so putting the .install in the source array breaks the sourceball options.