a lg @sTddlZddlZddlZddlZddlZddZddZddZdd Zd d Z dS) NcCs@tj|}tj|ddd}t|dks0J|r<|dSdS)Nz/**/contrib/*.spec.inT) recursiver)libgit get_repo_pathgloblen)project repo_pathretr Z/home/osmocom-build/jenkins/workspace/gerrit-binpkgs@2/osmo-ci/scripts/obs/lib/rpm_spec.pyget_spec_in_path s rcCs:t|}t|d}t|dks*Jtj|dS)z Get the name to the .tar.xz file generated by dpkg-buildpackage, that we also use in the rpm spec file. This requires lib.debian.move_files_to_output() to run first.z/*.tar.*r)rget_output_pathrrospathbasename)r path_outputr r r r get_source_names rc CsXt|}d|}|r$|d|7}tdddd|d|gtdddd|d|gdS) z Add a 'Requires: ...' line below the 'Name:' and '%package' lines of the .spec.in file. :param pkgname: of the meta-package to depend on (e.g. osmocom-nightly) :param version: of the meta-pkgname to depend on or None z Requires: z = sed-ez /^Name:/a\-iz /^%package/a\N)rrrun_cmd)r pkgnameversionrZreq_liner r r add_depends  rc Cst|dt|}t|}|dd}tdd|dd|g|rjd|}tdd d d |d|gtdd |dd|gd }tdd d d |d|gtddtj|dd|gdS)zi Update the version and source in the .spec.in file. :param version: from get-version-gen script z: generating rpm spec file-.rzs/^Version:.*/Version: /rzEpoch: rz /^Version:/a\zs/^Source:.*/Source: zSource1: rpmlintrcz /^Source:/a\zs/^%setup/%setup -n N) printrrreplacerrrrr)r repochrsourceZ epoch_lineZ rpmlint_liner r r generate.s   r$cCsVt|}t|}tj|dd}t||d|ttjj d|dS)Nrz/data/rpmlintrc) rrrrrrshutilcopyconfigpath_top)r Z path_spec_inrZ name_specr r r copy_to_outputLs  r*) rrr&rlib.gitrrrr$r*r r r r s