build: split scripts/metadata.pl into target-metadata.pl and package-metadata.pl