# How do you deal with conflicts?  (Version, Poudriere)



## poorandunlucky (Nov 27, 2017)

I'm trying to install a bunch of (userland) stuff using Poudriere, and I'm coming across version conflicts...

For instance, I'm trying to install a media server that requires MySQL 5.6, but I want to run MySQL 5.7 for my own purposes.

When I use pkg install mediaserver, it says there's a conflict, and that it's going to remove MySQL 5.7 to install MySQL 5.6... but I don't want that...

The same deal with PHP...  I want PHP 7, but some things use PHP 5...

How do I deal with this?


----------



## rigoletto@ (Nov 27, 2017)

Making it short: WIKI.


----------



## poorandunlucky (Nov 27, 2017)

lebarondemerde said:


> Making it short: WIKI.



Am I going to have to rebuild everything?  : <


----------



## rigoletto@ (Nov 27, 2017)

Just the affected packages.


----------



## poorandunlucky (Nov 27, 2017)

lebarondemerde said:


> Just the affected packages.



Alright, looks like I got it working...  I don't think too many ports were affected...

Good to know, though...

Also, I've been meaning to ask you...  How to you deal with updates to the ports tree?  The other day I updated the ports tree, and a (stupid) patch was applied to something like perl or whatever, bringing it from maybe 5.2.1,1,1,5 to 5.2.1,1,1,6 or something like that (you get the picture), and Poudriere just started deleting all the packages...  I was like WO! and ^C out of it, but long story short, I don't want to have to rebuild all my packages every time someone changes a punctuation mark in some scripting language's code...  At the same time, though, I'd love to keep all my stuff up to date...

How do I deal with that?  How do I keep my stuff up to date without going overboard?


----------



## rigoletto@ (Nov 27, 2017)

Err... I just rebuild everything. Most times those small updates should not break anything but when it break you may not realize soon, and later you will not have idea what is causing the break.

Anyway, most of those perl/python stuff are very small.

If you do not like to update often, you could get the quarterly ports and stick with them until a new quarterly appear. BUT you will need to use `svn` instead of portsnap, and you will lose the INDEX file. You would need to run `make index` to have the INDEX file created and it take some time.

EDIT: I use to run ports-mgmt/poudriere just at night. I run it and go to sleep.

One thing that usually speedup the building process is reducing the number of builders and increase the number of jobs.

My system is a AMD FX-8120 (8 cores) and 16GB RAM. I run it with 4 builders and 8 jobs per builder. Works fine.

/usr/local/etc/poudriere.conf

```
PARALLEL_JOBS=4
PREPARE_PARALLEL_JOBS=8
```

The default I guess works better when you have most small packages (usually servers) or when you build too many packages, like the entire ports tree.

EDIT_2: an alternative would be to play with nice(1) to reduce  ports-mgmt/poudriere schedule priority, if your system become slow while building ports.

For instance:

`nice -t 16 poudriere bulk etc.`

You can also use the `-n` (dry-run) option with `poudriere bulk` to know in advance what will be built/rebuilt.


----------



## SirDice (Nov 27, 2017)

poorandunlucky said:


> How do I deal with that? How do I keep my stuff up to date without going overboard?


Just let it do its thing. The reason it's rebuilding those is to ensure your dependencies are all neatly lined up and you don't have issues with clients. It's better to rebuild things a couple of times when it's unnecessary then skipping one and get dependency problems on your clients.

Same as lebarondemerde I just let it build at night, when I'm asleep. And in the morning I have 4 freshly built repositories. Ok, not always, it sometimes takes the better part of the day to finish everything (4x ~400 packages takes a while to complete). But the more often you run the updates the less things need to change for each update. So, just update as often as possible.


----------



## rigoletto@ (Nov 27, 2017)

Ah, setting ports-mgmt/poudriere to use devel/ccache should also speedup the things.


```
CCACHE_DIR=/var/cache/ccache
```


----------



## poorandunlucky (Nov 28, 2017)

SirDice, lebarondemerde : I agree that it's best to keep everything up to date, but I was still looking for a way around...  : \

lebarondemerde : What's "jobs per builder"?  What are "jobs"?  What's a "builder"?  A jail?  A thread?  I'm kind of confused about how Poudriere distinguishes between those things...

Also, what commands do you guys issue to keep your stuff up to date?  Do you have any scripts, or cron jobs, or anything like that?  I'm kind of tired of building stuff on end, been doing that for the past several days, I kinda want to just enjoy my system for a little while, and configure some of the finer things for now, so I don't really feel like fiddling with it for now, but when I get back to it, I'd like to know how you guys approach the whole ordeal (what commands you issue, the order, and if you have it as part of scheduled tasks)...

Do you guys use poudriered at all?  Seems like a cool idea...  You set stuff to be built from your normal user account, right?


----------



## rigoletto@ (Nov 28, 2017)

There is no mystery for that.

`poudriere ports -u`
`poudriere bulk -j JAILNAME -f PKG-FILE`
`pkg upgrade`

I personally use a script because I have a few ports-mgmt/poudriere jails in order to build packages with different options to several jails I have in my home server.

The script just issue ports-mgmt/poudriere `bulk` a few times, one for each of those different ports-mgmt/poudriere jails.

*Builders:* number of ports building at the same time.
*Jobs:* think threads per builder.

`poudriered` is intended to be used with `poudriere queue`, what is still experimental (aka does not work yet).

*Some folks do upgrade just a time per week, or something like that.


----------



## poorandunlucky (Nov 28, 2017)

lebarondemerde said:


> There is no mystery for that.
> 
> `poudriere ports -u`
> `poudriere bulk -j JAILNAME -f PKG-FILE`
> ...



That's pretty simple...

Do you know if there's any way to fix my Ctrl+C-ing out of Poudriere deleting some packages while it was updating?  I force-quit before it could rebuild them because I didn't know what it was doing...  I thought it was just going to run portsnap fetch update in the specified ports tree, but it started deleting stuff, and I panicked...  Now I probably have some dependencies that are missing packages...  I don't know how to check that everything's there or what...


----------



## rigoletto@ (Nov 28, 2017)

Every time you bulk build ports-mgmt/poudriere will analyze all packages in the repository and take the necessary measures to make the repository consistent. So, if there are missing packages Poudriere will build them.


----------



## poorandunlucky (Nov 28, 2017)

that's pretty sweet...

so you could essentially just have a script that does

`freebsd-update fetch update
portsnap fetch update
poudriere ports -u -p portstree
pkg upgrade`

... wait...  when I did poudriere ports -u, and it started deleting stuff, was it going to re-build what it deleted on its own?

[The point I was going to make, though, was that you could essentially have the same mechanism as Windows Update, except better, where _all_ your software _and_ the operating system are constantly kept up to date...]


----------



## rigoletto@ (Nov 28, 2017)

You do not need both, unless you actually have two separated trees:

`portsnap fetch update
poudriere ports -u -p portstree`

`poudriere ports -u` does just update the ports tree.

EDIT: it is not a good idea to update the packages in an unattended fashion.

If something fail during the build, `pkg` could later remove everything what does depend on it (the failed port). You can end up without half of your previous installed packages or even more.

EDIT_2: you do not need to run `freebsd-update` very often. One time per week is enough.


----------



## poorandunlucky (Nov 28, 2017)

lebarondemerde said:


> You do not need both, unless you actually have two separated trees:
> 
> `portsnap fetch update
> poudriere ports -u -p portstree`
> ...



Guess taking a snapshot before might be a better idea, then  

I'd definitely want to have all this run in the background...  another thing would be options... hmm...  I'll let you know what I come up with...

Also, I don't know if you saw but when you update the tree, and some ports have been updated, does it rebuild everything immediately, or does it just delete the package files?


----------



## rigoletto@ (Nov 28, 2017)

I actually use `svn` (manually) to handle the ports tree for some reasons. But as far I remember `poudriere ports -u` will not touch in the packages, you need to issue `poudriere bulk` for that.


----------

