lgc"ddlZddlZddlZddlZddlZddlZddlZdZdZ dZ dZ dZ dZ dZd Zd Zd d Zd ZdS)Ncvtjj}tjj}|r%tj|d|dS|dkr!tj|dS|dvr!tj|dStj|d|dS)z? checkout a commit, either latest tag or master or 20YY branch zorigin/latest)masternightlyN)libargsfeed git_branchgitcheckoutcheckout_latest_tagcheckout_default_branch)projectr branchs /obs/lib/srcpkg.pycheckout_for_feedr s 8=D X F 4 "4F"4"455555    ##G,,,,, & & & ''00000 "2D"2"233333ctj|}|d}tj|rHtj|dg|j}|stj |d|Stj |}| ddd}| ddd }tjd d d d d|dg|d}|j dkrt|dtjgd|jdd}tjgd|j} t|dtj|}|d|d|S#t|dd|d|cYSxYw|j dkrtj |d|j}| ddd}| ddd}|dr |dd}|S) zB :returns: the string from git-version-gen, e.g. '1.7.0.10-76bdb' z/git-version-gen.cwdz!empty output from git-version-gen^$r describez --abbrev=4z--tagsz--match=HEADFrcheckz: has no git tags)r z rev-parserr)r zrev-listz--countrz': getting version from debian/changelog-z: using 0.0.0 as versionz0.0.0.zcommand failed unexpectedlyz-gvN)rr get_repo_pathospathexistsrun_cmdoutputrstripexit_error_cmdget_latest_tag_patternreplace returncodeprintdebianget_last_version_from_changelog startswith) r repo_path script_pathretpatternresultcommitcountversions rget_git_versionr<s%%g..I000K w~~k""k;,)<<<CJJLL I  s$G H H H g,,W55Gooc2q))Gooc2r**G [%#+'++ %.U <<tj|}d|vr| dd}tjj }|r|d|}|S)Nrr$rUNKNOWN:r) rrr r get_latest_tagr3r<r1r2splitconflict_version)rr6rBs rget_version_for_feedrCRs x}  g$$W--..--6s122ww36 ' " "C ij88AA #::))C..#Cx0*))')) Jrctj|}d|vr|ddSdS)aR The osmo-gbproxy used to have the same package version as osmo-sgsn until 2021 where it was split into its own git repository. From then on, osmo-gbproxy has a 0.*.* package version, which is smaller than the previous 1.*.* from osmo-sgsn. We had to set the epoch to 1 for osmo-gbproxy so package managers know these 0.*.* versions are higher than the previous 1.*.* ones that are still found in e.g. debian 11. The epoch is set in debian/changelog, retrieve it from there. :returns: the epoch number if set, e.g. "1" or an empty string r?rr)rr1r2rA)r version_epochs r get_epochrFlsBJ>>wGGM m""3''** 2rcptjgdtjddS)zk Download the subproject sources here, so the package can be built in OBS without Internet access. )meson subprojectsdownloadopen5gsrNrr)r r%rrprepare_project_open5gsrN}sCK444G)))44666666rcxtjgdtjddddS)zB Fix bug in 23.10: https://github.com/myriadrf/LimeSuite/pull/386 )mvz-vzliblimesuite22.09-1.installzliblimesuite23.10-1.install limesuitez/debianFrNrLrMrrprepare_project_limesuiterRsUK000w,,[99BBB rctj|}d}tj|d|r,t |d|tj||dSdS)z Run contrib/generate_build_dep.sh if it exists in the given project, to to download sources for dependencies (see e.g. osmo_dia2gsup.git). zcontrib/generate_build_dep.sh/ : running rN)rr r%r&r'r(r0r))rr4r5s rrun_generate_build_deprVs%%g..I1K w~~22[22330 11K11222 KY//////00rctj|}t|dd5}||dddddS#1swxYwYdS)Nz/.tarball-versionw )rr r%openwrite)rr;r4fs rwrite_tarball_versionr]s%%g..I ---s 3 3 q 7                  sAA Actj|}tj|}t |d|dt j|d|ddS)z Write the current git commit to commit_$commit.txt file, so it gets uploaded to OBS along with the rest of the source package. This allows figuring out if the source package is still up-to-date or not for the master feed. z: adding commit_z.txtz/commit_N)rget_output_pathr get_headr0pathlibPathtouch)r output_pathr9s rwrite_commit_txtres{ %g..K W  g & &F W 2 2f 2 2 2333 LK5555566<<>>>>>rc$tjj}tjj}tjj}tj|tj||dkr!tj||nt|t|}|r||z }t|}|r|d|n|}tj |du}t|d|t|||tjjvrktjjsZtjjpd|} tj|| ||r!tj || |tj||t1jtj|tjdt0j|} | t=vr0t|d| t=| |tjjvrt?|tjj r/tj |tjj tjj!rtj!|tj"|tj#||r@tj $|||tj %||dkrtM|tj|S)Nrr?z: building source package zosmocom-prepare_project_rUr)'rrrBr version_appendr clonecleancheckout_from_reviewrrCrFrpm_specget_spec_in_pathr0r]configprojects_osmocomno_metaconflict_pkgnamer1control_add_depend add_dependchangelog_add_entry_if_neededr&makedirsr_remove_cache_extra_filesr'basenameglobalsrVconfigure_appenddisable_manualsbuild_source_packagemove_files_to_outputgeneratecopy_to_outputre) r gerrit_idrBr rhr;epochrE has_rpm_specmetapkgproject_specific_funcs rbuildrsx0 8=DX,NGMM'GMM'1}} $$Wi8888'""""7++G">! g  E,1>u((w(((wM<0099EL W ? ? ? ?@@@'=111#*---ch6F-(+@/@$/@/@ %%gw8HIII  H L # #GW6F G G GJ,,WmDDDK#G,,--- """Jrw/?/?/H/HJJ )) ;;$9;;<<<( '(***#*---w''' x H ##GSX-FGGG x, ""7+++J##G,,,J##G,,,- gw666 ##G,,, x!!! """ rcrtjtj|d}t|dks Jd|t |dd5}|D])}|drd|vrdddd S* dddn #1swxYwYd S) zm Check if an already built source package has osmo-gsm-manuals-dev in Build-Depends of the .dsc file z/*.dscrzfailed to get dsc path for rrzBuild-Depends:zosmo-gsm-manuals-devNTF)globrr_lenrZ readlinesr3)rpath_dschandlelines rrequires_osmo_gsm_manuals_devrs(yC/88@@@AAH x==A   FWFF    hqk3  6$$&&  D/00 .$66   5s 1B,B,,B03B0)r)rr&rasys lib.configr lib.debian lib.rpm_specrr<rCrFrNrRrVr]rerrrMrrrs   4 4 4444n4"666000    ? ? ?;;;;|     r