How to change repository name of installed packages in local database?

Miroslav Lachman 000.fbsd at quip.cz
Tue Jun 28 10:51:23 UTC 2016


Baptiste Daroussin wrote on 06/28/2016 12:33:
> On Tue, Jun 28, 2016 at 12:16:17PM +0200, Miroslav Lachman wrote:
>> I searched the man pages but cannot find the answer.
>> If we have machine with packages installed from more than one repository and
>> one day we want to use some already installed packages from another
>> repository, is there any easy way of switching this packages to another
>> repo?

[...]

>> Now we need to switch all packages from testing repo "redmine320" to
>> production repo "codelab".
>>
>> Is there any other way instead of manual deinstall and reinstall of all
>> those packages?
>>
>
> # remove the "repository" annotation
> pkg annotate -D expat repository
>
> # add the new one
> pkg annotate -A expat repository codelab
>
> For convenience we could allow to overrite an existing one, but we do not yet

Modification with pkg annotate -M works for me!

    # pkg annotate -M rubygem-web-console repository codelab
rubygem-web-console-2.3.0: Change annotation tagged: repository to new 
value: codelab? [y/N]: y
rubygem-web-console-2.3.0: Modified annotation tagged: repository

    # pkg annotate -S rubygem-web-console repository
rubygem-web-console-2.3.0: Tag: repository Value: codelab


I switched all repo "redmine320" packages to repository "codelab" with 
following command (not so elegant)

   # pkg query '%R %n' | awk '$1 == "redmine320" { print $2 }' | xargs 
-L1 -J % pkg annotate -y -M % repository codelab


Thank you Bapt and Franco!

Miroslav Lachman



More information about the freebsd-ports mailing list