...
deb-src lines instruct apt where it should get upstream source packages. In our example it is buster (a codebase of debian). Add an architecture:
Code Block | ||||
---|---|---|---|---|
| ||||
dpkg --add-architecture amd64 |
And update the data:
Code Block | ||||
---|---|---|---|---|
| ||||
apt-get update |
...
How to port a new package
1) Choose a package you want to port. For example, apache2. Go to the debian packages page at https://packages.debian.org/buster-backports/apache2 and copy the correct name of the source package in the right column ("Download Source Package apache2:"). Remember (or copy) "apache2". Install additional packages to manipulate the source code:
Code Block | ||
---|---|---|
| ||
du3p03% sudo apt-get install dpkg-dev Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: binutils libdpkg-perl make patch Suggested packages: binutils-doc debian-keyring gcc | c-compiler bzr make-doc ed diffutils-doc Recommended packages: build-essential gcc | c-compiler fakeroot libalgorithm-merge-perl libfile-fcntllock-perl liblocale-gettext-perl The following NEW packages will be installed: binutils dpkg-dev libdpkg-perl make patch 0 upgraded, 5 newly installed, 0 to remove and 7 not upgraded. Need to get 6277 kB of archives. After this operation, 46.4 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 https://apt2.dilos.org/dilos du3-unstable/main solaris-i386 binutils solaris-i386 2.31.1-1+dilos3 [4409 kB] Get:2 https://apt2.dilos.org/dilos du2-unstable/main solaris-i386 libdpkg-perl all 1.19.7+dilos5 [706 kB] Get:3 https://apt2.dilos.org/dilos du2-unstable/main solaris-i386 patch solaris-i386 2.7.6-3+dilos1 [137 kB] Get:4 https://apt2.dilos.org/dilos du2-unstable/main solaris-i386 make solaris-i386 4.1-9.1-2+dilos2 [316 kB] Get:5 https://apt2.dilos.org/dilos du2-unstable/main solaris-i386 dpkg-dev all 1.19.7+dilos5 [708 kB] Fetched 6277 kB in 8s (740 kB/s) Selecting previously unselected package binutils. (Reading database ... 15551 files and directories currently installed.) Preparing to unpack .../binutils_2.31.1-1+dilos3_solaris-i386.deb ... Unpacking binutils (2.31.1-1+dilos3) ... Selecting previously unselected package libdpkg-perl. Preparing to unpack .../libdpkg-perl_1.19.7+dilos5_all.deb ... Unpacking libdpkg-perl (1.19.7+dilos5) ... Selecting previously unselected package patch. Preparing to unpack .../patch_2.7.6-3+dilos1_solaris-i386.deb ... Unpacking patch (2.7.6-3+dilos1) ... Selecting previously unselected package make. Preparing to unpack .../make_4.1-9.1-2+dilos2_solaris-i386.deb ... Unpacking make (4.1-9.1-2+dilos2) ... Selecting previously unselected package dpkg-dev. Preparing to unpack .../dpkg-dev_1.19.7+dilos5_all.deb ... Unpacking dpkg-dev (1.19.7+dilos5) ... Setting up binutils (2.31.1-1+dilos3) ... Setting up make (4.1-9.1-2+dilos2) ... Setting up patch (2.7.6-3+dilos1) ... Setting up libdpkg-perl (1.19.7+dilos5) ... Setting up dpkg-dev (1.19.7+dilos5) ... Processing triggers for install-info (6.5.0.dfsg.1-1+dilos1) ... du3p03% |
2) Now download the source code into your build environment:
Code Block | ||||
---|---|---|---|---|
| ||||
du3p03% apt-get source apache2 Reading package lists... Done NOTICE: 'apache2' packaging is maintained in the 'Git' version control system at: https://salsa.debian.org/apache-team/apache2.git Please use: git clone https://salsa.debian.org/apache-team/apache2.git to retrieve the latest (possibly unreleased) updates to the package. Need to get 10.4 MB of source archives. Get:1 http://mirrors.edge.kernel.org/debian buster-backports/main apache2 2.4.43-1~bpo10+1 (dsc) [3530 B] Get:2 http://mirrors.edge.kernel.org/debian buster-backports/main apache2 2.4.43-1~bpo10+1 (tar) [9348 kB] Get:3 http://mirrors.edge.kernel.org/debian buster-backports/main apache2 2.4.43-1~bpo10+1 (asc) [488 B] Get:4 http://mirrors.edge.kernel.org/debian buster-backports/main apache2 2.4.43-1~bpo10+1 (diff) [1015 kB] Fetched 10.4 MB in 6s (1660 kB/s) dpkg-source: info: extracting apache2 in apache2-2.4.43 dpkg-source: info: unpacking apache2_2.4.43.orig.tar.gz dpkg-source: info: unpacking apache2_2.4.43-1~bpo10+1.debian.tar.xz dpkg-source: info: using patch list from debian/patches/series dpkg-source: info: applying fhs_compliance.patch dpkg-source: info: applying no_LD_LIBRARY_PATH.patch dpkg-source: info: applying suexec-CVE-2007-1742.patch dpkg-source: info: applying customize_apxs.patch dpkg-source: info: applying build_suexec-custom.patch dpkg-source: info: applying reproducible_builds.diff dpkg-source: info: applying buffer-http-request-bodies-for-tlsv13.diff dpkg-source: info: applying tlsv13-add-logno.diff du3p01% |
3) Now we can port the package. First of all you should install (possible) all dependencies to build the package. At this stage the build system does now know anything about dependencies, install them manually:
Code Block | ||
---|---|---|
| ||
du3p01% cd apache2-2.4.43 du3p01% dpkg-checkbuilddeps dpkg-checkbuilddeps: error: Unmet build dependencies: debhelper (>= 10) bison jdupes libapr1-dev (>= 1.6.0) libaprutil1-dev (>= 1.6.0) libbrotli-dev liblua5.2-dev libnghttp2-dev libpcre3-dev libssl-dev (>= 1.1.1) libxml2-dev lsb-release zlib1g-dev libcurl4-openssl-dev | libcurl4-dev libjansson-dev |
4) Now you can try to install them:
...
Code Block | ||
---|---|---|
| ||
du3p03% date -R Mon, 10 Aug 2020 12:06:57 +0300 |
The file is ready and we're preparing next file...
debian/control
This file Also you can use the template created by gmake debgenlog command, go to your local copy of the du3 repository, and than components/<any_component> (apt for example):
Code Block |
---|
# cd <path_to_du3>/du3/components/apt
# gmake debgenlog
/ws/home/akozlov/du3/tools/deb_gen_log.pl
dummy (1.2.3.4) unstable; urgency=low
* build for dilos
-- DilOS Team <dilos@dilos.org> Sun, 31 Jan 2021 22:08:33 +0300
|
Here you just need to change name and version of the component.
The file is ready and we're preparing next file...
debian/control
This file is used to specify dependencies o build the package(s):
...
If we install the package as is (in the current environment) the BASEDIR is "/" and we just clear it.it.
quilt patch
If during the porting process you need to change something outside the debian folder, then these changes must be placed in the dilos.patch:
Code Block |
---|
# quilt new dilos.patch
# quilt add <modifying_file>
# quilt refresh |
du3/components/<package>
When the porting has done and all packages built you should place it into the du3 repo. Create a directory (usualy by the source package name), in our examples it is apache2 and/or jdupes.
...
Code Block | ||
---|---|---|
| ||
du3p01% cat du3/components/jdupes/Makefile # # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version 1.0. # You may only use this file in accordance with the terms of version # 1.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # # Copyright (c) 2020 DilOS Team <dilos@dilos.org> # include ../../make-rules/shared-macros.mk COMPONENT_NAME= jdupes include ../../make-rules/deb_src2.mk # build: @echo "Nothing build" install: @echo "Nothing install" clean: $(RM) -r $(BUILD_DIR) # $(RM) *.changes # $(RM) *.deb clobber: clean test: $(NO_TESTS) |
Make sure there are no "white spaces" at the of lines:
Code Block | ||
---|---|---|
| ||
sed -i 's/ *$//' Makefile |
Copy the whole debian directory from the package tree to the component repo directory, add it to git, commit it and create a PR (pull request).
...
Code Block | ||
---|---|---|
| ||
du3p03% sudo dpkg-buildpackage -d -S -us -uc -sa dpkg-buildpackage: info: source package jdupes dpkg-buildpackage: info: source version 1.18.1-1~bpo10+1+dilos1 dpkg-buildpackage: info: source distribution unstable dpkg-buildpackage: info: source changed by DilOS Team <dilos@dilos.org> dpkg-source --before-build . dpkg-source: warning: can't parse dependency tree:native dpkg-source: warning: can't parse dependency tree:native debian/rules clean dh clean dh_auto_clean make -j1 distclean make[1]: Entering directory '/export/home/denis/projects/dilos/porting/jdupes-1.18.1' rm -f jdupes.o jody_paths.o jody_sort.o jody_win_unicode.o jody_strtoepoch.o string_malloc.o jody_cacheinfo.o act_deletefiles.o act_linkfiles.o act_printmatches.o act_summarize.o act_printjson.o xxhash.o act_dedupefiles.o jdupes-standalone build_date.h jdupes jdupes.exe *~ *.gcno *.gcda *.gcov rm -f *.pkg.tar.xz rm -f -r jdupes-*-win*/ jdupes-*-win*.zip rm -f -r jdupes-*-mac*/ jdupes-*-mac*.zip make[1]: Leaving directory '/export/home/denis/projects/dilos/porting/jdupes-1.18.1' dh_clean dpkg-source -b . dpkg-source: warning: can't parse dependency tree:native dpkg-source: warning: can't parse dependency tree:native dpkg-source: info: using source format '3.0 (quilt)' dpkg-source: info: building jdupes using existing ./jdupes_1.18.1.orig.tar.gz dpkg-source: info: building jdupes in jdupes_1.18.1-1~bpo10+1+dilos1.debian.tar.xz dpkg-source: info: building jdupes in jdupes_1.18.1-1~bpo10+1+dilos1.dsc dpkg-genbuildinfo --build=source dpkg-genbuildinfo: warning: File::FcntlLock not available; using flock which is not NFS-safe dpkg-genchanges -sa --build=source >../jdupes_1.18.1-1~bpo10+1+dilos1_source.changes dpkg-genchanges: info: including full source code in upload dpkg-source --after-build . dpkg-source: warning: can't parse dependency tree:native dpkg-source: warning: can't parse dependency tree:native dpkg-buildpackage: info: full upload (original source is included) du3p03% |
The file *.changes (jdupes_1.18.1-1~bpo10+1+dilos1_source.changes) has all files that should be copied as the source package.
That's all.