Add a script to check ports still needed to update after major upgrade of base.
This commit is contained in:
parent
15cbcbe10e
commit
e8a6657609
3 changed files with 165 additions and 0 deletions
|
@ -4,3 +4,5 @@ Sharable (bourne) shell scripts.
|
|||
Currently available:
|
||||
|
||||
[poudlist-all.sh](poudlist-all)
|
||||
|
||||
[check_old_rel_pkgs.sh](check_old_rel_pkgs)
|
||||
|
|
56
check_old_rel_pkgs/README.md
Normal file
56
check_old_rel_pkgs/README.md
Normal file
|
@ -0,0 +1,56 @@
|
|||
# check_old_rel_pkgs.sh
|
||||
## Description
|
||||
A small script to list ports/pkgs needs updating with base ABI change.<br>
|
||||
Would be helpful after major release upgrade.
|
||||
|
||||
## Usage
|
||||
No command line arguments.
|
||||
Simply run it as a bourne shell script.
|
||||
|
||||
Output is directed to stdout, so redirect to file if needed.
|
||||
|
||||
Output format is space separated as follows.
|
||||
|
||||
`origin arch lock removed`
|
||||
|
||||
Where:
|
||||
|
||||
* origin is the ports/pkgs origin. If any, @flavor is shown.
|
||||
* arch is architecture string on pkg database like
|
||||
FreeBSD:14:amd64
|
||||
where:
|
||||
* FreeBSD as operating system
|
||||
* 14 as major OS release
|
||||
* amd64 as CPU architecture
|
||||
* lock is the pkg lock status.
|
||||
* FREE for not locked.
|
||||
* LOCKED for locked.
|
||||
* removed for existence on ports tree.
|
||||
* EXISTS for not deleted.
|
||||
* DELETED for ports having MOVED entry without any successor.
|
||||
|
||||
If CPU architecture is "*", it means the port/pkg is independent from CPU architecture like fonts, documents and/or scripts.
|
||||
|
||||
Why FREE and EXISTS is shown?<br>
|
||||
It's for scripts to handle the output easier.
|
||||
As the output is directed to stdout, you can connect to pipe for further processing, or to file to keep.
|
||||
|
||||
As `cut -w` handles multiple space characters as single, I decided to output verbosely.
|
||||
|
||||
## Configuring the script
|
||||
|
||||
### CURVERS
|
||||
You need to specify current major release here.
|
||||
|
||||
13 for 13.*[-p*] or stable/13, 14 for 14.*[-p*] or stable/14.
|
||||
|
||||
For main branch, you should specify latest stable branch + 1.
|
||||
When stable/14 is the latest, set it as 15.
|
||||
|
||||
### PORTSDIR
|
||||
The directory where ports tree to be used exists.
|
||||
|
||||
Default is where vanilla FreeBSD expects: /usr/ports
|
||||
|
||||
## Sample output line
|
||||
`editors/vim@console FreeBSD:14:amd64 FREE EXISTS`
|
107
check_old_rel_pkgs/check_old_rel_pkgs.sh
Executable file
107
check_old_rel_pkgs/check_old_rel_pkgs.sh
Executable file
|
@ -0,0 +1,107 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2024 Tomoaki AOKI
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
|
||||
# Configurations
|
||||
|
||||
CURVERS=15
|
||||
PORTSDIR=/usr/ports
|
||||
|
||||
# End configurations section.
|
||||
|
||||
# pkg version -o | cut -f 1 -w | while read PACKAGE
|
||||
# do
|
||||
# ARCH=`pkg query %q ${PACKAGE}`
|
||||
# if [ ${CURVERS} != `echo ${ARCH} | cut -f 2 -d :` ]
|
||||
# then
|
||||
# echo Port ${PACKAGE} : ${ARCH}
|
||||
# fi
|
||||
# done
|
||||
|
||||
for PACKAGE in `pkg query -a %n` ; do
|
||||
PORT=`pkg query %o ${PACKAGE}`
|
||||
FLAVOR=`pkg info -A ${PACKAGE} | fgrep "flavor" | cut -f 4 -w`
|
||||
FLG="NO"
|
||||
|
||||
# Check if release string in the package matches current release or not.
|
||||
if [ -z ${FLAVOR} ] ; then
|
||||
ARCH=`pkg query %q ${PORT}`
|
||||
else
|
||||
ARCH=`pkg query %q ${PORT}@${FLAVOR}`
|
||||
fi
|
||||
REL=`echo ${ARCH} | cut -f 2 -d :`
|
||||
if [ ${CURVERS} = ${REL} ]
|
||||
then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Check if the package is deleted on ports tree or not using MOVED.
|
||||
if [ -z ${FLAVOR} ] ; then
|
||||
fgrep "${PORT}\|\|" ${PORTSDIR}/MOVED > /dev/null
|
||||
RET=$?
|
||||
else
|
||||
fgrep "${PORT}@${FLAVOR}\|\|" ${PORTSDIR}/MOVED > /dev/null
|
||||
RET=$?
|
||||
fi
|
||||
if [ 0 -eq $((RET)) ] ; then FLG="YES" ; fi
|
||||
|
||||
# Check if the package is locked or not.
|
||||
if [ -z ${FLAVOR} ] ; then
|
||||
LOCKED=`pkg info -k -q ${PORT}`
|
||||
else
|
||||
LOCKED=`pkg info -k -q ${PORT}@${FLAVOR}`
|
||||
fi
|
||||
|
||||
if [ "NO" = ${FLG} ] ; then
|
||||
if [ -z ${FLAVOR} ] ; then
|
||||
if [ "no" = ${LOCKED} ] ; then
|
||||
echo ${PORT} ${ARCH} FREE EXISTS
|
||||
else
|
||||
echo ${PORT} ${ARCH} LOCKED EXISTS
|
||||
fi
|
||||
else
|
||||
if [ "no" = ${LOCKED} ] ; then
|
||||
echo ${PORT}@${FLAVOR} ${ARCH} FREE EXISTS
|
||||
else
|
||||
echo ${PORT}@${FLAVOR} ${ARCH} LOCKED EXISTS
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ -z ${FLAVOR} ] ; then
|
||||
if [ "no" = ${LOCKED} ] ; then
|
||||
echo ${PORT} ${ARCH} FREE DELETED
|
||||
else
|
||||
echo ${PORT} ${ARCH} LOCKED DELETED
|
||||
fi
|
||||
else
|
||||
if [ "no" = ${LOCKED} ] ; then
|
||||
echo ${PORT}@${FLAVOR} ${ARCH} FREE DELETED
|
||||
else
|
||||
echo ${PORT}@${FLAVOR} ${ARCH} LOCKED DELETED
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
Loading…
Reference in a new issue