From: Michael Gmelin <free...@grem.de> Subject: Re: List of packages upgraded last time `pkg upgrade` was executed Date: Wed, 27 Jan 2021 10:05:57 +0100
> This will give you a list of all packages that were updated/installed > last: > > pkg query -e %t=$(pkg query %t | sort -n | tail -n1) %n-%v I tried this but unfortunately it doesn't seem to work as is expected. On the host I tried it, following packages are upgraded when I did `pkg upgrade` last time. p5-URI-5.06 p5-Module-CoreList-5.20210120 rubygem-bundler-2.2.7_1,1 sudo-1.9.5p2 1611721387 And I got following result. yasu@eastasia[1213]% pkg query -e %t=$(pkg query %t | sort -n | tail -n1) %n-%v p5-Module-CoreList-5.20210120 p5-URI-5.06 yasu@eastasia[1213]% So I checked timestamp of install packages. yasu@eastasia[1216]% pkg query -a '%n-%v %t' | sort -k 2 -n -r | head -10 ~ p5-URI-5.06 1611721389 p5-Module-CoreList-5.20210120 1611721389 rubygem-bundler-2.2.7_1,1 1611721388 sudo-1.9.5p2 1611721387 p5-Config-General-2.63 1611685127 libunwind-20201110 1611685127 bind916-9.16.11 1611685127 zstd-1.4.8 1611685126 sqlite3-3.34.1,1 1611685126 bind-tools-9.16.11 1611685125 yasu@eastasia[1217]% As you can see timestamps of rubygem-bundler-2.2.7_1,1 and sudo-1.9.5p2 are smaller than that of p5-URI-5.06 and p5-Module-CoreList-5.20210120. So they aren't included in the list. > As far as I can tell, packages installed by the same pkg invocation run > share the same installation timestamp (I didn't check the pkg sources, > but that's what appears to be the case), According to the above result, it doesn't seem to be true. And I think it's quite possible. When packages are upgraded they are upgraded not in parallel but sequentially. So let me assume following situation. * Pakcage A and B are to be upgraded. * A is upgraded first and B is next. * Both are quite large package. * Host is low-spec. In this case upgrade of each package may take a few minutes. And it result in that there is difference of a few minites between the timestamps of them after upgrade. > If you use a script to do upgrades, you could store the timestamp as > part of that and do something like this: > > touch /tmp/lastupgrade > pkg upgrade > # then, later: > pkg query -e "%t>=$(stat -f %m /tmp/lastupgrade)" %n-%v This didn't hit upon me and I think it's really excellent way to use file for timestamp. I'll use it in my shell script. Thank you for letting me know. --- Yasuhiro Kimura _______________________________________________ freebsd-ports@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-ports To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"