From: hasufell <hasufell@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] [PATCH vcs-snapshot] Use ${WORKDIR}/${P} rather than ${S} to support ${S} overrides.
Date: Mon, 04 Jun 2012 16:20:02 +0200 [thread overview]
Message-ID: <4FCCC412.6000000@gentoo.org> (raw)
In-Reply-To: <1338803954-3814-1-git-send-email-mgorny@gentoo.org>
[-- Attachment #1: Type: text/plain, Size: 2189 bytes --]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 06/04/2012 11:59 AM, Michał Górny wrote:
> One could set S to work on a subtree of the tarball rather than the
> whole tarball. Considering that, it's probably better to use
> ${WORKDIR}/${P} rather than ${S}.
>
> Fixes: https://bugs.gentoo.org/show_bug.cgi?id=419479 ---
> gx86/eclass/vcs-snapshot.eclass | 5 +++-- 1 file changed, 3
> insertions(+), 2 deletions(-)
>
> diff --git a/gx86/eclass/vcs-snapshot.eclass
> b/gx86/eclass/vcs-snapshot.eclass index 6748360..23cd696 100644 ---
> a/gx86/eclass/vcs-snapshot.eclass +++
> b/gx86/eclass/vcs-snapshot.eclass @@ -9,7 +9,8 @@ # @DESCRIPTION: #
> This eclass provides a convenience src_unpack() which does support
> # working with snapshots generated by various VCS-es. It unpacks
> those -# to ${S} rather than the original directory containing
> commit id. +# to ${WORKDIR}/${P} rather than the original directory
> containing +# commit id. # # Note that this eclass handles only
> unpacking. You need to specify # SRC_URI yourself, and call any
> autoreconfiguration as necessary. @@ -41,5 +42,5 @@
> vcs-snapshot_src_unpack() {
>
> # github, bitbucket: username-projectname-hash # gitweb:
> projectname-tagname-hash - mv *-*-[0-9a-f]*[0-9a-f]/ "${S}" || die
> + mv *-*-[0-9a-f]*[0-9a-f]/ "${WORKDIR}"/${P} || die }
Currently that eclass does not support multiple snapshot sources/tarballs.
I would suggest to fix that. My proposal currently breaks 6 ebuilds
which do not follow the newly described standard.
This way you could merge data and source snapshots from vcs.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJPzMQSAAoJEFpvPKfnPDWzJdMH/AuhgbDeVdnJViP+zZNjsq4B
C2FlaPCpl3HHTrMi7HhbFmbOnZeLA3VLaffdvaPvZU0O1RxhOQPNfp4t8/E2iuHF
q9vVwQFQe19izFa7EgapD2EOUVUeaNMGoX0K2qRgtfLeBwnLWsnagMYZkV2+5skA
84vnyRYtaDEx6Z+M0UipwFnubrgmItbvX7F3XZ3omCdlSjXaRDO0sc2hqMFjeZ5P
ESGfbWxFX59ztmxBni0iSJE3NdSiYr1mjuW6eFZazIq9T6cinByXfMJgbdz7N14e
8HaSxMTc6PVWUTVbmpj3POWnZ+KCHbFze39rO5HzY4ZPMIL4xTxXAppg2FnyhF4=
=KUJi
-----END PGP SIGNATURE-----
[-- Attachment #2: vcs-snapshot.eclass.diff --]
[-- Type: text/x-patch, Size: 1874 bytes --]
--- vcs-snapshot.eclass.old 2012-06-04 16:10:25.000000000 +0200
+++ vcs-snapshot.eclass 2012-06-04 16:11:16.000000000 +0200
@@ -8,8 +8,10 @@
# @BLURB: support eclass for VCS (github, bitbucket, gitweb) snapshots
# @DESCRIPTION:
# This eclass provides a convenience src_unpack() which does support
-# working with snapshots generated by various VCS-es. It unpacks those
-# to ${S} rather than the original directory containing commit id.
+# working with snapshots generated by various VCS-es. It unpacks all tarballs
+# and zipballs according to their name into ${WORKDIR}/${name}
+# rather than the original directory containing commit id.
+# See example below.
#
# Note that this eclass handles only unpacking. You need to specify
# SRC_URI yourself, and call any autoreconfiguration as necessary.
@@ -26,6 +28,10 @@
# inherit autotools-utils vcs-snapshot
#
# SRC_URI="http://github.com/example/${PN}/tarball/v${PV} -> ${P}.tar.gz"
+#
+# # line above unpacks into: ${WORKDIR}/${P}
+# # SRC_URI="http://github.com/example/${PN}/tarball/v${PV} -> ${P}-src.tar.gz"
+# # would unpack into: ${WORKDIR}/${P}-src
# @CODE
case ${EAPI:-0} in
@@ -37,9 +43,21 @@
EXPORT_FUNCTIONS src_unpack
vcs-snapshot_src_unpack() {
- default
-
# github, bitbucket: username-projectname-hash
# gitweb: projectname-tagname-hash
- mv *-*-[0-9a-f]*[0-9a-f]/ "${S}" || die
+ local i
+ local _tmpdir=${T}/_tmp
+ mkdir "${_tmpdir}" || die
+ pushd "${_tmpdir}" > /dev/null || die
+ for i in ${A} ; do
+ unpack ${i}
+ case ${i} in
+ *.tar.gz) mv "${_tmpdir}"/*/ "${WORKDIR}"/${i%.tar.gz} || die ;;
+ *.tar.xz) mv "${_tmpdir}"/*/ "${WORKDIR}"/${i%.tar.xz} || die ;;
+ *.tar.bz2) mv "${_tmpdir}"/*/ "${WORKDIR}"/${i%.tar.bz2} || die ;;
+ *.zip) mv "${_tmpdir}"/*/ "${WORKDIR}"/${i%.zip} || die ;;
+ *) mv "${_tmpdir}"/* "${WORKDIR}"/ ;;
+ esac
+ done
+ popd > /dev/null
}
[-- Attachment #3: vcs-snapshot.eclass --]
[-- Type: text/plain, Size: 2151 bytes --]
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/vcs-snapshot.eclass,v 1.2 2012/03/19 08:52:49 mgorny Exp $
# @ECLASS: vcs-snapshot.eclass
# @MAINTAINER:
# mgorny@gentoo.org
# @BLURB: support eclass for VCS (github, bitbucket, gitweb) snapshots
# @DESCRIPTION:
# This eclass provides a convenience src_unpack() which does support
# working with snapshots generated by various VCS-es. It unpacks all tarballs
# and zipballs according to their name into ${WORKDIR}/${name}
# rather than the original directory containing commit id.
# See example below.
#
# Note that this eclass handles only unpacking. You need to specify
# SRC_URI yourself, and call any autoreconfiguration as necessary.
# The example does that using autotools-utils eclass.
#
# Right now, the eclass was tested with github, bitbucket and gitweb
# snapshots. Feel free to report snapshotting services which aren't
# working.
# @EXAMPLE:
#
# @CODE
# EAPI=4
# AUTOTOOLS_AUTORECONF=1
# inherit autotools-utils vcs-snapshot
#
# SRC_URI="http://github.com/example/${PN}/tarball/v${PV} -> ${P}.tar.gz"
#
# # line above unpacks into: ${WORKDIR}/${P}
# # SRC_URI="http://github.com/example/${PN}/tarball/v${PV} -> ${P}-src.tar.gz"
# # would unpack into: ${WORKDIR}/${P}-src
# @CODE
case ${EAPI:-0} in
0|1) die "EAPI ${EAPI} unsupported.";; # default(), SRC_URI arrows
2|3|4) ;;
*) die "vcs-snapshot.eclass API in EAPI ${EAPI} not yet established."
esac
EXPORT_FUNCTIONS src_unpack
vcs-snapshot_src_unpack() {
# github, bitbucket: username-projectname-hash
# gitweb: projectname-tagname-hash
local i
local _tmpdir=${T}/_tmp
mkdir "${_tmpdir}" || die
pushd "${_tmpdir}" > /dev/null || die
for i in ${A} ; do
unpack ${i}
case ${i} in
*.tar.gz) mv "${_tmpdir}"/*/ "${WORKDIR}"/${i%.tar.gz} || die ;;
*.tar.xz) mv "${_tmpdir}"/*/ "${WORKDIR}"/${i%.tar.xz} || die ;;
*.tar.bz2) mv "${_tmpdir}"/*/ "${WORKDIR}"/${i%.tar.bz2} || die ;;
*.zip) mv "${_tmpdir}"/*/ "${WORKDIR}"/${i%.zip} || die ;;
*) mv "${_tmpdir}"/* "${WORKDIR}"/ ;;
esac
done
popd > /dev/null
}
next prev parent reply other threads:[~2012-06-04 14:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-04 9:59 [gentoo-dev] [PATCH vcs-snapshot] Use ${WORKDIR}/${P} rather than ${S} to support ${S} overrides Michał Górny
2012-06-04 14:20 ` hasufell [this message]
2012-06-04 15:50 ` Michał Górny
2012-06-04 19:26 ` hasufell
2012-06-04 20:06 ` Michał Górny
2012-06-04 20:47 ` hasufell
2012-06-05 7:11 ` Michał Górny
2012-06-05 12:26 ` hasufell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FCCC412.6000000@gentoo.org \
--to=hasufell@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox