[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] tools/libacpi: fix sed usage



commit 26c4f0b8a4cf233f600f4163fc3aeeb7f70b3021
Author:     Roger Pau Monne <roger.pau@xxxxxxxxxx>
AuthorDate: Mon Oct 31 11:05:20 2016 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Mon Oct 31 10:33:11 2016 +0000

    tools/libacpi: fix sed usage
    
    Current usage of sed in the libacpi Makefile make uses of non-POSIX options,
    that are not available on all the OSes supported by the Xen tools.
    
    The '-i' option has slightly different semantics between GNU and BSD sed
    implementations, while on the GNU version the suffix is optional, on the BSD
    one it is not. Also BSD sed seems to have problems parsing the script
    itself, reporting "extra characters at the end of d command".
    
    Fix those issues by using a temporary intermediate file, and replace the
    script with a simpler version that achieves the same purpose (removing the
    initial license header comment).
    
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Release-acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/libacpi/Makefile | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
index 18a5cd4..b79db47 100644
--- a/tools/libacpi/Makefile
+++ b/tools/libacpi/Makefile
@@ -47,9 +47,11 @@ $(MK_DSDT): mk_dsdt.c
 
 ifeq ($(GPL),y)
 $(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.asl: dsdt.asl dsdt_acpi_info.asl 
gpl/mk_dsdt_gpl.sh $(MK_DSDT)
-       awk 'NR > 1 {print s} {s=$$0}' $< > $@.$(TMP_SUFFIX)
+       # Remove last bracket
+       awk 'NR > 1 {print s} {s=$$0}' $< > $@.1.$(TMP_SUFFIX)
        # Strip license comment
-       sed -i '1,/\*\//{/\/\*/,/\*\//d}' $@.$(TMP_SUFFIX)
+       sed '1,/\*\//d' $@.1.$(TMP_SUFFIX) > $@.$(TMP_SUFFIX)
+       rm -f $@.1.$(TMP_SUFFIX)
        $(SHELL) gpl/mk_dsdt_gpl.sh >> $@.$(TMP_SUFFIX)
        cat dsdt_acpi_info.asl >> $@.$(TMP_SUFFIX)
        $(MK_DSDT) --debug=$(debug) --dm-version qemu-xen >> $@.$(TMP_SUFFIX)
@@ -57,8 +59,11 @@ $(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.asl: dsdt.asl 
dsdt_acpi_info.asl gpl/mk_d
 
 # NB. awk invocation is a portable alternative to 'head -n -1'
 $(ACPI_BUILD_DIR)/dsdt_%cpu.asl: dsdt.asl dsdt_acpi_info.asl 
gpl/mk_dsdt_gpl.sh $(MK_DSDT)
-       awk 'NR > 1 {print s} {s=$$0}' $< > $@.$(TMP_SUFFIX)
-       sed -i '1,/\*\//{/\/\*/,/\*\//d}' $@.$(TMP_SUFFIX)
+       # Remove last bracket
+       awk 'NR > 1 {print s} {s=$$0}' $< > $@.1.$(TMP_SUFFIX)
+       # Strip license comment
+       sed '1,/\*\//d' $@.1.$(TMP_SUFFIX) > $@.$(TMP_SUFFIX)
+       rm -f $@.1.$(TMP_SUFFIX)
        $(SHELL) gpl/mk_dsdt_gpl.sh >> $@.$(TMP_SUFFIX)
        cat dsdt_acpi_info.asl >> $@.$(TMP_SUFFIX)
        $(MK_DSDT) --debug=$(debug) --maxcpu $*  >> $@.$(TMP_SUFFIX)
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.