falconindy / pkgbuild-introspection

Tools for generating .SRCINFO files and PKGBUILD data extraction
MIT License
39 stars 9 forks source link

mksrcinfo troubled by PKGBUILD using case-esac to select sources for architecture #25

Closed phillid closed 9 years ago

phillid commented 9 years ago

When using a PKGBUILD with this snippet in it:

case $CARCH in
                "i686")
                        _arch="i386"
                        sha256sums=('123abc...')
                ;;
                "x86_64")
                        _arch="amd64"
                        sha256sums=('xyz456...')
                ;;
                *)
                        echo Unsupported architecture
                        exit
                ;;
esac

mksrcinfo exits cleanly, however inspection of the produced .SRCINFO shows it to contain 'Unsupported architecture'. I then replaced $CARCH with ${CARCH:?}. Lo and behold, I get an error from bash saying that $CARCH isn't set or is null, which would have (earlier) been causing the fallthrough in the case-esac to be run making the script exit and resulting in an SRCINFO containing the words echoed.

Note that makepkg --source produces a source package containing a valid/sane .SRCINFO.

falconindy commented 9 years ago

Please use architecture specific attributes, e.g.

source_x86_64=(...) sha256sums_x86_64=(...)

This is exactly the reason I implemented them in makepkg -- I can't and won't parse code constructs like your case/esac.

phillid commented 9 years ago

Thanks for reminding me about that; I was under the false impression that these features weren't yet available in the stable version of makepkg. Sorry about that.