Notebook

これは日々の作業を通して学んだことや毎日の生活で気づいたことをを記録しておく備忘録である。

HTML ファイル生成日時: 2024/12/21 11:44:57.596 (台灣標準時)

pkgsrc の package に対して patch を作成する方法

pkgsrc の package に対して patch を作成する方法を簡単にまとめておくで ござる。

ここでは、 pkgsrc_myownpkgs/py-astro-aleph というパッケージに対してパッ チを作成することを考えるでござる。まず、 make してみるでござる。


# cd /usr/pkgsrc/pkgsrc_myownpkgs/py-astro-aleph
# make
=> Bootstrap dependency digest>=20211023: found digest-20220214
=> Checksum BLAKE2s OK for astro_aleph-1.0.0.tar.gz
=> Checksum SHA512 OK for astro_aleph-1.0.0.tar.gz
===> Installing dependencies for py312-astro_aleph-1.0.0
==========================================================================
The following variables will affect the build process of this package,
py312-astro_aleph-1.0.0.  Their current value is shown below:

        * PKGSRC_BLAS_TYPES = netlib openblas openblas_pthread openblas_openmp
        * PYTHON_VERSION_DEFAULT = 312

Based on these variables, the following variables have been set:

        * BLAS_INCLUDES = -I/usr/pkg/include/netlib
        * BLAS_LIBS = -lblas
        * BLAS_PC = blas
        * BLAS_TYPE = netlib
        * CBLAS_LIBS = -lcblas -lblas
        * CBLAS_PC = cblas
        * LAPACKE_LIBS = -llapacke -llapack -lblas
        * LAPACKE_PC = lapacke
        * LAPACK_LIBS = -llapack -lblas
        * LAPACK_PC = lapack
        * PYPACKAGE = python312

You may want to abort the process now with CTRL-C and change the value
of variables in the first group before continuing.  Be sure to run
`/usr/bin/make clean' after the changes.
==========================================================================
=> Tool dependency py312-build>=0: found py312-build-1.0.3nb1
=> Tool dependency py312-installer>=0.7.0nb1: found py312-installer-0.7.0nb1
=> Tool dependency mktools-[0-9]*: found mktools-20220614
=> Tool dependency cwrappers>=20150314: found cwrappers-20220403
=> Full dependency py312-pandas>=1.1.3: found py312-pandas-2.1.4
=> Full dependency py312-astropy>=4.2: found py312-astropy-6.0.1
=> Full dependency py312-jplephem>=0: found py312-jplephem-2.21
=> Full dependency py312-rebound>=3.12.2: found py312-rebound-4.3.2
=> Full dependency py312-numpy>=1.20.3nb1: found py312-numpy-1.26.3
===> Checking for vulnerabilities in py312-astro_aleph-1.0.0
===> Overriding tools for py312-astro_aleph-1.0.0
===> Extracting for py312-astro_aleph-1.0.0
===> Patching for py312-astro_aleph-1.0.0
===> Creating toolchain wrappers for py312-astro_aleph-1.0.0
===> Configuring for py312-astro_aleph-1.0.0
===> Building for py312-astro_aleph-1.0.0
* Building wheel...
running bdist_wheel
running build
running build_py
creating build
creating build/lib.netbsd-10.0_RC3-amd64-cpython-312
creating build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph
copying aleph/AstEph.py -> build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph
copying aleph/DataBase.py -> build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph
copying aleph/Query.py -> build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph
copying aleph/__init__.py -> build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph
copying aleph/aleph_utils.py -> build/lib.netbsd-10.0_RC3-amd64-cpython-312/alep
copying aleph/pycutils.py -> build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph
copying aleph/cutils.h -> build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph
running build_ext
building 'cutils' extension
creating build/temp.netbsd-10.0_RC3-amd64-cpython-312
creating build/temp.netbsd-10.0_RC3-amd64-cpython-312/aleph
gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -O2 -I/usr/include -I/usr/pkg/ikg/include/python3.12 -c aleph/cutils.c -o build/temp.netbsd-10.0_RC3-amd64-cpyt
gcc -shared -Wl,-zrelro -L/usr/lib -Wl,-R/usr/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/g/include -I/usr/include -I/usr/pkg/include/python3.12 -I/usr/pkg/include -I/usr
installing to build/bdist.netbsd-10.0_RC3-amd64/wheel
running install
running install_lib
creating build/bdist.netbsd-10.0_RC3-amd64
creating build/bdist.netbsd-10.0_RC3-amd64/wheel
creating build/bdist.netbsd-10.0_RC3-amd64/wheel/aleph
copying build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph/AstEph.py -> build/bdi
copying build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph/DataBase.py -> build/b
copying build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph/Query.py -> build/bdis
copying build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph/__init__.py -> build/b
copying build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph/aleph_utils.py -> buil
copying build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph/pycutils.py -> build/b
copying build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph/cutils.h -> build/bdis
copying build/lib.netbsd-10.0_RC3-amd64-cpython-312/cutils.so -> build/bdist.net
running install_egg_info
running egg_info
writing astro_aleph.egg-info/PKG-INFO
writing dependency_links to astro_aleph.egg-info/dependency_links.txt
writing requirements to astro_aleph.egg-info/requires.txt
writing top-level names to astro_aleph.egg-info/top_level.txt
reading manifest file 'astro_aleph.egg-info/SOURCES.txt'
writing manifest file 'astro_aleph.egg-info/SOURCES.txt'
Copying astro_aleph.egg-info to build/bdist.netbsd-10.0_RC3-amd64/wheel/astro_al
running install_scripts
creating build/bdist.netbsd-10.0_RC3-amd64/wheel/astro_aleph-1.0.0.dist-info/WHE
creating '/usr/pkgsrc.2023Q4/pkgsrc_myownpkgs/py-astro-aleph/work/astro_aleph-1.
adding 'cutils.so'
adding 'aleph/AstEph.py'
adding 'aleph/DataBase.py'
adding 'aleph/Query.py'
adding 'aleph/__init__.py'
adding 'aleph/aleph_utils.py'
adding 'aleph/cutils.h'
adding 'aleph/pycutils.py'
adding 'astro_aleph-1.0.0.dist-info/METADATA'
adding 'astro_aleph-1.0.0.dist-info/WHEEL'
adding 'astro_aleph-1.0.0.dist-info/top_level.txt'
adding 'astro_aleph-1.0.0.dist-info/RECORD'
removing build/bdist.netbsd-10.0_RC3-amd64/wheel
Successfully built astro_aleph-1.0.0-cp312-cp312-netbsd_10_0_rc3_amd64.whl

work/astro_aleph-1.0.0/aleph/AstEph.py と work/astro_aleph-1.0.0/aleph/Query.py の二つのファイルに修正を加えたい とするでござる。 pkgvi コマンドを使って、ファイルを修正すればよいでご ざる。


# pkgvi work/astro_aleph-1.0.0/aleph/AstEph.py 
pkgvi: File was modified. For a diff, type:
pkgdiff "work/astro_aleph-1.0.0/aleph/AstEph.py"
# pkgvi work/astro_aleph-1.0.0/aleph/Query.py 
pkgvi: File was modified. For a diff, type:
pkgdiff "work/astro_aleph-1.0.0/aleph/Query.py"

ソースコードの修正が終わったら、次に mkpatches コマンドを実行して、パッ チファイルを作成するでござる。


# mkpatches

すると、 patches というディレクトリーができるでござる。


# ls -lF
total 12
-rw-r--r--   1 root  wheel   278 Apr 16 22:24 DESCR
-rw-r--r--   1 root  wheel   764 Apr 16 22:24 Makefile
-rw-r--r--   1 root  wheel   789 Apr 16 22:24 PLIST
-rw-r--r--   1 root  wheel   323 Apr 17 10:46 distinfo
drwxr-xr-x   2 root  wheel   512 Apr 17 10:50 patches/
drwxr-xr-x  15 root  wheel  1024 Apr 17 10:47 work/
# ls -lF patches/
total 4
-rw-r--r--  1 root  wheel  866 Apr 17 10:50 patch-aleph_AstEph.py
-rw-r--r--  1 root  wheel    0 Apr 17 10:50 patch-aleph_AstEph.py.orig
-rw-r--r--  1 root  wheel  439 Apr 17 10:50 patch-aleph_Query.py
-rw-r--r--  1 root  wheel    0 Apr 17 10:50 patch-aleph_Query.py.orig

更に、 make mps を実行して、パッチファイルについての情報を distinfo ファ イルの中に書き込むでござる。


# make mps

distinfo ファイルの内容が変更されているでござる。


# ls -ltF
total 12
-rw-r--r--   1 root  wheel   466 Apr 17 10:53 distinfo
drwxr-xr-x   2 root  wheel   512 Apr 17 10:50 patches/
drwxr-xr-x  15 root  wheel  1024 Apr 17 10:47 work/
-rw-r--r--   1 root  wheel   789 Apr 16 22:24 PLIST
-rw-r--r--   1 root  wheel   764 Apr 16 22:24 Makefile
-rw-r--r--   1 root  wheel   278 Apr 16 22:24 DESCR
# cat distinfo 
$NetBSD$

BLAKE2s (astro_aleph-1.0.0.tar.gz) = 9b699995c47d57ec37013e08a76aa4485983944debbb6b2772d1df37d733a099
SHA512 (astro_aleph-1.0.0.tar.gz) = 60b1f96801b43e938da26e91711ee2e229e7789d17563b29eb5252b57236d32b4c43bdc37da183f31b92df085737c2058224806647995bcc0af0c7fe93197d86
Size (astro_aleph-1.0.0.tar.gz) = 29354 bytes
SHA1 (patch-aleph_AstEph.py) = f0e21eadf5f80baa6d1c060bde949c50825ab204
SHA1 (patch-aleph_Query.py) = 54723aeea2c4aa2377afb8b5c8a01fbe3c5ccf54

この後、 make clean してから make install すれば、パッチが適用されたも のがインストールされるでござる。


# make clean
===> Cleaning for py312-astro_aleph-1.0.0
# make install
=> Bootstrap dependency digest>=20211023: found digest-20220214
=> Checksum BLAKE2s OK for astro_aleph-1.0.0.tar.gz
=> Checksum SHA512 OK for astro_aleph-1.0.0.tar.gz
===> Installing dependencies for py312-astro_aleph-1.0.0
==========================================================================
The following variables will affect the build process of this package,
py312-astro_aleph-1.0.0.  Their current value is shown below:

        * PKGSRC_BLAS_TYPES = netlib openblas openblas_pthread openblas_openmp
        * PYTHON_VERSION_DEFAULT = 312

Based on these variables, the following variables have been set:

        * BLAS_INCLUDES = -I/usr/pkg/include/netlib
        * BLAS_LIBS = -lblas
        * BLAS_PC = blas
        * BLAS_TYPE = netlib
        * CBLAS_LIBS = -lcblas -lblas
        * CBLAS_PC = cblas
        * LAPACKE_LIBS = -llapacke -llapack -lblas
        * LAPACKE_PC = lapacke
        * LAPACK_LIBS = -llapack -lblas
        * LAPACK_PC = lapack
        * PYPACKAGE = python312

You may want to abort the process now with CTRL-C and change the value
of variables in the first group before continuing.  Be sure to run
`/usr/bin/make clean' after the changes.
==========================================================================
=> Tool dependency py312-build>=0: found py312-build-1.0.3nb1
=> Tool dependency py312-installer>=0.7.0nb1: found py312-installer-0.7.0nb1
=> Tool dependency mktools-[0-9]*: found mktools-20220614
=> Tool dependency cwrappers>=20150314: found cwrappers-20220403
=> Full dependency py312-pandas>=1.1.3: found py312-pandas-2.1.4
=> Full dependency py312-astropy>=4.2: found py312-astropy-6.0.1
=> Full dependency py312-jplephem>=0: found py312-jplephem-2.21
=> Full dependency py312-rebound>=3.12.2: found py312-rebound-4.3.2
=> Full dependency py312-numpy>=1.20.3nb1: found py312-numpy-1.26.3
===> Checking for vulnerabilities in py312-astro_aleph-1.0.0
===> Overriding tools for py312-astro_aleph-1.0.0
===> Extracting for py312-astro_aleph-1.0.0
===> Patching for py312-astro_aleph-1.0.0
=> Applying pkgsrc patches for py312-astro_aleph-1.0.0
=> Ignoring patchfile /usr/pkgsrc.2023Q4/pkgsrc_myownpkgs/py-astro-aleph/patches/patch-aleph_AstEph.py.orig
=> Ignoring patchfile /usr/pkgsrc.2023Q4/pkgsrc_myownpkgs/py-astro-aleph/patches/patch-aleph_Query.py.orig
===> Creating toolchain wrappers for py312-astro_aleph-1.0.0
===> Configuring for py312-astro_aleph-1.0.0
===> Building for py312-astro_aleph-1.0.0
* Building wheel...
running bdist_wheel
running build
running build_py
creating build
creating build/lib.netbsd-10.0_RC3-amd64-cpython-312
creating build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph
copying aleph/AstEph.py -> build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph
copying aleph/DataBase.py -> build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph
copying aleph/Query.py -> build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph
copying aleph/__init__.py -> build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph
copying aleph/aleph_utils.py -> build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph
copying aleph/pycutils.py -> build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph
copying aleph/cutils.h -> build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph
running build_ext
building 'cutils' extension
creating build/temp.netbsd-10.0_RC3-amd64-cpython-312
creating build/temp.netbsd-10.0_RC3-amd64-cpython-312/aleph
gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -O2 -I/usr/include -I/usr/pkg/include -O2 -I/usr/include -I/usr/pkg/include -O2 -I/usr/include -I/usr/pkg/include -O2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/python3.12 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/python3.12 -fPIC -Ialeph -I/usr/pkg/include/python3.12 -c aleph/cutils.c -o build/temp.netbsd-10.0_RC3-amd64-cpython-312/aleph/cutils.o -O3 -Wno-unknown-pragmas -fPIC -shared
gcc -shared -Wl,-zrelro -L/usr/lib -Wl,-R/usr/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -Wl,-zrelro -L/usr/lib -Wl,-R/usr/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -Wl,-zrelro -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -O2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/python3.12 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/python3.12 build/temp.netbsd-10.0_RC3-amd64-cpython-312/aleph/cutils.o -L/usr/pkg/lib -o build/lib.netbsd-10.0_RC3-amd64-cpython-312/cutils.so
installing to build/bdist.netbsd-10.0_RC3-amd64/wheel
running install
running install_lib
creating build/bdist.netbsd-10.0_RC3-amd64
creating build/bdist.netbsd-10.0_RC3-amd64/wheel
creating build/bdist.netbsd-10.0_RC3-amd64/wheel/aleph
copying build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph/AstEph.py -> build/bdist.netbsd-10.0_RC3-amd64/wheel/aleph
copying build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph/DataBase.py -> build/bdist.netbsd-10.0_RC3-amd64/wheel/aleph
copying build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph/Query.py -> build/bdist.netbsd-10.0_RC3-amd64/wheel/aleph
copying build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph/__init__.py -> build/bdist.netbsd-10.0_RC3-amd64/wheel/aleph
copying build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph/aleph_utils.py -> build/bdist.netbsd-10.0_RC3-amd64/wheel/aleph
copying build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph/pycutils.py -> build/bdist.netbsd-10.0_RC3-amd64/wheel/aleph
copying build/lib.netbsd-10.0_RC3-amd64-cpython-312/aleph/cutils.h -> build/bdist.netbsd-10.0_RC3-amd64/wheel/aleph
copying build/lib.netbsd-10.0_RC3-amd64-cpython-312/cutils.so -> build/bdist.netbsd-10.0_RC3-amd64/wheel
running install_egg_info
running egg_info
writing astro_aleph.egg-info/PKG-INFO
writing dependency_links to astro_aleph.egg-info/dependency_links.txt
writing requirements to astro_aleph.egg-info/requires.txt
writing top-level names to astro_aleph.egg-info/top_level.txt
reading manifest file 'astro_aleph.egg-info/SOURCES.txt'
writing manifest file 'astro_aleph.egg-info/SOURCES.txt'
Copying astro_aleph.egg-info to build/bdist.netbsd-10.0_RC3-amd64/wheel/astro_aleph-1.0.0-py3.12.egg-info
running install_scripts
creating build/bdist.netbsd-10.0_RC3-amd64/wheel/astro_aleph-1.0.0.dist-info/WHEEL
creating '/usr/pkgsrc.2023Q4/pkgsrc_myownpkgs/py-astro-aleph/work/astro_aleph-1.0.0/dist/.tmp-ajxfgmi0/astro_aleph-1.0.0-cp312-cp312-netbsd_10_0_rc3_amd64.whl' and adding 'build/bdist.netbsd-10.0_RC3-amd64/wheel' to it
adding 'cutils.so'
adding 'aleph/AstEph.py'
adding 'aleph/DataBase.py'
adding 'aleph/Query.py'
adding 'aleph/__init__.py'
adding 'aleph/aleph_utils.py'
adding 'aleph/cutils.h'
adding 'aleph/pycutils.py'
adding 'astro_aleph-1.0.0.dist-info/METADATA'
adding 'astro_aleph-1.0.0.dist-info/WHEEL'
adding 'astro_aleph-1.0.0.dist-info/top_level.txt'
adding 'astro_aleph-1.0.0.dist-info/RECORD'
removing build/bdist.netbsd-10.0_RC3-amd64/wheel
Successfully built astro_aleph-1.0.0-cp312-cp312-netbsd_10_0_rc3_amd64.whl
===> Installing for py312-astro_aleph-1.0.0
=> Generating pre-install file lists
=> Automatic manual page handling
=> Generating post-install file lists
=> Checking file-check results for py312-astro_aleph-1.0.0
=> Creating binary package /usr/pkgsrc.2023Q4/pkgsrc_myownpkgs/py-astro-aleph/work/.packages/py312-astro_aleph-1.0.0.tgz
===> Building binary package for py312-astro_aleph-1.0.0
=> Creating binary package /tmp/packages/All/py312-astro_aleph-1.0.0.tgz
===> Installing binary package of py312-astro_aleph-1.0.0

参考文献



Frequently accessed files

  1. Computer___Python/20220518_0.html
  2. Computer___Network/20230726_00.html
  3. Misc___Taiwan/20240207_00.html
  4. Computer___Network/20230516_00.html
  5. Computer___FreeBSD/20220621_0.html
  6. Computer___Python/20220715_0.html
  7. Computer___Network/20230508_00.html
  8. Food___Taiwan/20220429_0.html
  9. Computer___Network/20240130_00.html
  10. Computer___NetBSD/20220817_3.html
  11. Computer___Python/20220410_0.html
  12. Computer___Network/20240416_00.html
  13. Computer___NetBSD/20230119_00.html
  14. Computer___Debian/20210223_1.html
  15. Computer___Python/20221013_0.html
  16. Computer___Python/20210124_0.html
  17. Computer___NetBSD/20220428_0.html
  18. Computer___NetBSD/20220818_1.html
  19. Computer___NetBSD/20240101_02.html
  20. Science___Math/20220420_0.html
  21. Computer___Python/20240101_00.html
  22. Computer___NetBSD/20220808_0.html
  23. Computer___TeX/20230503_00.html
  24. Science___Astronomy/20220503_0.html
  25. Computer___NetBSD/20230515_00.html
  26. Computer___Network/20220413_1.html
  27. Computer___NetBSD/20210127_0.html
  28. Computer___TeX/20231107_00.html
  29. Computer___Python/20220816_1.html
  30. Computer___Python/20230717_01.html


HTML file generated by Kinoshita Daisuke.