+i(ddlZddlZddlZddlZddlZddlZdZdZdZ dZ dZ dZ dZ d Zd Zd Zd Zdd ZdZdS)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 branchzorigin/latest)masternightlyN)libargsfeed git_branchgitcheckoutcheckout_latest_tagcheckout_default_branch)projectr branchs U/home/osmocom-build/jenkins/workspace/Osmocom_OBS_wireshark/scripts/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) z@: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 [     w       FC +++,,, ( ( (    1 2 2 2      - WEEE F F Fj@@IIG000000 0 - W666 7 7 7,E,,F,, , , , A 6#@AAA -   C ++c3 " "C ++dC # #C ~~c!""g Js +:F&&Gc"tjjdkr@tj|}|dr |ddn|St |}|dkr>tj|}d|vr| dd}tjjdkr7| ddkr|d z }| ddktjj }|r|d|}|S) Nrr$rUNKNOWN:rrz.0) rrr r get_latest_tagr3r<r1r2splitr:conflict_version)rr6rCs rget_version_for_feedrD\s  x}  g$$W--..--6s122ww36 ' " "C ij88AA #::))C..#C x} !!iinnq  4KCiinnq  x0*))')) Jrctj|}d|vr|ddSdS)a4The 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 stringr?rr)rr1r2rB)r version_epochs r get_epochrG|sBJ>>wGGM m""3''** 2rcptjgdtjddS)zeDownload the subproject sources here, so the package can be built in OBS without Internet access.)meson subprojectsdownloadopen5gsrN)rr)r r%rrprepare_project_open5gsrNsCK,,, G ! !) , ,rctjd}tjtjd}tjdd|g|dS)Npyhsszdata/pyhss_download_deps.shshz-er)rr r%r&r'join ci_obs_dirr))r4scripts rprepare_project_pyhssrUsQ%%g..I W\\#.*G H HFKtV$)444444rcttjd}tjgd|dS)a The format of the license field in pyproject.toml was changed from a "table" to a a string with an SPDX license expression. The sources have been adjusted to use the new format to appease a warning ("By 2026-Feb-18, you need to update your project and remove deprecated calls or your builds will no longer be supported."). However now the build fails with setuptools from Debian 12. Remove the license line from pyproject.toml, the debian packaging has its own license information in debian/copyright. pyosmocom)sed-iz/^license = /dzpyproject.tomlrN)rr r%r))r4s rprepare_project_pyosmocomrZs;%%k22IKAAAyQQQQQQrctj|}d}tj|d|r,t |d|tj||dSdS)zRun 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_depr^s%%g..I1K w~~22[22330 11K11222 KY//////00rctj|}t|dd5}||dddddS#1swxYwYdS)Nz/.tarball-versionw )rr r%openwrite)rr;r4fs rwrite_tarball_versionres%%g..I ---s 3 3 q 7                  sAA Actj|}tj|}t |d|dt j|d|ddS)zWrite 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_txtrms{ %g..K W  g & &F W 2 2f 2 2 2333 LK5555566<<>>>>>rcBtj|}tjgd|d}|jd}|D]7}|dkr t|d|tjddd |g| 8dS) N)grepz-rz-lz;include $(OSMO_GSM_MANUALS_DIR)/build/Makefile.asciidoc.incFrrarz6: setting asciidoc style to remove draft watermark in rXrYzZ/\/build\/Makefile\.asciidoc\.inc/s/^/ ASCIIDOCSTYLE = $(BUILDDIR)\/custom-dblatex.sty\n/r)rr r%r)r*r+rBr0)rr4 doc_makefiles doc_makefiles r*set_asciidoc_style_without_draft_watermarkrrs%%g..IK[[[ M "(//1177==M%   2    ^^P\^^___ r          rc\tjj}tjj}tjj}tj|tj||dkr!tj||nt|t|}|r||z }t|}|r|d|n|}tj |du}t|d|t|||tjjvrqtjjs`|dkrZtjjpd|} tj|| ||r!tj || |tj||t1jtj|tjdt0j|} | t=vr0t|d| t=| |tjjvrt?|tjj r/tj |tjj tjj!r tj!|n|dkrtE|tj#|tj$||r@tj %|||tj &||d krtO|tj|S) Nrr?z: building source package zosmocom-keyringzosmocom-prepare_project_r]rr)(rrrCr version_appendr clonecleancheckout_from_reviewrrDrGrpm_specget_spec_in_pathr0reconfigprojects_osmocomno_metaconflict_pkgnamer1control_add_depend add_dependchangelog_add_entry_if_neededr&makedirsrgremove_cache_extra_filesr'basenameglobalsr^configure_appenddisable_manualsrrbuild_source_packagemove_files_to_outputgeneratecopy_to_outputrm) r gerrit_idrCr rur;epochrF has_rpm_specmetapkgproject_specific_funcs rbuildrsCx0 8=DX,NGMM'GMM'1}} $$Wi8888'""""7++G">! g  E,1>u((w(((wM<0099EL W ? ? ? ?@@@'=111#*---ch6F-7VgKgKg(+@/@$/@/@ %%gw8HIII  H L # #GW6F G G GJ,,WmDDDK#G,,--- """Jrw/?/?/H/HJJ )) ;;$9;;<<<( '(***#*---w''' x H ##GSX-FGGG x< ""7++++   27;;;J##G,,,J##G,,,- gw666 ##G,,, x!!! """ rcrtjtj|d}t|dks Jd|t |dd5}|D])}|drd|vrdddd S* dddn #1swxYwYd S) zgCheck if an already built source package has osmo-gsm-manuals-dev in Build-Depends of the .dsc filez/*.dscrzfailed to get dsc path for rrzBuild-Depends:zosmo-gsm-manuals-devNTF)globrrglenrb readlinesr3)rpath_dschandlelines rrequires_osmo_gsm_manuals_devrs(yC/88@@@AAH x==A   FWFF    hqk3  6$$&&  D/00 5Kt5S5S  5s 1B,B,,B03B0)r)rr&ri lib.configr lib.debian lib.rpm_specrr<rDrGrNrUrZr^rermrrrrrMrrrs  4 4 4???D@"555 R R R000    ? ? ?   0====@     r