Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
An Honest Comparison of Ports and Portage
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
Hydralisk
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2003
Posts: 83

PostPosted: Sat Sep 13, 2003 6:21 pm    Post subject: An Honest Comparison of Ports and Portage Reply with quote

I'm sure that everyone, Larry the Cow included, knows that the Gentoo Portage system finds its roots with FreeBSD's ports, which is over ten years old. I've asked people on both sides of the river what the differences are, but I've recieved varied responses from either side. I decided that the only way to find out what the differences are, and which one is better, is to try FreeBSD for a month or two.

That time has passed, and now I will try to outline the relative advantages and disadvantages of Ports and Portage. Although, I have to admit, I'm currently typing this in vim on my Gentoo system.

First, a quick overview of Ports is in order. Think of it as Portage with different commands, and a different syntax for ebuilds. Instead of being written in BASH like ebuilds, FreeBSD ports are written in (BSD, not GNU) Makefile syntax. Here is, for example, the ports makefile for /usr/ports/archivers/zip (this is BSD-licensed code):

Code:

# New ports collection makefile for:    zip
# ftp://ftp.info-zip.org/pub/infozip/Info-ZIP.html
# Date created:      22 Dec 1994
# Whom:         ache
#
# $FreeBSD: ports/archivers/zip/Makefile,v 1.27 2003/03/08 22:55:34 kris Exp $
#

PORTNAME=   zip
PORTVERSION=   2.3
PORTREVISION=   1
CATEGORIES=   archivers
MASTER_SITES=   ftp://ftp.uu.net/pub/archiving/zip/src/ \
      ${MASTER_SITE_TEX_CTAN:S,%SUBDIR%,tools/zip/info-zip/src/,}
ZCRYPT_SRC=   zcrypt29-exportable.zip
DISTFILES=   zip23${EXTRACT_SUFX} ${ZCRYPT_SRC}

MAINTAINER=   ache@FreeBSD.org
COMMENT=   Create/update ZIP files compatible with pkzip

EXTRACT_DEPENDS=unzip:${PORTSDIR}/archivers/unzip

WRKSRC=      ${WRKDIR}/${PORTNAME}-${PORTVERSION}
EXTRACT_ONLY=   zip23${EXTRACT_SUFX}
MAKEFILE=   unix/Makefile
MAKE_FLAGS=   LOCAL_ZIP="-DUSE_CRYPT" -f
ALL_TARGET=   generic
MAN1=      zip.1

post-extract:
   unzip -q -aa -o ${_DISTDIR}${ZCRYPT_SRC} -d ${WRKSRC} -x WHERE

do-install:
.for file in zip zipcloak zipnote zipsplit
   ${INSTALL_PROGRAM} ${WRKSRC}/${file} ${PREFIX}/bin
.endfor
   ${INSTALL_MAN} ${WRKSRC}/man/zip.1 ${PREFIX}/man/man1

.include <bsd.port.mk>


That looks very similar to your average ebuild, but you can definitely see the evolutions Portage made (this is GPL-licensed code):

Code:

# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /home/httpd/cvsroot/gentoo-x86/app-arch/zip/zip-2.3-r2.ebuild,v 1.5 2003/09/05 22:49:03 msterret Exp $

IUSE="crypt"

DESCRIPTION="Info ZIP (encryption support)"
SRC_URI="http://www.ibiblio.org/pub/Linux/distributions/gentoo/distfiles/${PN}23.tar.gz
        crypt? ( ftp://ftp.icce.rug.nl/infozip/src/zcrypt29.zip )"
HOMEPAGE="ftp://ftp.freesoftware.com/pub/infozip/Zip.html"

SLOT="0"
KEYWORDS="~x86 ~ppc ~sparc ~alpha ~amd64"
LICENSE="Info-ZIP"

DEPEND="crypt? ( app-arch/unzip )"

src_unpack() {
        unpack ${A}
        if [ "`use crypt`" ]; then
                mv -f crypt.h ${S}
                mv -f crypt.c ${S}
        fi
        cd ${S}/unix
        cp Makefile Makefile.orig
        sed -e "s:-O2:${CFLAGS}:" Makefile.orig > Makefile
}

src_compile() {
        emake -f unix/Makefile generic_gcc || die
}

src_install() {
        dobin zip zipcloak zipnote zipsplit
        doman man/zip.1
        dodoc BUGS CHANGES LICENSE MANUAL README TODO WHATSNEW WHERE
}


If I wanted to install this port, I would type 'portinstall zip' (or 'portinstall archives/zip'), and the package would be automagically installed for me similar to what would happen if I typed 'emerge zip'.

Now, let's move on to the relative advantages of each system.

* In sheer number of Ports/Ebuilds, FreeBSD wins. FreeBSD passed 9,000 ports a month ago, and Gentoo was somewhere around 4,500 the last time I checked. However, Gentoo has many ebuilds that aren't in Ports, and FreeBSD has many ports that aren't in Portage. FreeBSD and Gentoo are both kept up to date similarly. However, FreeBSD had both KDE 3.1.3 and GNOME 2.4 in its ports tree before Gentoo.

* In ease of installing packages, Gentoo wins here. While the commands are very similar and what happens when you type them is almost identical, the deciding factor is the Gentoo --pretend option. It is vastly superior to the FreeBSD counterpart.

* In ease of removing packages, FreeBSD has a huge edge on Gentoo. This is because Portage completely ignores dependencies when you emerge --unmerge something. I could emerge --unmerge kdelibs and Gentoo will orphan the other KDE packages I just spend 8 hours compiling without a second thought. FreeBSD, on the other hand, has something called reverse dependencies. If I 'pkg_deinstall -r gtk-2.2.4', FreeBSD, will remove all packages that depend on GTK2 (GNOME2, gvim, galeon, etc.). This makes tasks that are incredibly difficult on Gentoo, such as removing GNOME, incredibly easy on FreeBSD. Reverse dependencies are, of course, my most-wanted new feature in Portage.

* When we consider updating the ports/portage tree, it is essentially a comparison of rsync and cvsup. The primary method of updating the ports tree in FreeBSD is cvsup, and Gentoo uses rsync. Comparing them would take another article, but the short story is that cvsup is superior to rsync. Gentoo makes it easier to actually give the command to upgrade the tree, by building it into emerge (i.e. 'emerge rsync'). With FreeBSD, I have to call it externally (i.e. 'cvsup -g -L 2 /root/ports-sup').

CVSup vs. Rsync was discussed in the December 23, 2002 GWN:

Quote:

There has been some discussion in the Gentoo developer community about migrating away from Portage's dependency on rsync and instead utilizing CVSup. Currently used in FreeBSD's ports system, CVSup offers a few distinct advantages, as well as challenges, over rsync:

Local changes will be preserved if you want them to, just like anoncvs. Anyone who's ever had their package.mask file overwritten by an emerge rsync will appreciate this feature.

CVSup is faster and more efficient than rsync. This means that CVSup can improve the efficiency of our Portage mirroring system.

CVSup's threaded design allows for file transfer begin almost immediately, unlike rsync which must build a complete file list first. Surprisingly, CVSup uses the rsync algorithm (which is very efficient) internally to synchronize individual files, but uses a better approach than rsync when coordinating the updates of large numbers of files.

CVSup is written in Modula 3, which means that transitioning to CVSup will require some non-trivial steps to ensure that we have proper Modula 3 support on all architectures.

CVSup also has the added psychological benefit of making FreeBSD users feel more at home.


* Once you've updated the ports/portage tree, you have to update the actual packages on your system. I would say this is a draw, as I have never had problems using 'emerge -Dup world' or 'portupgrade -Rva', respectively, on either system. However, I think Gentoo deserves a win here because it's emerge -p flag is more useful (and more colorful :) ) than FreeBSD's portupgrade -n flag.

* In support of Java packages, Gentoo easily beats FreeBSD because of java-config. This allows much easier, on-the-fly, switching of JVMs than anything currently on FreeBSD. The current FreeBSD java-config is unnacceptable. (I read somewhere, when looking into this, that the FreeBSD Java people were considering writing a java-config similar to Gentoo's.)

* Finally, when it comes to installing packages (i.e. precompiled ports or ebuilds), FreeBSD wins. For every release (and periodically in the interim), FreeBSD builds packages for just about every port in the tree. These packages can be install using 'pkg_add <package-file>' or 'pkg_add -r <package-name>'. The latter automatically downloads the package from a FreeBSD ftp mirror.

Overall, I don't think I can decide. Portage and Ports are both great systems; I would surely use one if the other did not exist. When (hopefully, not if) Portage gets reverse dependency handling (qpkg --query-deps and emerge depclean do not count), Portage would win decisively over Ports.
Back to top
View user's profile Send private message
drjimmy42
Guru
Guru


Joined: 03 Feb 2003
Posts: 512
Location: Nashua, NH

PostPosted: Sat Sep 13, 2003 6:39 pm    Post subject: Reply with quote

Wow, great article. Very informative.
Back to top
View user's profile Send private message
rogue
Tux's lil' helper
Tux's lil' helper


Joined: 15 May 2002
Posts: 99
Location: Falls Church, VA

PostPosted: Sat Sep 13, 2003 6:44 pm    Post subject: Reply with quote

good post. I used to run OpenBSD (might switch my server back to it if I ever get it out from behind my firewall) which uses the ports system. it may be because I've used gentoo for a bit longer, but I've found the portage system to be more "friendlier" to use then the ports system.
_________________
(rob)
Back to top
View user's profile Send private message
lghman
Guru
Guru


Joined: 29 Nov 2002
Posts: 548
Location: Florida

PostPosted: Sat Sep 13, 2003 7:13 pm    Post subject: Reply with quote

Very well written and informative article. :D

--sonik
_________________
"What a distressing contrast there is between the radiant intelligence of a child and the feeble mentality of the average adult" --Freud
Back to top
View user's profile Send private message
scriptkiddie
l33t
l33t


Joined: 30 Mar 2003
Posts: 955

PostPosted: Sat Sep 13, 2003 7:15 pm    Post subject: Reply with quote

I use to have a freeBSD system as a sever before I used Tru64 Unix and I found ports to be a great program, although when I found gentoo and debian, I began to like apt-get and portage a lot more :D
Back to top
View user's profile Send private message
pilla
Bodhisattva
Bodhisattva


Joined: 07 Aug 2002
Posts: 7729
Location: Underworld

PostPosted: Sat Sep 13, 2003 9:18 pm    Post subject: Reply with quote

Moving to Gentoo Chat.
_________________
"I'm just very selective about the reality I choose to accept." -- Calvin
Back to top
View user's profile Send private message
Sir_Stinksalot
Apprentice
Apprentice


Joined: 26 Jul 2002
Posts: 195
Location: Behind you. BOO!!!

PostPosted: Sat Sep 13, 2003 9:25 pm    Post subject: Reply with quote

I have never used freebsd but have heard of the portage/ports relationship. I am just curious though are the peeps in charge working on a better unmerge system for portage. I have found that gentoo compared to other linux distros is the easiest to get up to date packages. I liked apt-get but sometimes tracking down a server with a particular package could be like searching for a dependancy in redhat. I have used the unmerge option a few times but not on anything major that may be intertwined with other packages. So an improved unmerge option would make me want nothing and only be blessed by the future improvements.

BTW I love gentoo and probably shouldn't want more but uninstalling a package with intertwined deps would be cool.

Since I am writing this there are two things I would like to see but ain't complaining about. One would be to see an option in search that would allow for exact match only. Such as emerge -s gnome only coming up with gnome or something that starts with gnome or all packages coming up alphabetical order regardless of the category it resides in. And two it would be nice to be able to see all the packages in a particular category without going to the web.

If either of these suggestions already exist please share them with me. If you like my suggestions then please pass them on to somone who has the ability toi make them work
Back to top
View user's profile Send private message
arand
Apprentice
Apprentice


Joined: 22 Apr 2003
Posts: 215

PostPosted: Sat Sep 13, 2003 9:34 pm    Post subject: Reply with quote

Hydralisk,

Excellent write up and very informative. One question. Was there an equivlent of the use varibles in ports?

Thanks


Last edited by arand on Sat Sep 13, 2003 10:43 pm; edited 1 time in total
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Sat Sep 13, 2003 10:00 pm    Post subject: Re: An Honest Comparison of Ports and Portage Reply with quote

Good writeup. I'm not surprised to see that each system has advantages over the other. The primary area I see Portage winning in the not too distant future is volunteer support. Linux has managed to attract more users, so I think its safe to say that Gentoo/Portage might be the beneficiary of more input. For not being very old, Portage has nearly matched or beaten Ports (Ports being Portage's mentor certainly helped).

Hydralisk wrote:
* In sheer number of Ports/Ebuilds, FreeBSD wins. FreeBSD passed 9,000 ports a month ago, and Gentoo was somewhere around 4,500 the last time I checked.
If w.g.o is current (not sure how its updated), there are currently 5356 packages (not nitpicking ;)). I don't expect another 5000 packages in the same timeframe, but it will be interesting to see how the number of packages increases.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
gsfgf
Veteran
Veteran


Joined: 08 May 2002
Posts: 1266

PostPosted: Sat Sep 13, 2003 10:38 pm    Post subject: Reply with quote

Does BSD haven anything like USE?
_________________
Aim:gsfgf0
Back to top
View user's profile Send private message
Hydralisk
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2003
Posts: 83

PostPosted: Sat Sep 13, 2003 10:42 pm    Post subject: Reply with quote

arand wrote:
Hydralisk,

Excellent right up and very informative. One question. Was there an equivlent of the use varibles in ports?

Thanks


There is an equivalent of USE variables in FreeBSD ports. For instance, editors/vim (or app-editors/vim in portage) can be built with either GTK1 or GTK2, and with our without X11.

If I want to build it with GTK2: I put the following line at the end of make.conf:

Code:

# /etc/make.conf
# ...
WITH_GTK2=yes


If I want to build without X11 (i.e. no gvim), I put this at the bottom instead:

Code:

# /etc/make.conf
...
WITHOUT_X11=yes


Alternatively, I can define those as environment variables (like defining USE on the command line).
Back to top
View user's profile Send private message
kesuari
n00b
n00b


Joined: 18 May 2003
Posts: 63

PostPosted: Sun Sep 14, 2003 2:38 am    Post subject: Reply with quote

Good post. More bang for your buck than my comparison with Debian :)

-- A FreeBSD -> Gentoo convert.
Back to top
View user's profile Send private message
ba747heavy
Apprentice
Apprentice


Joined: 11 Aug 2003
Posts: 216
Location: New Mexico, USA

PostPosted: Sun Sep 14, 2003 5:14 am    Post subject: Reply with quote

Excellent article!
_________________
Fred Clausen
"leet [speak] is a cry for help from a shallow mind" - Doomwookie Jan 05
Back to top
View user's profile Send private message
choco
n00b
n00b


Joined: 10 Jun 2003
Posts: 49
Location: Jackson, MI

PostPosted: Mon Sep 15, 2003 1:40 am    Post subject: Reply with quote

Sir_Stinksalot:

1. The -s parameter of emerge takes a regular expression, so doing an
Code:
 emerge -s '^gnome'
would show only the ebuilds whose names start with gnome. And
Code:
 emerge -s '^gnome$'
would do an exact search for 'gnome'. '^' and '$' stand for the start and end of the ebuild name, respectively.

2. Since the ebuild files are grouped using directories in portage, to see all the files in category 'app-office' you could just go to /usr/portage/app-office and do an ls. On the other hand, I believe people have made utilities to browse the portage tree. 'pbrowser' is one of them, that I found in the forums but couldn't get to work for me.

Nothing like a "fair and balanced" article. Good read.
_________________
Who would win in a fight between Sandman and Clayface?
Back to top
View user's profile Send private message
mezz
Tux's lil' helper
Tux's lil' helper


Joined: 01 Jun 2002
Posts: 111

PostPosted: Mon Sep 15, 2003 1:59 am    Post subject: Reply with quote

Well written, I like it..

Umm, what about the controls and flexible? For example, in FreeBSD I can just put many different of varbles in the make.conf. For example, I can put where I want them to be install in like /opt instead /usr/local (prefix).. Can it be done in Portage without have to edit each ebuilds? I had to ask, because last time I tried Gentoo was like back in 1.2 or whatever, I don't remember what version.
Back to top
View user's profile Send private message
Vancouverite
Apprentice
Apprentice


Joined: 28 Sep 2002
Posts: 162
Location: Vancouver, Canada

PostPosted: Mon Sep 15, 2003 7:19 am    Post subject: Reply with quote

Great comparison of ports and portage! Now how do I get XMMS on FreeBSD to stop skipping when I do a whole bunch of things at once? The Con Kolivas patches do this for me on Linux, what settings am I missing on FreeBSD?
_________________
Screenshot
Back to top
View user's profile Send private message
charlieg
Advocate
Advocate


Joined: 30 Jul 2002
Posts: 2149
Location: Manchester UK

PostPosted: Mon Sep 15, 2003 8:58 am    Post subject: Reply with quote

This should be moved to 'Documentation, Tips & Tricks' as it's essentially a nice piece of Documentation.
_________________
Want Free games?
Free Gamer - open source games list & commentary

Open source web-enabled rich UI platform: Vexi
Back to top
View user's profile Send private message
asimon
l33t
l33t


Joined: 27 Jun 2002
Posts: 979
Location: Germany, Old Europe

PostPosted: Mon Sep 15, 2003 3:36 pm    Post subject: Reply with quote

FreeBSD uses nicer variable names in their ports, although I don't understand why they use WRKDIR instead of WORKDIR etc.

Gentoo's one-letter variables A, S, P, etc. are terrible.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum