Skip to content

Commit ceea407

Browse files
Vitexusclaude
andcommitted
Add Debian packaging for python3-opentelemetry-api
Packages the opentelemetry-api subdirectory of the monorepo. Uses PYBUILD_DIR to target the correct subdirectory. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3bd62f8 commit ceea407

23 files changed

Lines changed: 1899 additions & 0 deletions

debian/Jenkinsfile

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
#!groovy
2+
3+
// Current version of this Pipeline https://github.com/VitexSoftware/BuildImages/blob/main/Test/Jenkinsfile
4+
5+
String[] distributions = [
6+
// 'debian:bookworm',
7+
'debian:trixie',
8+
'debian:forky',
9+
// 'ubuntu:jammy',
10+
// 'ubuntu:noble',
11+
'ubuntu:resolute',
12+
]
13+
14+
String vendor = 'vitexsoftware'
15+
16+
properties([
17+
copyArtifactPermission('*')
18+
])
19+
node() {
20+
ansiColor('xterm') {
21+
stage('SCM Checkout') {
22+
checkout scm
23+
}
24+
}
25+
}
26+
27+
def branches = [:]
28+
distributions.each { distro ->
29+
branches[distro] = {
30+
def distroName = distro
31+
println "Dist:" + distroName
32+
33+
def dist = distroName.split(':')
34+
def distroFamily = dist[0]
35+
def distroCode = dist[1]
36+
def buildImage = ''
37+
def artifacts = []
38+
def buildVer = ''
39+
40+
node {
41+
ansiColor('xterm') {
42+
stage('Checkout ' + distroName) {
43+
checkout scm
44+
def imageName = vendor + '/' + distro
45+
buildImage = docker.image(imageName)
46+
sh 'git checkout debian/changelog'
47+
def version = sh (
48+
script: 'dpkg-parsechangelog --show-field Version',
49+
returnStdout: true
50+
).trim()
51+
buildVer = version + '.' + env.BUILD_NUMBER + '~' + distroCode
52+
}
53+
stage('Build ' + distroName) {
54+
buildImage.inside {
55+
def uniqueBuildId = env.BUILD_NUMBER + '-' + distroCode + '-' + env.EXECUTOR_NUMBER
56+
sh 'dch -b -v ' + buildVer + ' "' + env.BUILD_TAG + '"'
57+
sh 'sudo apt-get update --allow-releaseinfo-change'
58+
sh 'sudo chown jenkins:jenkins ..'
59+
sh 'sudo rm -rf debian/$(dpkg-parsechangelog --show-field Source)/ debian/.debhelper/ debian/tmp/'
60+
sh 'debuild-pbuilder -r"sudo -E" -i -us -uc -b'
61+
sh 'mkdir -p $WORKSPACE/dist/debian/ ; rm -rf $WORKSPACE/dist/debian/* ; for deb in $(cat debian/files | awk \'{print $1}\'); do mv "../$deb" $WORKSPACE/dist/debian/; done'
62+
artifacts = sh (
63+
script: "cat debian/files | awk '{print \$1}'",
64+
returnStdout: true
65+
).trim().split('\n')
66+
}
67+
}
68+
69+
stage('Test ' + distroName) {
70+
buildImage.inside {
71+
def debconf_debug = 0
72+
sh 'cd $WORKSPACE/dist/debian/ ; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz; cd $WORKSPACE'
73+
sh 'echo "deb [trusted=yes] file://///$WORKSPACE/dist/debian/ ./" | sudo tee /etc/apt/sources.list.d/local.list'
74+
sh 'sudo apt-get update --allow-releaseinfo-change'
75+
76+
def installOrder = []
77+
78+
def sorted_artifacts = artifacts.toList()
79+
80+
if (installOrder.isEmpty()) {
81+
sorted_artifacts.each { deb_file ->
82+
if (deb_file.endsWith('.deb')) {
83+
def pkgName = deb_file.tokenize('/')[-1].replaceFirst(/_.*/, '')
84+
sh 'sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + debconf_debug + ' apt-get -y install ' + pkgName
85+
}
86+
}
87+
} else {
88+
installOrder.each { pkgPrefix ->
89+
def debFile = null
90+
for (item in sorted_artifacts) {
91+
def itemStr = item.toString()
92+
if (itemStr.startsWith(pkgPrefix) && itemStr.endsWith('.deb')) {
93+
debFile = itemStr
94+
break
95+
}
96+
}
97+
if (debFile) {
98+
def pkgName = debFile.tokenize('/')[-1].replaceFirst(/_.*/, '')
99+
sh 'sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + debconf_debug + ' apt-get -y install ' + pkgName
100+
}
101+
}
102+
}
103+
104+
}
105+
stage('Archive artifacts ' + distroName ) {
106+
buildImage.inside {
107+
artifacts.each { deb_file ->
108+
println "Archiving artifact: " + deb_file
109+
archiveArtifacts artifacts: 'dist/debian/' + deb_file
110+
}
111+
def uniqueBuildId = env.BUILD_NUMBER + '-' + distroCode + '-' + env.EXECUTOR_NUMBER
112+
sh '''
113+
set -e
114+
if [ -f debian/files ]; then
115+
while read -r file _; do
116+
[ -n "$file" ] || continue
117+
rm -f "dist/debian/$file" || true
118+
rm -f "../$file" || true
119+
rm -f "$WORKSPACE/$file" || true
120+
done < debian/files
121+
fi
122+
'''
123+
}
124+
}
125+
}
126+
}
127+
}
128+
}
129+
}
130+
131+
parallel branches
132+
133+
node {
134+
stage('Publish to Aptly') {
135+
publishDebToAptly()
136+
}
137+
}

debian/README.Debian

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
opentelemetry-python for Debian
2+
3+
Please edit this to provide information specific to
4+
this opentelemetry-python Debian package.
5+
6+
(Automatically generated by debmake Version 4.5.1)
7+
8+
-- Vítězslav Dvořák <info@vitexsoftware.cz> Mon, 11 May 2026 15:24:13 +0200

debian/README.source

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
opentelemetry-python for Debian
2+
3+
See Debian policy manual section 4.14.
4+
https://www.debian.org/doc/debian-policy/ch-source.html#source-package-handling-debian-readme-source
5+
6+
If running dpkg-source -x on a source package doesn’t produce the source of the
7+
package, ready for editing, and allow one to make changes and run
8+
dpkg-buildpackage to produce a modified package without taking any additional
9+
steps, creating this file explain how to do all of these is recommended.
10+
Otherwise, remove this file.
11+
12+
(Automatically generated by debmake Version 4.5.1)
13+
14+
-- Vítězslav Dvořák <info@vitexsoftware.cz> Mon, 11 May 2026 15:24:13 +0200

debian/changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
python-opentelemetry-api (1.41.1-1) UNRELEASED; urgency=low
2+
3+
* Initial Debian packaging
4+
5+
-- Vítězslav Dvořák <info@vitexsoftware.cz> Mon, 11 May 2026 12:40:05 +0200

debian/clean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# You must remove unused comment lines for the released package.

debian/control

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Source: python-opentelemetry-api
2+
Section: python
3+
Priority: optional
4+
Maintainer: Vítězslav Dvořák <info@vitexsoftware.cz>
5+
Build-Depends:
6+
debhelper-compat (= 13),
7+
dh-python,
8+
pybuild-plugin-pyproject,
9+
python3-all,
10+
python3-hatchling,
11+
Standards-Version: 4.7.0
12+
Homepage: https://github.com/open-telemetry/opentelemetry-python
13+
Rules-Requires-Root: no
14+
Vcs-Git: https://github.com/Vitexus/opentelemetry-python.git
15+
Vcs-Browser: https://github.com/Vitexus/opentelemetry-python
16+
17+
Package: python3-opentelemetry-api
18+
Architecture: all
19+
Multi-Arch: foreign
20+
Depends:
21+
${misc:Depends},
22+
${python3:Depends},
23+
python3-importlib-metadata,
24+
Description: OpenTelemetry Python API
25+
OpenTelemetry is a collection of tools, APIs, and SDKs used to instrument,
26+
generate, collect, and export telemetry data (metrics, logs, and traces).
27+
.
28+
This package provides the OpenTelemetry Python API layer, which defines
29+
the interfaces for distributed tracing, metrics, and context propagation.
30+
.
31+
This package provides the Python 3 library.

0 commit comments

Comments
 (0)