PHP packaging
We currently use modified Debian packages to install PHP on appservers and in Docker images. These packages are available from apt.wikimedia.org in a dedicated component for others to use, like CI and MediaWiki-Vagrant.
Differences from Debian
Aside from custom patches we want to apply, the packages are slightly different. Starting with PHP 7.4, all packages are named php7.4-foo
(instead of the versionless php-foo
). This is implemented by patching dh-php:
Extended content |
---|
The following content has been placed in a collapsed box for improved usability. |
pkg-pecl.mk diff --git a/pkg-pecl.mk b/pkg-pecl.mk
index b15ce4f..5821c3d 100644
--- a/pkg-pecl.mk
+++ b/pkg-pecl.mk
@@ -25,7 +25,7 @@ export NO_INTERACTION=1
PHP_VERSIONS := $(shell /usr/sbin/phpquery -V)
PECL_NAME := $(if $(PECL_NAME_OVERRIDE),$(PECL_NAME_OVERRIDE),$(subst php-,,$(DEB_SOURCE)))
-INSTALL_ROOT = $(CURDIR)/debian/php-$(PECL_NAME)
+INSTALL_ROOT = $(CURDIR)/debian/php7.4-$(PECL_NAME)
# find corresponding package-PHP_MAJOR.PHP_MINOR.xml, package-PHP_MAJOR.xml or package.xml
$(foreach ver,$(PHP_VERSIONS),$(eval PACKAGE_XML_$(ver) := $(word 1,$(wildcard package-$(ver).xml package-$(basename $(ver)).xml package.xml))))
@@ -86,4 +86,4 @@ override_dh_gencontrol:
dh_gencontrol -- "-Vphp:Provides=$(addprefix php,$(addsuffix -$(PECL_NAME)$(,) ,$(DH_PHP_VERSIONS)))"
override_dh_php:
- dh_php -p php-$(PECL_NAME)
+ dh_php -p php7.4-$(PECL_NAME)
|
The above content has been placed in a collapsed box for improved usability. |
In an extension package, the binary package name also needs to be changed, including any potential dependencies. Any php-foo.*
files also need to be renamed to php7.4-foo.*
Extended content |
---|
The following content has been placed in a collapsed box for improved usability. |
git -C php-memcached show diff --git a/debian/control b/debian/control
index 6bd7298..ec1a2de 100644
--- a/debian/control
+++ b/debian/control
@@ -7,9 +7,9 @@ Build-Depends: debhelper (>= 10~),
dh-php,
libmemcached-dev (>= 1.0.18),
php-all-dev (>= 28~),
- php-igbinary,
- php-json,
- php-msgpack,
+ php7.4-igbinary,
+ php7.4-json,
+ php7.4-msgpack,
pkg-config,
zlib1g-dev
Standards-Version: 3.9.8
@@ -17,11 +17,11 @@ Homepage: http://pecl.php.net/package/memcached
Vcs-Git: https://salsa.debian.org/php-team/pecl/php-memcached.git
Vcs-Browser: https://salsa.debian.org/php-team/pecl/php-memcached
-Package: php-memcached
+Package: php7.4-memcached
Architecture: any
Pre-Depends: php-common (>= 2:69~)
-Depends: php-igbinary,
- php-msgpack,
+Depends: php7.4-igbinary,
+ php7.4-msgpack,
ucf,
${misc:Depends},
${pecl:Depends},
diff --git a/debian/gbp.conf b/debian/gbp.conf
index efad48c..dfbe5d8 100644
--- a/debian/gbp.conf
+++ b/debian/gbp.conf
@@ -1,5 +1,5 @@
[DEFAULT]
-debian-branch = debian/bullseye
+debian-branch = wikimedia/php74
debian-tag = debian/%(version)s
upstream-branch = upstream
upstream-tag = upstream/%(version)s
diff --git a/debian/php-memcached.docs b/debian/php7.4-memcached.docs
similarity index 100%
rename from debian/php-memcached.docs
rename to debian/php7.4-memcached.docs
diff --git a/debian/php-memcached.php b/debian/php7.4-memcached.php
similarity index 100%
rename from debian/php-memcached.php
rename to debian/php7.4-memcached.php
|
The above content has been placed in a collapsed box for improved usability. |
Initial forking
If you want to fork a new package from Debian, clone the Git repository from Salsa, adjust the packaging as explained above, and build the package:
$ https_proxy="http://webproxy:8080" gbp clone https://salsa.debian.org/php-team/pecl/php-pcov
$ cd php-pcov/
$ git checkout debian/bullseye
$ git checkout -b wikimedia/php74
$ # Make changes to the debian/ directory
$ # Add a changelog entry with +wmf1~buster1 appended to the version
$ PHP74="yes" gbp buildpackage --git-debian-branch=wikimedia/php74 --git-dist=buster-wikimedia -sa
Modifying a package
If you need to patch or modify a package already in our repository, use the latest .dsc to create a new Git repo. You can find the URL of the .dsc by looking in the pool.
$ gbp import-dsc --allow-unauthenticated https://apt.wikimedia.org/wikimedia/pool/component/php74/p/php-pcov/php-pcov_1.0.6-4%2Bwmf1~buster1.dsc
$ cd php-pcov
$ # Make your changes, bump changelog
$ PHP74="yes" gbp buildpackage --git-dist=buster-wikimedia