share common pkg fetch code by a macros