SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Downloaden Sie, um offline zu lesen
FreeBSD package management system
Vsevolod Stakhov
vsevolod@FreeBSD.org

ruBSD conference December 14, 2013
Ports and packages

Ports is the comprehensive system of source packages.
Mature
Clear and well defined
Simple (sometimes not)
Configurable

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

2 of 26
Ports before pkg
Packages
Makefile

Distfiles

Ports

Installed
Files

Patches

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

3 of 26
Disadvantages of the old architecture

Make cannot handle complex packages relationships
Complicated upgrade procedure (hard to keep up-to-date)
Hard to migrate between releases
Long build time

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

4 of 26
Planned ports and pkg interaction

Build Depends

Build

STAGE

Packages

Pkg

Instal

Run Depends

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

5 of 26
Ports and packages

Ports are used to build packages
Dependencies are resolved by pkg, not make
Stable branch of ports has an appropriate stable branch of
packages
Encourage users to install software from binary packages
But do not prevent them from building custom packages from
the ports

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

6 of 26
Repositories creation

Repo
Stable
ports

Build

Mirrors
Checksum
Checksum
Signature

Package
Checksum

Package
Checksum

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

7 of 26
Pkg architecture

User

Request

Remote
Repos

Solver
FS

Mirrors

Jobs
fetch

http://highsecure.ru/pkg

Package

Install

+ Manifest
Checksum
Files...

Vsevolod Stakhov vsevolod@FreeBSD.org

PkgDB

8 of 26
The current problems with pkg

Legacy ports support (with no staging, for example)
Plain dependencies style
Naive solver

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

9 of 26
The problems of the solver in pkg

Absence of conflicts resolving/handling
No alternatives support
Can perform merely a single task: install, upgrade or remove,
so install task cannot remove packages for example

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

10 of 26
Existing systems

There are many examples of solvers used in different package
management systems, for example:
Zypper/SUSE - uses libsolv as the base
Yum/RedHat - migrating to libsolv
Apt/Debian - uses internal solver
Pacman/Archlinux - uses naive internal solver

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

11 of 26
External solvers

To interact with an external solver we have chosen CUDF format
used in the Mancoosi research project http://mancoosi.org:
package: devel/libblah
version: 1
depends: x11/libfoo
package: security/blah
version: 2
depends: devel/libblah
conflicts: security/blah-devel

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

12 of 26
We need an internal solver!
Alternatives:
Write own logic of dependencies and conflicts resolution?

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

13 of 26
We need an internal solver!
Alternatives:
Write own logic of dependencies and conflicts resolution?
Use some existing solution?

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

13 of 26
We need an internal solver!
Alternatives:
Write own logic of dependencies and conflicts resolution?
Use some existing solution?
Use some known algorithm?

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

13 of 26
We need an internal solver!
Alternatives:
Write own logic of dependencies and conflicts resolution?
Use some existing solution?
Use some known algorithm?

Use SAT solver for packages management
SAT expression

(x1 ¬x2 x3 ) &(x3 ¬x1 )&(x2 )
Clause

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

13 of 26
Making a SAT problem

Assign a variable to each package: package A → a1 , package
B → b1
Interpret a request as a set of unary clauses:
Install/Upgrade package A → (a1 )
Delete package B → (¬b1 )

Convert dependencies and conflicts to disjuncted clauses

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

14 of 26
Converting dependencies and conflicts
If package A depends on package B (versions B1 and B2 ),
then we can either have package A not installed or any of B
installed:
(¬A B1 B2 )

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

15 of 26
Converting dependencies and conflicts
If package A depends on package B (versions B1 and B2 ),
then we can either have package A not installed or any of B
installed:
(¬A B1 B2 )
If we have a conflict between versions of B (B1 , B2 and B3 )
then we ensure that merely one version is installed:
(¬B1 ¬B2 )&(¬B1 ¬B3 )&(¬B2 ¬B3 )
Conflicts chain

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

15 of 26
The solving of SAT problem

Some rules to follow to speed up SAT problem solving.
Trivial propagation - solve unary clauses
Unit propagation - solve clauses with only a single unsolved
variable
Conflicts learning - if we assign some free variable and detect
a conflict during unit propagation, we can fallback and learn
that this variable must be negated
Package specific assumptions.

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

16 of 26
SAT problem propagation

Trivial propagation - direct install or delete rules
(¬A B)& (A) & (¬C ) &(¬A ¬D)
true

http://highsecure.ru/pkg

false

Vsevolod Stakhov vsevolod@FreeBSD.org

17 of 26
SAT problem propagation

Trivial propagation - direct install or delete rules
(¬A B)& (A) & (¬C ) &(¬A ¬D)
true

false

Unit propagation - simple depends and conflicts
Dependency

true

false

Conflict

(¬A B) & (A) & (¬C ) & (¬A ¬D)
B→true

http://highsecure.ru/pkg

D→false

Vsevolod Stakhov vsevolod@FreeBSD.org

17 of 26
Conflicts driven learning

To handle alternatives it is required to test all variables unassigned:
1. full depth-first enumeration of possible values
2. fallback if a conflict found
3. remember which assignment caused conflict
4. make negative assignment for the learned variable and go to
the first step

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

18 of 26
Package specific assumptions

Pure SAT solvers cannot deal with package management as they
do not consider several packages peculiarities:
try to keep installed packages (if no direct conflicts)
do not install packages if they are not needed
prefer high priority packages and repositories over low priority
ones
These options also improve SAT performance providing a good
initial assignment.

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

19 of 26
Packages universe
We convert all packages involved to a packages universe of the
following structure:
Conflict
Depend

Name
N1

Version

N2

N3

Nn

V1

V1

V1

V1

V2

V2

V2
Conflicts Chain

V3
http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

20 of 26
Package management task

A request is splitted to install/upgrade and delete requests
which could be passed simultaneously to the solver
A conflicts between packages are detected with a repository
creation
All depends, reverse and conflicts of the requested packages
are analyzed and the package universe is created
Each package is defined by its name and the digest of
significant fields (version, options and so on)

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

21 of 26
Solvers and Pkg

Pkg may pass the formed universe to an external CUDF
solver:
convert versions
format request
parse output

Alternatively the internal SAT solver may be used:
convert the universe to SAT problem
formulate request
???
PROFIT

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

22 of 26
Perspectives

Using pkg solver for ports management
Better support of multiple repositories
Test different solvers algorithms using CUDF
New dependencies and conflicts format
Provides and alternatives

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

23 of 26
New dependencies format
libblah >= 1.0 + option1 , +option2 libfoo! = 1.1
Can depend on normal packages and virtual packages
(provides)
Easy to define the concrete dependency versions
Alternative dependencies
P3
Or

P1

Depends

P2

>

Vx

Vy

Vz

!

Conflict

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

24 of 26
Alternatives
Used to organize packages with the same functionality (e.g.
web-browser)
May be used to implement virtual dependencies
(provides/requires)
Alternatives

Text Editor

http://highsecure.ru/pkg

Depends

Package

Vsevolod Stakhov vsevolod@FreeBSD.org

25 of 26
Thank you for your attention!
Questions?
vsevolod@FreeBSD.org

http://highsecure.ru/pkg

Vsevolod Stakhov vsevolod@FreeBSD.org

26 of 26

Weitere ähnliche Inhalte

Andere mochten auch

Log-Structured File System (LSFS) as a weapon to fight “I/O Blender” virtuali...
Log-Structured File System (LSFS) as a weapon to fight “I/O Blender” virtuali...Log-Structured File System (LSFS) as a weapon to fight “I/O Blender” virtuali...
Log-Structured File System (LSFS) as a weapon to fight “I/O Blender” virtuali...StarWind Software
 
Brief summary-standard-password-hashes-Aix-FreeBSD-Linux-Solaris-HP-UX-May-20...
Brief summary-standard-password-hashes-Aix-FreeBSD-Linux-Solaris-HP-UX-May-20...Brief summary-standard-password-hashes-Aix-FreeBSD-Linux-Solaris-HP-UX-May-20...
Brief summary-standard-password-hashes-Aix-FreeBSD-Linux-Solaris-HP-UX-May-20...Circling Cycle
 
Cryptography and secure systems
Cryptography and secure systemsCryptography and secure systems
Cryptography and secure systemsVsevolod Stakhov
 

Andere mochten auch (9)

rspamd-fosdem
rspamd-fosdemrspamd-fosdem
rspamd-fosdem
 
ast-rspamd
ast-rspamdast-rspamd
ast-rspamd
 
Rspamd symbols
Rspamd symbolsRspamd symbols
Rspamd symbols
 
Rspamd testing
Rspamd testingRspamd testing
Rspamd testing
 
rspamd-hyperscan
rspamd-hyperscanrspamd-hyperscan
rspamd-hyperscan
 
Log-Structured File System (LSFS) as a weapon to fight “I/O Blender” virtuali...
Log-Structured File System (LSFS) as a weapon to fight “I/O Blender” virtuali...Log-Structured File System (LSFS) as a weapon to fight “I/O Blender” virtuali...
Log-Structured File System (LSFS) as a weapon to fight “I/O Blender” virtuali...
 
Brief summary-standard-password-hashes-Aix-FreeBSD-Linux-Solaris-HP-UX-May-20...
Brief summary-standard-password-hashes-Aix-FreeBSD-Linux-Solaris-HP-UX-May-20...Brief summary-standard-password-hashes-Aix-FreeBSD-Linux-Solaris-HP-UX-May-20...
Brief summary-standard-password-hashes-Aix-FreeBSD-Linux-Solaris-HP-UX-May-20...
 
Cryptography and secure systems
Cryptography and secure systemsCryptography and secure systems
Cryptography and secure systems
 
rspamd-slides
rspamd-slidesrspamd-slides
rspamd-slides
 

Ähnlich wie New solver for FreeBSD pkg

Composer (PHP Usergroup Karlsruhe)
Composer (PHP Usergroup Karlsruhe)Composer (PHP Usergroup Karlsruhe)
Composer (PHP Usergroup Karlsruhe)Nils Adermann
 
You're Off the Hook: Blinding Security Software
You're Off the Hook: Blinding Security SoftwareYou're Off the Hook: Blinding Security Software
You're Off the Hook: Blinding Security SoftwareCylance
 
L2/L3 für Fortgeschrittene - Helle und dunkle Magie im Linux-Netzwerkstack
L2/L3 für Fortgeschrittene - Helle und dunkle Magie im Linux-NetzwerkstackL2/L3 für Fortgeschrittene - Helle und dunkle Magie im Linux-Netzwerkstack
L2/L3 für Fortgeschrittene - Helle und dunkle Magie im Linux-NetzwerkstackMaximilan Wilhelm
 
Lukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with Uciprov
Lukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with UciprovLukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with Uciprov
Lukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with UciprovZabbix
 
JavaEdge 2008: Your next version control system
JavaEdge 2008: Your next version control systemJavaEdge 2008: Your next version control system
JavaEdge 2008: Your next version control systemGilad Garon
 
Usage Note of Qt ODBC Database Access on Linux
Usage Note of Qt ODBC Database Access on LinuxUsage Note of Qt ODBC Database Access on Linux
Usage Note of Qt ODBC Database Access on LinuxWilliam Lee
 
Erp 2.50 openbravo environment installation openbravo-wiki
Erp 2.50 openbravo environment installation   openbravo-wikiErp 2.50 openbravo environment installation   openbravo-wiki
Erp 2.50 openbravo environment installation openbravo-wikiyaranusa
 
Security of Go Modules and Vulnerability Scanning in GoCenter and VS Code
Security of Go Modules and Vulnerability Scanning in GoCenter and VS CodeSecurity of Go Modules and Vulnerability Scanning in GoCenter and VS Code
Security of Go Modules and Vulnerability Scanning in GoCenter and VS CodeDeep Datta
 
Direction of building ns2 using cygwin under windows system
Direction of building ns2 using cygwin under windows systemDirection of building ns2 using cygwin under windows system
Direction of building ns2 using cygwin under windows systemyahyaoui hamdi
 
Sbt, idea and eclipse
Sbt, idea and eclipseSbt, idea and eclipse
Sbt, idea and eclipseMike Slinn
 
Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924yohanbeschi
 
From Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOSFrom Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOSSusan Potter
 
Core Java- An advanced review of features
Core Java- An advanced review of featuresCore Java- An advanced review of features
Core Java- An advanced review of featuresvidyamittal
 
Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)Robert Scholte
 
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
 Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2   Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2 Adil Khan
 

Ähnlich wie New solver for FreeBSD pkg (20)

Composer
ComposerComposer
Composer
 
tools.ppt
tools.ppttools.ppt
tools.ppt
 
Composer (PHP Usergroup Karlsruhe)
Composer (PHP Usergroup Karlsruhe)Composer (PHP Usergroup Karlsruhe)
Composer (PHP Usergroup Karlsruhe)
 
You're Off the Hook: Blinding Security Software
You're Off the Hook: Blinding Security SoftwareYou're Off the Hook: Blinding Security Software
You're Off the Hook: Blinding Security Software
 
Intro To OSGi
Intro To OSGiIntro To OSGi
Intro To OSGi
 
L2/L3 für Fortgeschrittene - Helle und dunkle Magie im Linux-Netzwerkstack
L2/L3 für Fortgeschrittene - Helle und dunkle Magie im Linux-NetzwerkstackL2/L3 für Fortgeschrittene - Helle und dunkle Magie im Linux-Netzwerkstack
L2/L3 für Fortgeschrittene - Helle und dunkle Magie im Linux-Netzwerkstack
 
Lukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with Uciprov
Lukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with UciprovLukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with Uciprov
Lukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with Uciprov
 
JavaEdge 2008: Your next version control system
JavaEdge 2008: Your next version control systemJavaEdge 2008: Your next version control system
JavaEdge 2008: Your next version control system
 
Usage Note of Qt ODBC Database Access on Linux
Usage Note of Qt ODBC Database Access on LinuxUsage Note of Qt ODBC Database Access on Linux
Usage Note of Qt ODBC Database Access on Linux
 
Erp 2.50 openbravo environment installation openbravo-wiki
Erp 2.50 openbravo environment installation   openbravo-wikiErp 2.50 openbravo environment installation   openbravo-wiki
Erp 2.50 openbravo environment installation openbravo-wiki
 
Security of Go Modules and Vulnerability Scanning in GoCenter and VS Code
Security of Go Modules and Vulnerability Scanning in GoCenter and VS CodeSecurity of Go Modules and Vulnerability Scanning in GoCenter and VS Code
Security of Go Modules and Vulnerability Scanning in GoCenter and VS Code
 
Go 1.8 Release Party
Go 1.8 Release PartyGo 1.8 Release Party
Go 1.8 Release Party
 
Direction of building ns2 using cygwin under windows system
Direction of building ns2 using cygwin under windows systemDirection of building ns2 using cygwin under windows system
Direction of building ns2 using cygwin under windows system
 
Native Hadoop with prebuilt spark
Native Hadoop with prebuilt sparkNative Hadoop with prebuilt spark
Native Hadoop with prebuilt spark
 
Sbt, idea and eclipse
Sbt, idea and eclipseSbt, idea and eclipse
Sbt, idea and eclipse
 
Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924
 
From Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOSFrom Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOS
 
Core Java- An advanced review of features
Core Java- An advanced review of featuresCore Java- An advanced review of features
Core Java- An advanced review of features
 
Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)Java9 and the impact on Maven Projects (JFall 2016)
Java9 and the impact on Maven Projects (JFall 2016)
 
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
 Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2   Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
 

Kürzlich hochgeladen

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 

Kürzlich hochgeladen (20)

Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 

New solver for FreeBSD pkg

  • 1. FreeBSD package management system Vsevolod Stakhov vsevolod@FreeBSD.org ruBSD conference December 14, 2013
  • 2. Ports and packages Ports is the comprehensive system of source packages. Mature Clear and well defined Simple (sometimes not) Configurable http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 2 of 26
  • 4. Disadvantages of the old architecture Make cannot handle complex packages relationships Complicated upgrade procedure (hard to keep up-to-date) Hard to migrate between releases Long build time http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 4 of 26
  • 5. Planned ports and pkg interaction Build Depends Build STAGE Packages Pkg Instal Run Depends http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 5 of 26
  • 6. Ports and packages Ports are used to build packages Dependencies are resolved by pkg, not make Stable branch of ports has an appropriate stable branch of packages Encourage users to install software from binary packages But do not prevent them from building custom packages from the ports http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 6 of 26
  • 9. The current problems with pkg Legacy ports support (with no staging, for example) Plain dependencies style Naive solver http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 9 of 26
  • 10. The problems of the solver in pkg Absence of conflicts resolving/handling No alternatives support Can perform merely a single task: install, upgrade or remove, so install task cannot remove packages for example http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 10 of 26
  • 11. Existing systems There are many examples of solvers used in different package management systems, for example: Zypper/SUSE - uses libsolv as the base Yum/RedHat - migrating to libsolv Apt/Debian - uses internal solver Pacman/Archlinux - uses naive internal solver http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 11 of 26
  • 12. External solvers To interact with an external solver we have chosen CUDF format used in the Mancoosi research project http://mancoosi.org: package: devel/libblah version: 1 depends: x11/libfoo package: security/blah version: 2 depends: devel/libblah conflicts: security/blah-devel http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 12 of 26
  • 13. We need an internal solver! Alternatives: Write own logic of dependencies and conflicts resolution? http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 13 of 26
  • 14. We need an internal solver! Alternatives: Write own logic of dependencies and conflicts resolution? Use some existing solution? http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 13 of 26
  • 15. We need an internal solver! Alternatives: Write own logic of dependencies and conflicts resolution? Use some existing solution? Use some known algorithm? http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 13 of 26
  • 16. We need an internal solver! Alternatives: Write own logic of dependencies and conflicts resolution? Use some existing solution? Use some known algorithm? Use SAT solver for packages management SAT expression (x1 ¬x2 x3 ) &(x3 ¬x1 )&(x2 ) Clause http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 13 of 26
  • 17. Making a SAT problem Assign a variable to each package: package A → a1 , package B → b1 Interpret a request as a set of unary clauses: Install/Upgrade package A → (a1 ) Delete package B → (¬b1 ) Convert dependencies and conflicts to disjuncted clauses http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 14 of 26
  • 18. Converting dependencies and conflicts If package A depends on package B (versions B1 and B2 ), then we can either have package A not installed or any of B installed: (¬A B1 B2 ) http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 15 of 26
  • 19. Converting dependencies and conflicts If package A depends on package B (versions B1 and B2 ), then we can either have package A not installed or any of B installed: (¬A B1 B2 ) If we have a conflict between versions of B (B1 , B2 and B3 ) then we ensure that merely one version is installed: (¬B1 ¬B2 )&(¬B1 ¬B3 )&(¬B2 ¬B3 ) Conflicts chain http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 15 of 26
  • 20. The solving of SAT problem Some rules to follow to speed up SAT problem solving. Trivial propagation - solve unary clauses Unit propagation - solve clauses with only a single unsolved variable Conflicts learning - if we assign some free variable and detect a conflict during unit propagation, we can fallback and learn that this variable must be negated Package specific assumptions. http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 16 of 26
  • 21. SAT problem propagation Trivial propagation - direct install or delete rules (¬A B)& (A) & (¬C ) &(¬A ¬D) true http://highsecure.ru/pkg false Vsevolod Stakhov vsevolod@FreeBSD.org 17 of 26
  • 22. SAT problem propagation Trivial propagation - direct install or delete rules (¬A B)& (A) & (¬C ) &(¬A ¬D) true false Unit propagation - simple depends and conflicts Dependency true false Conflict (¬A B) & (A) & (¬C ) & (¬A ¬D) B→true http://highsecure.ru/pkg D→false Vsevolod Stakhov vsevolod@FreeBSD.org 17 of 26
  • 23. Conflicts driven learning To handle alternatives it is required to test all variables unassigned: 1. full depth-first enumeration of possible values 2. fallback if a conflict found 3. remember which assignment caused conflict 4. make negative assignment for the learned variable and go to the first step http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 18 of 26
  • 24. Package specific assumptions Pure SAT solvers cannot deal with package management as they do not consider several packages peculiarities: try to keep installed packages (if no direct conflicts) do not install packages if they are not needed prefer high priority packages and repositories over low priority ones These options also improve SAT performance providing a good initial assignment. http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 19 of 26
  • 25. Packages universe We convert all packages involved to a packages universe of the following structure: Conflict Depend Name N1 Version N2 N3 Nn V1 V1 V1 V1 V2 V2 V2 Conflicts Chain V3 http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 20 of 26
  • 26. Package management task A request is splitted to install/upgrade and delete requests which could be passed simultaneously to the solver A conflicts between packages are detected with a repository creation All depends, reverse and conflicts of the requested packages are analyzed and the package universe is created Each package is defined by its name and the digest of significant fields (version, options and so on) http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 21 of 26
  • 27. Solvers and Pkg Pkg may pass the formed universe to an external CUDF solver: convert versions format request parse output Alternatively the internal SAT solver may be used: convert the universe to SAT problem formulate request ??? PROFIT http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 22 of 26
  • 28. Perspectives Using pkg solver for ports management Better support of multiple repositories Test different solvers algorithms using CUDF New dependencies and conflicts format Provides and alternatives http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 23 of 26
  • 29. New dependencies format libblah >= 1.0 + option1 , +option2 libfoo! = 1.1 Can depend on normal packages and virtual packages (provides) Easy to define the concrete dependency versions Alternative dependencies P3 Or P1 Depends P2 > Vx Vy Vz ! Conflict http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 24 of 26
  • 30. Alternatives Used to organize packages with the same functionality (e.g. web-browser) May be used to implement virtual dependencies (provides/requires) Alternatives Text Editor http://highsecure.ru/pkg Depends Package Vsevolod Stakhov vsevolod@FreeBSD.org 25 of 26
  • 31. Thank you for your attention! Questions? vsevolod@FreeBSD.org http://highsecure.ru/pkg Vsevolod Stakhov vsevolod@FreeBSD.org 26 of 26