* [gentoo-dev] vcs-snapshot.eclass: add a way to specify the extraction path
@ 2015-07-30 15:57 William Hubbs
2015-07-30 21:11 ` Mike Gilbert
2015-07-31 1:53 ` [gentoo-dev] vcs-snapshot.eclass: " Michał Górny
0 siblings, 2 replies; 5+ messages in thread
From: William Hubbs @ 2015-07-30 15:57 UTC (permalink / raw
To: gentoo development
[-- Attachment #1.1: Type: text/plain, Size: 450 bytes --]
All,
I'm finding in working on Go ebuilds, that we are propegating a
src_unpack function that is very similar to the one in vcs-snapshot.
This patch adds an EXTRACT_PATH variable to the vcs-snapshot eclass
which, if set, puts the extracted archives in the specified directory under ${S}.
If it is not set, nothing should happen.
This could be used by other types of ebuilds later, but for now it would
be used by Go ebuilds.
Thoughts?
William
[-- Attachment #1.2: vcs-snapshot.eclass.patch --]
[-- Type: text/x-diff, Size: 1540 bytes --]
Index: vcs-snapshot.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/vcs-snapshot.eclass,v
retrieving revision 1.7
diff -u -B -r1.7 vcs-snapshot.eclass
--- vcs-snapshot.eclass 25 Jul 2013 07:51:16 -0000 1.7
+++ vcs-snapshot.eclass 30 Jul 2015 15:44:55 -0000
@@ -40,6 +40,13 @@
*) die "vcs-snapshot.eclass API in EAPI ${EAPI} not yet established."
esac
+# @ECLASS-VARIABLE: EXTRACT_PATH
+# @DESCRIPTION:
+# This is a special purpose variable, mainly used by Go ebuilds, which
+# creates a sub directory under ${S} and stores the extracted archive
+# there. By default, this is empty, and please do not set it in your
+# ebuild unless you know exactly what you are doing.
+
EXPORT_FUNCTIONS src_unpack
# @FUNCTION: vcs-snapshot_src_unpack
@@ -57,13 +64,19 @@
do
case "${f}" in
*.tar|*.tar.gz|*.tar.bz2|*.tar.xz)
- local destdir=${WORKDIR}/${f%.tar*}
+ [[ -n $EXTRACT_PATH ]] &&
+ local destdir=${WORKDIR}/${P}/${EXTRACT_PATH} ||
+ local destdir=${WORKDIR}/${f%.tar*}
debug-print "${FUNCNAME}: unpacking ${f} to ${destdir}"
# XXX: check whether the directory structure inside is
# fine? i.e. if the tarball has actually a parent dir.
- mkdir "${destdir}" || die
+ if [[ -n ${EXTRACT_PATH} ]]; then
+ mkdir -p "${destdir}" || die
+ else
+ mkdir "${destdir}" || die
+ fi
tar -C "${destdir}" -x --strip-components 1 \
-f "${DISTDIR}/${f}" || die
;;
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-dev] vcs-snapshot.eclass: add a way to specify the extraction path
2015-07-30 15:57 [gentoo-dev] vcs-snapshot.eclass: add a way to specify the extraction path William Hubbs
@ 2015-07-30 21:11 ` Mike Gilbert
2015-07-31 14:44 ` [gentoo-dev] Jvcs-snapshot.eclass: " William Hubbs
2015-07-31 1:53 ` [gentoo-dev] vcs-snapshot.eclass: " Michał Górny
1 sibling, 1 reply; 5+ messages in thread
From: Mike Gilbert @ 2015-07-30 21:11 UTC (permalink / raw
To: Gentoo Dev
On Thu, Jul 30, 2015 at 11:57 AM, William Hubbs <williamh@gentoo.org> wrote:
> All,
>
> I'm finding in working on Go ebuilds, that we are propegating a
> src_unpack function that is very similar to the one in vcs-snapshot.
>
> This patch adds an EXTRACT_PATH variable to the vcs-snapshot eclass
> which, if set, puts the extracted archives in the specified directory under ${S}.
>
> If it is not set, nothing should happen.
>
> This could be used by other types of ebuilds later, but for now it would
> be used by Go ebuilds.
>
> Thoughts?
Can you provide an example of an ebuild in the tree for which this
would be useful?
I'm unclear as to why tarballs are being unpacked in sub-directories of ${S}.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-dev] vcs-snapshot.eclass: add a way to specify the extraction path
2015-07-30 15:57 [gentoo-dev] vcs-snapshot.eclass: add a way to specify the extraction path William Hubbs
2015-07-30 21:11 ` Mike Gilbert
@ 2015-07-31 1:53 ` Michał Górny
1 sibling, 0 replies; 5+ messages in thread
From: Michał Górny @ 2015-07-31 1:53 UTC (permalink / raw
To: William Hubbs; +Cc: gentoo development
[-- Attachment #1: Type: text/plain, Size: 943 bytes --]
Dnia 2015-07-30, o godz. 10:57:46
William Hubbs <williamh@gentoo.org> napisał(a):
> All,
>
> I'm finding in working on Go ebuilds, that we are propegating a
> src_unpack function that is very similar to the one in vcs-snapshot.
>
> This patch adds an EXTRACT_PATH variable to the vcs-snapshot eclass
> which, if set, puts the extracted archives in the specified directory under ${S}.
>
> If it is not set, nothing should happen.
>
> This could be used by other types of ebuilds later, but for now it would
> be used by Go ebuilds.
>
> Thoughts?
I'm against it. This doubles the eclass code, adding completely
orthogonal and incompatible behavior.
The goal of this eclass is to provide a relatively simple way of
extracting VCS snapshots and putting them in a predictable locations,
not fitting some random src_unpack() you happen to use.
--
Best regards,
Michał Górny
<http://dev.gentoo.org/~mgorny/>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 949 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-dev] Jvcs-snapshot.eclass: add a way to specify the extraction path
2015-07-30 21:11 ` Mike Gilbert
@ 2015-07-31 14:44 ` William Hubbs
2015-07-31 20:34 ` Mike Gilbert
0 siblings, 1 reply; 5+ messages in thread
From: William Hubbs @ 2015-07-31 14:44 UTC (permalink / raw
To: gentoo-dev; +Cc: mgorny, floppym
[-- Attachment #1: Type: text/plain, Size: 1371 bytes --]
On Thu, Jul 30, 2015 at 05:11:20PM -0400, Mike Gilbert wrote:
> On Thu, Jul 30, 2015 at 11:57 AM, William Hubbs <williamh@gentoo.org> wrote:
> > All,
> >
> > I'm finding in working on Go ebuilds, that we are propegating a
> > src_unpack function that is very similar to the one in vcs-snapshot.
> >
> > This patch adds an EXTRACT_PATH variable to the vcs-snapshot eclass
> > which, if set, puts the extracted archives in the specified directory under ${S}.
> >
> > If it is not set, nothing should happen.
> >
> > This could be used by other types of ebuilds later, but for now it would
> > be used by Go ebuilds.
> >
> > Thoughts?
>
> Can you provide an example of an ebuild in the tree for which this
> would be useful?
Sure,
Take a look at dev-go/go-snappy and most of the dev-go ebuilds.
They use a src_unpack function for the non-live side that is almost
exactly like vcs-snapshot except for the extraction location.
> I'm unclear as to why tarballs are being unpacked in sub-directories of ${S}.
For Go software that just uses the Go tools to build, it is easiest to
work with if you treat ${S} as a Go Workspace [1].
I could write my own golang-vcs-snapshot.eclass that does this, but I
thought it would be easier to leverage code that is already in the tree.
William
[1] https://golang.org/doc/code.html#Workspaces
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-dev] Jvcs-snapshot.eclass: add a way to specify the extraction path
2015-07-31 14:44 ` [gentoo-dev] Jvcs-snapshot.eclass: " William Hubbs
@ 2015-07-31 20:34 ` Mike Gilbert
0 siblings, 0 replies; 5+ messages in thread
From: Mike Gilbert @ 2015-07-31 20:34 UTC (permalink / raw
To: Gentoo Dev
On Fri, Jul 31, 2015 at 10:44 AM, William Hubbs <williamh@gentoo.org> wrote:
> On Thu, Jul 30, 2015 at 05:11:20PM -0400, Mike Gilbert wrote:
>> On Thu, Jul 30, 2015 at 11:57 AM, William Hubbs <williamh@gentoo.org> wrote:
>> > All,
>> >
>> > I'm finding in working on Go ebuilds, that we are propegating a
>> > src_unpack function that is very similar to the one in vcs-snapshot.
>> >
>> > This patch adds an EXTRACT_PATH variable to the vcs-snapshot eclass
>> > which, if set, puts the extracted archives in the specified directory under ${S}.
>> >
>> > If it is not set, nothing should happen.
>> >
>> > This could be used by other types of ebuilds later, but for now it would
>> > be used by Go ebuilds.
>> >
>> > Thoughts?
>>
>> Can you provide an example of an ebuild in the tree for which this
>> would be useful?
>
> Sure,
>
> Take a look at dev-go/go-snappy and most of the dev-go ebuilds.
>
> They use a src_unpack function for the non-live side that is almost
> exactly like vcs-snapshot except for the extraction location.
>
>> I'm unclear as to why tarballs are being unpacked in sub-directories of ${S}.
>
> For Go software that just uses the Go tools to build, it is easiest to
> work with if you treat ${S} as a Go Workspace [1].
>
> I could write my own golang-vcs-snapshot.eclass that does this, but I
> thought it would be easier to leverage code that is already in the tree.
The thing I find a bit awkward here is that vcs-snapshot_src_unpack
will automatically unpack multiple tarballs into separate directories.
As soon as you set EXTRACT_PATH, you break that; all tarballs get
unpacked into a single directory.
I think sharing code often a good thing, but I think some refactoring
is in order before it will be possible here.
Since go does things rather strangely, it may make more since to
maintain your own version of this function in another eclass.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-07-31 20:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-30 15:57 [gentoo-dev] vcs-snapshot.eclass: add a way to specify the extraction path William Hubbs
2015-07-30 21:11 ` Mike Gilbert
2015-07-31 14:44 ` [gentoo-dev] Jvcs-snapshot.eclass: " William Hubbs
2015-07-31 20:34 ` Mike Gilbert
2015-07-31 1:53 ` [gentoo-dev] vcs-snapshot.eclass: " Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox