Skip to contentSkip to conversation

archiver.bbclass: make it can filter the license

PATCH In review Robert Yang 2 participants 7 messages Mar 24, 2014 – Mar 25, 2014

lore
Share & tools
lore
#0 lore raw

cover archiver.bbclass: make it can filter the license

After talked with Chris, we use the copyleft_filter.bbclass which is from copyleft_compliance.bbclass to filter the license for both archiver.bbclass and copyleft_compliance.bbclass, and we may remove copyleft_compliance.bbclass in post 1.6, but we will keep it now.

// Robert

The following changes since commit 4a47c943a76e79af82d47d8fa83c6687e0d915a0:

busybox: disable fsck.minix and mkfs.minix (2014-03-23 09:08:49 +0000)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib rbt/archiver_license
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/archiver_license

Robert Yang (3):
archiver.bbclass: make it can filter the license archiver.bbclass: emit patch series files for original src local.conf.sample.extended: update it for the archiver

 meta/classes/archiver.bbclass            | 40 +++++++++++++++++++--
 meta/classes/copyleft_compliance.bbclass | 56 +----------------------------
 meta/classes/copyleft_filter.bbclass     | 62 ++++++++++++++++++++++++++++++++
 meta/conf/local.conf.sample.extended     | 10 +++++-
 4 files changed, 110 insertions(+), 58 deletions(-)
 create mode 100644 meta/classes/copyleft_filter.bbclass
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/3 archiver.bbclass: make it can filter the license

* Filter the license (default: no), the recipe whose license in COPYLEFT_LICENSE_INCLUDE will be included, and in COPYLEFT_LICENSE_EXCLUDE will be excluded.

* The user can set the recipe type that would be archived (native, target, and so on), deafult to all.

The copyleft_filter.bbclass is come from copyleft_compliance.bbclass, which is used by both copyleft_compliance.bbclass and archiver.bbclass.

[YOCTO #5740]

---
 meta/classes/archiver.bbclass            | 27 ++++++++++++--
 meta/classes/copyleft_compliance.bbclass | 56 +----------------------------
 meta/classes/copyleft_filter.bbclass     | 62 ++++++++++++++++++++++++++++++++
 3 files changed, 88 insertions(+), 57 deletions(-)
 create mode 100644 meta/classes/copyleft_filter.bbclass
meta/classes/archiver.bbclass +25 -2
index 7780c71..9aa9335 100644
@@ -12,9 +12,23 @@
 # 5) The environment data, similar to 'bitbake -e recipe':
 #    ARCHIVER_MODE[dumpdata] = "1"
 # 6) The recipe (.bb and .inc): ARCHIVER_MODE[recipe] = "1"
+# 7) Whether output the .src.rpm package:
+#    ARCHIVER_MODE[srpm] = "1"
+# 8) Filter the license, the recipe whose license in
+#    COPYLEFT_LICENSE_INCLUDE will be included, and in
+#    COPYLEFT_LICENSE_EXCLUDE will be excluded.
+#    COPYLEFT_LICENSE_INCLUDE = 'GPL* LGPL*'
+#    COPYLEFT_LICENSE_EXCLUDE = 'CLOSED Proprietary'
+# 9) The recipe type that will be archived:
+#    COPYLEFT_RECIPE_TYPES = 'target'
 #
-# All of the above can be packed into a .src.rpm package: (when PACKAGES != "")
-# ARCHIVER_MODE[srpm] = "1"
+
+# Don't filter the license by default
+COPYLEFT_LICENSE_INCLUDE ?= ''
+COPYLEFT_LICENSE_EXCLUDE ?= ''
+# Create archive for all the recipe types
+COPYLEFT_RECIPE_TYPES ?= 'target native nativesdk cross crosssdk cross-canadian'
+inherit copyleft_filter
 
 ARCHIVER_MODE[srpm] ?= "0"
 ARCHIVER_MODE[src] ?= "patched"
@@ -38,6 +52,15 @@ do_ar_original[dirs] = "${ARCHIVER_OUTDIR} ${ARCHIVER_WORKDIR}"
 python () {
     pn = d.getVar('PN', True)
 
+    if d.getVar('COPYLEFT_LICENSE_INCLUDE', True) or \
+            d.getVar('COPYLEFT_LICENSE_EXCLUDE', True):
+        included, reason = copyleft_should_include(d)
+        if not included:
+            bb.debug(1, 'archiver: %s is excluded: %s' % (pn, reason))
+            return
+        else:
+            bb.debug(1, 'archiver: %s is included: %s' % (pn, reason))
+
     ar_src = d.getVarFlag('ARCHIVER_MODE', 'src', True)
     ar_dumpdata = d.getVarFlag('ARCHIVER_MODE', 'dumpdata', True)
     ar_recipe = d.getVarFlag('ARCHIVER_MODE', 'recipe', True)
meta/classes/copyleft_compliance.bbclass +1 -55

67 lines not on this page · raw message

meta/classes/copyleft_filter.bbclass new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/3 archiver.bbclass: emit patch series files for original src

In reply to Robert Yang

Emit patch series files for original src so that the user knows how to apply the patch orderly.

[YOCTO #5113]

---
 meta/classes/archiver.bbclass | 13 +++++++++++++
 1 file changed, 13 insertions(+)
meta/classes/archiver.bbclass +13 -0
index 9aa9335..8d8e7c4 100644
@@ -150,6 +150,19 @@ python do_ar_original() {
             tar = tarfile.open(tarname, 'w:gz')
             tar.add('.')
             tar.close()
+
+    # Emit patch series files for 'original'
+    bb.note('Writing patch series files...')
+    for patch in src_patches(d):
+        _, _, local, _, _, parm = bb.fetch.decodeurl(patch)
+        patchdir = parm.get('patchdir')
+        if patchdir:
+            series = os.path.join(ar_outdir, 'series.subdir.%s' % patchdir.replace('/', '_'))
+        else:
+            series = os.path.join(ar_outdir, 'series')
+
+        with open(series, 'a') as s:
+            s.write('%s -p%s\n' % (os.path.basename(local), parm['striplevel']))
 }
 
 python do_ar_patched() {
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 3/3 local.conf.sample.extended: update it for the archiver

In reply to Robert Yang

Add the filter license comment for archiver.bbclass.

[YOCTO #5740]

---
 meta/conf/local.conf.sample.extended | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
meta/conf/local.conf.sample.extended +9 -1
index aa01917..048aa8b 100644
@@ -214,9 +214,17 @@
 # 6) the recipe (.bb and .inc):
 #ARCHIVER_MODE[recipe] = "1"
 #
-# Whether output the .src.rpm package:
+# 7) Whether output the .src.rpm package:
 #ARCHIVER_MODE[srpm] = "1"
 #
+# 8) Filter the license, the recipe whose license in
+#    COPYLEFT_LICENSE_INCLUDE will be included, and in
+#    COPYLEFT_LICENSE_EXCLUDE will be excluded.
+#    COPYLEFT_LICENSE_INCLUDE = 'GPL* LGPL*'
+#    COPYLEFT_LICENSE_EXCLUDE = 'CLOSED Proprietary'
+# 9) The recipe type that will be archived:
+#    COPYLEFT_RECIPE_TYPES = '<type1> <type2> ...'
+#    The type can be: target native nativesdk cross crosssdk cross-canadian.
 
 # Remove the old image before the new one generated to save disk space
 #RM_OLD_IMAGE = "1"
Signature · 1 line
1.8.3.1
#4 lore raw

Re: [PATCH 3/3] local.conf.sample.extended: update it for the archiver

Quoted 5 lines · Robert Yang
meta/conf/local.conf.sample.extended +3 -0
+# 9) The recipe type that will be archived:
+#    COPYLEFT_RECIPE_TYPES = '<type1> <type2> ...'
+#    The type can be: target native nativesdk cross crosssdk

cross-canadian.

Hmm, I wonder if we should note that the default is to archive all types, here.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#5 lore raw

Re: [PATCH 3/3] local.conf.sample.extended: update it for the archiver

Quoted 11 lines · Chris Larson
Quoted 5 lines · Robert Yang
(quoted diff) +3 -0
+# 9) The recipe type that will be archived:
+#    COPYLEFT_RECIPE_TYPES = '<type1> <type2> ...'
+#    The type can be: target native nativesdk cross crosssdk

cross-canadian.

Hmm, I wonder if we should note that the default is to archive all types, here.

Good idea, I've updated it and pushed to:

git://git.openembedded.org/openembedded-core-contrib rbt/archiver_license
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/archiver_license

meta/conf/local.conf.sample.extended +12 -2
index aa01917..a1f2464 100644
@@ -214,9 +214,20 @@
 # 6) the recipe (.bb and .inc):
 #ARCHIVER_MODE[recipe] = "1"
 #
-# Whether output the .src.rpm package:
+# 7) Whether output the .src.rpm package:
 #ARCHIVER_MODE[srpm] = "1"
 #
+# 8) Filter the license, the recipe whose license in
+#    COPYLEFT_LICENSE_INCLUDE will be included, and in
+#    COPYLEFT_LICENSE_EXCLUDE will be excluded.
+#COPYLEFT_LICENSE_INCLUDE = 'GPL* LGPL*'
+#COPYLEFT_LICENSE_EXCLUDE = 'CLOSED Proprietary'
+#
+# 9) Config the recipe type that will be archived, the type can be
+#    target, native, nativesdk, cross, crosssdk and cross-canadian,
+#    you can set one or more types. Archive all types by default.
+#COPYLEFT_RECIPE_TYPES = 'target'
+#
 
-R
 
#6 lore raw

Re: [PATCH 3/3] local.conf.sample.extended: update it for the archiver

Quoted 15 lines · Robert Yang
Quoted 13 lines · Chris Larson

On Sun, Mar 23, 2014 at 10:39 PM, Robert Yang <[email protected]> wrote:

+# 9) The recipe type that will be archived:

Quoted 5 lines
(quoted diff) +2 -0
+#    COPYLEFT_RECIPE_TYPES = '<type1> <type2> ...'
+#    The type can be: target native nativesdk cross crosssdk

cross-canadian.

Hmm, I wonder if we should note that the default is to archive all types, here.

Quoted 5 lines

Good idea, I've updated it and pushed to:

git://git.openembedded.org/openembedded-core-contrib rbt/archiver_license
http://cgit.openembedded.org/cgit.cgi/openembedded-core-
contrib/log/?h=rbt/archiver_license

Looks good to me.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics