Ondrej wrote:

> Nice thing about this is that there is no database, nothing. Just
> plain files, that
> can be fixed by hand.
>
> How would portage improve this?

Portage is just editable text files too.  I do not have any experience
with Debian so it may also do the following things I describe below.
If a Debian approach does things like this too, that would be great
:-)

Portage vs. spkg:

When I look at the instructions for creating a spkg:

http://www.sagemath.org/doc/html/prog/node24.html

The first thing that catches my eye is

"(b)
    Put your files in that directory."

So where do the files come from?  I took a spkg at random (readline),
extracted it, and tried to find out where to obtain its source code
from.  Here is all the documentation that the readline spkg contained:

"$ cat SPKG.txt
Deleted some files from the doc directory from the standard distro,
since it took tons of space;
didn't delete anything else."

I am not sure who last worked on readline because it does not say.  If
someone gave me the task of updating this spkg, I guess I would start
googling to find out were to obtain the source code.

In contrast to this, a portage package contains a script (called an
ebuild) that automatically downloads the source code needed to build
an application from wherever it lives on the Internet, checks the
archive's integrity, unarchives it, applies patches, builds it, tests
it, and installs it.  Beyond this, all packages that the package
depends on are checked to make sure they are present and if they are
not, each one is installed first using the same mechanism.

Here is the ebuild script for readline:

==== readline-5.2_p7.ebuild ====
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-libs/readline/readline-5.2_p7.ebuild,v
1.9 2007/12/11 23:59:41 vapier Exp $

inherit eutils multilib toolchain-funcs flag-o-matic

# Official patches
# See ftp://ftp.cwru.edu/pub/bash/readline-5.1-patches/
PLEVEL=${PV##*_p}
MY_PV=${PV/_p*}
MY_P=${PN}-${MY_PV}

DESCRIPTION="Another cute console display library"
HOMEPAGE="http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html";
SRC_URI="mirror://gnu/readline/${MY_P}.tar.gz
        $(for ((i=1; i<=PLEVEL; i++)); do
                printf
'ftp://ftp.cwru.edu/pub/bash/readline-%s-patches/readline%s-%03d\n' \
                        ${MY_PV} ${MY_PV/\.} ${i}
                printf
'mirror://gnu/bash/readline-%s-patches/readline%s-%03d\n' \
            ${MY_PV} ${MY_PV/\.} ${i}
        done)"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="alpha amd64 arm hppa ia64 m68k mips ppc ppc64 s390 sh sparc
~sparc-fbsd x86 ~x86-fbsd"
IUSE=""

# We must be certain that we have a bash that is linked
# to its internal readline, else we may get problems.
RDEPEND=">=sys-libs/ncurses-5.2-r2"
DEPEND="${RDEPEND}
        >=app-shells/bash-2.05b-r2"

S=${WORKDIR}/${MY_P}

src_unpack() {
        unpack ${MY_P}.tar.gz

        cd "${S}"
        # Official patches
        local i
        for ((i=1; i<=PLEVEL; i++)); do
                epatch "${DISTDIR}"/${PN}${MY_PV/\.}-$(printf '%03d' ${i})
        done
        epatch "${FILESDIR}"/${PN}-5.0-no_rpath.patch
        epatch "${FILESDIR}"/${PN}-5.2-rlfe-build.patch #151174
        epatch "${FILESDIR}"/${PN}-5.1-rlfe-uclibc.patch
        epatch "${FILESDIR}"/${PN}-5.1-fbsd-pic.patch

        ln -s ../.. examples/rlfe/readline

        # force ncurses linking #71420
        sed -i -e 's:^SHLIB_LIBS=:SHLIB_LIBS=-lncurses:'
support/shobj-conf || die "sed"
}

src_compile() {
        append-flags -D_GNU_SOURCE

        # the --libdir= is needed because if lib64 is a directory, it
will default        # to using that... even if CONF_LIBDIR isnt set or
we're using a version
        # of portage without CONF_LIBDIR support.
        econf --with-curses --libdir=/usr/$(get_libdir) || die
        emake || die

        if ! tc-is-cross-compiler; then
                cd examples/rlfe
                econf || die
                emake || die "make rlfe failed"
        fi
}

src_install() {
        emake DESTDIR="${D}" install || die
        dodir /$(get_libdir)

        mv "${D}"/usr/$(get_libdir)/*.so* "${D}"/$(get_libdir)
        chmod a+rx "${D}"/$(get_libdir)/*.so*

        # Bug #4411
        gen_usr_ldscript libreadline.so
        gen_usr_ldscript libhistory.so

        if ! tc-is-cross-compiler; then
                dobin examples/rlfe/rlfe || die
        fi

        dodoc CHANGELOG CHANGES README USAGE NEWS
        docinto ps
        dodoc doc/*.ps
        dohtml -r doc
}

pkg_preinst() {
        preserve_old_lib /$(get_libdir)/lib{history,readline}.so.4 #29865
}

pkg_postinst() {
        preserve_old_lib_notify /$(get_libdir)/lib{history,readline}.so.4
}

====

All ebuild scripts adhere to a well-defined specification
(http://www.gentoo.org/proj/en/devrel/handbook/handbook.xml?part=2&chap=1)
so a developer can look at any ebuild script in the portage tree and
see the exact same format.  For example, a short description of the
package is present along with the homepage of the project, the URI
from where the source can be downloaded, and flags which indicate
which architectures the package will work with.

Beyond this, all portage packages have a ChangeLog file which contains
all of the work that has been done on the package since it was first
put in the tree, who did the work, and when it was done:

==== /usr/portage/sys-libs/readline/ChangeLog ===
# ChangeLog for sys-libs/readline
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
# $Header: /var/cvsroot/gentoo-x86/sys-libs/readline/ChangeLog,v 1.108
2007/09/29 05:03:43 jer Exp $

  29 Sep 2007; Jeroen Roovers <[EMAIL PROTECTED]> readline-5.2_p7.ebuild:
  Stable for HPPA (bug #194013).

  28 Sep 2007; nixnut <[EMAIL PROTECTED]> readline-5.2_p7.ebuild:
  Stable on ppc wrt bug 194013

  28 Sep 2007; Ra��l Porcel <[EMAIL PROTECTED]> readline-5.2_p7.ebuild:
  alpha/ia64/x86 stable wrt #194013

  28 Sep 2007; Ferris McCormick <[EMAIL PROTECTED]> readline-5.2_p7.ebuild:
  Sparc stable --- Bug #194013

  28 Sep 2007; Christoph Mende <[EMAIL PROTECTED]> readline-5.2_p7.ebuild:
  Stable on amd64 wrt bug #194013

  28 Sep 2007; Joshua Kinard <[EMAIL PROTECTED]> readline-5.2_p7.ebuild:
  Stable on mips, per #194013.
<snip>
----

If someone gave me the task of updating this portage-based package to
the latest version, I would have a good idea of where to start even if
I had never seen this package before.

Anyway, the main thing I like about the portage approach is that it is
very systematic.  If a Debian approach is systematic like this, that
would be great too.

From my point of view, simple = a well thought out system :-)

Ted

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to