From: Saul Wold <sgw@linux.intel.com>
To: Patches and discussions about the oe-core layer
<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 1/1] archive.bbclass: archive work directory
Date: Fri, 06 Jan 2012 00:46:29 -0800 [thread overview]
Message-ID: <4F06B4E5.7090901@linux.intel.com> (raw)
In-Reply-To: <b63c8a5a0cf70a797fd49844b7854151a58f579e.1325837822.git.wenzong.fan@windriver.com>
On 01/06/2012 12:20 AM, wenzong.fan@windriver.com wrote:
> From: Wenzong Fan<wenzong.fan@windriver.com>
>
> Some legal departments believe a complete archive of the work directory
> is required for certain license compliance issues. We could therefore
> do with a class which archives up the work directories in each build and
> provide them so those legal departments can be happy.
>
> Implementations:
>
> Add a new class named 'archive.bbclass' to provide task 'do_archive',
> and get it called after 'do_patch' before 'do_configure'.
>
> Following cases should be considered to the sources dirs:
> 1) The sources dir is under $WORKDIR:
> Just archive sources and temp/run.* up.
>
> 2) The sources dir is outside of $WORKDIR, the only package is gcc:
> Copy its sources and temp/run.* to a temporary dir and then archive
> them up.
>
> 3) The sources dir is equal to $WORKDIR:
> Just archive whole work dir up.
>
> [YOCTO #1590]
>
> Signed-off-by: Wenzong Fan<wenzong.fan@windriver.com>
> ---
> meta/classes/archive.bbclass | 42 ++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 42 insertions(+), 0 deletions(-)
> create mode 100644 meta/classes/archive.bbclass
>
> diff --git a/meta/classes/archive.bbclass b/meta/classes/archive.bbclass
> new file mode 100644
> index 0000000..75ac090
> --- /dev/null
> +++ b/meta/classes/archive.bbclass
> @@ -0,0 +1,42 @@
> +# Archive the patched sources and build scripts to assist in license
> +# compliance by the end user or legal departments.
> +
> +ARCHIVE_DIR = "${TMPDIR}/archives/${MULTIMACH_TARGET_SYS}/"
> +do_archive[dirs] = "${ARCHIVE_DIR}"
> +
I see you set ARCHIVE_DIR, but I don' see you move or copy any files to
this directory, am I missing something?
> +archive_do_archive() {
> + # In mostly scenarios the $S is under $WORKDIR and has a separate
> + # dir for storing the sources; but gcc is a special case, its sources
> + # had been moved to the shared location 'tmp/work-shared/'
> + if [[ -d ${S}&& ${S} != ${WORKDIR} ]]; then
> + if [[ ${S} =~ "/work-shared/gcc" ]]; then
> + # Create temporary sources directory for gcc
> + mkdir -p ${PF}/temp
> + cp -r ${S} ${PF}
> + cp -r ${S}/../temp/* ${PF}/temp
> + cp -r ${WORKDIR}/temp/* ${PF}/temp
> + tarbase=`pwd`
> + else
> + tarbase=`dirname ${WORKDIR}`
> + fi
> +
> + sourcedir=`basename ${S}`
> + tar -C $tarbase -cjf ${PF}.tar.bz2 ${PF}/$sourcedir \
> + ${PF}/temp --exclude log.do_*
> +
Also, do you want to name the tarball PF or BP, which deals with
removing any multilib naming issues if the build it multilib.
Note BP = ${BPN}-${PV} so it removes the ${PR} if that is important
(which it might be).
> + # Remove the temporary gcc sources directory
> + if [[ ${S} =~ "/work-shared/gcc"&& -d ${PF} ]]; then
> + rm -rf ${PF}
> + fi
> + fi
> +
> + # Just archive whole build directory up when $S is equal to $WORKDIR
> + if [[ -d ${S}&& ${S} == ${WORKDIR} ]]; then
> + tarbase=`dirname ${WORKDIR}`
> + tar -C $tarbase -cjf ${PF}.tar.bz2 ${PF} --exclude log.do_*
> + fi
> +}
> +
> +addtask do_archive after do_patch before do_configure
> +
> +EXPORT_FUNCTIONS do_archive
next prev parent reply other threads:[~2012-01-06 8:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-06 8:20 [PATCH 0/1] archive.bbclass: archive work directory wenzong.fan
2012-01-06 8:20 ` [PATCH 1/1] " wenzong.fan
2012-01-06 8:46 ` Saul Wold [this message]
2012-01-09 2:20 ` wenzong fan
2012-01-06 17:39 ` Phil Blundell
2012-01-09 3:31 ` [PATCH 1/1] archive.bbclass: archive work directoryDistribution wenzong fan
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=4F06B4E5.7090901@linux.intel.com \
--to=sgw@linux.intel.com \
--cc=openembedded-core@lists.openembedded.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