LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   What other functionalities would like to have on sbopkg (http://www.linuxquestions.org/questions/slackware-14/what-other-functionalities-would-like-to-have-on-sbopkg-944364/)

ChrisAbela 05-11-2012 03:07 AM

What other functionalities would like to have on sbopkg
 
I would like to update packages according to their dependencies in their original queue files. Thus if I need to upgrade package A and B, but A depends on B, then sbopkg would get the order right from the original queue files. If C also depended on B, then maybe you would like to re-build it as well. I had written a script that does this for me but it is just a script and therefore not integrated in sbopkg.

I would also like to see some clever way to uninstall packages. If I would like to uninstall package A, but B was only installed as a dependency for A, then sbopkg would let me know and offer the option of removing both.

If I would like to uninstall B, it would be nice to warn you that A and C depend on B.

sbopkg does not uninstall packages, but it might be helpful if the queue files have been carefully compiled.

I would also like to optionally ignore md5sum checksum errors; they are pretty useless most of the time, and there is not much to do about them.

What else?

samac 05-11-2012 03:38 AM

+1 for including queues as a built in part of sbopkg, however if a package includes an optional dependency this could be a problem for some people. Should the queue only contain the files that are essential or should it include all?

samac

ChrisAbela 05-11-2012 03:50 AM

When you build a package you list your dependencies in a queue file. At that point there are no optional dependencies, they are either in the queue file or not. When upgrading, the same queue file would be referred.

I am attaching my upgrade script. I had written it some time ago and I did not maintain it much. Most of the time it works, and occasionally it fails:-

Quote:

#!/bin/sh
#
# Copyright 2011 Chris Abela, Malta
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "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 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.
#
# Script to upgrade SlackBuilds
#
# This script takes the SlackBuilds flagged for updating as arguments and then
# them creates an Sbopkg queue file that may be used to re-build your packages
# in the correct sequence.
#
# Binary builts are not catered for.
#
# This script assumes rigourous maintenance of the Sbopkg queue files.

USAGE="sh upgrade.sh package_name_1 package_name_2 ..."
QUEUES=${QUEUES:-/var/lib/sbopkg/queues/}
DATE=$( date +%y%m%d )

# A simple usage hint
if [ "$#" -eq 0 ]; then
echo "$USAGE"
exit
else echo "Please wait until I find all the packages built against $* ..."
echo
fi

[ ! -d $QUEUES ] \
&& echo "Sbopkg queue directory was not found, aborting" \
&& exit

cd $QUEUES
# Remove previous upgrade sqf file as they will disturb the algorithm
rm -f upgrade.??????.sqf

sorting() {
# Remove double entries
FORMAT=$( echo "$1" | tr ' ' '\012' | sort -u )
}

format() {
# Replace White Spaces by Line Feeds
FORMAT=$( echo "$1" | tr ' ' '\012' )
}

find_deps() {
unset PREVIOUS_DEPS
# DEPS were compiled against $@:
for PKG in $@; do
DEPS=$( grep -l $PKG *.sqf| grep -v "^$PKG" | grep -v "[[:alnum:]]$PKG" \
| grep -v "$PKG[[:alnum:]]" | sed 's/\.sqf//' )
DEPS="${DEPS} ${PREVIOUS_DEPS}"
PREVIOUS_DEPS=$DEPS
done
sorting "$DEPS"
DEPS="$FORMAT"
}

reverse(){
# Reverse the order of $@
unset REVERSE
for i in $@; do
REVERSE="$i $REVERSE"
done
}

rationalise (){
# Remove double entries in $@ without touching the order
for i in $@; do
# If D does not have i; then append i to D
echo "$D" | grep -q "$i" || D="$D $i"
done
}

build_options (){
# Determine the build options
for i in $@; do
# Do not consider anything after #
BUILD_OPTIONS=$( cat ${i}.sqf | sed 's/#.*//' | grep $i | \
grep -v "[[:alnum:]]${i}" | grep -v "${i}[[:alnum:]]" )
echo $BUILD_OPTIONS >> upgrade.$DATE.sqf
done
}

find_deps $@ # Find the first lot which where built against $@
FINAL_DEPS="$DEPS"
while [ -n "$DEPS" ]; do # Find the next lot that were built against them
find_deps "$DEPS"
FINAL_DEPS="$FINAL_DEPS $DEPS"
done # No more were found
FINAL_DEPS="$@ $FINAL_DEPS"
rationalise $FINAL_DEPS
format "$D"
echo $D

# Write the sbopkg queue file
echo "#upgrade $*" > upgrade.$DATE.sqf
for i in "$FORMAT"; do
build_options $i
done
cat upgrade.$DATE.sqf
echo


All times are GMT -5. The time now is 01:17 PM.