* [master][kirkstone][PATCH] rootfs-postcommands: fix symlinks where link and output path are equal
@ 2022-05-03 8:03 Davide Gardenal
2022-05-03 9:43 ` [OE-core] " Luca Ceresoli
0 siblings, 1 reply; 3+ messages in thread
From: Davide Gardenal @ 2022-05-03 8:03 UTC (permalink / raw)
To: openembedded-core; +Cc: Davide Gardenal
When creating the manifest and the testdata.json links, if the link
name is equal to the output name the link is not created, otherwise
it is. This prevents a link-to-self in the first case.
Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com>
---
meta/classes/rootfs-postcommands.bbclass | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass
index 7b92df69c5..c949115647 100644
--- a/meta/classes/rootfs-postcommands.bbclass
+++ b/meta/classes/rootfs-postcommands.bbclass
@@ -267,9 +267,10 @@ python write_image_manifest () {
if os.path.exists(manifest_name) and link_name:
manifest_link = deploy_dir + "/" + link_name + ".manifest"
- if os.path.lexists(manifest_link):
- os.remove(manifest_link)
- os.symlink(os.path.basename(manifest_name), manifest_link)
+ if manifest_link != manifest_name
+ if os.path.lexists(manifest_link):
+ os.remove(manifest_link)
+ os.symlink(os.path.basename(manifest_name), manifest_link)
}
# Can be used to create /etc/timestamp during image construction to give a reasonably
@@ -339,9 +340,10 @@ python write_image_test_data() {
if os.path.exists(testdata_name) and link_name:
testdata_link = os.path.join(deploy_dir, "%s.testdata.json" % link_name)
- if os.path.lexists(testdata_link):
- os.remove(testdata_link)
- os.symlink(os.path.basename(testdata_name), testdata_link)
+ if testdata_link != testdata_name:
+ if os.path.lexists(testdata_link):
+ os.remove(testdata_link)
+ os.symlink(os.path.basename(testdata_name), testdata_link)
}
write_image_test_data[vardepsexclude] += "TOPDIR"
--
2.32.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [OE-core] [master][kirkstone][PATCH] rootfs-postcommands: fix symlinks where link and output path are equal
2022-05-03 8:03 [master][kirkstone][PATCH] rootfs-postcommands: fix symlinks where link and output path are equal Davide Gardenal
@ 2022-05-03 9:43 ` Luca Ceresoli
2022-05-03 9:46 ` Davide Gardenal
0 siblings, 1 reply; 3+ messages in thread
From: Luca Ceresoli @ 2022-05-03 9:43 UTC (permalink / raw)
To: Davide Gardenal; +Cc: openembedded-core, Davide Gardenal
Hi Davide,
Il giorno Tue, 3 May 2022 10:03:09 +0200
"Davide Gardenal" <davidegarde2000@gmail.com> ha scritto:
> When creating the manifest and the testdata.json links, if the link
> name is equal to the output name the link is not created, otherwise
> it is. This prevents a link-to-self in the first case.
>
> Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com>
> ---
> meta/classes/rootfs-postcommands.bbclass | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/meta/classes/rootfs-postcommands.bbclass
> b/meta/classes/rootfs-postcommands.bbclass index
> 7b92df69c5..c949115647 100644 ---
> a/meta/classes/rootfs-postcommands.bbclass +++
> b/meta/classes/rootfs-postcommands.bbclass @@ -267,9 +267,10 @@
> python write_image_manifest () {
> if os.path.exists(manifest_name) and link_name:
> manifest_link = deploy_dir + "/" + link_name + ".manifest"
> - if os.path.lexists(manifest_link):
> - os.remove(manifest_link)
> - os.symlink(os.path.basename(manifest_name), manifest_link)
> + if manifest_link != manifest_name
> + if os.path.lexists(manifest_link):
> + os.remove(manifest_link)
> + os.symlink(os.path.basename(manifest_name),
This change is mixing tabs and spaces.
> # Can be used to create /etc/timestamp during image construction to
> give a reasonably @@ -339,9 +340,10 @@ python write_image_test_data()
> {
> if os.path.exists(testdata_name) and link_name:
> testdata_link = os.path.join(deploy_dir, "%s.testdata.json"
> % link_name)
> - if os.path.lexists(testdata_link):
> - os.remove(testdata_link)
> - os.symlink(os.path.basename(testdata_name), testdata_link)
> + if testdata_link != testdata_name:
> + if os.path.lexists(testdata_link):
> + os.remove(testdata_link)
> + os.symlink(os.path.basename(testdata_name),
And this as well.
Can you send v2 with spaces-only indentation?
Best regards,
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [OE-core] [master][kirkstone][PATCH] rootfs-postcommands: fix symlinks where link and output path are equal
2022-05-03 9:43 ` [OE-core] " Luca Ceresoli
@ 2022-05-03 9:46 ` Davide Gardenal
0 siblings, 0 replies; 3+ messages in thread
From: Davide Gardenal @ 2022-05-03 9:46 UTC (permalink / raw)
To: Luca Ceresoli; +Cc: openembedded-core, Davide Gardenal
Yes, I don’t know how this happened...
> Il giorno 3 mag 2022, alle ore 11:43, Luca Ceresoli <luca.ceresoli@bootlin.com> ha scritto:
>
> Hi Davide,
>
> Il giorno Tue, 3 May 2022 10:03:09 +0200
> "Davide Gardenal" <davidegarde2000@gmail.com> ha scritto:
>
>> When creating the manifest and the testdata.json links, if the link
>> name is equal to the output name the link is not created, otherwise
>> it is. This prevents a link-to-self in the first case.
>>
>> Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com>
>> ---
>> meta/classes/rootfs-postcommands.bbclass | 14 ++++++++------
>> 1 file changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/meta/classes/rootfs-postcommands.bbclass
>> b/meta/classes/rootfs-postcommands.bbclass index
>> 7b92df69c5..c949115647 100644 ---
>> a/meta/classes/rootfs-postcommands.bbclass +++
>> b/meta/classes/rootfs-postcommands.bbclass @@ -267,9 +267,10 @@
>> python write_image_manifest () {
>> if os.path.exists(manifest_name) and link_name:
>> manifest_link = deploy_dir + "/" + link_name + ".manifest"
>> - if os.path.lexists(manifest_link):
>> - os.remove(manifest_link)
>> - os.symlink(os.path.basename(manifest_name), manifest_link)
>> + if manifest_link != manifest_name
>> + if os.path.lexists(manifest_link):
>> + os.remove(manifest_link)
>> + os.symlink(os.path.basename(manifest_name),
>
> This change is mixing tabs and spaces.
>
>> # Can be used to create /etc/timestamp during image construction to
>> give a reasonably @@ -339,9 +340,10 @@ python write_image_test_data()
>> {
>> if os.path.exists(testdata_name) and link_name:
>> testdata_link = os.path.join(deploy_dir, "%s.testdata.json"
>> % link_name)
>> - if os.path.lexists(testdata_link):
>> - os.remove(testdata_link)
>> - os.symlink(os.path.basename(testdata_name), testdata_link)
>> + if testdata_link != testdata_name:
>> + if os.path.lexists(testdata_link):
>> + os.remove(testdata_link)
>> + os.symlink(os.path.basename(testdata_name),
>
> And this as well.
>
> Can you send v2 with spaces-only indentation?
>
> Best regards,
> --
> Luca Ceresoli, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-05-03 9:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-03 8:03 [master][kirkstone][PATCH] rootfs-postcommands: fix symlinks where link and output path are equal Davide Gardenal
2022-05-03 9:43 ` [OE-core] " Luca Ceresoli
2022-05-03 9:46 ` Davide Gardenal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox