[pacman-dev] [PATCH 1/4] makepkg: remove VCS package support
Allan McRae
allan at archlinux.org
Sun Jun 3 11:40:46 EDT 2012
The current VCS packaging support is really, really, really bad.
It is best to strip it out completely before rewriting it.
Signed-off-by: Allan McRae <allan at archlinux.org>
---
scripts/makepkg.sh.in | 117 -------------------------------------------------
1 file changed, 117 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index c055691..0c54497 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1786,114 +1786,6 @@ check_software() {
return $ret
}
-devel_check() {
- newpkgver=""
-
- # Do not update pkgver if --holdver is set, when building a source package, repackaging,
- # reading PKGBUILD from pipe (-f), or if we cannot write to the file (-w)
- if (( HOLDVER || SOURCEONLY || REPKG )) ||
- [[ ! -f $BUILDFILE || ! -w $BUILDFILE || $BUILDFILE = "/dev/stdin" ]]; then
- return
- fi
-
- if [[ -z $FORCE_VER ]]; then
- # Check if this is a svn/cvs/etc PKGBUILD; set $newpkgver if so.
- # 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 check to make sure we have the VCS tool available.
- local vcs=()
-
- [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] && vcs+=("darcs")
- [[ -n ${_cvsroot} && -n ${_cvsmod} ]] && vcs+=("cvs")
- [[ -n ${_gitroot} && -n ${_gitname} ]] && vcs+=("git")
- [[ -n ${_svntrunk} && -n ${_svnmod} ]] && vcs+=("svn")
- [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] && vcs+=("bzr")
- [[ -n ${_hgroot} && -n ${_hgrepo} ]] && vcs+=("hg")
-
- if (( ${#vcs[@]} == 0 )); then
- return
- elif (( ${#vcs[@]} > 1 )); then
- warning "$(gettext "Ambiguous VCS package. Cannot pick from: %s.")" "${vcs[*]}"
- return 0
- fi
-
- if ! type -p "$vcs" >/dev/null; then
- warning "$(gettext "Cannot find the %s binary required to determine latest %s revision.")" "$vcs" "$vcs"
- return 0
- fi
-
- msg "$(gettext "Determining latest %s revision...")" "$vcs"
-
- case "$vcs" in
- darcs)
- newpkgver=$(date +%Y%m%d)
- ;;
- cvs)
- newpkgver=$(date +%Y%m%d)
- ;;
- git)
- newpkgver=$(date +%Y%m%d)
- ;;
- svn)
- newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p')
- ;;
- bzr)
- newpkgver=$(bzr revno ${_bzrtrunk})
- ;;
- hg)
- if pushd "./src/$_hgrepo" > /dev/null; then
- local ret=0
- hg pull || ret=$?
- if (( ! ret )); then
- hg update
- elif (( ret != 1 )); then
- return 1
- fi
- else
- [[ ! -d ./src/ ]] && mkdir ./src/
- hg clone "$_hgroot/$_hgrepo" "./src/$_hgrepo"
- if ! pushd "./src/$_hgrepo" > /dev/null; then
- warning "$(gettext "An error occured while determining the hg version number.")"
- return 0
- fi
- fi
- newpkgver=$(hg tip --template "{rev}")
- popd > /dev/null
- ;;
- esac
-
- if [[ -n $newpkgver ]]; then
- msg2 "$(gettext "Version found: %s")" "$newpkgver"
- fi
-
- else
- # Version number retrieved from fakeroot->makepkg argument
- newpkgver=$FORCE_VER
- fi
-}
-
-devel_update() {
- # This is lame, but if we're wanting to use an updated pkgver for
- # retrieving svn/cvs/etc sources, we'll update the PKGBUILD with
- # the new pkgver and then re-source it. This is the most robust
- # method for dealing with PKGBUILDs that use, e.g.:
- #
- # pkgver=23
- # ...
- # _foo=pkgver
- #
- if [[ -n $newpkgver && $newpkgver != "$pkgver" ]]; then
- if [[ -f $BUILDFILE && -w $BUILDFILE ]]; then
- @SEDINPLACE@ "s/^pkgver=[^ ]*/pkgver=$newpkgver/" "$BUILDFILE"
- @SEDINPLACE@ "s/^pkgrel=[^ ]*/pkgrel=1/" "$BUILDFILE"
- source "$BUILDFILE"
- else
- warning "$(gettext "%s is not writeable -- pkgver will not be updated")" "$BUILDFILE"
- fi
- fi
-}
-
backup_package_variables() {
local var
for var in ${splitpkg_overrides[@]}; do
@@ -2267,13 +2159,6 @@ check_sanity || exit 1
# check we have the software required to process the PKGBUILD
check_software || exit 1
-# We need to run devel_update regardless of whether we are in the fakeroot
-# build process so that if the user runs makepkg --forcever manually, we
-# 1) output the correct pkgver, and 2) use the correct filename when
-# checking if the package file already exists - fixes FS #9194
-devel_check
-devel_update
-
if (( ${#pkgname[@]} > 1 )); then
SPLITPKG=1
fi
@@ -2508,7 +2393,6 @@ else
# if we are root or if fakeroot is not enabled, then we don't use it
if ! check_buildenv "fakeroot" "y" || (( EUID == 0 )); then
if (( ! REPKG )); then
- devel_update
(( BUILDFUNC )) && run_build
(( CHECKFUNC )) && run_check
fi
@@ -2530,7 +2414,6 @@ else
fi
else
if (( ! REPKG && ( PKGFUNC || SPLITPKG ) )); then
- devel_update
(( BUILDFUNC )) && run_build
(( CHECKFUNC )) && run_check
cd_safe "$startdir"
--
1.7.10.3
More information about the pacman-dev
mailing list