# Install some packages from local repository



## uzsolt (Dec 2, 2014)

I want some packages with own options which differ from default options, and I don't want update x11-drivers/xf86-video-ati because the newest version doesn't support ClockGating, ForceLowPowerMode options (I need them, else my laptop's fan works all the time - it's a "bit" annoying). I've created a local repository and I've set up in file /usr/local/etc/pkg/repos/local.conf:

```
local: { url: "file:///usr/ports/packages/", mirror_type: NONE, enabled: yes }
```

I've disabled and re-enabled the official package repository:
/usr/local/etc/pkg/repos/FreeBSD.conf:

```
FreeBSD: { enabled: no }
```
/usr/local/etc/pkg/repos/official-freebsd.conf:

```
FreeBSD: { url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest", mirror_type: "srv", signature_type: "fingerprints", fingerprints: "/usr/share/keys/pkg", enabled: yes }
```

When I run `pkg version -RUl '<'`, it doesn't print anything (it's OK for me), but when I run `pkg upgrade`, it wants to upgrade xf86-video-ati from 6.14.6_4 to 7.5.0.

I think the repository annotation is right (`pkg info -A xf86-video-ati`): 
	
	



```
xf86-video-ati-6.14.6_4:
  repository : local
```

I can lock this package but is there any solution to prevent this upgrade?


----------



## SirDice (Dec 2, 2014)

Yes, disable the FreeBSD repository completely and only use your local repository.


----------



## uzsolt (Dec 2, 2014)

Sorry, I wasn't exact. I want some package from local repository and others from FreeBSD. Or is it impossible (yet)?


----------



## SirDice (Dec 2, 2014)

I understood you perfectly well. Use one or the other, don't try to mix them. You'll quickly run into a dependency hell.


----------



## uzsolt (Dec 2, 2014)

Ah, ok. But how can I prevent upgrading of xorg-video-ati? With `pkg lock xorg-video-ati`?
I think with this "disabled upgrade" I don't run into a dependency hell because nothing needs xorg-video-ati. Is it right idea?

Other packages with different options: these packages are simple, relative small programs (not libraries), for example audio/musicpd (enabled httpd, to share the best musics with "home theater"  ), print/hplip (I've a HP scanner so I need enabled scan option, which is default disabled), deskutils/fet (disabled examples and enabled ONLYCL because I'm using it on a server too), and some other similar packages. Nothing depends on this packages.
Do you think in this case can I run into dependency hell?


----------



## SirDice (Dec 2, 2014)

I would suggest setting up ports-mgmt/poudriere and build everything yourself. That way you'll have full control over the options and features while keeping the advantages of using packages. And because everything is in sync you won't run into dependency problems.


----------



## uzsolt (Dec 2, 2014)

I used ports-mgmt/portmaster but I'm bored the large/huge build times (graphics/okular and its KDE-dependencies, editors/libreoffice,...).


----------



## SirDice (Dec 2, 2014)

Poudriere automates everything. So you just start it and a few hours later you'll have your own freshly built repository.


----------



## uzsolt (Dec 2, 2014)

I want to skip these few hours  I don't have a build server so I will have to build every package on my laptop.

The most important point isn't using of an own repository. I want to install and upgrade many ready-to-use packages and want some (about ten) packages with my own options (and disable upgrading of xf86-video-ati). I thought the best way is to create an own local repository with desired packages and use two repos together. Do you know a method/program?


----------



## SirDice (Dec 2, 2014)

I've not tried this but the solution appears to be explained in pkg-repository(5):

```
WORKING WITH MULTIPLE REPOSITORIES
     Where several different repositories are configured pkg will search
     amongst them all in the order specified, unless directed to use a single
     repository by the -r flag to pkg-fetch(8), pkg-install(8),
     pkg-upgrade(8), pkg-search(8) or pkg-rquery(8).  The search order is as
     displayed in the output of

           pkg -v -v

     Where several different versions of the same package are available, pkg
     will select the one with the highest version to install or to upgrade an
     installed package to, even if a lower numbered version can be found in a
     repository earlier in the list.  This applies even if an explicit version
     is stated on the command line.  Thus if packages example-1.0.0 and
     example-1.0.1 are available in configured repositories, then

           pkg install example-1.0.0

     will actually result in example-1.0.1 being installed.  To override this
     behaviour, on first installation of the package, select the repository
     with the appropriate version:

           pkg install -r repo-a example-1.0.0

     and then to make updates to that package ``sticky'' to the same reposi-
     tory, add an annotation to the package:

           pkg annotate -A example repository repo-a
```


----------



## uzsolt (Dec 2, 2014)

Yes, I tried this. The correct priority of repository was the reason why I disabled and re-enabled the FreeBSD repository.


```
$ pkg -v -v | sed -n '/Repositories/,/\$/p'
Repositories:
local: {
   url : "file:///usr/ports/packages/",
   enabled : yes
}
FreeBSD: {
  url : "pkg+http://pkg.FreeBSD.org/freebsd:10:x86:64/latest",
  enabled : yes,
  mirror_type : "SRV",
  signature_type : "FINGERPRINTS",
  fingerprints : "/usr/share/keys/pkg"
}
```

Without disable/enable the order was wrong (first is FreeBSD, second is local).
I annotated the desired packages too, as I wrote in my first comment - but it doesn't work as I expected.


----------



## jb_fvwm2 (Dec 2, 2014)

I would think that  if/when `portmaster  -P -x xf86-video-6.14.6_4`  again works with the new package system, it could be a solution in this case; not knowledgeable about the portupgrade equivalent syntax but as the latter works with packages (if set up with a symlink as I've posted in another thread) already, it may work as of now. So two things to check.


----------



## uzsolt (Dec 2, 2014)

I've an +IGNOREME in /var/db/pkg/xf86-video-6.14.6_4 so portmaster doesn't upgrade this package (and the -x option isn't needed). But for me the -P option won't work: `portmaster -P firefox` wants to build firefox and its dependencies.


----------



## Chris_H (Jan 14, 2018)

uzsolt said:


> Yes, I tried this. The correct priority of repository was the reason why I disabled and re-enabled the FreeBSD repository.
> 
> 
> ```
> ...


I know this thread is old. But the actual order is not determined by the order listed. But _alphabetically_.
As a result. I always prepend my preferred repos numerically. eg;

```
00local-repo
01local-repo
...

FreeBSD
```
This way any local repos get chosen first, in the order of preference. Followed by the FreeBSD repo.

HTH

--Chris


----------



## Harmnot (Mar 18, 2018)

Chris_H said:


> I know this thread is old. But the actual order is not determined by the order listed. But _alphabetically_.
> As a result. I always prepend my preferred repos numerically. eg;
> 
> ```
> ...


Is that the method to make of install faster ?


----------



## Chris_H (Apr 2, 2018)

Harmnot said:


> Is that the method to make of install faster ?


Hello, Harmont!
Well. It's faster if your _local_ repository is faster than the remote one, eg; FreeBSD. 
In other words; the example, and description I posted above was to illustrate how to set repository
*priority*. While that priority _may_ affect the overall performance, or speed. That would only
be a by-product. It really only allows you to choose who (as a repository) you want to be chosen
1st, 2nd, ...
If you prioritize by the _speed_ of the repository. Then yes, that will speed things up. 

Hope I was clear enough. 

--Chris


----------

