From ea7168c5f79661e781cd085c337975922aaae942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=C4=9Bzslav=20Dvo=C5=99=C3=A1k?= Date: Fri, 3 Sep 2021 23:32:20 +0200 Subject: [PATCH 01/13] Debian Bookworm build added --- Jenkinsfile | 185 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..07eb3c6 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,185 @@ +#!groovy + +// Docker images generated by https://github.com/VitexSoftware/BuildImages + + +pipeline { + agent none + + options { + ansiColor('xterm') + copyArtifactPermission('*'); + //disableConcurrentBuilds() + } + + environment { + RED = '\\e[31m' + GREEN = '\\e[32m' + ENDCOLOR = '\\e[0m' + } + + stages { + + stage('debian-buster') { + agent { + docker { image 'vitexsoftware/debian:oldstable' } + } + steps { + dir('build/debian/package') { + checkout scm + buildPackage() + installPackages() + } + stash includes: 'dist/**', name: 'dist-buster' + } + post { + success { + archiveArtifacts 'dist/debian/' + copyArtifact() + } + } + } + + stage('debian-bullseye') { + agent { + docker { image 'vitexsoftware/debian:stable' } + } + steps { + dir('build/debian/package') { + checkout scm + buildPackage() + installPackages() + } + stash includes: 'dist/**', name: 'dist-bullseye' + } + post { + success { + archiveArtifacts 'dist/debian/' + copyArtifact() + } + } + } + + stage('debian-bookworm') { + agent { + docker { image 'vitexsoftware/debian:testing' } + } + steps { + dir('build/debian/package') { + checkout scm + buildPackage() + installPackages() + } + stash includes: 'dist/**', name: 'dist-bookworm' + } + post { + success { + archiveArtifacts 'dist/debian/' + copyArtifact() + } + } + } + + stage('ubuntu-focal') { + agent { + docker { image 'vitexsoftware/ubuntu:stable' } + } + steps { + dir('build/debian/package') { + checkout scm + buildPackage() + installPackages() + } + stash includes: 'dist/**', name: 'dist-focal' + } + post { + success { + archiveArtifacts 'dist/debian/' + copyArtifact() + } + } + } + + stage('ubuntu-hirsute') { + agent { + docker { image 'vitexsoftware/ubuntu:testing' } + } + steps { + dir('build/debian/package') { + checkout scm + buildPackage() + installPackages() + } + stash includes: 'dist/**', name: 'dist-hirsute' + } + post { + success { + archiveArtifacts 'dist/debian/' + copyArtifact() + } + } + } + + } +} + +def copyArtifact(){ + step ([$class: 'CopyArtifact', + projectName: '${JOB_NAME}', + filter: "**/*.deb", + target: '/var/tmp/deb', + flatten: true, + selector: specific('${BUILD_NUMBER}') + ]); +} + +def buildPackage() { + + def DIST = sh ( + script: 'lsb_release -sc', + returnStdout: true + ).trim() + + def DISTRO = sh ( + script: 'lsb_release -sd', + returnStdout: true + ).trim() + + + def SOURCE = sh ( + script: 'dpkg-parsechangelog --show-field Source', + returnStdout: true + ).trim() + + def VERSION = sh ( + script: 'dpkg-parsechangelog --show-field Version', + returnStdout: true + ).trim() + + ansiColor('vga') { + echo '\033[42m\033[90mBuild debian package ' + SOURCE + ' v' + VERSION + ' for ' + DISTRO + '\033[0m' + } + + def VER = VERSION + '~' + DIST + '~' + env.BUILD_NUMBER + +//Buster problem: Can't continue: dpkg-parsechangelog is not new enough(needs to be at least 1.17.0) +// +// debianPbuilder additionalBuildResults: '', +// components: '', +// distribution: DIST, +// keyring: '', +// mirrorSite: 'http://deb.debian.org/debian/', +// pristineTarName: '' + sh 'dch -b -v ' + VER + ' "' + env.BUILD_TAG + '"' + sh 'sudo apt-get update' + sh 'debuild-pbuilder -i -us -uc -b' + 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' +} + +def installPackages() { + sh 'cd $WORKSPACE/dist/debian/ ; dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz; cd $WORKSPACE' + sh 'echo "deb [trusted=yes] file:///$WORKSPACE/dist/debian/ ./" | sudo tee /etc/apt/sources.list.d/local.list' + sh 'sudo apt-get update' + sh 'echo "${GREEN} INSTALATION ${ENDCOLOR}"' + sh 'IFS="\n\b"; for package in `ls $WORKSPACE/dist/debian/ | grep .deb | awk -F_ \'{print \$1}\'` ; do echo -e "${GREEN} installing ${package} on `lsb_release -sc` ${ENDCOLOR} " ; sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=developer apt-get -y install $package ; done;' +} From 34873ebd1cd021c91f47bb35c435001e7f09f06c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=C4=9Bzslav=20Dvo=C5=99=C3=A1k?= Date: Sun, 5 Sep 2021 22:12:26 +0200 Subject: [PATCH 02/13] Package rename --- composer.json | 3 ++- debian/changelog | 2 +- debian/control | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index b9ee9a3..8fbd21e 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,8 @@ ], "require": { "ext-soap": "*", - "vitexsoftware/ease-core": ">=1.12" + "vitexsoftware/ease-core": ">=1.12", + "spoje.net/subreg": "dev-master" }, "autoload": { "psr-4": { diff --git a/debian/changelog b/debian/changelog index 0595bd3..5e9d68a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -php-subreg (0.3) unstable; urgency=medium +php-spojenet-subreg (1.0) unstable; urgency=medium * new support for Pricelist command diff --git a/debian/control b/debian/control index 5a71c0b..48d09d3 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Uploaders: Vitex Priority: optional Homepage: https://github.com/Spoje-NET/php-subreg -Package: php-subreg +Package: php-spojenet-subreg Depends: ${misc:Depends}, ease-framework Architecture: all Section: web From c47d12a8fa8b862ae75588191f74388389463df4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=C4=9Bzslav=20Dvo=C5=99=C3=A1k?= Date: Sun, 5 Sep 2021 22:32:55 +0200 Subject: [PATCH 03/13] Deps updated --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 48d09d3..5cef038 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Priority: optional Homepage: https://github.com/Spoje-NET/php-subreg Package: php-spojenet-subreg -Depends: ${misc:Depends}, ease-framework +Depends: ${misc:Depends}, php-vitexsoftware-ease-core Architecture: all Section: web Priority: optional From b9a9b469a0b3746af1d49efca2769ca12dd0e596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=C4=9Bzslav=20Dvo=C5=99=C3=A1k?= Date: Sun, 5 Sep 2021 22:37:55 +0200 Subject: [PATCH 04/13] Debian's composer.json update --- debian/composer.json | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/debian/composer.json b/debian/composer.json index b180e0d..dd164a4 100644 --- a/debian/composer.json +++ b/debian/composer.json @@ -8,14 +8,20 @@ "email": "info@vitexsoftware.cz" } ], - "version": "0.2", + "version": "1.0", "require": { "ext-soap": "*", - "deb/ease-framework": "*" + "deb/ease-core": "*" }, "autoload": { "psr-4": { "Subreg\\": "." } - } + }, + "repositories": [ + { + "type": "path", + "url": "/usr/share/php/EaseCore" + } + ] } From e7814dbdba6a728adb5c6415bb146da448b0209c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=C4=9Bzslav=20Dvo=C5=99=C3=A1k?= Date: Sun, 5 Sep 2021 22:58:46 +0200 Subject: [PATCH 05/13] try to rename all to php-spojenet-subreg --- debian/README.Debian | 4 ++-- debian/compat | 3 ++- debian/control | 2 +- debian/fixversion.sh | 4 ++-- debian/{php-subreg-doc.conf => php-spojenet-subreg-doc.conf} | 0 ...php-subreg-doc.install => php-spojenet-subreg-doc.install} | 0 debian/{php-subreg.install => php-spojenet-subreg.install} | 0 debian/{postinst => php-spojenet-subreg.postinst} | 2 +- 8 files changed, 8 insertions(+), 7 deletions(-) rename debian/{php-subreg-doc.conf => php-spojenet-subreg-doc.conf} (100%) rename debian/{php-subreg-doc.install => php-spojenet-subreg-doc.install} (100%) rename debian/{php-subreg.install => php-spojenet-subreg.install} (100%) rename debian/{postinst => php-spojenet-subreg.postinst} (95%) diff --git a/debian/README.Debian b/debian/README.Debian index 4262962..d71922d 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -1,7 +1,7 @@ -Ease framework Core for Debian +Subreg PHP library debian package ------------------------------ - Is installed by standard way in /usr/share/php/EaseCore + Is installed by standard way in /usr/share/php/Subreg -- Vítězslav Dvořák Ne říj 21 15:17:56 CEST 2012 diff --git a/debian/compat b/debian/compat index f599e28..9f1d48e 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1,2 @@ -10 +11 + diff --git a/debian/control b/debian/control index 5cef038..ae197f0 100644 --- a/debian/control +++ b/debian/control @@ -1,4 +1,4 @@ -Source: php-subreg +Source: php-spojenet-subreg Build-Depends: debhelper (>= 7.0.50~) Section: web Standards-Version: 3.9.8 diff --git a/debian/fixversion.sh b/debian/fixversion.sh index edf9984..c254307 100755 --- a/debian/fixversion.sh +++ b/debian/fixversion.sh @@ -1,9 +1,9 @@ #!/bin/bash VERSTR=`dpkg-parsechangelog --show-field Version` COMPOSER_VERSTR=`echo ${VERSTR}|sed 's/-/./g'` -echo update debian/php-subreg/usr/share/php/Subreg/composer.json version to ${COMPOSER_VERSTR} +echo update debian/php-spojentet-subreg/usr/share/php/Subreg/composer.json version to ${COMPOSER_VERSTR} sed -i -e '/\"version\"/c\ \"version\": \"'${COMPOSER_VERSTR}'",' debian/php-subreg/usr/share/php/Ease/composer.json echo Update debian/php-subreg/usr/share/php/Subreg/Client.php version to ${VERSTR} -sed -i -e "/static public \$libVersion/c\ static public \$libVersion = '${VERSTR}';" debian/php-subreg/usr/share/php/Subreg/Client.php +sed -i -e "/static public \$libVersion/c\ static public \$libVersion = '${VERSTR}';" debian/php-spojenet-subreg/usr/share/php/Subreg/Client.php echo Update src/Ease/Atom.php version to ${VERSTR} sed -i -e "/static public \$libVersion/c\ static public \$libVersion = '${VERSTR}';" src/Subreg/Client.php diff --git a/debian/php-subreg-doc.conf b/debian/php-spojenet-subreg-doc.conf similarity index 100% rename from debian/php-subreg-doc.conf rename to debian/php-spojenet-subreg-doc.conf diff --git a/debian/php-subreg-doc.install b/debian/php-spojenet-subreg-doc.install similarity index 100% rename from debian/php-subreg-doc.install rename to debian/php-spojenet-subreg-doc.install diff --git a/debian/php-subreg.install b/debian/php-spojenet-subreg.install similarity index 100% rename from debian/php-subreg.install rename to debian/php-spojenet-subreg.install diff --git a/debian/postinst b/debian/php-spojenet-subreg.postinst similarity index 95% rename from debian/postinst rename to debian/php-spojenet-subreg.postinst index f5b86c9..d60f812 100644 --- a/debian/postinst +++ b/debian/php-spojenet-subreg.postinst @@ -1,5 +1,5 @@ #!/bin/sh -# postinst script for ease-core +# postinst script for php-spojenet-subreg # # see: dh_installdeb(1) From b60e389c39bf76ba98cea302be245f1d09851e44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=C4=9Bzslav=20Dvo=C5=99=C3=A1k?= Date: Mon, 13 Sep 2021 00:12:47 +0200 Subject: [PATCH 06/13] Dependency update --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index ae197f0..038b9ec 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Priority: optional Homepage: https://github.com/Spoje-NET/php-subreg Package: php-spojenet-subreg -Depends: ${misc:Depends}, php-vitexsoftware-ease-core +Depends: ${misc:Depends}, php-vitexsoftware-ease-core, php-soap Architecture: all Section: web Priority: optional From 93279a2f884050d0b9e6d3c37fb1d5b6bb95f13f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=C4=9Bzslav=20Dvo=C5=99=C3=A1k?= Date: Fri, 17 Sep 2021 16:18:00 +0200 Subject: [PATCH 07/13] parent is without constructor now --- debian/files | 4 ++-- src/Subreg/Client.php | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/debian/files b/debian/files index 3abeedd..30f66cc 100644 --- a/debian/files +++ b/debian/files @@ -1,2 +1,2 @@ -php-subreg_0.3_all.buildinfo web optional -php-subreg_0.3_all.deb web optional +php-spojenet-subreg_1.0_all.deb web optional +php-spojenet-subreg_1.0_amd64.buildinfo web optional diff --git a/src/Subreg/Client.php b/src/Subreg/Client.php index f6cc2b1..9890ae2 100644 --- a/src/Subreg/Client.php +++ b/src/Subreg/Client.php @@ -19,7 +19,7 @@ class Client extends \Ease\Molecule * ClientLibrary version * @var string */ - static public $libVersion = '0.3'; + static public $libVersion = '1.0'; /** * Object Configuration @@ -63,7 +63,6 @@ class Client extends \Ease\Molecule */ public function __construct($config) { - parent::__construct(); $this->config = $config; $this->soaper = new \SoapClient(null, [ From 47f9e68631d1ad9c5adb82059d012b641d6e4984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=C4=9Bzslav=20Dvo=C5=99=C3=A1k?= Date: Fri, 24 Sep 2021 23:52:46 +0200 Subject: [PATCH 08/13] Debian 9 Stretch build added --- Jenkinsfile | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 07eb3c6..1e76211 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,6 +20,26 @@ pipeline { stages { + stage('debian-stretch') { + agent { + docker { image 'vitexsoftware/debian:lts' } + } + steps { + dir('build/debian/package') { + checkout scm + buildPackage() + installPackages() + } + stash includes: 'dist/**', name: 'dist-stretch' + } + post { + success { + archiveArtifacts 'dist/debian/' + copyArtifact() + } + } + } + stage('debian-buster') { agent { docker { image 'vitexsoftware/debian:oldstable' } @@ -177,9 +197,10 @@ def buildPackage() { } def installPackages() { + def DEBCONF_DEBUG=0 //Set to "5" or "developer" to debug debconf sh 'cd $WORKSPACE/dist/debian/ ; dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz; cd $WORKSPACE' sh 'echo "deb [trusted=yes] file:///$WORKSPACE/dist/debian/ ./" | sudo tee /etc/apt/sources.list.d/local.list' sh 'sudo apt-get update' sh 'echo "${GREEN} INSTALATION ${ENDCOLOR}"' - sh 'IFS="\n\b"; for package in `ls $WORKSPACE/dist/debian/ | grep .deb | awk -F_ \'{print \$1}\'` ; do echo -e "${GREEN} installing ${package} on `lsb_release -sc` ${ENDCOLOR} " ; sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=developer apt-get -y install $package ; done;' + sh 'IFS="\n\b"; for package in `ls $WORKSPACE/dist/debian/ | grep .deb | awk -F_ \'{print \$1}\'` ; do echo -e "${GREEN} installing ${package} on `lsb_release -sc` ${ENDCOLOR} " ; sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + DEBCONF_DEBUG + ' apt-get -y install $package ; done;' } From 01217976f5b4df8e767d21e950780d2ace65e532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=C4=9Bzslav=20Dvo=C5=99=C3=A1k?= Date: Tue, 23 Nov 2021 12:00:06 +0100 Subject: [PATCH 09/13] fixed missing php-xml dependency on Bookworm --- Jenkinsfile | 54 ++++++++++++++++++----------------------------------- 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1e76211..7e95827 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,35 +20,15 @@ pipeline { stages { - stage('debian-stretch') { - agent { - docker { image 'vitexsoftware/debian:lts' } - } - steps { - dir('build/debian/package') { - checkout scm - buildPackage() - installPackages() - } - stash includes: 'dist/**', name: 'dist-stretch' - } - post { - success { - archiveArtifacts 'dist/debian/' - copyArtifact() - } - } - } - stage('debian-buster') { agent { - docker { image 'vitexsoftware/debian:oldstable' } + docker { image 'vitexsoftware/debian:buster' } } steps { dir('build/debian/package') { checkout scm - buildPackage() - installPackages() + buildPackage() + installPackages() } stash includes: 'dist/**', name: 'dist-buster' } @@ -62,13 +42,13 @@ pipeline { stage('debian-bullseye') { agent { - docker { image 'vitexsoftware/debian:stable' } + docker { image 'vitexsoftware/debian:bullseye' } } steps { dir('build/debian/package') { checkout scm - buildPackage() - installPackages() + buildPackage() + installPackages() } stash includes: 'dist/**', name: 'dist-bullseye' } @@ -82,13 +62,15 @@ pipeline { stage('debian-bookworm') { agent { - docker { image 'vitexsoftware/debian:testing' } + docker { image 'vitexsoftware/debian:bookworm' } } steps { dir('build/debian/package') { checkout scm - buildPackage() - installPackages() + sh 'sudo apt update' + sh 'sudo apt install -y php-xml' //TODO: Remove after upstream dependency fix + buildPackage() + installPackages() } stash includes: 'dist/**', name: 'dist-bookworm' } @@ -102,13 +84,13 @@ pipeline { stage('ubuntu-focal') { agent { - docker { image 'vitexsoftware/ubuntu:stable' } + docker { image 'vitexsoftware/ubuntu:focal' } } steps { dir('build/debian/package') { checkout scm - buildPackage() - installPackages() + buildPackage() + installPackages() } stash includes: 'dist/**', name: 'dist-focal' } @@ -122,13 +104,13 @@ pipeline { stage('ubuntu-hirsute') { agent { - docker { image 'vitexsoftware/ubuntu:testing' } + docker { image 'vitexsoftware/ubuntu:hirsute' } } steps { dir('build/debian/package') { checkout scm - buildPackage() - installPackages() + buildPackage() + installPackages() } stash includes: 'dist/**', name: 'dist-hirsute' } @@ -199,7 +181,7 @@ def buildPackage() { def installPackages() { def DEBCONF_DEBUG=0 //Set to "5" or "developer" to debug debconf sh 'cd $WORKSPACE/dist/debian/ ; dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz; cd $WORKSPACE' - sh 'echo "deb [trusted=yes] file:///$WORKSPACE/dist/debian/ ./" | sudo tee /etc/apt/sources.list.d/local.list' + sh 'echo "deb [trusted=yes] file:////$WORKSPACE/dist/debian/ ./" | sudo tee /etc/apt/sources.list.d/local.list' sh 'sudo apt-get update' sh 'echo "${GREEN} INSTALATION ${ENDCOLOR}"' sh 'IFS="\n\b"; for package in `ls $WORKSPACE/dist/debian/ | grep .deb | awk -F_ \'{print \$1}\'` ; do echo -e "${GREEN} installing ${package} on `lsb_release -sc` ${ENDCOLOR} " ; sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + DEBCONF_DEBUG + ' apt-get -y install $package ; done;' From 34ed75d892e1588426ff2b0f682eabcff0f32dab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=C4=9Bzslav=20Dvo=C5=99=C3=A1k?= Date: Fri, 8 Apr 2022 13:16:29 +0200 Subject: [PATCH 10/13] Jenkinsfile update --- Jenkinsfile | 188 ---------------------------------------------------- 1 file changed, 188 deletions(-) delete mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 7e95827..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,188 +0,0 @@ -#!groovy - -// Docker images generated by https://github.com/VitexSoftware/BuildImages - - -pipeline { - agent none - - options { - ansiColor('xterm') - copyArtifactPermission('*'); - //disableConcurrentBuilds() - } - - environment { - RED = '\\e[31m' - GREEN = '\\e[32m' - ENDCOLOR = '\\e[0m' - } - - stages { - - stage('debian-buster') { - agent { - docker { image 'vitexsoftware/debian:buster' } - } - steps { - dir('build/debian/package') { - checkout scm - buildPackage() - installPackages() - } - stash includes: 'dist/**', name: 'dist-buster' - } - post { - success { - archiveArtifacts 'dist/debian/' - copyArtifact() - } - } - } - - stage('debian-bullseye') { - agent { - docker { image 'vitexsoftware/debian:bullseye' } - } - steps { - dir('build/debian/package') { - checkout scm - buildPackage() - installPackages() - } - stash includes: 'dist/**', name: 'dist-bullseye' - } - post { - success { - archiveArtifacts 'dist/debian/' - copyArtifact() - } - } - } - - stage('debian-bookworm') { - agent { - docker { image 'vitexsoftware/debian:bookworm' } - } - steps { - dir('build/debian/package') { - checkout scm - sh 'sudo apt update' - sh 'sudo apt install -y php-xml' //TODO: Remove after upstream dependency fix - buildPackage() - installPackages() - } - stash includes: 'dist/**', name: 'dist-bookworm' - } - post { - success { - archiveArtifacts 'dist/debian/' - copyArtifact() - } - } - } - - stage('ubuntu-focal') { - agent { - docker { image 'vitexsoftware/ubuntu:focal' } - } - steps { - dir('build/debian/package') { - checkout scm - buildPackage() - installPackages() - } - stash includes: 'dist/**', name: 'dist-focal' - } - post { - success { - archiveArtifacts 'dist/debian/' - copyArtifact() - } - } - } - - stage('ubuntu-hirsute') { - agent { - docker { image 'vitexsoftware/ubuntu:hirsute' } - } - steps { - dir('build/debian/package') { - checkout scm - buildPackage() - installPackages() - } - stash includes: 'dist/**', name: 'dist-hirsute' - } - post { - success { - archiveArtifacts 'dist/debian/' - copyArtifact() - } - } - } - - } -} - -def copyArtifact(){ - step ([$class: 'CopyArtifact', - projectName: '${JOB_NAME}', - filter: "**/*.deb", - target: '/var/tmp/deb', - flatten: true, - selector: specific('${BUILD_NUMBER}') - ]); -} - -def buildPackage() { - - def DIST = sh ( - script: 'lsb_release -sc', - returnStdout: true - ).trim() - - def DISTRO = sh ( - script: 'lsb_release -sd', - returnStdout: true - ).trim() - - - def SOURCE = sh ( - script: 'dpkg-parsechangelog --show-field Source', - returnStdout: true - ).trim() - - def VERSION = sh ( - script: 'dpkg-parsechangelog --show-field Version', - returnStdout: true - ).trim() - - ansiColor('vga') { - echo '\033[42m\033[90mBuild debian package ' + SOURCE + ' v' + VERSION + ' for ' + DISTRO + '\033[0m' - } - - def VER = VERSION + '~' + DIST + '~' + env.BUILD_NUMBER - -//Buster problem: Can't continue: dpkg-parsechangelog is not new enough(needs to be at least 1.17.0) -// -// debianPbuilder additionalBuildResults: '', -// components: '', -// distribution: DIST, -// keyring: '', -// mirrorSite: 'http://deb.debian.org/debian/', -// pristineTarName: '' - sh 'dch -b -v ' + VER + ' "' + env.BUILD_TAG + '"' - sh 'sudo apt-get update' - sh 'debuild-pbuilder -i -us -uc -b' - 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' -} - -def installPackages() { - def DEBCONF_DEBUG=0 //Set to "5" or "developer" to debug debconf - sh 'cd $WORKSPACE/dist/debian/ ; dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz; cd $WORKSPACE' - sh 'echo "deb [trusted=yes] file:////$WORKSPACE/dist/debian/ ./" | sudo tee /etc/apt/sources.list.d/local.list' - sh 'sudo apt-get update' - sh 'echo "${GREEN} INSTALATION ${ENDCOLOR}"' - sh 'IFS="\n\b"; for package in `ls $WORKSPACE/dist/debian/ | grep .deb | awk -F_ \'{print \$1}\'` ; do echo -e "${GREEN} installing ${package} on `lsb_release -sc` ${ENDCOLOR} " ; sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + DEBCONF_DEBUG + ' apt-get -y install $package ; done;' -} From 86279ffa801d4bc061e7c610bd307e1068228a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=C4=9Bzslav=20Dvo=C5=99=C3=A1k?= Date: Mon, 20 Nov 2023 13:33:59 +0100 Subject: [PATCH 11/13] Update for current Ease Framework --- debian/Jenkinsfile | 74 +++++++++++++++++++++++++++++ src/Subreg/Client.php | 105 ++++++++++++++++++++++++------------------ src/demo.php | 1 + 3 files changed, 135 insertions(+), 45 deletions(-) create mode 100644 debian/Jenkinsfile diff --git a/debian/Jenkinsfile b/debian/Jenkinsfile new file mode 100644 index 0000000..5ac20fe --- /dev/null +++ b/debian/Jenkinsfile @@ -0,0 +1,74 @@ +#!groovy + +String[] distributions = ['debian:bullseye', 'debian:bookworm', 'ubuntu:focal', 'ubuntu:jammy'] + +String vendor = 'vitexsoftware' +String distribution = '' +//String distroFamily = '' +String distroCodename = '' +String ver = '' + +properties([ + copyArtifactPermission('*') +]) +node() { + ansiColor('xterm') { + stage('SCM Checkout') { + checkout scm + } + } +} + +distributions.each { + distribution = it + + println "Dist:" + distribution + + def dist = distribution.split(':') + // distroFamily = dist[0] + distroCodename = dist[1] + + def buildImage = '' + + node { + ansiColor('xterm') { + stage('Checkout ' + distribution) { + buildImage = docker.image(vendor + '/' + distribution) + sh 'git checkout debian/changelog' + def version = sh ( + script: 'dpkg-parsechangelog --show-field Version', + returnStdout: true + ).trim() + ver = version + '.' + env.BUILD_NUMBER + '~' + distroCodename + } + stage('Build ' + distribution) { + buildImage.inside { + sh 'dch -b -v ' + ver + ' "' + env.BUILD_TAG + '"' + sh 'sudo apt-get update --allow-releaseinfo-change' + sh 'sudo chown jenkins:jenkins ..' + sh 'debuild-pbuilder -i -us -uc -b' + 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' + } + } + + stage('Test ' + distribution) { + buildImage.inside { + def debconf_debug = 0 //Set to "5" or "developer" to debug debconf + sh 'cd $WORKSPACE/dist/debian/ ; dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz; cd $WORKSPACE' + sh 'echo "deb [trusted=yes] file://///$WORKSPACE/dist/debian/ ./" | sudo tee /etc/apt/sources.list.d/local.list' + sh 'sudo apt-get update --allow-releaseinfo-change' + sh 'echo "INSTALATION"' + sh 'sudo apt -y install abraflexi-client-config' + sh 'IFS="\n\b"; for package in `ls $WORKSPACE/dist/debian/ | grep .deb | grep -v dbgsym | awk -F_ \'{print \$1}\'` ; do echo -e "${GREEN} installing ${package} on `lsb_release -sc` ${ENDCOLOR} " ; sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + debconf_debug + ' apt-get -y install $package ; abraflexi-benchmark -p -c 1 -d 5 ; done;' + stash includes: 'dist/**', name: 'dist-' + distroCodename + } + } + stage('Copy artifacts ' + distribution ) { + buildImage.inside { + sh 'mv $WORKSPACE/dist/debian/*.deb $WORKSPACE' + } + } + } + } +} + diff --git a/src/Subreg/Client.php b/src/Subreg/Client.php index 9890ae2..0da6295 100644 --- a/src/Subreg/Client.php +++ b/src/Subreg/Client.php @@ -1,9 +1,10 @@ - * @copyright (C) 2018 Spoje.Net + * @copyright (C) 2018,2023 Spoje.Net */ namespace Subreg; @@ -15,11 +16,13 @@ */ class Client extends \Ease\Molecule { + use \Ease\Log\Logging; + /** * ClientLibrary version - * @var string + * @var string */ - static public $libVersion = '1.0'; + public static $libVersion = '1.0'; /** * Object Configuration @@ -35,7 +38,7 @@ class Client extends \Ease\Molecule /** * Authentification - * @var string + * @var string */ public $token = null; @@ -47,24 +50,25 @@ class Client extends \Ease\Molecule /** * Last call error Data - * @var array + * @var array */ public $lastError = []; /** * Last call obtained Data - * @var array + * @var array */ public $lastResult = []; /** - * + * * @param type $config */ public function __construct($config) { $this->config = $config; - $this->soaper = new \SoapClient(null, + $this->soaper = new \SoapClient( + null, [ "location" => $config['location'], "uri" => $config['uri'] @@ -77,22 +81,27 @@ public function __construct($config) * Add Info about used user, server and libraries * * @param string $additions Additional note text - * + * * @return boolean was logged ? */ public function logBanner($additions = null) { - return $this->addStatusMessage('API '.str_replace('://', - '://'.$this->config['login'].'@', $this->config['uri']).' php-subreg v'.self::$libVersion.' EasePHP Framework v'.\Ease\Atom::$frameworkVersion.' '.$additions, - 'debug'); + return $this->addStatusMessage( + 'API ' . str_replace( + '://', + '://' . $this->config['login'] . '@', + $this->config['uri'] + ) . ' php-subreg v' . self::$libVersion . ' EasePHP Framework v' . \Ease\Atom::$frameworkVersion . ' ' . $additions, + 'debug' + ); } /** * API Call - * + * * @param string $command command to execute * @param array $params command parameters - * + * * @return array */ public function call($command, $params = []) @@ -128,19 +137,21 @@ public function call($command, $params = []) /** * log Error - * + * * @param array $errorData */ public function logError($errorData) { $this->lastError = $errorData; - $this->addStatusMessage($errorData['errorcode']['major'].' '.$errorData['errorcode']['minor'].': '.$errorData['errormsg'], - 'error'); + $this->addStatusMessage( + $errorData['errorcode']['major'] . ' ' . $errorData['errorcode']['minor'] . ': ' . $errorData['errormsg'], + 'error' + ); } /** * Perform Login to Server - * + * * @return boolean success */ public function login() @@ -160,11 +171,11 @@ public function login() /** * Check if domain is available or not - * + * * @link https://subreg.cz/manual/?cmd=Check_Domain Command: Check_Domain - * + * * @param string $domain - * + * * @return array */ public function checkDomain($domain) @@ -174,9 +185,9 @@ public function checkDomain($domain) /** * Create a new domain - * + * * @link https://subreg.cz/manual/?cmd=Create_Domain Order: Create_Domain - * + * * @param string $domain * @param string $registrantID * @param string $contactsAdminID @@ -184,14 +195,20 @@ public function checkDomain($domain) * @param string $authID * @param array $nsHosts Hostnames of nameservers: ['ns.domain.cz','ns2.domain.cz'] * @param string $nsset Nameserver Set (only for FRED registries (.CZ,.EE,...)) - * @param int $period - * + * @param int $period + * * @return array */ - public function registerDomain($domain, $registrantID, $contactsAdminID, - $contactsTechID, $authID, $nsHosts = [], - $nsset = null, $period = 1) - { + public function registerDomain( + $domain, + $registrantID, + $contactsAdminID, + $contactsTechID, + $authID, + $nsHosts = [], + $nsset = null, + $period = 1 + ) { foreach ($nsHosts as $host) { $ns[]["hostname"] = $host; @@ -231,9 +248,9 @@ public function registerDomain($domain, $registrantID, $contactsAdminID, /** * Get all domains from your account - * + * * @link https://subreg.cz/manual/?cmd=Domains_List Command: Domains_List - * + * * @return array */ public function domainsList() @@ -243,43 +260,41 @@ public function domainsList() /** * Get pricelist from your account - * + * * @link https://subreg.cz/manual/?cmd=Pricelist Command: Pricelist - * + * * @return array */ public function pricelist() { return $this->call('Pricelist'); } - + /** * Get specified pricelist from your account - * + * * @link https://subreg.cz/manual/?cmd=Get_Pricelist Command: Get_Pricelist - * + * * @param string requested pricelist name - * + * * @return array */ public function getPricelist($pricelist) { - return $this->call('Get_Pricelist', ['pricelist'=>$pricelist]); + return $this->call('Get_Pricelist', ['pricelist' => $pricelist]); } - + /** - * + * * @link https://subreg.cz/manual/?cmd=Renew_Domain Command: Renew_Domain - * + * * @param string $domain name * @param int $years - * + * * @return type */ public function renewDomain(string $domain, int $years = 1) { - return $this->call('Make_Order', ['order' => ['domain' => $domain, 'params' => ['period' => $years], 'type' => 'Renew_Domain']] ); + return $this->call('Make_Order', ['order' => ['domain' => $domain, 'params' => ['period' => $years], 'type' => 'Renew_Domain']]); } - - } diff --git a/src/demo.php b/src/demo.php index 6436bb0..0c78d59 100644 --- a/src/demo.php +++ b/src/demo.php @@ -1,4 +1,5 @@ Date: Mon, 20 Nov 2023 13:48:18 +0100 Subject: [PATCH 12/13] Build fix --- debian/Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/debian/Jenkinsfile b/debian/Jenkinsfile index 5ac20fe..2b7b5b7 100644 --- a/debian/Jenkinsfile +++ b/debian/Jenkinsfile @@ -58,8 +58,7 @@ distributions.each { sh 'echo "deb [trusted=yes] file://///$WORKSPACE/dist/debian/ ./" | sudo tee /etc/apt/sources.list.d/local.list' sh 'sudo apt-get update --allow-releaseinfo-change' sh 'echo "INSTALATION"' - sh 'sudo apt -y install abraflexi-client-config' - sh 'IFS="\n\b"; for package in `ls $WORKSPACE/dist/debian/ | grep .deb | grep -v dbgsym | awk -F_ \'{print \$1}\'` ; do echo -e "${GREEN} installing ${package} on `lsb_release -sc` ${ENDCOLOR} " ; sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + debconf_debug + ' apt-get -y install $package ; abraflexi-benchmark -p -c 1 -d 5 ; done;' + sh 'IFS="\n\b"; for package in `ls $WORKSPACE/dist/debian/ | grep .deb | grep -v dbgsym | awk -F_ \'{print \$1}\'` ; do echo -e "${GREEN} installing ${package} on `lsb_release -sc` ${ENDCOLOR} " ; sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + debconf_debug + ' apt-get -y install $package ; abraflexi-daydigest; done;' stash includes: 'dist/**', name: 'dist-' + distroCodename } } From 4e4c83ffc3150784ac2d4b2582c535dc1da86162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=C4=9Bzslav=20Dvo=C5=99=C3=A1k?= Date: Mon, 20 Nov 2023 13:52:05 +0100 Subject: [PATCH 13/13] Build fix II --- debian/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/Jenkinsfile b/debian/Jenkinsfile index 2b7b5b7..7f323e9 100644 --- a/debian/Jenkinsfile +++ b/debian/Jenkinsfile @@ -58,7 +58,7 @@ distributions.each { sh 'echo "deb [trusted=yes] file://///$WORKSPACE/dist/debian/ ./" | sudo tee /etc/apt/sources.list.d/local.list' sh 'sudo apt-get update --allow-releaseinfo-change' sh 'echo "INSTALATION"' - sh 'IFS="\n\b"; for package in `ls $WORKSPACE/dist/debian/ | grep .deb | grep -v dbgsym | awk -F_ \'{print \$1}\'` ; do echo -e "${GREEN} installing ${package} on `lsb_release -sc` ${ENDCOLOR} " ; sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + debconf_debug + ' apt-get -y install $package ; abraflexi-daydigest; done;' + sh 'IFS="\n\b"; for package in `ls $WORKSPACE/dist/debian/ | grep .deb | grep -v dbgsym | awk -F_ \'{print \$1}\'` ; do echo -e "${GREEN} installing ${package} on `lsb_release -sc` ${ENDCOLOR} " ; sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DEBUG=' + debconf_debug + ' apt-get -y install $package ; done;' stash includes: 'dist/**', name: 'dist-' + distroCodename } }