All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Ready to merge patches from O.S. Systems tree
@ 2012-01-31  2:10 Otavio Salvador
  2012-01-31  2:10 ` [PATCH 1/2] udev: improve udev-cache robustness Otavio Salvador
  2012-01-31  2:10 ` [PATCH 2/2] classes/gitpkgv.bbclass: import from Meta-OE Otavio Salvador
  0 siblings, 2 replies; 7+ messages in thread
From: Otavio Salvador @ 2012-01-31  2:10 UTC (permalink / raw)
  To: openembedded-core

This patchset provides two patches. The first does the changes
suggested some time ago by Richard to avoid too much forking in new
udev cache support; the later imports gitpkgv from Meta-OE as some
layers will start using it (Meta-TI is one) and this avoids the
dependency on Meta-OE for its support.

The following changes since commit d7b13cd42ab8d5f44f97e119b73ec2e363677d26:

  useradd.bbclass: Fix missing quote (2012-01-27 23:57:33 +0000)

are available in the git repository at:
  git://github.com/OSSystems/oe-core master
  https://github.com/OSSystems/oe-core/tree/HEAD

Otavio Salvador (2):
  udev: improve udev-cache robustness
  classes/gitpkgv.bbclass: import from Meta-OE

 meta/classes/gitpkgv.bbclass                   |   95 ++++++++++++++++++++++++
 meta/recipes-core/udev/udev.inc                |    8 ++-
 meta/recipes-core/udev/udev/init               |   15 +++-
 meta/recipes-core/udev/udev/udev-cache         |   14 +++-
 meta/recipes-core/udev/udev/udev-cache.default |    4 +
 5 files changed, 129 insertions(+), 7 deletions(-)
 create mode 100644 meta/classes/gitpkgv.bbclass
 create mode 100644 meta/recipes-core/udev/udev/udev-cache.default

-- 
1.7.2.5




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] udev: improve udev-cache robustness
  2012-01-31  2:10 [PATCH 0/2] Ready to merge patches from O.S. Systems tree Otavio Salvador
@ 2012-01-31  2:10 ` Otavio Salvador
  2012-02-01 16:35   ` Richard Purdie
  2012-01-31  2:10 ` [PATCH 2/2] classes/gitpkgv.bbclass: import from Meta-OE Otavio Salvador
  1 sibling, 1 reply; 7+ messages in thread
From: Otavio Salvador @ 2012-01-31  2:10 UTC (permalink / raw)
  To: openembedded-core

 * allow udev-cache to be disabled at runtime (using
   /etc/default/udev-cache);

 * make cache invalidated if kernel, bootparams or device list
   changes;

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 meta/recipes-core/udev/udev.inc                |    8 +++++++-
 meta/recipes-core/udev/udev/init               |   15 ++++++++++++---
 meta/recipes-core/udev/udev/udev-cache         |   14 +++++++++++---
 meta/recipes-core/udev/udev/udev-cache.default |    4 ++++
 4 files changed, 34 insertions(+), 7 deletions(-)
 create mode 100644 meta/recipes-core/udev/udev/udev-cache.default

diff --git a/meta/recipes-core/udev/udev.inc b/meta/recipes-core/udev/udev.inc
index 0e571d6..e5fbe40 100644
--- a/meta/recipes-core/udev/udev.inc
+++ b/meta/recipes-core/udev/udev.inc
@@ -25,6 +25,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \
            file://network.sh \
            file://local.rules \
            file://udev-cache \
+           file://udev-cache.default \
            file://init"
 
 inherit autotools pkgconfig update-rc.d
@@ -58,7 +59,7 @@ FILES_libgudev = "${base_libdir}/libgudev*.so.* ${libdir}/libgudev*.so.*"
 FILES_libgudev-dbg = "${base_libdir}/.debug/libgudev*.so.* ${libdir}/.debug/libgudev*.so.*"
 FILES_libgudev-dev = "${includedir}/gudev* ${libdir}/libgudev*.so ${libdir}/libgudev*.la \
                      ${libdir}/libgudev*.a ${libdir}/pkgconfig/gudev*.pc"
-FILES_udev-cache = "${sysconfdir}/init.d/udev-cache"
+FILES_udev-cache = "${sysconfdir}/init.d/udev-cache ${sysconfdir}/default/udev-cache"
 
 FILES_udev-acl = "${base_libdir}/udev/udev-acl ${base_libdir}/udev/rules.d/70-acl.rules"
 
@@ -72,6 +73,11 @@ do_install_append () {
 	install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev
 	install -m 0755 ${WORKDIR}/udev-cache ${D}${sysconfdir}/init.d/udev-cache
 
+	install -d ${D}${sysconfdir}/default
+	install -m 0755 ${WORKDIR}/udev-cache.default ${D}${sysconfdir}/default/udev-cache
+
+	touch ${D}${sysconfdir}/udev/cache.data
+
 	install -d ${D}${sysconfdir}/udev/rules.d/
 
 	install -m 0644 ${WORKDIR}/local.rules         ${D}${sysconfdir}/udev/rules.d/local.rules
diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init
index 6a4464c..f2c7f87 100644
--- a/meta/recipes-core/udev/udev/init
+++ b/meta/recipes-core/udev/udev/init
@@ -14,6 +14,7 @@ export TZ=/etc/localtime
 [ -d /sys/class ] || exit 1
 [ -r /proc/mounts ] || exit 1
 [ -x /sbin/udevd ] || exit 1
+[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
 [ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
 
 kill_udevd() {
@@ -35,9 +36,17 @@ LANG=C awk '$2 == "/dev" && ($3 == "tmpfs" || $3 == "devtmpfs") { exit 1 }' /pro
 [ -e /dev/shm ] || mkdir -m 1777 /dev/shm
 
 
-if [ -e /etc/dev.tar ]; then
-	(cd /; tar xf /etc/dev.tar 2>&1 | grep -v 'time stamp' || true)
-	not_first_boot=1
+if [ "$DEVCACHE" != "" ]; then
+	# Ensure we are consistent to use the cache
+	echo -n > /dev/shm/cache.data
+	[ -x /bin/uname ] && /bin/uname -mrspv >> /dev/shm/cache.data
+	[ -r /proc/cmdline ] && cat /proc/cmdline >> /dev/shm/cache.data
+	[ -r /proc/devices ] && cat /proc/devices >> /dev/shm/cache.data
+	[ -r /proc/atags ] && cat /proc/atags >> /dev/shm/cache.data
+	if [ -e $DEVCACHE ] && cmp -s /dev/shm/cache.data /etc/udev/cache.data; then
+		(cd /; tar xf $DEVCACHE > /dev/null 2>&1)
+		not_first_boot=1
+	fi
 fi
 
 # make_extra_nodes
diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
index 77bbda6..f6a43bf 100644
--- a/meta/recipes-core/udev/udev/udev-cache
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -9,12 +9,20 @@
 # Short-Description: cache /dev to speedup the udev next boot
 ### END INIT INFO
 
-[ -d /sys/class ] || exit 1
+export TZ=/etc/localtime
+
 [ -r /proc/mounts ] || exit 1
 [ -x /sbin/udevd ] || exit 1
+[ -d /sys/class ] || exit 1
+
+[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
 
-if [ ! -e /etc/dev.tar ]; then
-	(cd /; tar cf /etc/dev.tar dev)
+if [ "$DEVCACHE" != "" ]; then
+	echo "Populating dev cache"
+	(cd /; tar cf "$DEVCACHE" dev)
+	mv /dev/shm/cache.data /etc/udev/cache.data
+else
+	rm -f /dev/shm/cache.data
 fi
 
 exit 0
diff --git a/meta/recipes-core/udev/udev/udev-cache.default b/meta/recipes-core/udev/udev/udev-cache.default
new file mode 100644
index 0000000..5c4937a
--- /dev/null
+++ b/meta/recipes-core/udev/udev/udev-cache.default
@@ -0,0 +1,4 @@
+# Default for /etc/init.d/udev
+
+# Comment this out to disable device cache
+DEVCACHE="/etc/dev.tar"
-- 
1.7.2.5




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] classes/gitpkgv.bbclass: import from Meta-OE
  2012-01-31  2:10 [PATCH 0/2] Ready to merge patches from O.S. Systems tree Otavio Salvador
  2012-01-31  2:10 ` [PATCH 1/2] udev: improve udev-cache robustness Otavio Salvador
@ 2012-01-31  2:10 ` Otavio Salvador
  2012-02-01 13:19   ` Richard Purdie
  1 sibling, 1 reply; 7+ messages in thread
From: Otavio Salvador @ 2012-01-31  2:10 UTC (permalink / raw)
  To: openembedded-core

It provides a GITPKGV and GITPKGVTAG variables to be used in PKGV, as
described bellow:

 - GITPKGV which is a sortable version with the format NN+GITHASH, to
   be used in PKGV, where

   NN equals the total number of revs up to SRCREV
   GITHASH is SRCREV's (full) hash

 - GITPKGVTAG which is the output of 'git describe' allowing for
   automatic versioning

gitpkgv.bbclass assumes the git repository has been cloned, and
contains SRCREV. So ${GITPKGV} and ${GITPKGVTAG} should never be
used in PV, only in PKGV.  It can handle SRCREV = ${AUTOREV}, as
well as SRCREV = "<some fixed git hash>".

The code has been imported from Meta-OE at revision
a76fff17ea8420686ef81b35f80efac1bef21649.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 meta/classes/gitpkgv.bbclass |   95 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 95 insertions(+), 0 deletions(-)
 create mode 100644 meta/classes/gitpkgv.bbclass

diff --git a/meta/classes/gitpkgv.bbclass b/meta/classes/gitpkgv.bbclass
new file mode 100644
index 0000000..238b0d2
--- /dev/null
+++ b/meta/classes/gitpkgv.bbclass
@@ -0,0 +1,95 @@
+# gitpkgv.bbclass provides a GITPKGV and GITPKGVTAG variables to be
+# used in PKGV, as described bellow:
+#
+# - GITPKGV which is a sortable version with the format NN+GITHASH, to
+#   be used in PKGV, where
+#
+#   NN equals the total number of revs up to SRCREV
+#   GITHASH is SRCREV's (full) hash
+#
+# - GITPKGVTAG which is the output of 'git describe' allowing for
+#   automatic versioning
+#
+# gitpkgv.bbclass assumes the git repository has been cloned, and
+# contains SRCREV. So ${GITPKGV} and ${GITPKGVTAG} should never be
+# used in PV, only in PKGV.  It can handle SRCREV = ${AUTOREV}, as
+# well as SRCREV = "<some fixed git hash>".
+#
+# WARNING: if upstream repository is always using consistent and
+# sortable tag name scheme you can get sortable version including tag
+# name with ${GITPKGVTAG}, but be aware that ie tag sequence "v1.0,
+# v1.2, xtest, v2.0" will force you to increment PE to get upgradeable
+# path to v2.0 revisions
+#
+# use example:
+#
+# inherit gitpkgv
+#
+# PV = "1.0+gitr${SRCPV}"      # expands to something like 1.0+gitr3+4c1c21d7dbbf93b0df336994524313dfe0d4963b
+# PKGV = "1.0+gitr${GITPKGV}"  # expands also to something like 1.0+gitr31337+4c1c21d7d
+#
+# or
+#
+# inherit gitpkgv
+#
+# PV = "1.0+gitr${SRCPV}" # expands to something like 1.0+gitr3+4c1c21d7dbbf93b0df336994524313dfe0d4963b
+# PKGV = "${GITPKGVTAG}"  # expands to something like 1.0-31337+g4c1c21d
+#                           if there is tag v1.0 before this revision or
+#                           ver1.0-31337+g4c1c21d if there is tag ver1.0
+
+GITPKGV = "${@get_git_pkgv(d, False)}"
+GITPKGVTAG = "${@get_git_pkgv(d, True)}"
+
+def gitpkgv_drop_tag_prefix(version):
+    import re
+    if re.match("v\d", version):
+        return version[1:]
+    else:
+        return version
+
+def get_git_pkgv(d, use_tags):
+    import os
+    import bb
+
+    src_uri = bb.data.getVar('SRC_URI', d, 1).split()
+    fetcher = bb.fetch2.Fetch(src_uri, d)
+    ud = fetcher.ud
+
+    #
+    # If SRCREV_FORMAT is set respect it for tags
+    #
+    format = bb.data.getVar('SRCREV_FORMAT', d, True)
+    if not format:
+        format = 'default'
+
+    found = False
+    for url in ud.values():
+        if url.type == 'git':
+            for name, rev in url.revisions.items():
+                if not os.path.exists(url.localpath):
+                    return None
+
+                found = True
+
+                cwd = os.getcwd()
+                os.chdir(url.localpath)
+
+                commits = bb.fetch2.runfetchcmd("git rev-list %s -- 2> /dev/null | wc -l" % rev, d, quiet=True).strip()
+
+                if use_tags:
+                    try:
+                        output = bb.fetch2.runfetchcmd("git describe %s 2>/dev/null" % rev, d, quiet=True).strip()
+                        ver = gitpkgv_drop_tag_prefix(output)
+                    except Exception:
+                        ver = "0.0-%s-g%s" % (commits, rev[:7])
+                else:
+                    ver = "%s+%s" % (commits, rev[:7])
+
+                os.chdir(cwd)
+
+                format = format.replace(name, ver)
+
+    if found:
+        return format
+
+    return '0+0'
-- 
1.7.2.5




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] classes/gitpkgv.bbclass: import from Meta-OE
  2012-01-31  2:10 ` [PATCH 2/2] classes/gitpkgv.bbclass: import from Meta-OE Otavio Salvador
@ 2012-02-01 13:19   ` Richard Purdie
  2012-02-01 18:00     ` Otavio Salvador
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Purdie @ 2012-02-01 13:19 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Tue, 2012-01-31 at 02:10 +0000, Otavio Salvador wrote:
> It provides a GITPKGV and GITPKGVTAG variables to be used in PKGV, as
> described bellow:
> 
>  - GITPKGV which is a sortable version with the format NN+GITHASH, to
>    be used in PKGV, where
> 
>    NN equals the total number of revs up to SRCREV
>    GITHASH is SRCREV's (full) hash
> 
>  - GITPKGVTAG which is the output of 'git describe' allowing for
>    automatic versioning
> 
> gitpkgv.bbclass assumes the git repository has been cloned, and
> contains SRCREV. So ${GITPKGV} and ${GITPKGVTAG} should never be
> used in PV, only in PKGV.  It can handle SRCREV = ${AUTOREV}, as
> well as SRCREV = "<some fixed git hash>".
> 
> The code has been imported from Meta-OE at revision
> a76fff17ea8420686ef81b35f80efac1bef21649.
> 
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
>  meta/classes/gitpkgv.bbclass |   95 ++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 95 insertions(+), 0 deletions(-)
>  create mode 100644 meta/classes/gitpkgv.bbclass

As discussed on IRC, I think some of the code here should really be
integrated into the bitbake git fetcher to ensure we have a
clean/consistent API for fetcher functionality. The interface I'm
thinking about would be similar to SRCPV:

SRCPV = "${@bb.fetch2.get_srcrev(d)}"

with a new fetcher call being added such as get_simplified_srcrev(d).
Switching between the simplified revision and the description could be
governed by a variable setting similar to some of the existing variables
that control fetcher behaviour.

There has been substantial work done to improve the fetcher APIs and
clean up the various corner cases and this would seem a logical
continuation of that, in keeping with the objectives of OE-Core.

Cheers,

Richard


> diff --git a/meta/classes/gitpkgv.bbclass b/meta/classes/gitpkgv.bbclass
> new file mode 100644
> index 0000000..238b0d2
> --- /dev/null
> +++ b/meta/classes/gitpkgv.bbclass
> @@ -0,0 +1,95 @@
> +# gitpkgv.bbclass provides a GITPKGV and GITPKGVTAG variables to be
> +# used in PKGV, as described bellow:
> +#
> +# - GITPKGV which is a sortable version with the format NN+GITHASH, to
> +#   be used in PKGV, where
> +#
> +#   NN equals the total number of revs up to SRCREV
> +#   GITHASH is SRCREV's (full) hash
> +#
> +# - GITPKGVTAG which is the output of 'git describe' allowing for
> +#   automatic versioning
> +#
> +# gitpkgv.bbclass assumes the git repository has been cloned, and
> +# contains SRCREV. So ${GITPKGV} and ${GITPKGVTAG} should never be
> +# used in PV, only in PKGV.  It can handle SRCREV = ${AUTOREV}, as
> +# well as SRCREV = "<some fixed git hash>".
> +#
> +# WARNING: if upstream repository is always using consistent and
> +# sortable tag name scheme you can get sortable version including tag
> +# name with ${GITPKGVTAG}, but be aware that ie tag sequence "v1.0,
> +# v1.2, xtest, v2.0" will force you to increment PE to get upgradeable
> +# path to v2.0 revisions
> +#
> +# use example:
> +#
> +# inherit gitpkgv
> +#
> +# PV = "1.0+gitr${SRCPV}"      # expands to something like 1.0+gitr3+4c1c21d7dbbf93b0df336994524313dfe0d4963b
> +# PKGV = "1.0+gitr${GITPKGV}"  # expands also to something like 1.0+gitr31337+4c1c21d7d
> +#
> +# or
> +#
> +# inherit gitpkgv
> +#
> +# PV = "1.0+gitr${SRCPV}" # expands to something like 1.0+gitr3+4c1c21d7dbbf93b0df336994524313dfe0d4963b
> +# PKGV = "${GITPKGVTAG}"  # expands to something like 1.0-31337+g4c1c21d
> +#                           if there is tag v1.0 before this revision or
> +#                           ver1.0-31337+g4c1c21d if there is tag ver1.0
> +
> +GITPKGV = "${@get_git_pkgv(d, False)}"
> +GITPKGVTAG = "${@get_git_pkgv(d, True)}"
> +
> +def gitpkgv_drop_tag_prefix(version):
> +    import re
> +    if re.match("v\d", version):
> +        return version[1:]
> +    else:
> +        return version
> +
> +def get_git_pkgv(d, use_tags):
> +    import os
> +    import bb
> +
> +    src_uri = bb.data.getVar('SRC_URI', d, 1).split()
> +    fetcher = bb.fetch2.Fetch(src_uri, d)
> +    ud = fetcher.ud
> +
> +    #
> +    # If SRCREV_FORMAT is set respect it for tags
> +    #
> +    format = bb.data.getVar('SRCREV_FORMAT', d, True)
> +    if not format:
> +        format = 'default'
> +
> +    found = False
> +    for url in ud.values():
> +        if url.type == 'git':
> +            for name, rev in url.revisions.items():
> +                if not os.path.exists(url.localpath):
> +                    return None
> +
> +                found = True
> +
> +                cwd = os.getcwd()
> +                os.chdir(url.localpath)
> +
> +                commits = bb.fetch2.runfetchcmd("git rev-list %s -- 2> /dev/null | wc -l" % rev, d, quiet=True).strip()
> +
> +                if use_tags:
> +                    try:
> +                        output = bb.fetch2.runfetchcmd("git describe %s 2>/dev/null" % rev, d, quiet=True).strip()
> +                        ver = gitpkgv_drop_tag_prefix(output)
> +                    except Exception:
> +                        ver = "0.0-%s-g%s" % (commits, rev[:7])
> +                else:
> +                    ver = "%s+%s" % (commits, rev[:7])
> +
> +                os.chdir(cwd)
> +
> +                format = format.replace(name, ver)
> +
> +    if found:
> +        return format
> +
> +    return '0+0'





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] udev: improve udev-cache robustness
  2012-01-31  2:10 ` [PATCH 1/2] udev: improve udev-cache robustness Otavio Salvador
@ 2012-02-01 16:35   ` Richard Purdie
  2012-02-01 18:11     ` Otavio Salvador
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Purdie @ 2012-02-01 16:35 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Tue, 2012-01-31 at 02:10 +0000, Otavio Salvador wrote:
> * allow udev-cache to be disabled at runtime (using
>    /etc/default/udev-cache);
> 
>  * make cache invalidated if kernel, bootparams or device list
>    changes;
> 
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
>  meta/recipes-core/udev/udev.inc                |    8 +++++++-
>  meta/recipes-core/udev/udev/init               |   15 ++++++++++++---
>  meta/recipes-core/udev/udev/udev-cache         |   14 +++++++++++---
>  meta/recipes-core/udev/udev/udev-cache.default |    4 ++++
>  4 files changed, 34 insertions(+), 7 deletions(-)
>  create mode 100644 meta/recipes-core/udev/udev/udev-cache.default
> 
> diff --git a/meta/recipes-core/udev/udev.inc b/meta/recipes-core/udev/udev.inc
> index 0e571d6..e5fbe40 100644
> --- a/meta/recipes-core/udev/udev.inc
> +++ b/meta/recipes-core/udev/udev.inc
> @@ -25,6 +25,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \
>             file://network.sh \
>             file://local.rules \
>             file://udev-cache \
> +           file://udev-cache.default \
>             file://init"
>  
>  inherit autotools pkgconfig update-rc.d
> @@ -58,7 +59,7 @@ FILES_libgudev = "${base_libdir}/libgudev*.so.* ${libdir}/libgudev*.so.*"
>  FILES_libgudev-dbg = "${base_libdir}/.debug/libgudev*.so.* ${libdir}/.debug/libgudev*.so.*"
>  FILES_libgudev-dev = "${includedir}/gudev* ${libdir}/libgudev*.so ${libdir}/libgudev*.la \
>                       ${libdir}/libgudev*.a ${libdir}/pkgconfig/gudev*.pc"
> -FILES_udev-cache = "${sysconfdir}/init.d/udev-cache"
> +FILES_udev-cache = "${sysconfdir}/init.d/udev-cache ${sysconfdir}/default/udev-cache"
>  
>  FILES_udev-acl = "${base_libdir}/udev/udev-acl ${base_libdir}/udev/rules.d/70-acl.rules"
>  
> @@ -72,6 +73,11 @@ do_install_append () {
>  	install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev
>  	install -m 0755 ${WORKDIR}/udev-cache ${D}${sysconfdir}/init.d/udev-cache
>  
> +	install -d ${D}${sysconfdir}/default
> +	install -m 0755 ${WORKDIR}/udev-cache.default ${D}${sysconfdir}/default/udev-cache
> +
> +	touch ${D}${sysconfdir}/udev/cache.data
> +
>  	install -d ${D}${sysconfdir}/udev/rules.d/
>  
>  	install -m 0644 ${WORKDIR}/local.rules         ${D}${sysconfdir}/udev/rules.d/local.rules
> diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init
> index 6a4464c..f2c7f87 100644
> --- a/meta/recipes-core/udev/udev/init
> +++ b/meta/recipes-core/udev/udev/init
> @@ -14,6 +14,7 @@ export TZ=/etc/localtime
>  [ -d /sys/class ] || exit 1
>  [ -r /proc/mounts ] || exit 1
>  [ -x /sbin/udevd ] || exit 1
> +[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
>  [ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
>  
>  kill_udevd() {
> @@ -35,9 +36,17 @@ LANG=C awk '$2 == "/dev" && ($3 == "tmpfs" || $3 == "devtmpfs") { exit 1 }' /pro
>  [ -e /dev/shm ] || mkdir -m 1777 /dev/shm
>  
> 
> -if [ -e /etc/dev.tar ]; then
> -	(cd /; tar xf /etc/dev.tar 2>&1 | grep -v 'time stamp' || true)
> -	not_first_boot=1
> +if [ "$DEVCACHE" != "" ]; then
> +	# Ensure we are consistent to use the cache
> +	echo -n > /dev/shm/cache.data
> +	[ -x /bin/uname ] && /bin/uname -mrspv >> /dev/shm/cache.data
> +	[ -r /proc/cmdline ] && cat /proc/cmdline >> /dev/shm/cache.data
> +	[ -r /proc/devices ] && cat /proc/devices >> /dev/shm/cache.data
> +	[ -r /proc/atags ] && cat /proc/atags >> /dev/shm/cache.data
> +	if [ -e $DEVCACHE ] && cmp -s /dev/shm/cache.data /etc/udev/cache.data; then
> +		(cd /; tar xf $DEVCACHE > /dev/null 2>&1)
> +		not_first_boot=1
> +	fi
>  fi

This still forks much more than I'd like or than is necessary. In the
interests of getting this resolved, you could do something like my
example below which doesn't fork. It does mangle newlines in the data
but in this case I don't think that matters.

Could we get away with /proc/version instead of uname -mrpsv ?

Cheers,

Richard

#!/bin/sh
readfile () {
    filename=$1
    READDATA=""
    if [ -r $filename ]; then
        while read line; do    
            READDATA="$READDATA$line"
        done < $filename
    fi
}

readfile /proc/cmdline
CMDLINE="$READDATA"
readfile /proc/devices
DEVICES="$READDATA"
readfile /proc/atags
ATAGS="$READDATA"

if [ "$DEVCACHE" != "" ]; then
    if [ -e $DEVCACHE ]; then
        readfile /etc/udev/cache.data
        if [ "$READDATA" = "$CMDLINE $DEVICES $ATAGS" ]; then
            (cd /; tar xf $DEVCACHE > /dev/null 2>&1)
            not_first_boot=1
        fi
    fi
fi






^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] classes/gitpkgv.bbclass: import from Meta-OE
  2012-02-01 13:19   ` Richard Purdie
@ 2012-02-01 18:00     ` Otavio Salvador
  0 siblings, 0 replies; 7+ messages in thread
From: Otavio Salvador @ 2012-02-01 18:00 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 1570 bytes --]

On Wed, Feb 1, 2012 at 11:19, Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> As discussed on IRC, I think some of the code here should really be
> integrated into the bitbake git fetcher to ensure we have a
> clean/consistent API for fetcher functionality. The interface I'm
> thinking about would be similar to SRCPV:
>
> SRCPV = "${@bb.fetch2.get_srcrev(d)}"
>
> with a new fetcher call being added such as get_simplified_srcrev(d).
> Switching between the simplified revision and the description could be
> governed by a variable setting similar to some of the existing variables
> that control fetcher behaviour.
>

I fully agree that having some of the code here ought to be in bitbake git
fetcher but I'd like to work on this after this code has been merge onto
OE-Core mostly because this will blocker on newer bitbake version
requirement and some layers are using it but now depending on meta-oe just
because of this class.


> There has been substantial work done to improve the fetcher APIs and
> clean up the various corner cases and this would seem a logical
> continuation of that, in keeping with the objectives of OE-Core.


Can this be merged and afterwareds I refactor it moving part of this code
onto bitbake? I am not used to bitbake code and I don't have enough time to
learn it in following week or so.

-- 
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br

[-- Attachment #2: Type: text/html, Size: 2236 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] udev: improve udev-cache robustness
  2012-02-01 16:35   ` Richard Purdie
@ 2012-02-01 18:11     ` Otavio Salvador
  0 siblings, 0 replies; 7+ messages in thread
From: Otavio Salvador @ 2012-02-01 18:11 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 757 bytes --]

On Wed, Feb 1, 2012 at 14:35, Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> This still forks much more than I'd like or than is necessary. In the
> interests of getting this resolved, you could do something like my
> example below which doesn't fork. It does mangle newlines in the data
> but in this case I don't think that matters.
>

I am making a new patch version using your proposal as base.


> Could we get away with /proc/version instead of uname -mrpsv ?


Sure. Good catch.

New version of patch will come soon.

-- 
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br

[-- Attachment #2: Type: text/html, Size: 1444 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-02-01 18:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-31  2:10 [PATCH 0/2] Ready to merge patches from O.S. Systems tree Otavio Salvador
2012-01-31  2:10 ` [PATCH 1/2] udev: improve udev-cache robustness Otavio Salvador
2012-02-01 16:35   ` Richard Purdie
2012-02-01 18:11     ` Otavio Salvador
2012-01-31  2:10 ` [PATCH 2/2] classes/gitpkgv.bbclass: import from Meta-OE Otavio Salvador
2012-02-01 13:19   ` Richard Purdie
2012-02-01 18:00     ` Otavio Salvador

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.