From d338b3981dcfd039a60fae616886707e4d69fceb Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sun, 3 Jun 2012 19:33:34 +1000 Subject: makepkg: remove VCS package support 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 --- doc/PKGBUILD.5.txt | 64 ------------------------------------------------------ 1 file changed, 64 deletions(-) (limited to 'doc/PKGBUILD.5.txt') diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt index 062b1ab6..9d9e5998 100644 --- a/doc/PKGBUILD.5.txt +++ b/doc/PKGBUILD.5.txt @@ -392,70 +392,6 @@ The install script does not need to be specified in the source array. A template install file is available in '{pkgdatadir}' as 'proto.install' for reference with all of the available functions defined. - -Development Directives ----------------------- -makepkg supports building development versions of packages without having to -manually update the pkgver in the PKGBUILD. This was formerly done using the -separate utility 'versionpkg'. In order to utilize this functionality, your -PKGBUILD must use correct variable names depending on the SCM being fetched -from (e.g., 'makepkg-git', 'mplayer-svn'). - -*CVS*:: - The generated pkgver will be the date the package is built. - - *_cvsroot*;; - The root of the CVS repository. - - *_cvsmod*;; - The CVS module to fetch. - -*SVN*:: - The generated pkgver will be the latest SVN revision number. - - *_svntrunk*;; - The trunk of the SVN repository. - - *_svnmod*;; - The SVN module to fetch. - -*Git*:: - The generated pkgver will be the date the package is built. - - *_gitroot*;; - The URL (all protocols supported) to the GIT repository. - - *_gitname*;; - GIT tag or branch to use. - -*Mercurial*:: - The generated pkgver will be the hg tip revision number. - - *_hgroot*;; - The URL of the mercurial repository. - - *_hgrepo*;; - The repository to follow. - -*Darcs*:: - The generated pkgver will be the date the package is built. - - *_darcstrunk*;; - URL to the repository trunk. - - *_darcsmod*;; - Darcs module to use. - -*Bazaar*:: - The generated pkgver will be the latest Bazaar revision number (revno). - - *_bzrtrunk*;; - URL to the bazaar repository. - - *_bzrmod*;; - Bazaar module to use. - - Example ------- The following is an example PKGBUILD for the 'patch' package. For more -- cgit v1.2.3-70-g09d2 From e0cd7b02932e5472f4c4fa30896ff73240dc9341 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Mon, 23 Jul 2012 16:37:08 +1000 Subject: doc: Document using VCS sources in a PKGBUILD Signed-off-by: Allan McRae --- doc/PKGBUILD.5.txt | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'doc/PKGBUILD.5.txt') diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt index 9d9e5998..a8d3f891 100644 --- a/doc/PKGBUILD.5.txt +++ b/doc/PKGBUILD.5.txt @@ -109,6 +109,10 @@ It is also possible to change the name of the downloaded file, which is helpful with weird URLs and for handling multiple source files with the same name. The syntax is: `source=('filename::url')`. + +makepkg also supports building developmental versions of packages using sources +downloaded from version control systems (VCS). For more information, see +<> below. ++ Files in the source array with extensions `.sig`, `.sign` or `.asc` are recognized by makepkg as PGP signatures and will be automatically used to verify the integrity of the corresponding source file. @@ -392,6 +396,34 @@ The install script does not need to be specified in the source array. A template install file is available in '{pkgdatadir}' as 'proto.install' for reference with all of the available functions defined. +Using VCS Sources[[VCS]] +------------------------ +Building a developmental version of a package using sources from a version control +system (VCS) is enabled by specifying the source in the form +`source=('folder::url#fragment')`. Currently makepkg supports the `git` protocol. + +The source URL is divided into three components: + +*folder*:: + (optional) Specifies an alternate folder name for makepkg to download the VCS + source into. + +*url*:: + The url to the VCS repo. This must include the the vcs in the URL protocol for + makepkg to recognize this as a VCS source. If the protocol does not include + the VCS name, it can be added by prefixing the URL with `vcs+`. For example, + using a git repository over `http` would have a source URL in the form + `git+http://...`. + +*fragment*:: + (optional) Allows specifying a revision number or branch for makepkg to checkout + from the VCS. For example, to checkout a given revision, the source line would + have the format `source=(url#revision=123)`. The available fragments depends on + the VCS being used: + + *git*;; + branch, commit, tag + Example ------- The following is an example PKGBUILD for the 'patch' package. For more -- cgit v1.2.3-70-g09d2 From c887ccf90553ffb00825353d98c47fea909ba611 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Mon, 23 Jul 2012 16:50:01 +1000 Subject: doc: document automatically updating the pkgver variable Signed-off-by: Allan McRae --- doc/PKGBUILD.5.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'doc/PKGBUILD.5.txt') diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt index a8d3f891..48820e5c 100644 --- a/doc/PKGBUILD.5.txt +++ b/doc/PKGBUILD.5.txt @@ -47,6 +47,11 @@ similar to `$_basekernver`. *pkgver*:: The version of the software as released from the author (e.g., '2.7.1'). The variable is not allowed to contain colons or hyphens. ++ +The `pkgver` variable can be automatically updated by providing a `pkgver()` function +in the PKGBUILD that outputs the new package version. This is run after downloading +and extracting the sources so can use those files in determining the new `pkgver`. +This is most useful when used with sources from version control systems (see below). *pkgrel*:: This is the release number specific to the Arch Linux release. This -- cgit v1.2.3-70-g09d2 From 062204daa135feb5aad918e8842749b69de41c40 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Mon, 23 Jul 2012 16:51:53 +1000 Subject: doc: Document using svn source url Signed-off-by: Allan McRae --- doc/PKGBUILD.5.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'doc/PKGBUILD.5.txt') diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt index 48820e5c..3d04b604 100644 --- a/doc/PKGBUILD.5.txt +++ b/doc/PKGBUILD.5.txt @@ -405,7 +405,8 @@ Using VCS Sources[[VCS]] ------------------------ Building a developmental version of a package using sources from a version control system (VCS) is enabled by specifying the source in the form -`source=('folder::url#fragment')`. Currently makepkg supports the `git` protocol. +`source=('folder::url#fragment')`. Currently makepkg supports the `git` and `svn` +protocols. The source URL is divided into three components: @@ -429,6 +430,9 @@ The source URL is divided into three components: *git*;; branch, commit, tag + *svn*;; + revision + Example ------- The following is an example PKGBUILD for the 'patch' package. For more -- cgit v1.2.3-70-g09d2 From 7e4aa9e52492450db1705f1057e82934b1187e0e Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Mon, 23 Jul 2012 20:01:35 +1000 Subject: makepkg: add hg url support Supported fragments are branch, revision and tag. Signed-off-by: Allan McRae --- doc/PKGBUILD.5.txt | 7 ++++-- scripts/makepkg.sh.in | 69 ++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 71 insertions(+), 5 deletions(-) (limited to 'doc/PKGBUILD.5.txt') diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt index 3d04b604..47f9e884 100644 --- a/doc/PKGBUILD.5.txt +++ b/doc/PKGBUILD.5.txt @@ -405,8 +405,8 @@ Using VCS Sources[[VCS]] ------------------------ Building a developmental version of a package using sources from a version control system (VCS) is enabled by specifying the source in the form -`source=('folder::url#fragment')`. Currently makepkg supports the `git` and `svn` -protocols. +`source=('folder::url#fragment')`. Currently makepkg supports the `git`, `hg` and +`svn` protocols. The source URL is divided into three components: @@ -430,6 +430,9 @@ The source URL is divided into three components: *git*;; branch, commit, tag + *hg*;; + branch, revision, tag + *svn*;; revision diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 3157a9ce..ec78970c 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -199,7 +199,7 @@ get_filepath() { local proto="$(get_protocol "$1")" case $proto in - git*|svn*) + git*|hg*|svn*) if [[ -d "$startdir/$file" ]]; then file="$startdir/$file" elif [[ -d "$SRCDEST/$file" ]]; then @@ -235,7 +235,7 @@ get_filename() { local proto=$(get_protocol "$netfile") case $proto in - git*|svn*) + git*|hg*|svn*) filename=${netfile##*/} filename=${filename%%#*} # fall-through @@ -450,6 +450,66 @@ download_git() { popd &>/dev/null } +download_hg() { + local netfile=$1 + + local fragment=${netfile##*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" + + local repo=${netfile##*/} + repo=${repo%%#*} + + local url=$(get_url "$netfile") + url=${url##*hg+} + url=${url%%#*} + + if [[ ! -d "$dir" ]]; then + msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "hg" + if ! hg clone "$url" "$dir"; then + error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "hg" + plain "$(gettext "Aborting...")" + exit 1 + fi + elif (( ! HOLDVER )); then + msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "hg" + cd_safe "$dir" + if ! hg pull -u; then + # only warn on failure to allow offline builds + warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "hg" + fi + fi + + msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "hg" + pushd "$srcdir" &>/dev/null + rm -rf "${dir##*/}" + + local ref + if [[ -n $fragment ]]; then + case ${fragment%%=*} in + branch|revision|tag) + ref=('-u' "${fragment##*=}") + ;; + *) + error "$(gettext "Unrecognized reference: %s")" "${fragment}" + plain "$(gettext "Aborting...")" + exit 1 + esac + fi + + if ! hg clone "${ref[@]}" "$dir" "${dir##*/}"; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "hg" + plain "$(gettext "Aborting...")" + exit 1 + fi + + popd &>/dev/null +} + download_svn() { local netfile=$1 @@ -535,6 +595,9 @@ download_sources() { git*) (( GET_VCS )) && download_git "$netfile" ;; + hg*) + (( GET_VCS )) && download_hg "$netfile" + ;; svn*) (( GET_VCS )) && download_svn "$netfile" ;; @@ -909,7 +972,7 @@ generate_checksums() { proto="$(get_protocol "$netfile")" case $proto in - git*|svn*) + git*|hg*|svn*) sum="SKIP" ;; *) -- cgit v1.2.3-70-g09d2