How to update a mix of packages and ports on FreeBSD

183

You need to remember that pkg and ports register installed software in the same place (an SQLite database in /var/db/pkg). Neither system records any additional information that a particular piece of software was installed as a pre-compiled package, or as a port. Thus, once a piece of software is installed by either approach, the tools have no way of knowing how it was installed.

When you selected GTK2 support for the editors/vim port, that was registered in the package database. When you later ran pkg upgrade, pkg looked at the package data for vim, and found that GTK2 support had been enabled in the installed version, whereas it is not enabled in the pre-compiled package. pkg upgrade is doing exactly what it should - finding any installed packages that are different from the available pre-compiled packages, and attempting to upgrade them. Those differences can be in version number, dependency graph, compile-time options, etc.

The proper way to prevent pkg from considering a port or package (once installed, there is no difference, as far as the tools are concerned) that you want to protect is to use the pkg lock command.

Alternatively, if you find yourself changing options on a number of ports, you might consider installing poudriere and maintaining your own package repository. It takes a bit of setting up, and works best if your build host has a ZFS storage pool, although it will work if you don't have ZFS; it is a very flexible and convenient way to manage custom software builds.

Share:
183

Related videos on Youtube

Ayush Chaudhary
Author by

Ayush Chaudhary

Updated on September 18, 2022

Comments

  • Ayush Chaudhary
    Ayush Chaudhary almost 2 years

    I received the source for an application from a guy to make a few changes in the app. The data model version was, say, App3. I had to add about 3-4 more data model versions in the process. So the active model version when I sent him was App7

    I built the project (it was running properly on my mac) I sent him the zip and when he ran, he got the error "Can't find model for source store" I had him create the latest data model again, based on the data model App3 and make it the same as App7 and set it as the current version.

    He still has the error and I can't figure out why? Are the intermediate data model version causing issues? Is it required to delete the sqlite file in the application support->iphone simulator folder? I am all over the place with this. Please help!

    • Ricardo Buring
      Ricardo Buring over 10 years
      Is using pkg lock the recommended solution? It works, but I would hope something as simple as this could be handled automatically.
    • Dereckson
      Dereckson almost 10 years
      Yes, pkg lock is the solution designed for that: from the man page: “pkg lock is used to lock packages against reinstallation, modification or deletion.”.
    • HL1234
      HL1234 over 7 years
      this post is quit old. But I like to told that I have until now the same problem. I had asking the FreeBSD Forum "Using packages and ports at the same time?" And one member give me the advice to use a script for installation updates, like he has done. You can find it there in his answer.
  • Ayush Chaudhary
    Ayush Chaudhary about 12 years
    Retaining data here isn't necessary. The app should simply build and run. Updating the model is causing the problem. If he deletes the data file on his mac, will it solve?
  • Ayush Chaudhary
    Ayush Chaudhary about 12 years
    Sorry, I didn't get you. You meant deleting the sqlite file?
  • OutOnAWeekend
    OutOnAWeekend about 12 years
    Yes, deleting the SQLite data store should solve the error. But all the existing data is going to be lost, so take back up before deleting.
  • Ayush Chaudhary
    Ayush Chaudhary about 12 years
    It did solve. Although retaining data isn't necessary in this case, but I have 2 questions :
  • Ayush Chaudhary
    Ayush Chaudhary about 12 years
    1. Why did I not have to do it while development on my machine? 2. When I release it to users, can I programmatically delete the sqlite db file? 3. What if I want to retain the data?
  • OutOnAWeekend
    OutOnAWeekend about 12 years
    1. Are you certain you did not have this error in your machine? Check in the Finder that you already have a store. Make any change to the data model in XCode (add a new attribute/change the type of an existing one, etc.), save the project and run it. The same error should come for you too. 2. I would think 'yes', but you should not do it. 3. Check the link Nevan has given above. Core Data Model versioning is a thing in itself.
  • nevan king
    nevan king about 12 years
    @AyushChaudhary well, assuming that his data isn't important to him.
  • Ayush Chaudhary
    Ayush Chaudhary about 12 years
    Not really important. Plus, the data model change is more like a complete overhaul. Many, many attributes added. It'll be syncing with a web server. So keeping these two points in mind, I think deleting the sqlite(a sort of fresh install) is the best option. What say?
  • nevan king
    nevan king about 12 years
    If his data isn't important, and nobody else using the app has important data, just delete the sqlite file (or ask him to) and create a new one. Versioning is only useful in production, or to avoid re-creating data sets when you're testing. Sounds like the changes here are too big to even bother.
  • Ayush Chaudhary
    Ayush Chaudhary about 12 years
    During deployment when I push the update, I should delete the file programmatically for the users, right?
  • nevan king
    nevan king about 12 years
    It depends on whether their data is important or not. If it's something like cache data, you can delete it. If it's something like their list of favorite movies (which they created) you'll have to version it or your users won't be happy.