Skip to content

Commit

Permalink
merge php-runkit7 and php-sqlsrv
Browse files Browse the repository at this point in the history
  • Loading branch information
caothu159 committed May 4, 2024
2 parents d97e440 + a962b91 commit 2312492
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 129 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ on:
branches: [main]
paths-ignore:
- "**.md"
- "**.yml"
- "dists/**"
pull_request:
branches: [main]
paths-ignore:
- "**.md"
- "**.yml"
- "dists/**"

# Allows you to run this workflow manually from the Actions tab
Expand Down Expand Up @@ -69,7 +71,7 @@ jobs:
run: bash ci/install_build_deps.sh
- name: Updating build information
if: false == true
run: bash ci/update_packages.sh
run: bash ci/package_update.sh
- name: Building package binary
if: false == true
run: bash ci/build_packages.sh
Expand All @@ -96,7 +98,6 @@ jobs:
if: false == true
run: |
if [ "$(git status --porcelain=v1 2>/dev/null | wc -l)" != "0" ]; then
git add dists/
git add src/debian/changelog
git commit -m "Update packages on dists from ${{ matrix.operating-system }} at $(date +'%d-%m-%y')" &&
# git push https://${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git main ||
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
[php-runkit7](https://github.com/diepxuan/php-runkit7)
[php-sqlsrv](https://github.com/diepxuan/php-sqlsrv)
=====
Package of runkit for PHP 7.2+
Package of sqlsrv for PHP 8.1+
-----

#### Compatibility: from PHP 8.1

[runkit7](https://pecl.php.net/package/runkit7) implementing php7.2+ support
[sqlsrv](https://pecl.php.net/package/sqlsrv) is Microsoft Drivers for PHP for SQL Server (SQLSRV)

This package to install sqlsrv to ubuntu from apt

#### BUILDING AND INSTALLING `sqlsrv` IN UNIX
#### BUILDING AND INSTALLING IN UNIX

`pecl install runkit7` can be used to install [runkit7 releases published on PECL](https://pecl.php.net/package/runkit7).
`pecl install sqlsrv` can be used to install [sqlsrv releases published on PECL](https://pecl.php.net/package/sqlsrv).
2 changes: 2 additions & 0 deletions ci/environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ env pwd_dir $(pwd || dirname $(realpath "$0") || realpath .)
# user evironment
env email ductn@diepxuan.com
env changelog $(realpath ./src/debian/changelog)
env controlin $(realpath ./src/debian/control.in)
env rules $(realpath ./src/debian/rules)
env timelog "$(date -R)"

# plugin
Expand Down
4 changes: 1 addition & 3 deletions ci/install_build_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ printf "man-db man-db/auto-update boolean false\n" | sudo debconf-set-selections

# add repository for install missing depends
sudo apt install software-properties-common
grep -r "/ondrej/php" /etc/apt/sources.list /etc/apt/sources.list.d/*.list >/dev/null 2>&1 ||
sudo add-apt-repository ppa:ondrej/php -y
sudo add-apt-repository ppa:ondrej/php -y

curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
Expand All @@ -38,7 +37,6 @@ sudo apt build-dep $INPUT_APT_OPTS -- "./$INPUT_SOURCE_DIR"
# But let’s be explicit here.
# shellcheck disable=SC2086
sudo apt install $INPUT_APT_OPTS -- dpkg-dev libdpkg-perl dput $INPUT_EXTRA_BUILD_DEPS

# sudo apt update
# sudo ACCEPT_EULA=Y apt install -y msodbcsql18
# # optional: for unixODBC development headers
Expand Down
8 changes: 8 additions & 0 deletions ci/package_update.runkit7.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
#!/bin/bash

set -e

cat | tee -a "$source_dir/debian/$module.ini" <<-EOF
runkit.internal_override=On
EOF
30 changes: 17 additions & 13 deletions ci/update_packages.sh → ci/package_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,28 @@ set -e
. $(dirname $(realpath "$BASH_SOURCE"))/head.sh

pecl download $module
# pecl download runkit7-alpha
package_dist=$(ls | grep $module)
tar xvzf $package_dist -C $INPUT_SOURCE_DIR
tar xvzf $package_dist -C $source_dir

ls -la $INPUT_SOURCE_DIR
ls -la $source_dir

# Update module sqlsrv release latest
release_tag=$(echo $package_dist | sed 's|.tgz||g' | cut -d '-' -f2)
old_release_tag=$(cat $changelog | head -n 1 | awk '{print $2}' | sed 's|[()]||g')
sed -i -e "0,/$old_release_tag/ s/$old_release_tag/$release_tag/g" $changelog
old_project=$(cat $changelog | head -n 1 | awk '{print $1}' | sed 's|[()]||g')
sed -i -e "0,/_PROJECT_/ s/_PROJECT_/$project/g" $controlin
sed -i -e "0,/_MODULE_/ s/_MODULE_/$module/g" $controlin

# Update os release latest
# old_release_os=$(cat $changelog | head -n 1 | awk '{print $2}' | cut -d '+' -f2 | sed 's|[()]||g')
# sed -i -e "0,/$old_release_os/ s/$old_release_os/${DISTRIB}${RELEASE}/g" $changelog
# sed -i -e "0,/$old_release_os/ s/$old_release_os//g" $changelog
cat | tee "$source_dir/debian/$module.ini" <<-EOF
; configuration for pecl $module module
; priority=20
extension=$module.so
EOF

# Update os codename
release_tag=$(echo $package_dist | sed 's|.tgz||g' | cut -d '-' -f2)
old_release_tag=$(cat $changelog | head -n 1 | awk '{print $2}' | sed 's|[()]||g')
old_codename_os=$(cat $changelog | head -n 1 | awk '{print $3}')
sed -i -e "0,/$old_project/ s/$old_project/$project/g" $changelog
sed -i -e "0,/$old_release_tag/ s/$old_release_tag/$release_tag/g" $changelog
sed -i -e "0,/$old_codename_os/ s/$old_codename_os/$CODENAME;/g" $changelog

# Update time building
sed -i -e "0,/<$email> .*/ s/<$email> .*/<$email> $timelog/g" $changelog

. $ci_dir/package_update.$module.sh
14 changes: 14 additions & 0 deletions ci/package_update.sqlsrv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
#!/bin/bash

set -e

sed -i -e "s|php-all-dev, tar|php-all-dev, tar, unixodbc-dev, unixodbc|g" $controlin
sed -i -e "s|\${shlibs:Depends}$|\${shlibs:Depends}, msodbcsql18|g" $controlin
rm -rf "$controlin-e"

cat | tee -a $rules <<-EOF
override_dh_shlibdeps:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
EOF
4 changes: 1 addition & 3 deletions ci/put_ppa_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ login = anonymous
allow_unsigned_uploads = 0
EOF

release_package=$(cat $changelog | head -n 1 | awk '{print $1}')
release_version=$(cat $changelog | head -n 1 | awk '{print $2}' | sed 's|[()]||g')
package=$(ls -a $dists_dir | grep _source.changes | head -n 1)

package=$(ls -a $dists_dir | grep ${release_package}_${release_version} | grep _source.changes | head -n 1)
[[ -n $package ]] &&
package=$dists_dir/$package &&
[[ -f $package ]] &&
Expand Down
2 changes: 0 additions & 2 deletions src/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
package.xml
sqlsrv-*
sqlsrv-*/
6 changes: 1 addition & 5 deletions src/debian/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@ files
build

.debhelper
php*-sqlsrv.php
!php-sqlsrv.php
php-sqlsrv/
php*-sqlsrv/
php-sqlsrv-all-dev/

*.substvars
81 changes: 0 additions & 81 deletions src/debian/control

This file was deleted.

12 changes: 6 additions & 6 deletions src/debian/control.in
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
Source: php-sqlsrv
Source: _PROJECT_
Priority: optional
Maintainer: Tran Ngoc Duc <ductn@diepxuan.com>
Uploaders: Tran Ngoc Duc <ductn@diepxuan.com>
Build-Depends: debhelper-compat (= 12),
debhelper (>= 10~),
dh-php (>= 4~),
php-all-dev, tar, unixodbc-dev, unixodbc
php-all-dev, tar
Section: php
Standards-Version: 2.0.1
Homepage: https://pecl.php.net/package/sqlsrv
Homepage: https://pecl.php.net/package/_MODULE_

Package: php-sqlsrv
Package: _PROJECT_
Architecture: any
Pre-Depends: php-common (>= 2:69~)
Depends: ${misc:Depends},
${pecl:Depends},
${php:Depends},
${shlibs:Depends},
msodbcsql18
${shlibs:Depends}

Recommends: ghostscript,
ttf-dejavu-core,
${pecl:Recommends}
Expand Down
1 change: 0 additions & 1 deletion src/debian/php-sqlsrv.php

This file was deleted.

3 changes: 0 additions & 3 deletions src/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@ include /usr/share/dh-php/pkg-pecl.mk

override_dh_builddeb:
dh_builddeb -- -Zgzip

override_dh_shlibdeps:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
4 changes: 0 additions & 4 deletions src/debian/sqlsrv.ini

This file was deleted.

0 comments on commit 2312492

Please sign in to comment.