How to update applications, if ports and packages were installed together?

Hello.

Some apps I have built from ports-collection, some - from pkg-repository. If I want to update all of them, how can I do it right?
Thank you.
 
It depends on how many packages and how many computers you need to upgrade.
For small amount of custom ports and for small amount of unified computers I tried to make package for the required ports.
man ports()
Code:
     package              Make a binary package for the port.  The port will
                          be installed if it has not already been.  The
                          package is a .tbz file that you can use to install
                          the port on other machines with pkg-add(8).  If the
                          directory specified by PACKAGES does not exist, the
                          package will be put into the current directory.  See
                          PKGREPOSITORY and PKGFILE.

     package-recursive    Like package, but makes a package for each depending
                          port as well.

After that I used that custom packages for upgrade.
 
What I do (I only rarely need to compile a program from ports).
Before compiling the port I do make install-missing-packages for the port.
After installation I pkg lock the package so that it is ignored during pkg upgrade.
If a new version for a manually compiled port is available (what even pkg upgrade tells me about) I unlock the package, update it the same way I installed it and lock the package again.
 
The article mentions portsnap, which is not in 14.0.
Noted!

What are we supposed to use instead, keeping in mind that at least on my AWS-EC2 instances the space is too limited for storing locally the version history of the ports, e.g. as sourced by git clone/pull.
 
You could give net/gitup a shot. Or do the actual building of the ports on some other system. I build packages for my VPS on a system at home. It's an old i5 that wasn't doing anything any way. It takes a while to build but I can simply run pkg-update(8) on my VPS and have everything neatly updated there. With all the options set/unset as I want/need them. No build dependencies lingering around on the VPS. No ports tree either, don't need it there.
 
It depends on how many packages and how many computers you need to upgrade.
For small amount of custom ports and for small amount of unified computers I tried to make package for the required ports.
man ports()
Code:
     package              Make a binary package for the port.  The port will
                          be installed if it has not already been.  The
                          package is a .tbz file that you can use to install
                          the port on other machines with pkg-add(8).  If the
                          directory specified by PACKAGES does not exist, the
                          package will be put into the current directory.  See
                          PKGREPOSITORY and PKGFILE.

     package-recursive    Like package, but makes a package for each depending
                          port as well.

After that I used that custom packages for upgrade.
Be a bit careful by doing that as you're building packages in an unclean environment which may introduce other issues due to ports picking up various libraries etc.
 
Hi,

What I do is to combine three tools: poudriere, darkhttpd and AppJail.

* poudriere: To manage my custom repository.
* darkhttpd: To distribute packages over my network. Not necessary when you don't need to distribute your packages to others.
* AppJail: To manage my jails, specifically for this context, to create a jail only with the package I have built.

Code:
# poudriere ports -l
PORTSTREE METHOD  TIMESTAMP           PATH
default   git+ssh 2023-11-02 13:59:53 /usr/local/poudriere/ports/default
# poudriere jail -l
JAILNAME VERSION         ARCH  METHOD TIMESTAMP           PATH
132amd64 13.2-RELEASE-p4 amd64 http   2023-10-13 06:28:21 /usr/local/poudriere/jails/132amd64

As you can see, I have installed and configured poudriere and it already contains packages in that repository. What I need to do is install darkhttpd and mount a volume.

appjail makejail -j darkhttpd -f gh+AppJail-makejails/darkhttpd -o virtualnet=":<random> default" -o nat -o fstab="/usr/local/poudriere/data/packages/132amd64-default /usr/local/www/darkhttpd" -o expose=80

After running this command, I can see my packages from another computer:

Code:
$ fetch -qo - http://192.168.1.105
fetch -qo - http://192.168.1.105
<html>
<head>
<title>/</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>/</h1>
<tt><pre>
<a href="../">..</a>/
<a href=".buildname">.buildname</a>              21
<a href=".jailversion">.jailversion</a>            16
<a href=".latest/">.latest</a>/
<a href=".pkg-cache/">.pkg-cache</a>/
<a href=".real_1698965306/">.real_1698965306</a>/
<a href="All/">All</a>/
<a href="Latest/">Latest</a>/
<a href="meta.conf">meta.conf</a>              163
<a href="meta.pkg">meta.pkg</a>               236
<a href="meta.txz">meta.txz</a>               236
<a href="packagesite.pkg">packagesite.pkg</a>      44008
<a href="packagesite.txz">packagesite.txz</a>      44008
</pre></tt>
<hr>
Generated by darkhttpd/1.14 on Thu, 02 Nov 2023 22:57:46 GMT
</body>
</html>

After the above command succeeds, I can create a jail, commonly with the name of the port I want to test, but with configuration files for pkg(8) to use my custom repository and the latest branch. For this example, I will test sysutils/initool.

appjail quick initool virtualnet=":<random> default" nat copydir=files file=/usr/local/etc/pkg/repos/FreeBSD.conf file=/usr/local/etc/pkg/repos/Custom.conf overwrite=force start

I have created a custom directory from where AppJail will copy the files:

Code:
# tree -pug files/
[drwxr-xr-x root     wheel   ]  files/
└── [drwxr-xr-x root     wheel   ]  usr
    └── [drwxr-xr-x root     wheel   ]  local
        └── [drwxr-xr-x root     wheel   ]  etc
            └── [drwxr-xr-x root     wheel   ]  pkg
                └── [drwxr-xr-x root     wheel   ]  repos
                    ├── [-rw-r--r-- root     wheel   ]  Custom.conf
                    └── [-rw-r--r-- root     wheel   ]  FreeBSD.conf
 
6 directories, 2 files
# cat files/usr/local/etc/pkg/repos/Custom.conf
custom {
        url: http://192.168.1.105
        priority: 1
}
# cat files/usr/local/etc/pkg/repos/FreeBSD.conf
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}

The last step is simply to install the port and test it.

Code:
# appjail pkg jail initool install -y initool
Updating FreeBSD repository catalogue...
[initool.appjail] Fetching meta.conf: 100%    163 B   0.2kB/s    00:01
[initool.appjail] Fetching packagesite.pkg: 100%    7 MiB 629.4kB/s    00:11
Processing entries: 100%
FreeBSD repository update completed. 34178 packages processed.
Updating custom repository catalogue...
[initool.appjail] Fetching meta.conf: 100%    163 B   0.2kB/s    00:01
[initool.appjail] Fetching packagesite.pkg: 100%   43 KiB  44.0kB/s    00:01
Processing entries: 100%
custom repository update completed. 148 packages processed.
All repositories are up to date.
The following 3 package(s) will be affected (of 0 checked):
 
New packages to be INSTALLED:
        gmp: 6.3.0 [custom]
        indexinfo: 0.3.1 [custom]
        initool: 0.14.0 [custom]
 
Number of packages to be installed: 3
 
The process will require 3 MiB more space.
553 KiB to be downloaded.
[initool.appjail] [1/3] Fetching indexinfo-0.3.1.pkg: 100%    6 KiB   5.7kB/s    00:01
[initool.appjail] [2/3] Fetching initool-0.14.0.pkg: 100%   70 KiB  72.1kB/s    00:01
[initool.appjail] [3/3] Fetching gmp-6.3.0.pkg: 100%  477 KiB 488.4kB/s    00:01
Checking integrity... done (0 conflicting)
[initool.appjail] [1/3] Installing indexinfo-0.3.1...
[initool.appjail] [1/3] Extracting indexinfo-0.3.1: 100%
[initool.appjail] [2/3] Installing gmp-6.3.0...
[initool.appjail] [2/3] Extracting gmp-6.3.0: 100%
[initool.appjail] [3/3] Installing initool-0.14.0...
[initool.appjail] [3/3] Extracting initool-0.14.0: 100%
# appjail cmd jexec initool initool v
0.14.0

Some time ago I wrote a howto in the AppJail wiki, maybe it will help you:

* Using a custom repository in a jail with poudriere.

There is a lot of information about poudriere and custom repositories, start with their wiki:

* Creating pkg(8) repositories.

---

You can use a GUI application (although it requires some additional configuration), but for simplicity I used a command line tool. I prefer to use jails instead of combining the ports and the official repository because it can mess up my host and I don't want such a thing.
 
Back
Top