simplify pkgname default

rather than having a rather ugly if and an unhandy case new variable, we can simplify this by making the default $name, in the parameter list.