Add debug code for buildpkg