From
|
Alpt <alpt@freaknet.org>
|
Date
|
Fri, 28 Nov 2003 16:30:45 +0100
|
Subject
|
[hackmeeting] "Emerde 1.0.4: Ultimate packages solution for Slackware" is out
|
***Emerde 1.0.4 is out***
http://emerde.freaknet.org
----------------------------------------------------------------------
Emerde is the port of Gentoo's portage system that installs, removes,
updates, mantains your system rapidly and easily. Furthermore on
Slackware distribution it cooperates with the Slackware's db and allows
to install .tgz files directly, using dependeces checking.
----------------------------------------------------------------------
pkg2por was created.
Emerde 1.0.4 is now completely compatible with the slackware's packages
system.
What does it means?
Well, Emerde can understand the slackware's pkg database (/var/log/packages)
and Slackware can understand the Emerde's database (/var/db/pkg), in
this way you can install .tgz using the portage's dependeces resolving.
For more informations read README.pkg2por and README.por2pkg
Usage:
emerde [ options ] [ action ] [ ... | [PKGROOT=/path/] tgzfile | ... ]
Below there are few example:
----------------------------------------------------------------------
[root@darkalpt]# cd /mnt/cdrom/slackware/n/
[root@darkalpt n]# emerde tcpdump-3.7.2-i386-1.tgz
Calculating dependencies \
Emerde: I'm going to install this packages( ['net-analyzer/tcpdump'] )
Installing package tcpdump-3.7.2-i386-1 ([recommended])...
PACKAGE DESCRIPTION:
tcpdump: tcpdump
tcpdump:
tcpdump: Tcpdump is a tool for network monitoring and data acquisition.
You
tcpdump: can use it to dump information on all the packets on a network
that
tcpdump: match a boolean expression. Tcpdump uses libpcap, a system
tcpdump: independent interface for user-level packet capture.
tcpdump:
pkg2por: Loading tcpdump-3.7.2-i386-1's data
pkg2por: Found tcpdump-3.7.2 with 3.7.2 in net-analyzer
pkg2por: Loading db's info
pkg2por: Writing db data in /var/db/pkg/net-analyzer/tcpdump-3.7.2
pkg2por: Done
Emerde: installpkg done.
[root@darkalpt n]#
-------------------------------------------------------------------
Quick hack for emerde users:
Copy pkg2por in /usr/bin/ and apply the patches attached here. If you applied
previous patches, reverse them.
# cp pkg2por /usr/bin
# patch /usr/lib/portage/bin/emerge emerge_2.0.49-r15.patch
# patch /usr/lib/portage/bin/emergehelp.py emergehelp.py.patch
# patch /sbin/installpkg installpkg.patch
# patch /sbin/removepkg removepkg.patch
If you want to rebuild the entire Emerde's db from the Slackware's db
use:
# /usr/bin/pkg2por ALL
That's all folks, Enjoy! )^_^(
--
"I don't know nothing" The One Who reached the Thinking Matter
[ Alpt --- Freaknet Medialab ]
[ GPG Key ID 441CF0EE ]
[ Key fingerprint = 8B02 26E8 831A 7BB9 81A9 5277 BFF8 037E 441C F0EE ]
431a432
> pkg2por $shortname
316a317
> pkg2por $PKGNAME REMOVE
13c13
< print " "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] [ "+turquoise("ebuildfile")+" | "+turquoise("tbz2file")+" | "+turquoise("dependency")+" ] [ ... ]"
---
> print " "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] [ "+turquoise("ebuildfile")+" | "+turquoise("tbz2file")+" | "+turquoise("[PKGROOT=/path/] tgzfile")+" | "+turquoise("dependency")+" ] [ ... ]"
766a767,768
> pkgfile=[]
> pkgroot="/mnt/cdrom/slackware"
784a787,831
> #Emerde: installs slackware's pkg
> elif x[:7]=="PKGROOT":
> pkgroot=x.split('=')[1]
> if not os.path.exists(pkgroot):
> print "\nEmerde: !! "+pkgroot+" doesn't exist\n"
> sys.exit(1)
> print "Emerde: Using "+pkgroot+" as root dir for slackware's packages"
> elif x[-4:]==".tgz":
> def getpkgfile(arg, dir, files):
> for file in files:
> filename = os.path.join(dir,file)
> if file.find("-")!=-1:
> if arg==getpkgname(file) and file[-4:]==".tgz":
> pkgfile.append(filename)
> return 0
> break
> def getpkgname(xep):
> myname=xep.split('-')
> if myname[1][0].isdigit():
> pkgname=myname[0]
> else:
> pkgname=myname[0]+"-"+myname[1]
> return pkgname
> mypkg=getpkgname(x)
> mykey=portage.dep_expand(getpkgname(x),portage.portdb)
> try:
> self.mysd=self.select_dep(portage.root,mykey,arg=mypkg)
> except Exception, e:
> print "\nEmerde: !!! Problem in",mykey,"dependencies."
> print "!!!",e
> sys.exit(1)
> if not self.mysd:
> return (0,myfavorites)
> elif not "--oneshot" in myopts:
> myfavorites.append(mykey)
> print "\nEmerde: I'm going to install this packages(",myfavorites,")"
> for whatpkg in myfavorites:
> os.path.walk(pkgroot, getpkgfile, whatpkg.split('/')[1])
> pkgfile.append("NULL")
> if pkgfile[0]=="NULL":
> print "Emerde: !! No pkg "+whatpkg+" found. Skipping"
> continue
> portage.spawn("/sbin/installpkg "+pkgfile[0], free=1)
> print "Emerde: installpkg done."
> sys.exit(0)
1357a1405,1407
> mysplit=string.split(x[pkgindex],"/")
> portage.spawn("/usr/bin/por2pkg "+mysplit[1]+" "+mysplit[0], free=1)
>
1601a1652
> portage.spawn("/usr/bin/por2pkg "+mysplit[1]+" "+mysplit[0]+" REMOVE", free=1)
pkg2por: Packages to Portage
With this utility Slackware shares its database with the Emerde's database.
In this way you can use installpkg, upgradepkg as you were used to.
Enjoy (+_^)
***Installation:
- You need to copy pkg2por in /usr/bin/ and apply the relative patches:
# cp pkg2por /usr/bin/
# patch /sbin/installpkg installpkg.patch
# patch /sbin/removepkg removepkg.patch
# patch /usr/lib/portage/bin/emerge emerge_2.0.49-r15.patch
# patch /usr/lib/portage/bin/emergehelp.py emergehelp.py.patch
***Usage:
- pkg2por name [action]
- For the first execution you should use
# pkg2por ALL
It will build the complete Emerde's database in /var/db/pkg with all the installed packages
- To add a new entry in the db you can use "pkg2por name [category]"
ex: pkg2por python-2.2.1-i386-1
- To remove an entry from the db you can use "pkg2por name REMOVE"
ex: pkg2por python-2.2.1-i386-1 REMOVE
- To remove the entiry db you can use "pkg2por ALL REMOVE"
ex: pkg2por ALL REMOVE
#pkg2por is a part of the Emerde system, a port of Gentoo's portage.
#Emerde is ported by AlpT@freaknet.org and the www.freaknet.org
#Please read the readme for more info
#!/bin/bash
#pkg2por: PKG to Portage.
#pkg2por is a part of the Emerde system, a port of Gentoo's portage.
#Emerde is ported by AlpT@freaknet.org and the www.freaknet.org
#Please read the readme for more info
ARG1=$1
ARG2=$2
ARG3=$3
#BINPATH=`whereis pkg2por -b | cut -d " " -f 2`
if [ -z $ARG1 ]
then
echo "Usage: pkg2por name [action]"
echo "ex: pkg2por python-2.2.1-i386-1"
echo " pkg2por python-2.2.1-i386-1 REMOVE"
echo "To update all the pkg's db:"
echo "ex: pkg2por ALL"
echo " pkg2por ALL REMOVE"
exit 1
fi
if ( test $(/usr/bin/id -u) != 0)
then
echo "You MUST to be root to run pkg2por"
exit 1
fi
if [ -z $ARG2 ]
then
ACTION="UPDATE"
else
ACTION="REMOVE"
fi
cd /var/log/packages
if [ $ARG1 = "ALL" ]
then
ACTION=$ARG2
if [ "$ACTION" = "REMOVE" ]
then
echo "pkg2por: Removing ALL the portage's db"
else
echo "pkg2por: Updating ALL the portage's db"
echo "pkg2por: it will take a while"
fi
for nlist in `/bin/ls -1 -B /var/log/packages/`
do
pkg2por $nlist $ACTION
done
exit 0
fi
PKGPATH="/var/log/packages/$ARG1"
echo "pkg2por: Loading $ARG1's data"
version=`echo $PKGPATH | cut -d "-" -f 2 | sed -e s/^[a-z]/SECONDDELIMITER/`
if [ $(echo $version | cut -b -15) = "SECONDDELIMITER" ]
then
version=`echo $PKGPATH | cut -d "-" -f -3`
nameinfo=`echo $PKGPATH | cut -d "-" -f -2 | cut -d "/" -f 5`
else
nameinfo=`echo $PKGPATH | cut -d "-" -f -1 | cut -d "/" -f 5`
fi
category=`find /usr/portage/ -name $nameinfo -type d | cut -d "/" -f 4`
name="$nameinfo-$version"
echo "pkg2por: Found $name with $version in $category"
PORPATH="/var/db/pkg/$category/$name"
if [ $ACTION = "REMOVE" ]
then
if ! [ -d $PORPATH ]
then
echo "pkg2por: Nothing to do. Skipping."
exit 0
fi
echo "pkg2por: Removing $name in $category ($PORPATH)"
rm -rf $PORPATH
rmdir --ignore-fail-on-non-empty /var/db/pkg/$category
echo "pkg2por: Done"
exit 0
fi
if ! [ -f $PKGPATH ]
then
echo "pkg2por: $PKGPATH doesn't exist"
exit 1
fi
PORPATH="/usr/portage/$category/$nameinfo/"
if ! test -d $PORPATH
then
if test -d /usr/portage/$category/$nameinfo*
then
PORPATH=`/bin/ls -1 -B -d /usr/portage/$category/$nameinfo*`
nameinfo=`echo $PORPATH | cut -d "/" -f 6 | cut -d "/" -f 5`
name="$nameinfo-$version"
echo "pkg2por: Using $name in $category"
else
echo "pkg2por: !! $name isn't available in portage's db"
exit 1
fi
fi
EBUILD="/usr/portage/$category/$nameinfo/$name.ebuild"
if ! [ -f $EBUILD ]
then
echo "pkg2por: No exact version found in portage's db"
EBUILD=`ls $PORPATH/*.ebuild | grep $version`
if ! [ -z "$EBUILD" ]
then
echo "pkg2por: Using next available version is: `echo $EBUILD | cut -d "/" -f 6-`"
else
echo "pkg2por: No version $version available in portage's db"
exit 1
fi
fi
PORPATH="/var/db/pkg/$category/$name"
echo "pkg2por: Loading db's info"
if ! [ -d $PORPATH ]
then
# if [ -f $EBUILD ]
# then
# echo "pkg2por: $name is already in portage's db. Skipping"
# exit 0
# fi
#else
echo "pkg2por: Creating $PORPATH"
if ! [ -d /var/db/pkg/$category ]
then
mkdir /var/db/pkg/$category
fi
mkdir $PORPATH
fi
cd $PORPATH
#Gets file list from FILE LIST:
if fgrep "\./" $PKGPATH 1> /dev/null 2>&1;
then
TRIGGER="^\.\/"
else
TRIGGER="FILE LIST:"
fi
LIST=`sed -n "/$TRIGGER/,/^$/p" < $PKGPATH | fgrep -v "FILE LIST:" | fgrep -v "install/" | fgrep -v "./" | sort -u`
NUMBER=`date +%s`
#Converting FILE LIST: to CONTENTS
echo "pkg2por: Writing db data in $PORPATH"
rm -f CONTENTS
for single in $LIST
do
if [ -d /$single ]
then
echo "dir /$single" >> CONTENTS
fi
if [ -f /$single ]
then
MD5=`md5sum /$single | cut -d " " -f 1`
echo "obj /$single $MD5 $NUMBER" >> CONTENTS
fi
if [ -h /$single ]
then
LINK=`stat $single -c %N | sed -e s/\`//g -e s/\'//g`
SIZE="`stat $single -c %s`L"
#Bleh, WTF are the first 4 arguments in this string???
echo "sym /$LINK (41471, 130839L, 771L, 1, 0, 0, $SIZE, $NUMBER, $NUMBER, $NUMBER)" >> CONTENTS
fi
if [ -c /$single -o -b /$single ]
then
echo "dev /$single" >> CONTENTS
fi
if [ -p /$single ]
then
echo "fif /$single" >> CONTENTS
fi
done
PF=$name
CATEGORY=$category
CC="gcc"
CXX="g++"
COUNTER=$(expr `cat /var/cache/edb/counter` + 1)
USE=`cat /etc/make.profile/make.defaults | sed -n /^USE=/,/\"/p | sed -e s/USE=\"// -e s/\"// | grep -v "#"`
USE2=`cat /etc/make.conf | sed -n /^USE=/,/\"/p | sed -e s/USE=\"// -e s/\"// | grep -v "#"`
USE="$USE $USE2"
CFLAGS=`cat /etc/make.globals | grep -v CXXFLAGS | sed -n /^CFLAGS=/,/\"/p | sed -e s/CFLAGS=\"// -e s/\"// | grep -v "#"`
CXXFLAGS=`cat /etc/make.globals | grep -v CXXFLAGS | sed -n /^CXXFLAGS=/,/\"/p | sed -e s/CXXFLAGS=\"// -e s/\"// | grep -v "#"`
if [ -z "$CXXFLAGS" ]
then
CXXFLAGS=$CFLAGS
fi
CHOST=`cat /etc/make.conf | sed -n /^CHOST=/,/\"/p | sed -e s/CHOST=\"// -e s/\"// | grep -v "#"`
SLOT=`cat $EBUILD | grep "\<SLOT\>" | sed -n /^SLOT=/,/\"/p | sed -e s/SLOT=\"// -e s/\"// | grep -v "#"`
if [ -z "$SLOT" ]
then
SLOT="0"
fi
DEPEND=`cat $EBUILD | grep "\<DEPEND\>" | sed -n /^DEPEND=/,/\"/p | sed -e s/DEPEND=\"// -e s/\"// | grep -v "#"`
RDEPEND=`cat $EBUILD | grep "\<RDEPEND\>" | sed -n /^RDEPEND=/,/\"/p | sed -e s/RDEPEND=\"// -e s/\"// | grep -v "#"`
PDEPEND=`cat $EBUILD | grep "\<PDEPEND\>" | sed -n /^PDEPEND=/,/\"/p | sed -e s/PDEPEND=\"// -e s/\"// | grep -v "#"`
CDEPEND=`cat $EBUILD | grep "\<CDEPEND\>" | sed -n /^CDEPEND=/,/\"/p | sed -e s/CDEPEND=\"// -e s/\"// | grep -v "#"`
PROVIDE=`cat $EBUILD | grep "\<PROVIDE\>" | sed -n /^PROVIDE=/,/\"/p | sed -e s/PROVIDE=\"// -e s/\"// | grep -v "#"`
LICENSE=`cat $EBUILD | grep "\<LICENSE\>" | sed -n /^LICENSE=/,/\"/p | sed -e s/LICENSE=\"// -e s/\"// | grep -v "#"`
IUSE=`cat $EBUILD | grep "\<IUSE\>" | sed -n /^IUSE=/,/\"/p | sed -e s/IUSE=\"// -e s/\"// | grep -v "#"`
echo "$CBUILD" > CBUILD
echo "$CC" > CC
echo "$CDEPEND" > CDEPEND
echo "$CFLAGS" > CFLAGS
echo "$CHOST" > CHOST
echo "$CXX" > CXX
echo "$CXXFLAGS" > CXXFLAGS
echo "$DEPEND" > DEPEND
echo "$IUSE" > IUSE
echo "$LICENSE" > LICENSE
echo "$CATEGORY" > CATEGORY
echo "$PDEPEND" > PDEPEND
echo "$PF" > PF
echo "$PROVIDE" > PROVIDE
echo "$RDEPEND" > RDEPEND
echo "$SLOT" > SLOT
echo "$USE" > USE
echo "$COUNTER" > COUNTER
set | bzip2 -9 - > environment.bz2
cp $EBUILD .
echo $COUNTER > /var/cache/edb/counter
echo "pkg2por: Done"