[pacman-dev] [PATCH] makepkg: Add warning if VCS tool is not present when determining latest VCS revision
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com> --- scripts/makepkg.sh.in | 32 +++++++++++++++++++++++++------- 1 files changed, 25 insertions(+), 7 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 4e15d54..8d082a2 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1538,30 +1538,48 @@ devel_check() { # This will only be used on the first call to makepkg; subsequent # calls to makepkg via fakeroot will explicitly pass the version # number to avoid having to determine the version number twice. - # Also do a brief check to make sure we have the VCS tool available. + # Also do a check to make sure we have the VCS tool available. oldpkgver=$pkgver if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then - type -p darcs >/dev/null || return 0 + if ! type -p darcs >/dev/null; then + warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "darcs" "darcs" + return 0 + fi msg "$(gettext "Determining latest %s revision...")" 'darcs' newpkgver=$(date +%Y%m%d) elif [[ -n ${_cvsroot} && -n ${_cvsmod} ]] ; then - type -p cvs >/dev/null || return 0 + if ! type -p cvs >/dev/null; then + warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "cvs" "cvs" + return 0 + fi msg "$(gettext "Determining latest %s revision...")" 'cvs' newpkgver=$(date +%Y%m%d) elif [[ -n ${_gitroot} && -n ${_gitname} ]] ; then - type -p git >/dev/null || return 0 + if ! type -p git >/dev/null; then + warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "git "git" + return 0 + fi msg "$(gettext "Determining latest %s revision...")" 'git' newpkgver=$(date +%Y%m%d) elif [[ -n ${_svntrunk} && -n ${_svnmod} ]] ; then - type -p svn >/dev/null || return 0 + if ! type -p svn >/dev/null; then + warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "svn" "svn" + return 0 + fi msg "$(gettext "Determining latest %s revision...")" 'svn' newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p') elif [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] ; then - type -p bzr >/dev/null || return 0 + if ! type -p bzr >/dev/null; then + warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "bzr" bzr" + return 0 + fi msg "$(gettext "Determining latest %s revision...")" 'bzr' newpkgver=$(bzr revno ${_bzrtrunk}) elif [[ -n ${_hgroot} && -n ${_hgrepo} ]] ; then - type -p hg >/dev/null || return 0 + if ! type -p hg >/dev/null; then + warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "hg" "hg" + return 0 + fi msg "$(gettext "Determining latest %s revision...")" 'hg' if [[ -d ./src/$_hgrepo ]] ; then cd ./src/$_hgrepo -- 1.7.5.4
On 25/06/11 14:31, Eric Bélanger wrote:
Signed-off-by: Eric Bélanger<snowmaniscool@gmail.com>
Signed-off-by: Allan However, note this is one of the crap things about the current VCS implementation. devel_check is run before the installation of makedepends so this many result in people getting warnings when running makepkg for the first time but not the second... Apart from the planned (for long a time) rewrite of all of this, I'm not sure there is much else to do here. Allan
On Sat, Jun 25, 2011 at 6:18 AM, Allan McRae <allan@archlinux.org> wrote:
On 25/06/11 14:31, Eric Bélanger wrote:
Signed-off-by: Eric Bélanger<snowmaniscool@gmail.com>
Signed-off-by: Allan
However, note this is one of the crap things about the current VCS implementation. devel_check is run before the installation of makedepends so this many result in people getting warnings when running makepkg for the first time but not the second...
Yeah. My initial intention was to move these checks in the check_software function but, after that patch was done, I realized that devel_check would fail if the VCS tool was missing. Changing the warning message to error would've make it imposible to build these package in a clean chroot so that wasn't a good solution. In the end, I decided to make this patch so my work woudn't be lost. I also checked the VCS bugs and it's messy.
Apart from the planned (for long a time) rewrite of all of this, I'm not sure there is much else to do here.
I might be overlooking something, but why don't we just install the required VCS package? Instead of the warnings in my patch, we could have a message like "Installing git to determine latest git revision" then do a 'pacman -S git' and so forth. As the VCS tool will be in the makedepends anyway the inconvenience of that method would be minor, if any.
Allan
On 25/06/11 22:45, Eric Bélanger wrote:
On Sat, Jun 25, 2011 at 6:18 AM, Allan McRae<allan@archlinux.org> wrote:
On 25/06/11 14:31, Eric Bélanger wrote:
Signed-off-by: Eric Bélanger<snowmaniscool@gmail.com>
Signed-off-by: Allan
However, note this is one of the crap things about the current VCS implementation. devel_check is run before the installation of makedepends so this many result in people getting warnings when running makepkg for the first time but not the second...
Yeah. My initial intention was to move these checks in the check_software function but, after that patch was done, I realized that devel_check would fail if the VCS tool was missing. Changing the warning message to error would've make it imposible to build these package in a clean chroot so that wasn't a good solution. In the end, I decided to make this patch so my work woudn't be lost. I also checked the VCS bugs and it's messy.
Apart from the planned (for long a time) rewrite of all of this, I'm not sure there is much else to do here.
I might be overlooking something, but why don't we just install the required VCS package? Instead of the warnings in my patch, we could have a message like "Installing git to determine latest git revision" then do a 'pacman -S git' and so forth. As the VCS tool will be in the makedepends anyway the inconvenience of that method would be minor, if any.
I'd prefer not to have pacman install anything unless -s is specified and then it needs to be cleaned up with -r. So it is slightly more complicated than that. In the end, this will be less of an issue once we get around to dealing with those patches that allowed something like: source=("git@@http://git.repo.com...) as then we can do the check in check_software. I have pulled the patch as-is to my working branch. Allan
participants (2)
-
Allan McRae
-
Eric Bélanger