SlideShare a Scribd company logo
1 of 51
Download to read offline
Arch Linux Packge
的前世今生
Chih-Hsuan Yen
(yan12125)
COSCUP x GNOME.Asia x openSUSE.Asia 2018
About Me
• A PhD student from National Taiwan University
• Embedded systems, deep learning, storage
• 打包狗
• AUR & ArchlinuxCN
• MacPorts
• python3-android
(台灣犬)
• Work as hard
as a dog
• As tired as a
dog
What are packages?
• The basic unit of a distribution
• Why packaging
• Learn software internals
• An expression of freedom
Fork Merge
“凝聚共識的過程” - 唐鳳, 2018
Philosophy
• UNIX philosophy – do simple tools well
• Arch Linux philosophy: KISS – Keep It Simple &
Stupid
• Simple architecture
• Simple file formats
始臣之解牛之時,所見無非全牛者
三年之后,未嘗見全牛也
方今之時,臣以神遇而不以目視,
官知止而神欲行
道
Daily routines for Arch Linux users
What’s behind the scenes?
• Listing repositories from /etc/pacman.conf
• Checking available server(s) from the mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
Server = http://ftp.tku.edu.tw/Linux/ArchLinux/$repo/os/$arch
core, extra, …
x86_64
Repositories
What packages do you have?
• Downloading package databases from mirrors
• Analyzing repo databases
• Each foo.db is a gzipped tarball
• Each folder in this tarball describes a package
/var/lib/pacman/sync
What packages do you have?
• Package description file
Installing packages
• Downloading package(s)
• Packages are xz-compressed tarballs
/var/cache/pacman/pkg
Package metadata files
• .PKGINFO: general package info
• Related to installation: package size, signature,
dependencies, conflicts
• .BUILDINFO: new in pacman 5.1, for reproducible
builds
• .MTREE: gzipped mtree file
• Hash checksums, size, permission, modification time for
each file in the package
• .INSTALL: the install script
Generation of packages and repos
PKGBUILD
PKGBUILD
PKGBUILD
alice.pkg.tar.gz
bob.pkg.tar.gz
eve.pkg.tar.gz
[crypto]
crypto.db
crypto.db.tar.gz
alice.pkg.tar.gz
bob.pkg.tar.gz
eve.pkg.tar.gz
makepkg repo-add
PKGBUILD
• A shell script
• Structure
• Basic information – pkgname, pkgver, source
• prepare()
• pkgver()
• build()
• check()
• package()
• Other files: patches, data files, install script
A sample PKGBUILD - which
pkgname=which
pkgver=2.21
pkgrel=2
pkgdesc='A utility to show the full path of commands'
arch=('x86_64')
url='https://savannah.gnu.org/projects/which/'
license=('GPL3')
groups=('base' 'base-devel')
depends=('glibc' 'bash')
source=("https://ftp.gnu.org/gnu/$pkgname/$pkgname-
$pkgver.tar.gz")
md5sums=('097ff1a324ae02e0a3b0369f07a7544a')
A sample PKGBUILD - which
build() {
cd $pkgname-$pkgver
./configure --prefix=/usr
make
}
package() {
cd $pkgname-$pkgver
make DESTDIR="$pkgdir" install
}
Once upon a time…
• There’s only one build() function, and `makepkg` is
run as root
• Package files should not be owned by the user running
`makepkg`
• Later fakeroot is introduced
• 2009/01: package() is added (v3.2.2-61-g08034ceb)
• Matching this pattern: make && sudo make install
• “Minimize fakeroot usage”
History of PKGBUILD
• 2010/12: check() is added (v3.4.2-203-g0c29eb43)
• 2012/08: prepare() is added (v4.0.3-326-g065b7f86)
• Getting VCS sources done
• Applying patches
• `autoreconf`
• 2012/08: pkgver() is added (v4.0.3-352-g888020de)
• For updating pkgver of VCS packages automatically
Arch Linux packaging practices
• Keep close to upstream
• Avoid bundled sources
• No development packages in general (不拆包)
libsqlite3-dev
libsqlite3-0
sqlite3
sqlite
(Debian) (Arch Linux)
Split packages (v3.2.2-67-g3d49d880)
• Some packages (e.g. Python 2/3 variants of a
Python package) share some packages information
and/or build steps
• Generating multiple packages from one PKGBUILD
python2-request-futures-
x.y-z-any.pkg.tar.xz
python-request-futures-
x.y-z-any.pkg.tar.xz
PKGBUILD
makepkg
Split packages
package_python-requests-futures() {
depends=('python-requests')
cd $_distname
python setup.py install --root="${pkgdir}" --optimize=1
}
package_python2-requests-futures() {
depends=('python2-requests' 'python2-futures')
cd "$_distname-py2"
python2 setup.py install --root="${pkgdir}" --optimize=1
}
Learning from PKGBUILDs
Arch Linux homepage -> Package search
Learning from PKGBUILDs
AUR homepage -> Package search
Sharing Packages
pkgname=which
pkgver=2.21
pkgrel=2
pkgdesc=‘…'
arch=('x86_64')
…
Distribute PKGBUILD
Distribute binary packages
Sharing PKGBUILDs
• Personal VCS repo
• Many on GitHub
• AUR (Arch User Repository)
https://aur.archlinux.org/
Uploading to AUR
• AUR3
• mkaurball / makepkg --source => foo.src.tar.gz
• Login to AUR and upload the tarball via the web
interface
• AUR4
• Each package is a git repo
• makepkg --printsrcinfo > .SRCINFO
• git push to aur@aur.archlinux.org:foo.git
After uploading to AUR…
• phantomjs
• webkitgtk
Good AUR comments
• darling-dmg-git
Use the same environment for
building
Install the “base-devel”
group in a chroot
Build in the chroot
1
2
Chroot-related commands
• pacstrap: install packages to the given
folder
• mkarchroot: create a chroot using
pacstrap
• makechrootpkg: run makepkg in a
chroot
• {extra,testing,staging}-x86_64-build:
run all steps above
** Need the “devtools” package **
makechrootpkg
makepkg
*-x86_64-build
Common issues in chroots
Missing
dependencies
Container issues
• Logs
• configure.ac,
CMakeLists.txt, setup.py
Keeping Packages Up-to-date
• Why keeping packages up-to-date?
• Arch Linux convention
"We will encourage you to develop the three great
virtues of a programmer: laziness, impatience, and
hubris." -- LarryWall, Programming Perl
Keeping Packages Up-to-date
Automatically
https://github.com/lilydjwg/nvchecker/
nvchecker
• Checking multiple softwares using a configuration
file, usually nvchecker.ini
• Independent of package managers
• Use oldver file and newver file to record versions
• Multiple backends
• AUR, PyPI, NPM, GitHub, regular expressions
• Parallel checking
• Need to run nvtake to update old_ver.txt for each
software
An example nvchecker.ini
[__config__]
oldver = old_ver.txt
newver = new_ver.txt
[McBopomofo]
github = openvanilla/McBopomofo
use_latest_release = true
[py-jsbeautifier]
pypi = jsbeautifier
[FileZilla]
url = https://filezilla-project.org/versions.php?type=client
regex = <a name="([d.]+)">
Running nvchecker
• nvchecker nvchecker.ini
Integration with Package
Managers
• Why not just update PKGBUILD?
https://gitlab.com/yan12125/nvchecker-toolbelt/
Unofficial Repositories
alice.pkg.tar.gz
bob.pkg.tar.gz
eve.pkg.tar.gz
[crypto]
crypto.db
crypto.db.tar.gz
alice.pkg.tar.gz
bob.pkg.tar.gz
eve.pkg.tar.gz
repo-add
Creating Unofficial Repositories
• repo-add myrepo.db.tar.gz foo.pkg.tar.xz
• repo-remove myrepo.db.tar.gz foo
• repo-elephant
Using Unofficial Repositories
[archlinuxfr]
Server = http://repo.archlinux.fr/$arch
SigLevel = PackageOptional
More unofficial repositories:
https://wiki.archlinux.org/index.php
/unofficial_user_repositories
(Append to /etc/pacman.conf)
Repo
name
Package
signing
How to trust binaries packages?
• A little cryptography (RSA)
• Use makepkg --sign to sign packages
Primes
𝑁 = 𝑝 × 𝑞
Easy
Mission impossible
• Use p and q to sign
• Use N to verify
Packaging rebuilds
• Rebuild a package without actually changing
PKGBUILD
• Only pkgrel is bumped
• Common scenarios
• Changed SONAME (name of a shared library)
• Changed runtime library paths (e.g., Python, Perl)
icuuc.so.61 icuuc.so.62
/usr/lib/python3.6 /usr/lib/python3.7
Staging repositories
• For storing rebuilt packages temporarily
• Rebuild all packages to staging/community-
staging/multilib-staging and move them all at once
/usr/lib/python3.6/site-packages/foo
/usr/lib/python3.7/site-packages/bar
/usr/bin/python3.7
Automatic packaging
• Manual packaging
• Check software versions
• Updating PKGBUILD
• extra-x86_64-build
• repo-add
• Automatic packaging
nvchecker lilac archrepo2
(checking new versions) (package building) (repo management)
Arch Linux China community
• Maintains one of the largest unofficial repository
[archlinuxcn]
• Develops several tools/scripts to make packaging
managing easier
https://github.com/archlinuxcn/
Automatic Packaging with
nvchecker & lilac
from lilac import *
build_prefix = 'extra-x86_64'
pre_build = aur_pre_build
post_build = aur_post_build
if __name__ == '__main__':
single_main()
[aurman]
aur =
Case I: pull
packages
from AUR
nvchecker.ini
aurman/lilac.py
aurman-x.y-z-
any.pkg.tar.xz
Automatic Packaging with
nvchecker & lilac
from lilaclib import *
build_prefix = 'extra-x86_64'
def pre_build():
pypi_pre_build(depends=[‘python-parsing'])
def post_build():
pypi_post_build()
update_aur_repo()
[python-svgwrite]
pypi = svgwrite
Case II: pull packages
from upstream &
push to AUR
nvchecker.ini
python-svgwrite/lilac.py
python-svgwrite-
x.y-z-any.pkg.tar.xz
Missing features
• Check version from multiple sources
• Dependency inference
• Support for *-testing and *-staging repositories
• Building packages for multiple repositories
• Handling multiple repositories
• Package movement – staging → testing → stable
• Cyclic dependency (?)
Building for *-{testing,staging}
• Layout
expansion
aurman
└── PKGBUILD
aurman
├── yan12125
│ └── PKGBUILD
└── yan12125-staging
└── PKGBUILD
extra-x86_64-build
staging-x86_64-build
Dependency inference
• Currently lilac requires additional declarations for
non-official dependencies
depends = ['lxqt-build-tools-git']
(qtermwidget-git/lilac.py)
makedepends=(git cmake lxqt-build-tools-git
qt5-tools python-pyqt5 python-sip sip)
pyalpm
(qtermwidget-git/PKGBUILD)
How can I help?
• Report bugs
• Become a tester
• Applying as a Trusted User (TU)
• Submit packages to archlinuxcn/repo
• Join Arch Linux Taiwan and materialize dreams!
Arch Linux Package 的前世今生

More Related Content

What's hot

re:Invent 2019 BPF Performance Analysis at Netflix
re:Invent 2019 BPF Performance Analysis at Netflixre:Invent 2019 BPF Performance Analysis at Netflix
re:Invent 2019 BPF Performance Analysis at NetflixBrendan Gregg
 
The Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOsThe Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOsDivye Kapoor
 
Lisa12 methodologies
Lisa12 methodologiesLisa12 methodologies
Lisa12 methodologiesBrendan Gregg
 
CNIT 152: 9 Network Evidence
CNIT 152: 9 Network Evidence CNIT 152: 9 Network Evidence
CNIT 152: 9 Network Evidence Sam Bowne
 
Analyzing Blockchain Transactions in Apache Spark with Jiri Kremser
Analyzing Blockchain Transactions in Apache Spark with Jiri KremserAnalyzing Blockchain Transactions in Apache Spark with Jiri Kremser
Analyzing Blockchain Transactions in Apache Spark with Jiri KremserDatabricks
 
Using apache spark for processing trillions of records each day at Datadog
Using apache spark for processing trillions of records each day at DatadogUsing apache spark for processing trillions of records each day at Datadog
Using apache spark for processing trillions of records each day at DatadogVadim Semenov
 
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)Thomas Graf
 
Using eBPF to Measure the k8s Cluster Health
Using eBPF to Measure the k8s Cluster HealthUsing eBPF to Measure the k8s Cluster Health
Using eBPF to Measure the k8s Cluster HealthScyllaDB
 
Linux Desktop Operation - Session 1
Linux Desktop Operation - Session 1Linux Desktop Operation - Session 1
Linux Desktop Operation - Session 1Arash Foroughi
 
Pcapngを読んでみる
Pcapngを読んでみるPcapngを読んでみる
Pcapngを読んでみるYagi Shinnosuke
 
KCD Munich 2023 - Demystifying Container Images Understanding Multi-Architect...
KCD Munich 2023 - Demystifying Container Images Understanding Multi-Architect...KCD Munich 2023 - Demystifying Container Images Understanding Multi-Architect...
KCD Munich 2023 - Demystifying Container Images Understanding Multi-Architect...Robert Bohne
 
Jdk9で変更になる(かも知れない)jvmオプションの標準設定
Jdk9で変更になる(かも知れない)jvmオプションの標準設定Jdk9で変更になる(かも知れない)jvmオプションの標準設定
Jdk9で変更になる(かも知れない)jvmオプションの標準設定Kazuyuki Nakamura
 
ストレージネットワーク基礎講座
ストレージネットワーク基礎講座ストレージネットワーク基礎講座
ストレージネットワーク基礎講座Brocade
 

What's hot (20)

re:Invent 2019 BPF Performance Analysis at Netflix
re:Invent 2019 BPF Performance Analysis at Netflixre:Invent 2019 BPF Performance Analysis at Netflix
re:Invent 2019 BPF Performance Analysis at Netflix
 
sed(1)
sed(1)sed(1)
sed(1)
 
Buku Hijau II : Panduan ClearOS 6
Buku Hijau II : Panduan ClearOS 6Buku Hijau II : Panduan ClearOS 6
Buku Hijau II : Panduan ClearOS 6
 
The Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOsThe Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOs
 
Lisa12 methodologies
Lisa12 methodologiesLisa12 methodologies
Lisa12 methodologies
 
CNIT 152: 9 Network Evidence
CNIT 152: 9 Network Evidence CNIT 152: 9 Network Evidence
CNIT 152: 9 Network Evidence
 
Nmap commands
Nmap commandsNmap commands
Nmap commands
 
Analyzing Blockchain Transactions in Apache Spark with Jiri Kremser
Analyzing Blockchain Transactions in Apache Spark with Jiri KremserAnalyzing Blockchain Transactions in Apache Spark with Jiri Kremser
Analyzing Blockchain Transactions in Apache Spark with Jiri Kremser
 
Using apache spark for processing trillions of records each day at Datadog
Using apache spark for processing trillions of records each day at DatadogUsing apache spark for processing trillions of records each day at Datadog
Using apache spark for processing trillions of records each day at Datadog
 
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
 
Wireshark
WiresharkWireshark
Wireshark
 
Using eBPF to Measure the k8s Cluster Health
Using eBPF to Measure the k8s Cluster HealthUsing eBPF to Measure the k8s Cluster Health
Using eBPF to Measure the k8s Cluster Health
 
Linux Desktop Operation - Session 1
Linux Desktop Operation - Session 1Linux Desktop Operation - Session 1
Linux Desktop Operation - Session 1
 
Wireshark - presentation
Wireshark - presentationWireshark - presentation
Wireshark - presentation
 
Pcapngを読んでみる
Pcapngを読んでみるPcapngを読んでみる
Pcapngを読んでみる
 
Cisco umbrella
Cisco umbrellaCisco umbrella
Cisco umbrella
 
KCD Munich 2023 - Demystifying Container Images Understanding Multi-Architect...
KCD Munich 2023 - Demystifying Container Images Understanding Multi-Architect...KCD Munich 2023 - Demystifying Container Images Understanding Multi-Architect...
KCD Munich 2023 - Demystifying Container Images Understanding Multi-Architect...
 
Jdk9で変更になる(かも知れない)jvmオプションの標準設定
Jdk9で変更になる(かも知れない)jvmオプションの標準設定Jdk9で変更になる(かも知れない)jvmオプションの標準設定
Jdk9で変更になる(かも知れない)jvmオプションの標準設定
 
Akıllı Sözleşmeler
Akıllı SözleşmelerAkıllı Sözleşmeler
Akıllı Sözleşmeler
 
ストレージネットワーク基礎講座
ストレージネットワーク基礎講座ストレージネットワーク基礎講座
ストレージネットワーク基礎講座
 

Similar to Arch Linux Package 的前世今生

Lec 10-linux-review
Lec 10-linux-reviewLec 10-linux-review
Lec 10-linux-reviewabinaya m
 
Package Management via Spack on SJTU π Supercomputer
Package Management via Spack on SJTU π SupercomputerPackage Management via Spack on SJTU π Supercomputer
Package Management via Spack on SJTU π SupercomputerJianwen Wei
 
Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Lions, Tigers and Deers: What building zoos can teach us about securing micro...Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Lions, Tigers and Deers: What building zoos can teach us about securing micro...Sysdig
 
Navigating container technology for enhanced security by Niklas Saari
Navigating container technology for enhanced security by Niklas SaariNavigating container technology for enhanced security by Niklas Saari
Navigating container technology for enhanced security by Niklas SaariMetosin Oy
 
Docker: Behind the API
Docker: Behind the APIDocker: Behind the API
Docker: Behind the APIKarl Matthias
 
Leonid Vasilyev "Building, deploying and running production code at Dropbox"
Leonid Vasilyev  "Building, deploying and running production code at Dropbox"Leonid Vasilyev  "Building, deploying and running production code at Dropbox"
Leonid Vasilyev "Building, deploying and running production code at Dropbox"IT Event
 
SPACK: A Package Manager for Supercomputers, Linux, and MacOS
SPACK: A Package Manager for Supercomputers, Linux, and MacOSSPACK: A Package Manager for Supercomputers, Linux, and MacOS
SPACK: A Package Manager for Supercomputers, Linux, and MacOSinside-BigData.com
 
WTF my container just spawned a shell!
WTF my container just spawned a shell!WTF my container just spawned a shell!
WTF my container just spawned a shell!Sysdig
 
Linux containers and docker
Linux containers and dockerLinux containers and docker
Linux containers and dockerFabio Fumarola
 
Linux container internals
Linux container internalsLinux container internals
Linux container internalsAshwin Bilgi
 
Java in containers
Java in containersJava in containers
Java in containersMartin Baez
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
 
Build your own embedded linux distributions by yocto project
Build your own embedded linux distributions by yocto projectBuild your own embedded linux distributions by yocto project
Build your own embedded linux distributions by yocto projectYen-Chin Lee
 
Postgre sql linuxcontainers by Jignesh Shah
Postgre sql linuxcontainers by Jignesh ShahPostgre sql linuxcontainers by Jignesh Shah
Postgre sql linuxcontainers by Jignesh ShahPivotalOpenSourceHub
 
PostgreSQL and Linux Containers
PostgreSQL and Linux ContainersPostgreSQL and Linux Containers
PostgreSQL and Linux ContainersJignesh Shah
 
Spack - A Package Manager for HPC
Spack - A Package Manager for HPCSpack - A Package Manager for HPC
Spack - A Package Manager for HPCinside-BigData.com
 
Gnubs-pres-foss-cdac-sem
Gnubs-pres-foss-cdac-semGnubs-pres-foss-cdac-sem
Gnubs-pres-foss-cdac-semSagun Baijal
 
Gnubs pres-foss-cdac-sem
Gnubs pres-foss-cdac-semGnubs pres-foss-cdac-sem
Gnubs pres-foss-cdac-semSagun Baijal
 

Similar to Arch Linux Package 的前世今生 (20)

LXC
LXCLXC
LXC
 
Lec 10-linux-review
Lec 10-linux-reviewLec 10-linux-review
Lec 10-linux-review
 
Package Management via Spack on SJTU π Supercomputer
Package Management via Spack on SJTU π SupercomputerPackage Management via Spack on SJTU π Supercomputer
Package Management via Spack on SJTU π Supercomputer
 
Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Lions, Tigers and Deers: What building zoos can teach us about securing micro...Lions, Tigers and Deers: What building zoos can teach us about securing micro...
Lions, Tigers and Deers: What building zoos can teach us about securing micro...
 
Navigating container technology for enhanced security by Niklas Saari
Navigating container technology for enhanced security by Niklas SaariNavigating container technology for enhanced security by Niklas Saari
Navigating container technology for enhanced security by Niklas Saari
 
Docker: Behind the API
Docker: Behind the APIDocker: Behind the API
Docker: Behind the API
 
Leonid Vasilyev "Building, deploying and running production code at Dropbox"
Leonid Vasilyev  "Building, deploying and running production code at Dropbox"Leonid Vasilyev  "Building, deploying and running production code at Dropbox"
Leonid Vasilyev "Building, deploying and running production code at Dropbox"
 
SPACK: A Package Manager for Supercomputers, Linux, and MacOS
SPACK: A Package Manager for Supercomputers, Linux, and MacOSSPACK: A Package Manager for Supercomputers, Linux, and MacOS
SPACK: A Package Manager for Supercomputers, Linux, and MacOS
 
WTF my container just spawned a shell!
WTF my container just spawned a shell!WTF my container just spawned a shell!
WTF my container just spawned a shell!
 
Linux containers and docker
Linux containers and dockerLinux containers and docker
Linux containers and docker
 
Linux container internals
Linux container internalsLinux container internals
Linux container internals
 
Java in containers
Java in containersJava in containers
Java in containers
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Build your own embedded linux distributions by yocto project
Build your own embedded linux distributions by yocto projectBuild your own embedded linux distributions by yocto project
Build your own embedded linux distributions by yocto project
 
Postgre sql linuxcontainers by Jignesh Shah
Postgre sql linuxcontainers by Jignesh ShahPostgre sql linuxcontainers by Jignesh Shah
Postgre sql linuxcontainers by Jignesh Shah
 
PostgreSQL and Linux Containers
PostgreSQL and Linux ContainersPostgreSQL and Linux Containers
PostgreSQL and Linux Containers
 
Ansible docker
Ansible dockerAnsible docker
Ansible docker
 
Spack - A Package Manager for HPC
Spack - A Package Manager for HPCSpack - A Package Manager for HPC
Spack - A Package Manager for HPC
 
Gnubs-pres-foss-cdac-sem
Gnubs-pres-foss-cdac-semGnubs-pres-foss-cdac-sem
Gnubs-pres-foss-cdac-sem
 
Gnubs pres-foss-cdac-sem
Gnubs pres-foss-cdac-semGnubs pres-foss-cdac-sem
Gnubs pres-foss-cdac-sem
 

Recently uploaded

Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Intelisync
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 

Recently uploaded (20)

Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 

Arch Linux Package 的前世今生

  • 1. Arch Linux Packge 的前世今生 Chih-Hsuan Yen (yan12125) COSCUP x GNOME.Asia x openSUSE.Asia 2018
  • 2. About Me • A PhD student from National Taiwan University • Embedded systems, deep learning, storage • 打包狗 • AUR & ArchlinuxCN • MacPorts • python3-android (台灣犬) • Work as hard as a dog • As tired as a dog
  • 3. What are packages? • The basic unit of a distribution • Why packaging • Learn software internals • An expression of freedom Fork Merge “凝聚共識的過程” - 唐鳳, 2018
  • 4. Philosophy • UNIX philosophy – do simple tools well • Arch Linux philosophy: KISS – Keep It Simple & Stupid • Simple architecture • Simple file formats 始臣之解牛之時,所見無非全牛者 三年之后,未嘗見全牛也 方今之時,臣以神遇而不以目視, 官知止而神欲行 道
  • 5. Daily routines for Arch Linux users
  • 6. What’s behind the scenes? • Listing repositories from /etc/pacman.conf • Checking available server(s) from the mirrorlist [core] Include = /etc/pacman.d/mirrorlist [extra] Include = /etc/pacman.d/mirrorlist Server = http://ftp.tku.edu.tw/Linux/ArchLinux/$repo/os/$arch core, extra, … x86_64 Repositories
  • 7. What packages do you have? • Downloading package databases from mirrors • Analyzing repo databases • Each foo.db is a gzipped tarball • Each folder in this tarball describes a package /var/lib/pacman/sync
  • 8. What packages do you have? • Package description file
  • 9. Installing packages • Downloading package(s) • Packages are xz-compressed tarballs /var/cache/pacman/pkg
  • 10. Package metadata files • .PKGINFO: general package info • Related to installation: package size, signature, dependencies, conflicts • .BUILDINFO: new in pacman 5.1, for reproducible builds • .MTREE: gzipped mtree file • Hash checksums, size, permission, modification time for each file in the package • .INSTALL: the install script
  • 11. Generation of packages and repos PKGBUILD PKGBUILD PKGBUILD alice.pkg.tar.gz bob.pkg.tar.gz eve.pkg.tar.gz [crypto] crypto.db crypto.db.tar.gz alice.pkg.tar.gz bob.pkg.tar.gz eve.pkg.tar.gz makepkg repo-add
  • 12. PKGBUILD • A shell script • Structure • Basic information – pkgname, pkgver, source • prepare() • pkgver() • build() • check() • package() • Other files: patches, data files, install script
  • 13. A sample PKGBUILD - which pkgname=which pkgver=2.21 pkgrel=2 pkgdesc='A utility to show the full path of commands' arch=('x86_64') url='https://savannah.gnu.org/projects/which/' license=('GPL3') groups=('base' 'base-devel') depends=('glibc' 'bash') source=("https://ftp.gnu.org/gnu/$pkgname/$pkgname- $pkgver.tar.gz") md5sums=('097ff1a324ae02e0a3b0369f07a7544a')
  • 14. A sample PKGBUILD - which build() { cd $pkgname-$pkgver ./configure --prefix=/usr make } package() { cd $pkgname-$pkgver make DESTDIR="$pkgdir" install }
  • 15. Once upon a time… • There’s only one build() function, and `makepkg` is run as root • Package files should not be owned by the user running `makepkg` • Later fakeroot is introduced • 2009/01: package() is added (v3.2.2-61-g08034ceb) • Matching this pattern: make && sudo make install • “Minimize fakeroot usage”
  • 16. History of PKGBUILD • 2010/12: check() is added (v3.4.2-203-g0c29eb43) • 2012/08: prepare() is added (v4.0.3-326-g065b7f86) • Getting VCS sources done • Applying patches • `autoreconf` • 2012/08: pkgver() is added (v4.0.3-352-g888020de) • For updating pkgver of VCS packages automatically
  • 17. Arch Linux packaging practices • Keep close to upstream • Avoid bundled sources • No development packages in general (不拆包) libsqlite3-dev libsqlite3-0 sqlite3 sqlite (Debian) (Arch Linux)
  • 18. Split packages (v3.2.2-67-g3d49d880) • Some packages (e.g. Python 2/3 variants of a Python package) share some packages information and/or build steps • Generating multiple packages from one PKGBUILD python2-request-futures- x.y-z-any.pkg.tar.xz python-request-futures- x.y-z-any.pkg.tar.xz PKGBUILD makepkg
  • 19. Split packages package_python-requests-futures() { depends=('python-requests') cd $_distname python setup.py install --root="${pkgdir}" --optimize=1 } package_python2-requests-futures() { depends=('python2-requests' 'python2-futures') cd "$_distname-py2" python2 setup.py install --root="${pkgdir}" --optimize=1 }
  • 20. Learning from PKGBUILDs Arch Linux homepage -> Package search
  • 21. Learning from PKGBUILDs AUR homepage -> Package search
  • 23. Sharing PKGBUILDs • Personal VCS repo • Many on GitHub • AUR (Arch User Repository) https://aur.archlinux.org/
  • 24. Uploading to AUR • AUR3 • mkaurball / makepkg --source => foo.src.tar.gz • Login to AUR and upload the tarball via the web interface • AUR4 • Each package is a git repo • makepkg --printsrcinfo > .SRCINFO • git push to aur@aur.archlinux.org:foo.git
  • 25. After uploading to AUR… • phantomjs • webkitgtk
  • 26. Good AUR comments • darling-dmg-git
  • 27. Use the same environment for building Install the “base-devel” group in a chroot Build in the chroot 1 2
  • 28.
  • 29. Chroot-related commands • pacstrap: install packages to the given folder • mkarchroot: create a chroot using pacstrap • makechrootpkg: run makepkg in a chroot • {extra,testing,staging}-x86_64-build: run all steps above ** Need the “devtools” package ** makechrootpkg makepkg *-x86_64-build
  • 30. Common issues in chroots Missing dependencies Container issues • Logs • configure.ac, CMakeLists.txt, setup.py
  • 31. Keeping Packages Up-to-date • Why keeping packages up-to-date? • Arch Linux convention "We will encourage you to develop the three great virtues of a programmer: laziness, impatience, and hubris." -- LarryWall, Programming Perl
  • 33. nvchecker • Checking multiple softwares using a configuration file, usually nvchecker.ini • Independent of package managers • Use oldver file and newver file to record versions • Multiple backends • AUR, PyPI, NPM, GitHub, regular expressions • Parallel checking • Need to run nvtake to update old_ver.txt for each software
  • 34. An example nvchecker.ini [__config__] oldver = old_ver.txt newver = new_ver.txt [McBopomofo] github = openvanilla/McBopomofo use_latest_release = true [py-jsbeautifier] pypi = jsbeautifier [FileZilla] url = https://filezilla-project.org/versions.php?type=client regex = <a name="([d.]+)">
  • 36. Integration with Package Managers • Why not just update PKGBUILD? https://gitlab.com/yan12125/nvchecker-toolbelt/
  • 38. Creating Unofficial Repositories • repo-add myrepo.db.tar.gz foo.pkg.tar.xz • repo-remove myrepo.db.tar.gz foo • repo-elephant
  • 39. Using Unofficial Repositories [archlinuxfr] Server = http://repo.archlinux.fr/$arch SigLevel = PackageOptional More unofficial repositories: https://wiki.archlinux.org/index.php /unofficial_user_repositories (Append to /etc/pacman.conf) Repo name Package signing
  • 40. How to trust binaries packages? • A little cryptography (RSA) • Use makepkg --sign to sign packages Primes 𝑁 = 𝑝 × 𝑞 Easy Mission impossible • Use p and q to sign • Use N to verify
  • 41. Packaging rebuilds • Rebuild a package without actually changing PKGBUILD • Only pkgrel is bumped • Common scenarios • Changed SONAME (name of a shared library) • Changed runtime library paths (e.g., Python, Perl) icuuc.so.61 icuuc.so.62 /usr/lib/python3.6 /usr/lib/python3.7
  • 42. Staging repositories • For storing rebuilt packages temporarily • Rebuild all packages to staging/community- staging/multilib-staging and move them all at once /usr/lib/python3.6/site-packages/foo /usr/lib/python3.7/site-packages/bar /usr/bin/python3.7
  • 43. Automatic packaging • Manual packaging • Check software versions • Updating PKGBUILD • extra-x86_64-build • repo-add • Automatic packaging nvchecker lilac archrepo2 (checking new versions) (package building) (repo management)
  • 44. Arch Linux China community • Maintains one of the largest unofficial repository [archlinuxcn] • Develops several tools/scripts to make packaging managing easier https://github.com/archlinuxcn/
  • 45. Automatic Packaging with nvchecker & lilac from lilac import * build_prefix = 'extra-x86_64' pre_build = aur_pre_build post_build = aur_post_build if __name__ == '__main__': single_main() [aurman] aur = Case I: pull packages from AUR nvchecker.ini aurman/lilac.py aurman-x.y-z- any.pkg.tar.xz
  • 46. Automatic Packaging with nvchecker & lilac from lilaclib import * build_prefix = 'extra-x86_64' def pre_build(): pypi_pre_build(depends=[‘python-parsing']) def post_build(): pypi_post_build() update_aur_repo() [python-svgwrite] pypi = svgwrite Case II: pull packages from upstream & push to AUR nvchecker.ini python-svgwrite/lilac.py python-svgwrite- x.y-z-any.pkg.tar.xz
  • 47. Missing features • Check version from multiple sources • Dependency inference • Support for *-testing and *-staging repositories • Building packages for multiple repositories • Handling multiple repositories • Package movement – staging → testing → stable • Cyclic dependency (?)
  • 48. Building for *-{testing,staging} • Layout expansion aurman └── PKGBUILD aurman ├── yan12125 │ └── PKGBUILD └── yan12125-staging └── PKGBUILD extra-x86_64-build staging-x86_64-build
  • 49. Dependency inference • Currently lilac requires additional declarations for non-official dependencies depends = ['lxqt-build-tools-git'] (qtermwidget-git/lilac.py) makedepends=(git cmake lxqt-build-tools-git qt5-tools python-pyqt5 python-sip sip) pyalpm (qtermwidget-git/PKGBUILD)
  • 50. How can I help? • Report bugs • Become a tester • Applying as a Trusted User (TU) • Submit packages to archlinuxcn/repo • Join Arch Linux Taiwan and materialize dreams!