def spec_is_modified(pkgoutdir, project, pkgname): specname = pkgname + ".spec" cached_spec = os.path.join(pkgoutdir, '.osc', specname) cleanup = False if not os.path.exists(cached_spec): cleanup = True sh.osc('api', '/source/%s/%s/%s.spec' % ( project, pkgname, pkgname), _out=cached_spec) r = sh.cmp( '-s', os.path.join(pkgoutdir, specname), cached_spec, _ok_code=[0, 1]) if cleanup: os.remove(cached_spec) return r.exit_code == 1