Saturday, May 2, 2009

Using SlackPkg on Slack/390

As promised in my previous post, some instructions to use SlackPkg in Slack/390 to keep your installation up-to-date.

After almost two years without activiry, the maintainers have released some patches / upgrades for Slack/390 - both the -stable and the -current versions.
Since I use SlackPkg on my other Slackware installations (12.1, 12.2 & -current), I wanted to use this same tool in my Slack/390 installation.

First i tried with the version that is included in /extra in Slack/390, but it is quite old (1.4, from 2005) and it simply didn't work.

The first problem is that the big majority of packages on the Slack/390 mirrors do not have the associated xxxx.tgz.asc file, which contain the GPG ckecksum of the package.
This was simple to resolve, setting CHECKGPG=off in /etc/slackpkg/slackpkg.conf

But the second problem I encountered was with the naming of some files on the Slack/390 mirrors that differs from the 'main' Slackware version:

  • The MANIFEST.bz2 files are called MANIFEST.s390.bz2 in Slack/390

  • The CHECKSUM.md5 files are called CHECKSUM.s390.md5 in Slack/390

  • The PACKAGES.TXT files are called PACKAGES.s390.TXT in Slack/390

  • The FILELIST.TXT file is called FILELIST.TXT.s390 (yes, at the end) in Slack/390


I remembered from the newer versions that there was an option for the 'architecture', so I decided to try SlackPkg 2.70.5 from slackware-12.2
It can be downloaded here or any valid Slackware mirror.
Since SlackPkg is written as a collection of scripts and marked as "noarch", I expected no problems.

So I downloaded the package, upgraded the 1.4 version with upgradepkg and edited /etc/slackpkg/slackpkg.conf
I commented out the 'standard' x86 architecture and uncommented the ARCH=s390 line.
But no luck yet... Still the same problems with the differences in the file names.

At this moment I reached the conclusion that I had to 'hack' the SlackPkg scripts to get it working.

I ended up modifying two files, /usr/bin/slackpkg & /usr/libexec/slackpkg/core-functions.sh

The first patch is to the main slackpkg script and defines a variable 'subARCH' to insert the ".s390" text in the filenames in case the ARCH is s390:

--- slackpkg.orig 2009-04-10 23:44:49.000000000 -0300
+++ /usr/sbin/slackpkg 2009-04-10 23:57:28.000000000 -0300
@@ -40,6 +40,7 @@
SOURCE=$(grep -e "^\([a-z]\)" $CONF/mirrors)
. $CONF/slackpkg.conf
ARCH=${ARCH:-i[3456]86}
+[ "$ARCH" = "s390" ] && subARCH=".s390"
LOCAL=0
KERNELMD5=$(md5sum /boot/vmlinuz 2>/dev/null)
TMPDIR=$(mktemp -p /tmp -d slackpkg.XXXXXX 2>/dev/null || echo "FAILED")


The second patch is to the core-functions script and inserts the $subARCH variable in the filenames:

--- core-functions.sh.orig 2009-04-10 23:53:19.000000000 -0300
+++ /usr/libexec/slackpkg/core-functions.sh 2009-04-11 00:02:49.000000000 -0300
@@ -618,16 +618,16 @@
#
echo -e "\t\tList of all files"
for i in $FIRST $SECOND $THIRD $FOURTH $FIFTH ; do
- getfile ${i}/MANIFEST.bz2 $TMPDIR/${i}-MANIFEST.bz2 && \
+ getfile ${i}/MANIFEST${subARCH}.bz2 $TMPDIR/${i}-MANIFEST.bz2 && \
DIRS="$DIRS $i"
done

echo -e "\t\tPackage List"
- getfile FILELIST.TXT $TMPDIR/FILELIST.TXT
+ getfile FILELIST.TXT${subARCH} $TMPDIR/FILELIST.TXT

if [ "$CHECKPKG" = "on" ]; then
echo -e "\t\tChecksums"
- getfile CHECKSUMS.md5 ${TMPDIR}/CHECKSUMS.md5
+ getfile CHECKSUMS${subARCH}.md5 ${TMPDIR}/CHECKSUMS.md5
fi
cp $TMPDIR/CHECKSUMS.md5 $WORKDIR/CHECKSUMS.md5

@@ -635,7 +635,7 @@
#
echo -e "\t\tPackage descriptions"
for i in $DIRS; do
- getfile ${i}/PACKAGES.TXT $TMPDIR/${i}-PACKAGES.TXT
+ getfile ${i}/PACKAGES${subARCH}.TXT $TMPDIR/${i}-PACKAGES.TXT
done

# Format FILELIST.TXT


With these changes, I got SlackPkg working in my Slack/390 installation!

There are still some problems, but they depend on some cleaning up of the Slack/390 mirrors.
In the following image you can see that SlackPkg wants to "upgrade" some packages to older versions:


The fact that SlackPkg want to "downgrade" itself to version 1.4 is understandable, as it is the official version for Slack/390.
The suggestions to downgrade abiword, gftp and gucharmap are caused by the fact that these packages exist two times on the mirrors, once in slackware/gnome (the older versions) and once in slackware/xap (the newer versions).
I wrote about these inconsistencies to s390support@slackware.com but unfortunately have not received any answers yet.

Even with these minor problems, keeping your Slack/390 installation is a lot simpler now with a working SlackPkg!

Labels: , ,

Friday, May 1, 2009

Update on Slack/390

For those who have been following my posts on installing Slack/390 on Hercules:
There has been a security update this week - see the ChangeLog

I recently managed to patch a current version of SlackPkg to work on Slack/390 (the version included in /extra does not work).
I'll try to organize my notes during the following days and publish the patch so that everyone can keep Slack/390 updated with this wonderful tool :)

Labels: , ,

Saturday, April 18, 2009

Adventures with SlackPkg - Part I

As a big fan of Slackware, I try to follow the -current branch of this distribution on two of my machines at home.
Doing this is not a good idea on a production machine, as things might stop working. The -current branch is mainly for testing newer versions of packages. The developers of Slackware are usually grateful when receiving feedback if something goes wrong, so that it can be fixed before the new stable release.

I use SlackPkg, a wonderful tool that since long has been included with Slackware as an extra, but since the release of 12.2 is part of the standard installation.
SlackPkg can check for updates to the -current or stable branch and then upgrade or add the available packages and patches.

This week (April 15th) a new version of the 'pkgtools' package was released, fixing some small bugs. While trying to upgrade the package with SlackPkg, it complained that the md5sum was not matching.
After researching some of the code, I found out that in the 'checkpkg' function in /usr/libexec/slackpkg/core-functions.sh the 'MD5ORIGINAL' variable receives the md5sum of both the package to be installed and the source package (source/a/pkgtools/pkgtools-12.34567890-noarch-2.tgz).

A temporary work-around was to disable md5sum checking in SlackPkg, changing CHECKPKG=on to CHECKPKG=off in /etc/slackpkg/slackpkg.conf

I posted the problem at LinuxQuestions and the same day Alan Hicks responded with a patch that basically filters out the source-packages when getting the md5sum.

The trick is in the included 'grep -v'. In /usr/libexec/slackpkg/core-functions.sh the line:
MD5ORIGINAL=$(grep "/${NAMEPKG}$" ${WORKDIR}/CHECKSUMS.md5| cut -f1 -d \ )
was changed to:
MD5ORIGINAL=$(grep "/${NAMEPKG}$" ${WORKDIR}/CHECKSUMS.md5| grep -v '/source/'| cut -f1 -d \ )

It seems to be a rare occurrence of having an installation package and source package with exactly the same name.

The patch lets SlackPkg install the package, but it is still not perfect, as it tries to install it twice.
But I'll leave this to PiterPunk to fix, as it is no serious problem. :-)

Labels: ,