[aur-general] mksrcinfo bug: PKGBUILD stdout appears in mksrcinfo
mksrcinfo will include anything the PKGBUILD writes to stdout in the body of the PKGBUILD (i.e. not in any prepare/build/package/etc. functions when being sourced, for example: pkgname=example pkgver=1 echo "Hello world." prepare() {} build() {} package() {} ... which will generate an .SRCINFO file with "Hello world." as the first line. This .SRCINFO file is then not parseable by AUR4 when trying to push it to the package's git repository, which will end up with an error that looks like this: $ git push -u origin master:master Counting objects: 4, done. Delta compression using up to 8 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 4.38 KiB | 0 bytes/s, done. Total 4 (delta 0), reused 0 (delta 0) remote: Traceback (most recent call last): remote: File "/srv/http/vhosts/ aur.archlinux.org/public/git-interface/aurinfo.py", line 127, in ParseAurinfoFromIterable remote: key, value = map(str.strip, line.split('=', 1)) remote: ValueError: need more than 1 value to unpack remote: remote: During handling of the above exception, another exception occurred: remote: remote: Traceback (most recent call last): remote: File "hooks/update", line 239, in <module> remote: srcinfo = aurinfo.ParseAurinfoFromIterable(srcinfo_raw, ecatcher) remote: File "/srv/http/vhosts/ aur.archlinux.org/public/git-interface/aurinfo.py", line 130, in ParseAurinfoFromIterable remote: current_package['pkgname'])) remote: TypeError: 'NoneType' object is not subscriptable remote: error: hook declined to update refs/heads/master To ^aur:/matlab.git ! [remote rejected] master -> master (hook declined) error: failed to push some refs to '^aur:/matlab.git' The fix should prevent the PKGBUILD's stdout output from appearing in the .SRCINFO that mksrcinfo generates.
Maybe that’s a stupid question, but why do you need printing something to stdout in a PKGBUILD, especially outside of any function ? Bruno Le 15 août 2015 11:56:51 GMT+02:00, Ido Rosen <ido@kernel.org> a écrit :
mksrcinfo will include anything the PKGBUILD writes to stdout in the body of the PKGBUILD (i.e. not in any prepare/build/package/etc. functions when being sourced, for example:
pkgname=example pkgver=1 echo "Hello world." prepare() {} build() {} package() {}
... which will generate an .SRCINFO file with "Hello world." as the first line. This .SRCINFO file is then not parseable by AUR4 when trying to push it to the package's git repository, which will end up with an error that looks like this:
$ git push -u origin master:master Counting objects: 4, done. Delta compression using up to 8 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 4.38 KiB | 0 bytes/s, done. Total 4 (delta 0), reused 0 (delta 0) remote: Traceback (most recent call last): remote: File "/srv/http/vhosts/ aur.archlinux.org/public/git-interface/aurinfo.py", line 127, in ParseAurinfoFromIterable remote: key, value = map(str.strip, line.split('=', 1)) remote: ValueError: need more than 1 value to unpack remote: remote: During handling of the above exception, another exception occurred: remote: remote: Traceback (most recent call last): remote: File "hooks/update", line 239, in <module> remote: srcinfo = aurinfo.ParseAurinfoFromIterable(srcinfo_raw, ecatcher) remote: File "/srv/http/vhosts/ aur.archlinux.org/public/git-interface/aurinfo.py", line 130, in ParseAurinfoFromIterable remote: current_package['pkgname'])) remote: TypeError: 'NoneType' object is not subscriptable remote: error: hook declined to update refs/heads/master To ^aur:/matlab.git ! [remote rejected] master -> master (hook declined) error: failed to push some refs to '^aur:/matlab.git'
The fix should prevent the PKGBUILD's stdout output from appearing in the .SRCINFO that mksrcinfo generates.
On Sat, Aug 15, 2015 at 12:53 PM, Bruno Pagani <bruno.pagani@ens-lyon.org> wrote:
Maybe that’s a stupid question, but why do you need printing something to stdout in a PKGBUILD, especially outside of any function ?
The only good reason I can think of, is to tell users that (and how) they need to provide a source archive manually. But there's a better way to do that. Just add something like this to the PKGBUILD: DLAGENTS+=('file::/usr/bin/sh -c echo\ '"$(printf "%q" "Could not find %u. " \ "Download it from $url, and symlink it to $(pwd)/.")"'\;\ exit\ 1') source=("file://something.tar.gz") Besides not suffering from the problem that Ido describes, this approach has the advantage that users can install a custom file:// dlagent in /etc/makepkg.conf if they want, for example one that automatically searches for such sources in ~/downloads and symlinks them into the PKGBUILD dir if found: DLAGENTS=(... 'file::/usr/bin/sh -c find\ \$HOME/downloads\ -name\ \$(echo\ %u\ \|\ cut\ -c\ 7-)\ -exec\ ln\ -s\ \\\{\\\}\ %o\ \\\;\ -quit' )
participants (3)
-
Bruno Pagani
-
Ido Rosen
-
Sam S.