Added variable generating_upstream_patch_defined. When set to 1, this