souki n00b
Joined: 08 Jul 2002 Posts: 10
|
Posted: Fri Aug 02, 2002 3:21 pm Post subject: unrestricted path for .tbz2 packages |
|
|
Hi,
I'm using more and more tbz2 packages, but portage doesn't allow me to archivate them as I want to (not exactly true, see at end):
- tbz2 files are going to /usr/portage/packages/All
I would prefer to choose the complete path (including archive name).
All informations needed by portage are included in it, so why be so restrictive?
- to install a tbz2 file, it should be in /usr/portage/packages/All
Again, why be so restrictive?
- when installing a tbz2, if the corresponding ebuild does not exist in the /usr/portage/ tree, there is a warning message. Well, it works, but here I'm a little confused: tbz2 has its own ebuild attached, so what does this warning means?
example:
- I'm upgrading perl-5.6.1 to perl-5.8.0, ok this is not a restriction here, the archives are properly stored with right versions in their names and I can easily switch from one to the other.
- Now, I want mod_perl. The same version has to be compiled for each version of perl. I have to store the two archives elsewhere because I need something in the path remembering me what I've done for later use. If I want to shift back, I move the correct archive in /usr/portage/packages/All
- Now, I want different CFLAGS or USE settings. The same problem arises.
What I would like to do is:
Quote: |
#> quickpkg dev-perl/mod_perl /tmp/my_archives/mod_perl-1.27-my_tag.tbz2
#> emerge /tmp/my_archives/freedom.tbz2
|
so I could maintain my set of archives easily.
For now, I'm using a small script that split the tbz2, get the name, copy to the right place, emerge, and clean. Ok, I can do that way, and I will understand if you (gentoo-dev) choose to keep the default behaviour like it is.
my best regards,
~souki
three scripts following
quickpkg_package: this script is based on quickpkg, copyright in the source
Code: |
#!/bin/bash
# This script tries to quickly create a gentoo binary package using the
#
# /var/db/pkg/class-app/app/* files
#
# This script is based on quickpkg, copyright follows
# Copyright (C) 2001 - Terry Chan. GNU GPL
#
# It adds: package name support
# arbitrary destination dir support
# arbitrary archive name support
# defaults to old behaviour
#
export PKGDIR="`python2.2 -c 'import portage; print portage.settings["PKGDIR"];'`"
if [ -z $1 ]; then
echo "QUICKPKG ver 1.0-patched"
echo "Example Usage: quickpkg /var/db/pkg/net-www/prozilla-1.3.6/"
echo "Example Usage: quickpkg net-www/prozilla-1.3.6"
echo "Example Usage: quickpkg net-www/prozilla-1.3.6 /tmp"
echo "Example Usage: quickpkg net-www/prozilla-1.3.6 /tmp/mypkg.tbz2"
exit 1
fi
DBPATH=""
DEST=""
if [ -d "$1" ]; then
DBPATH=$1
else
if [ -d "/var/db/pkg/$1" ]; then
DBPATH="/var/db/pkg/$1"
else
echo "package unknown: $1"
exit 1
fi
fi
echo "DBPATH=${DBPATH}"
PF=`cat ${DBPATH}/PF`
echo "PF=${PF}"
if [ ! -z $2 ]; then
if [ -d "$2" ]; then
DEST="$2/${PF}.tbz2"
else
DEST="$2"
fi
else
[ -d ${PKGDIR}/All ] || mkdir -p ${PKGDIR}/All
DEST="${PKGDIR}/All/${PF}.tbz2"
fi
echo "DEST=${DEST}"
MYDIR="/tmp/portage/${PF}"
[ -d ${MYDIR}/temp ] && rm -r ${MYDIR}/temp
mkdir -p ${MYDIR}/temp
cp ${DBPATH}/* ${MYDIR}/temp
cut -f 2 -d " " ${DBPATH}/CONTENTS >${MYDIR}/filelist
tar cjvf ${MYDIR}/bin.tar.bz2 --files-from=${MYDIR}/filelist --no-recursion
rm ${MYDIR}/temp/CONTENTS
xpak ${MYDIR}/temp ${MYDIR}/inf.xpak
tbz2tool join ${MYDIR}/bin.tar.bz2 ${MYDIR}/inf.xpak ${MYDIR}/${PF}.tbz2
mv ${MYDIR}/${PF}.tbz2 ${DEST}
rm ${MYDIR}/temp/*
rm ${MYDIR}/bin.tar.bz2 ${MYDIR}/inf.xpak ${MYDIR}/filelist
|
quickpkg_merge: arbitrary path for .tbz2
Code: |
#!/bin/bash
export PKGDIR="`python2.2 -c 'import portage; print portage.settings["PKGDIR"];'`"
if [ ! -f "$1" ]; then
echo "Example Usage: quickpkg /tmp/mypkg.tbz2"
exit 1
fi
MYDIR=/tmp/portage
[ -d ${MYDIR}/temp ] && rm -r ${MYDIR}/temp
mkdir -p ${MYDIR}/temp
cp $1 ${MYDIR}/temp
tbz2tool split $1 ${MYDIR}/temp/bin.tar.bz2 ${MYDIR}/temp/inf.xpak
xpand ${MYDIR}/temp/inf.xpak
if [ "$?" -ne 0 ]
then
echo "Could not xpand!"
exit 1
fi
if [ -f "${MYDIR}/temp/PF" ]; then
PF=`cat ${MYDIR}/temp/PF`
echo "PF=${PF}"
else
echo "Package corrupted!?"
exit 1
fi
[ -d ${PKGDIR}/All ] || mkdir -p ${PKGDIR}/All
DEST="${PKGDIR}/All/${PF}.tbz2"
if [ -f ${DEST} ]; then
echo "Aborting: conflicting with ${DEST}"
exit 1
fi
cp $1 ${DEST}
emerge ${DEST}
rm ${DEST}
|
xpand: this script is used by quickpkg_merge, it does the oposite of xpak
Code: |
#!/usr/bin/python2.2
import xpak
import sys
if len(sys.argv)!=2:
print "xpak: expecting two arguments."
sys.exit(1)
xpak.xsplit(sys.argv[1])
xpak.xpand(xpak.getboth(sys.argv[1]), '/tmp/portage/temp')
|
|
|