DH_SAMEVERSIONDEP(1)
π DH_SAMEVERSIONDEP π
okay bestie, gather round, because this little helper in the User Contributed Perl Documentation section is actually iconic and I need you to know about it. it's dh_sameversiondep, and it lives in the debhelper cinematic universe (iykyk). π
β¨ NAME β¨
dh_sameversiondep β generates a versioned dependency based on the versioned dependencies of the reference package. π¦
πΈ SYNOPSIS πΈ
dh_sameversiondep [debhelper options]
π DESCRIPTION π
so dh_sameversiondep is a helper tool that can generate a dependency versioned the exact same way as a dependency of another reference package, where that dependency comes from the same source. no cap. π
here's the glow-up: dh_sameversiondep scans debian/control for a specially formatted substvar (peep the "sameVersionDep substvar SPECIFICATION" section below π), figures out its value, and writes that value into the debian/package.substvars file.
the most common use case β and honestly the moment β is keeping your liba-dev package's dependency on the external libb-dev package as tight as your liba package's dependency on the respective external libb package. (there's an "EXAMPLE" section below with all the deets, go look.) π
dh_sameversiondep works as follows:
- searches for the
sameVersionDepsubstvar in theDepends,Recommends,Suggests,EnhancesandPre-Dependsfields of the requested packages. when one is found, it gets parsed and the dependency package name, reference package name and dependency type (eitherDependsorRecommendsetc.) are determined. π - all dependencies of the requested type are collected for the dependency package based on the
dpkg-query --statusoutput. if a multi-arch awaredpkgis detected, this query is architecture-qualified as needed. ποΈ - all dependencies of the requested type are collected for the reference package either from
debian/control(substvars are expanded) or fromdpkg-query --statusoutput if the package was not found indebian/control. π - both collections are intersected, leaving only common packages in both collections. π
- the common package list is filtered by leaving only those which come from the same source as the dependency package. π§
- whatever packages are left (most likely only one), their names are replaced with the dependency package name, preserving all versioning information. this result is written to the
debian/package.substvarsfile as a value of thesameVersionDepsubstvar being processed. β¨
π¨ bestie listen. dh_sameversiondep is very strict about errors. if either the dependency package or the reference package cannot be found, or the resulting dependency set is empty, it will fail with an error. no soft launches here.
π also important:dh_sameversiondepMUST be run beforedh_gencontrol. however, it is recommended to rundh_sameversiondepafterdh_shlibdeps. periodt.
π¦ sameVersionDep substvar SPECIFICATION π¦
the sameVersionDep substvar can appear in either the Depends, Recommends, Suggests, Enhances or Pre-Depends field of any binary package. the field that the substvar appears in becomes the default dependency type for that substvar. it should be formatted as follows (and yes, everything is case sensitive π«Ά):
${sameVersionDep:dependency[[:reference]-dependency type]}
π dependency (mandatory)
the name of the package which you want to add as a dependency. you literally can't skip this one. π
π reference (optional)
the name of the package whose dependencies are to be intersected with the dependencies of the dependency package. defaults to the first package in debian/control if omitted. π
π dependency type (optional)
can be either Depends, Recommends, Suggests, Enhances or Pre-Depends. defaults to the name of the field which the substvar was found in. specifies which type of dependencies to consider when analyzing the dependency package and the reference package. β
π EXAMPLE π
assume we have the following in debian/control:
Package: liba
Depends: libc (>= 0.1), depa, depb, depc
Package: libb
Depends: libd (>= 0.2), depd, depe, depf
Package: libab-dev
Depends: ${sameVersionDep:libc-dev}, ${sameVersionDep:libd-dev:libb}
assuming that libc and libc-dev (both from the same source), as well as libd and libd-dev (both from the same source) are installed, the value of sameVersionDep:libc-dev will be libc-dev (>= 0.1) and the value of sameVersionDep:libd-dev:libb will be libd-dev (>= 0.2). π₯
sameVersionDep:libc-dev could also be written as sameVersionDep:libc-dev:liba-Depends and sameVersionDep:libd-dev:libb as sameVersionDep:libd-dev:libb-Depends β but it is not necessary because the defaults are sufficient. she ate and left no crumbs. π
π SEE ALSO π
πΈ AUTHOR πΈ
Modestas Vainius <modax@debian.org>
and that's the whole vibe, bestie β this page is from perl v5.42.3, dated 2026-08-19, and it's DH_SAMEVERSIONDEP(1) if you ever need to find her again. mwah. πβ¨
π¦ where this page comes from
- ubuntu stonking: pkg-kde-tools 0.22.1ubuntu2 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms