[pacman-dev] Inconsistency of makepkg's activities in devel_check()
Hello developers. :-)
I noticed that makepkg handles Mercurial repositories differently from
CVS/SVN/Bazaar/etc. With the others, $newpkgver is either computed using
$(date ...) or retrieved from the online repository and the PKGBUILD is
responsible for retrieving the contents as it is demonstrated here:
http://wiki.archlinux.org/index.php/Arch_CVS_%6_SVN_PKGBUILD_guidelines.
Only with hg the repository is automatically cloned, pulled and updated:
- - - - - makepkg, in devel_check(), lines 1211 and following - - - - -
if [ -n "${_darcstrunk}" -a -n "${_darcsmod}" ] ; then
[ $(type -p darcs) ] || return 0
msg "$(gettext "Determining latest darcs revision...")"
newpkgver=$(date +%Y%m%d)
elif [ -n "${_cvsroot}" -a -n "${_cvsmod}" ] ; then
[ $(type -p cvs) ] || return 0
msg "$(gettext "Determining latest cvs revision...")"
newpkgver=$(date +%Y%m%d)
elif [ -n "${_gitroot}" -a -n "${_gitname}" ] ; then
[ $(type -p git) ] || return 0
msg "$(gettext "Determining latest git revision...")"
newpkgver=$(date +%Y%m%d)
elif [ -n "${_svntrunk}" -a -n "${_svnmod}" ] ; then
[ $(type -p svn) ] || return 0
msg "$(gettext "Determining latest svn revision...")"
newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p')
elif [ -n "${_bzrtrunk}" -a -n "${_bzrmod}" ] ; then
[ $(type -p bzr) ] || return 0
msg "$(gettext "Determining latest bzr revision...")"
newpkgver=$(bzr revno ${_bzrtrunk})
elif [ -n "${_hgroot}" -a -n "${_hgrepo}" ] ; then
[ $(type -p hg) ] || return 0
msg "$(gettext "Determining latest hg revision...")"
if [ -d ./src/$_hgrepo ] ; then
cd ./src/$_hgrepo
hg pull
hg update
else
[[ ! -d ./src/ ]] && mkdir ./src/
hg clone $_hgroot/$_hgrepo ./src/$_hgrepo
cd ./src/$_hgrepo
fi
newpkgver=$(hg tip --template "{rev}")
cd ../../
fi
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This behaviour seems to be widely unknown, which leads to a lot of
PKGBUILDS pulling/updating twice - first automatically and then again in
build():
http://aur.archlinux.org/packages/aldrin-hg/aldrin-hg/PKGBUILD
http://aur.archlinux.org/packages/audacious-hg/audacious-hg/PKGBUILD
...
I just wonder why hg is handled differently and whether it wouldn't be
better
a) also to clone/update/pull/... svn/bzr/cvs/etc. in devel_check() -
cf. http://wiki.archlinux.org/index.php/The_Arch_Way regarding
automation
or b) to remove devel_check() entirely, but leave devel_update() and let
the PKGBUILD handle such changes, eg. like this:
- - - complete example PKGBUILD in case anyone wants to try it - - -
# Contributor: Artyom Smirnov
Hello again. Here is a patch that implements the third approach (a function called "update"). I kept the rest of devel_check(), so you can test it without breaking support for other PKGBUILDS. Benjamin Richter - - - - - - 0001-makepkg-call-update-in-devel_check.patch - - - - - -
From 21ee2c4c75e7618b2d34057900e8112259e54c9c Mon Sep 17 00:00:00 2001 From: Benjamin Richter
Date: Mon, 17 Aug 2009 13:09:54 +0200 Subject: [PATCH] makepkg: call update() in devel_check()
This allows the PKGBUILD to define a function update() which is
called in devel_check(). Thus, svn/cvs/...-PKGBUILDS can specify
by themselves how the package version should be computed and other
SCM systems can be used easily.
It is also possible to retrieve the latest revision in update()
like it already happens with hg repositories when $_hgroot and
$_hgrepo are set.
Signed-off-by: Benjamin Richter
On Sun, Aug 16, 2009 at 8:58 PM, Benjamin
Richter
Hello developers. :-)
I noticed that makepkg handles Mercurial repositories differently from CVS/SVN/Bazaar/etc. With the others, $newpkgver is either computed using $(date ...) or retrieved from the online repository and the PKGBUILD is responsible for retrieving the contents as it is demonstrated here: http://wiki.archlinux.org/index.php/Arch_CVS_%6_SVN_PKGBUILD_guidelines.
Only with hg the repository is automatically cloned, pulled and updated:
I noticed this inconsistency just recently looking at makepkg code, and I don't like it either. I quickly looked at your proposed solutions and I am not convinced (or maybe the first one a) ). My suggestions : 1) cloning in all cases (like a) ) one big? disadvantage is that all existing scm PKGBUILDs will have to be converted and I wonder if this method might be too restrictive in some cases, where someone want to clone a repo in a specific way. 2) removing hg / mercurial support This is the easiest one :D 3) implement a way to get the version with hg without cloning, like all other scm already have This is the nicest / most difficult (maybe impossible?) one :)
On Mon, Aug 17, 2009 at 9:40 AM, Xavier
On Sun, Aug 16, 2009 at 8:58 PM, Benjamin Richter
wrote: Hello developers. :-)
I noticed that makepkg handles Mercurial repositories differently from CVS/SVN/Bazaar/etc. With the others, $newpkgver is either computed using $(date ...) or retrieved from the online repository and the PKGBUILD is responsible for retrieving the contents as it is demonstrated here: http://wiki.archlinux.org/index.php/Arch_CVS_%6_SVN_PKGBUILD_guidelines.
Only with hg the repository is automatically cloned, pulled and updated:
I noticed this inconsistency just recently looking at makepkg code, and I don't like it either. I quickly looked at your proposed solutions and I am not convinced (or maybe the first one a) ).
My suggestions : 1) cloning in all cases (like a) ) one big? disadvantage is that all existing scm PKGBUILDs will have to be converted and I wonder if this method might be too restrictive in some cases, where someone want to clone a repo in a specific way.
Someone just proposed a patch to actually make GIT more like Hg (http://bugs.archlinux.org/task/15895). I'm not a fan of needing a full clone to get a version, but we could make it a bit more structured and make a specific function like fetch() fire before we get a version number? We already have build() and package()... -Dan
Dan McGee wrote:
On Mon, Aug 17, 2009 at 9:40 AM, Xavier
wrote: On Sun, Aug 16, 2009 at 8:58 PM, Benjamin Richter
wrote: Hello developers. :-)
I noticed that makepkg handles Mercurial repositories differently from CVS/SVN/Bazaar/etc. With the others, $newpkgver is either computed using $(date ...) or retrieved from the online repository and the PKGBUILD is responsible for retrieving the contents as it is demonstrated here: http://wiki.archlinux.org/index.php/Arch_CVS_%6_SVN_PKGBUILD_guidelines.
Only with hg the repository is automatically cloned, pulled and updated:
I noticed this inconsistency just recently looking at makepkg code, and I don't like it either. I quickly looked at your proposed solutions and I am not convinced (or maybe the first one a) ).
My suggestions : 1) cloning in all cases (like a) ) one big? disadvantage is that all existing scm PKGBUILDs will have to be converted and I wonder if this method might be too restrictive in some cases, where someone want to clone a repo in a specific way.
Someone just proposed a patch to actually make GIT more like Hg (http://bugs.archlinux.org/task/15895). I'm not a fan of needing a full clone to get a version, but we could make it a bit more structured and make a specific function like fetch() fire before we get a version number? We already have build() and package()...
And likely check() in the future... (http://bugs.archlinux.org/task/15145). Adding a fetch() function would allow us to easily fix FS#13727 (http://bugs.archlinux.org/task/13727), where devel_update() is run before checking makedepends. From experience, someone needs to provide a PKGBUILD prototype for us to discuss or this suggestion would go nowhere... Allan
On Tue, Aug 18, 2009 at 12:22 PM, Allan McRae
And likely check() in the future... (http://bugs.archlinux.org/task/15145). Adding a fetch() function would allow us to easily fix FS#13727 (http://bugs.archlinux.org/task/13727), where devel_update() is run before checking makedepends. From experience, someone needs to provide a PKGBUILD prototype for us to discuss or this suggestion would go nowhere...
How do we deal with the newpkgver stuff? should the fetch function overrides pkgver itself or something? This is weird..
Am Montag, den 17.08.2009, 16:40 +0200 schrieb Xavier:
2) removing hg / mercurial support This is the easiest one :D :-/
3) implement a way to get the version with hg without cloning, like all other scm already have This is the nicest / most difficult (maybe impossible?) one :) Indeed. It is nice. But not impossible :-D
newpkgver=$(hg incoming -n "${_hgroot}/${_hgrepo}" -l 1 --template '{rev}') The local repository has to be created first (hg init is sufficient, _no_ clone needed!) and this line has to be executed in the local repository. Benjamin Richter
Am Montag, den 17.08.2009, 22:56 +0200 schrieb Benjamin Richter:
newpkgver=$(hg incoming -n "${_hgroot}/${_hgrepo}" -l 1 --template '{rev}')
PS: Unfortunately this still downloads all changes (like clone) - it just throws them away :-(
participants (4)
-
Allan McRae
-
Benjamin Richter
-
Dan McGee
-
Xavier