scope var to clear_environment
smoketest: fix -Wshadow error
s/srcinfo_create/srcinfo_write/

for consistency with makepkg's 'pkginfo_write'.
obviate warning by using better variable names
reorder args to pkgbuild_get_attribute for consistency
scope singlevalued attr list for globals more appropriately