[arch-projects] [ABS] [PATCH] Merge bzr, git, hg and svn into a generic proto
Ivan Shapovalov
intelfx100 at gmail.com
Tue Oct 8 09:46:53 EDT 2013
On Tuesday 08 October 2013 at 15:26:16, Maxime wrote:
> Having separate prototypes for each VCS type is no longer relevant since
> Pacman 4.1. Having a generic prototype for regular, bzr, git hg and svn
> packages makes more sense. Left cvs, and darcs protos untouched as they
> are not yet supported in Pacman.
>
> Signed-off-by: Maxime Gauduin <alucryd at gmail.com>
> ---
> prototypes/PKGBUILD-bzr.proto | 64 -------------------------
> prototypes/PKGBUILD-git.proto | 64 -------------------------
> prototypes/PKGBUILD-hg.proto | 65 -------------------------
> prototypes/PKGBUILD-svn.proto | 63 ------------------------
> prototypes/PKGBUILD.proto | 108 ++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 108 insertions(+), 256 deletions(-)
> delete mode 100644 prototypes/PKGBUILD-bzr.proto
> delete mode 100644 prototypes/PKGBUILD-git.proto
> delete mode 100644 prototypes/PKGBUILD-hg.proto
> delete mode 100644 prototypes/PKGBUILD-svn.proto
> create mode 100644 prototypes/PKGBUILD.proto
>
> diff --git a/prototypes/PKGBUILD-bzr.proto b/prototypes/PKGBUILD-bzr.proto
> deleted file mode 100644
> index 81f145f..0000000
> --- a/prototypes/PKGBUILD-bzr.proto
> +++ /dev/null
> @@ -1,64 +0,0 @@
> -# This is an example PKGBUILD file. Use this as a start to creating your own,
> -# and remove these comments. For more information, see 'man PKGBUILD'.
> -# NOTE: Please fill out the license field for your package! If it is unknown,
> -# then please put 'unknown'.
> -
> -# See http://wiki.archlinux.org/index.php/VCS_PKGBUILD_Guidelines
> -# for more information on packaging from Bazaar sources.
> -
> -# Maintainer: Your Name <youremail at domain.com>
> -pkgname=NAME-bzr
> -pkgver=VERSION
> -pkgrel=1
> -pkgdesc=""
> -arch=()
> -url=""
> -license=('GPL')
> -groups=()
> -depends=()
> -makedepends=('bzr')
> -provides=()
> -conflicts=()
> -replaces=()
> -backup=()
> -options=()
> -install=
> -source=()
> -noextract=()
> -md5sums=() #generate with 'makepkg -g'
> -
> -_bzrtrunk=BZRURL
> -_bzrmod=MODNAME
> -
> -build() {
> - cd "$srcdir"
> - msg "Connecting to Bazaar server...."
> -
> - if [[ -d "$_bzrmod" ]]; then
> - cd "$_bzrmod" && bzr --no-plugins pull "$_bzrtrunk" -r "$pkgver"
> - msg "The local files are updated."
> - else
> - bzr --no-plugins branch "$_bzrtrunk" "$_bzrmod" -q -r "$pkgver"
> - fi
> -
> - msg "Bazaar checkout done or server timeout"
> - msg "Starting build..."
> -
> - rm -rf "$srcdir/$_bzrmod-build"
> - cp -r "$srcdir/$_bzrmod" "$srcdir/$_bzrmod-build"
> - cd "$srcdir/$_bzrmod-build"
> -
> - #
> - # BUILD HERE
> - #
> - ./autogen.sh
> - ./configure --prefix=/usr
> - make
> -}
> -
> -package() {
> - cd "$srcdir/$_bzrmod-build"
> - make DESTDIR="$pkgdir/" install
> -}
> -
> -# vim:set ts=2 sw=2 et:
> diff --git a/prototypes/PKGBUILD-git.proto b/prototypes/PKGBUILD-git.proto
> deleted file mode 100644
> index 05b721b..0000000
> --- a/prototypes/PKGBUILD-git.proto
> +++ /dev/null
> @@ -1,64 +0,0 @@
> -# This is an example PKGBUILD file. Use this as a start to creating your own,
> -# and remove these comments. For more information, see 'man PKGBUILD'.
> -# NOTE: Please fill out the license field for your package! If it is unknown,
> -# then please put 'unknown'.
> -
> -# See http://wiki.archlinux.org/index.php/VCS_PKGBUILD_Guidelines
> -# for more information on packaging from GIT sources.
> -
> -# Maintainer: Your Name <youremail at domain.com>
> -pkgname=NAME-git
> -pkgver=VERSION
> -pkgrel=1
> -pkgdesc=""
> -arch=()
> -url=""
> -license=('GPL')
> -groups=()
> -depends=()
> -makedepends=('git')
> -provides=()
> -conflicts=()
> -replaces=()
> -backup=()
> -options=()
> -install=
> -source=()
> -noextract=()
> -md5sums=() #generate with 'makepkg -g'
> -
> -_gitroot=GITURL
> -_gitname=MODENAME
> -
> -build() {
> - cd "$srcdir"
> - msg "Connecting to GIT server...."
> -
> - if [[ -d "$_gitname" ]]; then
> - cd "$_gitname" && git pull origin
> - msg "The local files are updated."
> - else
> - git clone "$_gitroot" "$_gitname"
> - fi
> -
> - msg "GIT checkout done or server timeout"
> - msg "Starting build..."
> -
> - rm -rf "$srcdir/$_gitname-build"
> - git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
> - cd "$srcdir/$_gitname-build"
> -
> - #
> - # BUILD HERE
> - #
> - ./autogen.sh
> - ./configure --prefix=/usr
> - make
> -}
> -
> -package() {
> - cd "$srcdir/$_gitname-build"
> - make DESTDIR="$pkgdir/" install
> -}
> -
> -# vim:set ts=2 sw=2 et:
> diff --git a/prototypes/PKGBUILD-hg.proto b/prototypes/PKGBUILD-hg.proto
> deleted file mode 100644
> index 8474533..0000000
> --- a/prototypes/PKGBUILD-hg.proto
> +++ /dev/null
> @@ -1,65 +0,0 @@
> -# This is an example PKGBUILD file. Use this as a start to creating your own,
> -# and remove these comments. For more information, see 'man PKGBUILD'.
> -# NOTE: Please fill out the license field for your package! If it is unknown,
> -# then please put 'unknown'.
> -
> -# See http://wiki.archlinux.org/index.php/VCS_PKGBUILD_Guidelines
> -# for more information on packaging from Mercurial(hg) sources.
> -
> -# Maintainer: Your Name <youremail at domain.com>
> -pkgname=NAME-hg
> -pkgver=VERSION
> -pkgrel=1
> -pkgdesc=""
> -arch=()
> -url=""
> -license=('GPL')
> -groups=()
> -depends=()
> -makedepends=('mercurial')
> -provides=()
> -conflicts=()
> -replaces=()
> -backup=()
> -options=()
> -install=
> -source=()
> -noextract=()
> -md5sums=() #generate with 'makepkg -g'
> -
> -_hgroot=HGURL
> -_hgrepo=REPONAME
> -
> -build() {
> - cd "$srcdir"
> - msg "Connecting to Mercurial server...."
> -
> - if [[ -d "$_hgrepo" ]]; then
> - cd "$_hgrepo"
> - hg pull -u
> - msg "The local files are updated."
> - else
> - hg clone "$_hgroot" "$_hgrepo"
> - fi
> -
> - msg "Mercurial checkout done or server timeout"
> - msg "Starting build..."
> -
> - rm -rf "$srcdir/$_hgrepo-build"
> - cp -r "$srcdir/$_hgrepo" "$srcdir/$_hgrepo-build"
> - cd "$srcdir/$_hgrepo-build"
> -
> - #
> - # BUILD HERE
> - #
> - ./autogen.sh
> - ./configure --prefix=/usr
> - make
> -}
> -
> -package() {
> - cd "$srcdir/$_hgrepo-build"
> - make DESTDIR="$pkgdir/" install
> -}
> -
> -# vim:set ts=2 sw=2 et:
> diff --git a/prototypes/PKGBUILD-svn.proto b/prototypes/PKGBUILD-svn.proto
> deleted file mode 100644
> index aff5ca9..0000000
> --- a/prototypes/PKGBUILD-svn.proto
> +++ /dev/null
> @@ -1,63 +0,0 @@
> -# This is an example PKGBUILD file. Use this as a start to creating your own,
> -# and remove these comments. For more information, see 'man PKGBUILD'.
> -# NOTE: Please fill out the license field for your package! If it is unknown,
> -# then please put 'unknown'.
> -
> -# See http://wiki.archlinux.org/index.php/VCS_PKGBUILD_Guidelines
> -# for more information on packaging from SVN sources.
> -
> -# Maintainer: Your Name <youremail at domain.com>
> -pkgname=NAME-svn
> -pkgver=VERSION
> -pkgrel=1
> -pkgdesc=""
> -arch=()
> -url=""
> -license=('GPL')
> -groups=()
> -depends=()
> -makedepends=('subversion')
> -provides=()
> -conflicts=()
> -replaces=()
> -backup=()
> -options=()
> -install=
> -source=()
> -noextract=()
> -md5sums=() #generate with 'makepkg -g'
> -
> -_svntrunk=SVNURL
> -_svnmod=MODNAME
> -
> -build() {
> - cd "$srcdir"
> - msg "Connecting to SVN server...."
> -
> - if [[ -d "$_svnmod/.svn" ]]; then
> - (cd "$_svnmod" && svn up -r "$pkgver")
> - else
> - svn co "$_svntrunk" --config-dir ./ -r "$pkgver" "$_svnmod"
> - fi
> -
> - msg "SVN checkout done or server timeout"
> - msg "Starting build..."
> -
> - rm -rf "$srcdir/$_svnmod-build"
> - svn export "$srcdir/$_svnmod" "$srcdir/$_svnmod-build"
> - cd "$srcdir/$_svnmod-build"
> -
> - #
> - # BUILD HERE
> - #
> - ./autogen.sh
> - ./configure --prefix=/usr
> - make
> -}
> -
> -package() {
> - cd "$srcdir/$_svnmod-build"
> - make DESTDIR="$pkgdir/" install
> -}
> -
> -# vim:set ts=2 sw=2 et:
> diff --git a/prototypes/PKGBUILD.proto b/prototypes/PKGBUILD.proto
> new file mode 100644
> index 0000000..5ad5699
> --- /dev/null
> +++ b/prototypes/PKGBUILD.proto
> @@ -0,0 +1,108 @@
> +# This is an example PKGBUILD file. Use this as a start to creating your own,
> +# and remove these comments. For more information, see 'man PKGBUILD'.
> +# NOTE: Please fill out the license field for your package! If it is unknown,
> +# then please put 'unknown'.
> +
> +# Maintainer: Your Name <youremail at domain.com>
> +pkgname=NAME
> +pkgver=VERSION
> +pkgrel=1
> +pkgdesc=""
> +arch=()
> +url=""
> +license=('GPL')
> +groups=()
> +depends=()
> +makedepends=()
> +provides=()
> +conflicts=()
> +replaces=()
> +backup=()
> +options=()
> +install=
> +source=('SRC_NAME::SRC_URL')
> +
> +# SRC_NAME: Use to change the source name if needed
> +# Example:
> +# source=("$pkgname-$pkgver.tar.gz::http://www.foobar.com/foobar.tar.gz")
> +
> +noextract=()
> +md5sums=() # Generate with 'makepkg -g'
> +
> +################################################################################
> +################################# VCS specific #################################
> +################################################################################
> +
> +# The following guidelines are specific to BZR, GIT, HG and SVN packages.
> +# CVS and DARCS are not natively supported in pacman yet, please refer to the
> +# dedicated prototypes instead.
> +# See http://wiki.archlinux.org/index.php/VCS_PKGBUILD_Guidelines for more
> +# information on packaging from VCS sources.
> +
> +pkgname=NAME-VCS # '-bzr', '-git', '-hg' or '-svn'
> +makedepends=('VCS_PACKAGE') # 'bzr', 'git', 'mercurial' or 'subversion'
> +provides=("${pkgname%-VCS}")
> +conflicts=("${pkgname%-VCS}")
> +source=('DIR_NAME::VCS+REPO_URL#FRAGMENT')
> +md5sums=('SKIP')
> +
> +# DIR_NAME: Use to change the source directory name if needed
> +
> +# VCS: Use to specify the VCS type, not needed when REPO_URL is explicit (for
> +# example git://URL, svn://URL or lp:NAME)
> +
> +# FRAGMENT: Use to pull a specific branch, commit/revision or tag
> +# Bazaar accepts the 'revision' keyword
> +# Git accepts the 'branch', 'commit' and 'tag' keywords
> +# Mercurial accepts the 'branch', 'revision' and 'tag' keywords
> +# Subversion accepts the 'revision' keyword
> +
> +# Examples:
> +# source=("lp:${pkgname%-bzr}#revision=42")
> +# source=("git+https://github.com/author/${pkgname%-git}.git#branch=unstable")
> +# source=('hg+https://bitbucket.org/author/project#tag=2.0')
Maybe replace 'project' with '${pkgname%-hg}' to be uniform?
> +# source=("${pkgname%-svn}::svn://svn.code.sf.net/p/project/code/trunk"}
> +
> +pkgver() {
> + cd "$srcdir"
Here, and in prepare()/build()/package(), shouldn't we cd to '${pkgname%-VCS}' instead?
Regards,
--
Ivan Shapovalov / intelfx /
> +
> +# Bazaar
> + printf "%s" "$(bzr revno)"
> +
> +# Git, tags available
> + printf "%s" "$(git describe --long | sed 's/-/./g')"
> +
> +# Git, no tags available
> + printf "%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
> +
> +# Mercurial
> + printf "%s.%s" "$(hg identify -n)" "$(hg identify -i)"
> +
> +# Subversion
> + printf "%s" "$(svnversion | tr -d 'A-z')"
> +
> +# Fallback
> + printf "%s" "$(date +%Y%m%d)"
> +}
> +
> +################################################################################
> +
> +prepare() {
> + cd "$srcdir"
> + patch -Np1 ../foo.patch
> + patch -Np0 ../bar.patch
> +}
> +
> +build() {
> + cd "$srcdir"
> + ./autogen.sh
> + ./configure --prefix=/usr
> + make
> +}
> +
> +package() {
> + cd "$srcdir"
> + make DESTDIR="$pkgdir/" install
> +}
> +
> +# vim:set ts=2 sw=2 et:
>
More information about the arch-projects
mailing list