diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ead95771f015ca0b061d53f6654d6596ebb23a17..e4fd69cd902464cdaa304d164e509f64846827c5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -50,3 +50,25 @@ build: only: - main - devel + +debian: + stage: build + resource_group: deb-${CI_COMMIT_BRANCH} # this prevents parallel (potentially racy) pipeline runs + script: + - apt-get install -y --no-install-recommends build-essential cdbs devscripts equivs fakeroot debhelper curl unzip + - curl https://gitlab.kit.edu/api/v4/projects/170104/jobs/artifacts/debian/download?job=build | funzip /dev/stdin > api-generator.deb + - apt-get install -yf ./api-generator.deb + - rm ./api-generator.deb + - export PROJECT_ROOT=$(pwd) + - mkdir /tmp/build/ + - cp -r . /tmp/build/netdb_client + - cd /tmp/build/netdb_client/ + - mk-build-deps -ir -t "apt-get -o Debug::pkgProblemResolver=yes -y --no-install-recommends" + - debuild -b -uc -us + - cp /tmp/build/*.deb $PROJECT_ROOT + artifacts: + paths: + - ./*.deb + expire_in: 7 days + only: + - debian diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000000000000000000000000000000000000..9d06a4ecd7c228bef690edc9d494d2a0a7e7ba4a --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +netdb-client (0.1-1) UNRELEASED; urgency=medium + + * Initial release. + + -- Julian Keck <julian.keck9@kit.edu> Thu, 28 Mar 2024 09:45:10 +0100 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000000000000000000000000000000000000..4e225eca794c472a3039c3085d06eaf0becc25a8 --- /dev/null +++ b/debian/control @@ -0,0 +1,27 @@ +Source: netdb-client +Maintainer: Julian Keck <julian.keck9@kit.edu> +Section: python +Priority: optional +Build-Depends: + debhelper-compat (= 13), + dh-python, + python3-all, + python3-setuptools, + python3-semver, + python3-wheel, + python3-requests, + aptitude +Standards-Version: 4.6.2 +Homepage: https://gitlab.kit.edu/scc-net/netvs/netdb-client +Vcs-Git: https://gitlab.kit.edu/scc-net/netvs/netdb-client.git +Vcs-Browser: https://gitlab.kit.edu/scc-net/netvs/netdb-client +Rules-Requires-Root: no + +Package: python3-netdb-client +Architecture: all +Multi-Arch: foreign +Depends: + ${misc:Depends}, + ${python3:Depends} +Description: TODO Better description + Bla bla blablabl jasfasd a diff --git a/debian/patches/01-initial-patch b/debian/patches/01-initial-patch new file mode 100644 index 0000000000000000000000000000000000000000..cfc0b2b1f81af0e4d508ab8c30c59077d179d46f --- /dev/null +++ b/debian/patches/01-initial-patch @@ -0,0 +1,69 @@ +--- a/setup.py ++++ b/setup.py +@@ -4,12 +4,34 @@ + import os + import requests + import semver ++ ++ ++# True: a is larger ++def cmp_semver(a, b) -> bool: ++ for k in ['major', 'minor', 'patch', 'prerelease', 'build']: ++ if a[k] > b[k]: ++ return True ++ if b[k] > a[k]: ++ return False ++ return True ++ ++def semver_str(sv) -> str: ++ result = "" ++ if "major" in sv and sv["major"] is not None: ++ result += str(sv["major"]) ++ if "minor" in sv and sv["minor"] is not None: ++ result += str(sv["minor"]) ++ if "patch" in sv and sv["patch"] is not None: ++ result += "." + str(sv["patch"]) ++ if "prerelease" in sv and sv["prerelease"] is not None: ++ result += "-" + str(sv["prerelease"]) ++ return result.lstrip(".").lstrip("-").rstrip(".").rstrip("-") + +-vers = requests.get(f"{os.environ.get('NETDB_SCHEME', 'https')}://{os.environ.get('NETDB_ENDPOINT')}").json()[0] ++vers = requests.get(f"{os.environ.get('NETDB_SCHEME', 'https')}://{os.environ.get('NETDB_ENDPOINT')}", proxies={os.environ.get('NETDB_SCHEME', 'https'): ''}).json()[0] + largest_ver = None + for v in vers: +- sem_v = semver.Version.parse(v['numeric']) +- if largest_ver is None or largest_ver < sem_v: ++ sem_v = semver.parse(v['numeric']) ++ if largest_ver is None or cmp_semver(sem_v, largest_ver): + largest_ver = sem_v + + latest_previous_util_version = os.environ.get('LATEST_UTIL_VERSION', None) +@@ -19,14 +41,16 @@ + post_version = None + + def get_gen_version(): +- ver = subprocess.run(["pip freeze | grep net_api_generator"], shell=True, text=True, check=True, capture_output=True).stdout +- return ver.split('@')[-1][:12] ++ ver = subprocess.run(["aptitude show python3-net-api-generator | grep Version"], shell=True, text=True, check=True, capture_output=True).stdout ++ return ver.split(': ')[-1] + + class APIGenBuild(build_py): + def run(self): + build_versions = [f'{v["major"]}.{v["minor"]}' for v in vers] +- default_version = f'{largest_ver.major}.{largest_ver.minor}' ++ default_version = f'{largest_ver["major"]}.{largest_ver["minor"]}' + environ = os.environ.copy() ++ environ['http_proxy'] = "" ++ environ['https_proxy'] = "" + for version in build_versions: + target_dir = os.path.join(self.build_lib, 'netdb_client', f"api{version.replace('.', '')}") + self.mkpath(target_dir) +@@ -47,7 +71,7 @@ + + setup( + name='netdb_client', +- version=f'{str(largest_ver)}{".post" + str(post_version) if post_version is not None else ""}{".dev1" if os.environ.get("CI_COMMIT_BRANCH", "local") == "devel" else ""}+{util_version}', ++ version=f'{semver_str(largest_ver)}{".post" + semver_str(post_version) if post_version is not None else ""}{".dev1" if os.environ.get("CI_COMMIT_BRANCH", "local") == "devel" else ""}+{util_version}', + author='NETVS-Team <netvs@scc.kit.edu>', + description='This is a meta package to install the automatically generated NET-API definitions for the currently supported API versions.', + url='https://git.scc.kit.edu/scc-net/net-suite/netdb-client-lib', diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000000000000000000000000000000000000..00ec204770af86c49ce4d64b6cb0b4eaec410c7e --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +01-initial-patch diff --git a/debian/python3-netdb-client.lintian-overrides b/debian/python3-netdb-client.lintian-overrides new file mode 100644 index 0000000000000000000000000000000000000000..e646f2474e3e6038451b44678b46bbc727fa836a --- /dev/null +++ b/debian/python3-netdb-client.lintian-overrides @@ -0,0 +1 @@ +initial-upload-closes-no-bugs diff --git a/debian/rules b/debian/rules new file mode 100644 index 0000000000000000000000000000000000000000..bf9e2ecd09c91874f04051781e11bbc21671cf9a --- /dev/null +++ b/debian/rules @@ -0,0 +1,12 @@ +#!/usr/bin/make -f + +export PYBUILD_NAME=netdb-client +export PYBUILD_TEST_PYTEST=0 +export NETDB_ENDPOINT=api.netdb.scc.kit.edu +export https_proxy="" +export http_proxy="" + +BUILD_DATE = $(shell LC_ALL=C date -u "+%B %d, %Y" -d "@$(SOURCE_DATE_EPOCH)") + +%: + dh $@ --with python3 --buildsystem=pybuild diff --git a/debian/source.lintian-overrides b/debian/source.lintian-overrides new file mode 100644 index 0000000000000000000000000000000000000000..cb5ab09dea77441e65c1f91e29ed502b672dc955 --- /dev/null +++ b/debian/source.lintian-overrides @@ -0,0 +1,3 @@ +missing-prerequisite-for-pyproject-backend +debian-watch-file-is-missing +very-long-line-length-in-source-file diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000000000000000000000000000000000000..163aaf8d82b6c54f23c45f32895dbdfdcc27b047 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/upstream/metadata b/debian/upstream/metadata new file mode 100644 index 0000000000000000000000000000000000000000..419e8437cbf388eee6ebb2b51a2314f9179d22da --- /dev/null +++ b/debian/upstream/metadata @@ -0,0 +1,3 @@ +Bug-Database: https://gitlab.kit.edu/scc-net/netvs/netdb-client/-/issues +Bug-Submit: https://gitlab.kit.edu/scc-net/netvs/netdb-client/-/issues +Repository: https://gitlab.kit.edu/scc-net/netvs/netdb-client