Merge lp:~fboudra/linaro-license-protection/bug978711-create-latest-and-headers-symlinks-v2 into lp:~linaro-automation/linaro-license-protection/trunk

Proposed by Fathi Boudra
Status: Merged
Merged at revision: 64
Proposed branch: lp:~fboudra/linaro-license-protection/bug978711-create-latest-and-headers-symlinks-v2
Merge into: lp:~linaro-automation/linaro-license-protection/trunk
Diff against target: 67 lines (+19/-8)
2 files modified
scripts/publish_to_snapshots.py (+18/-7)
testing/test_publish_to_snapshots.py (+1/-1)
To merge this branch: bzr merge lp:~fboudra/linaro-license-protection/bug978711-create-latest-and-headers-symlinks-v2
Reviewer Review Type Date Requested Status
Deepti B. Kalakeri (community) Approve
Review via email: mp+104142@code.launchpad.net

Description of the change

Create latest and HEADER.html symlinks for Ubuntu images. (LP: #978711)

To post a comment you must log in.
Revision history for this message
Deepti B. Kalakeri (deeptik) wrote :
Download full text (4.6 KiB)

On Mon, Apr 30, 2012 at 9:53 PM, Fathi Boudra <email address hidden>wrote:

> Fathi Boudra has proposed merging
> lp:~fboudra/linaro-license-protection/bug978711-create-latest-and-headers-symlinks-v2
> into lp:linaro-license-protection.
>
> Requested reviews:
> Linaro Infrastructure (linaro-infrastructure)
> Related bugs:
> Bug #978711 in Linaro CI: "Create latest and headers symlinks for
> published images"
> https://bugs.launchpad.net/linaro-ci/+bug/978711
>
> For more details, see:
>
> https://code.launchpad.net/~fboudra/linaro-license-protection/bug978711-create-latest-and-headers-symlinks-v2/+merge/104142<https://code.launchpad.net/%7Efboudra/linaro-license-protection/bug978711-create-latest-and-headers-symlinks-v2/+merge/104142>
>
> Create latest and HEADER.html symlinks for Ubuntu images. (LP: #978711)
> --
>
> https://code.launchpad.net/~fboudra/linaro-license-protection/bug978711-create-latest-and-headers-symlinks-v2/+merge/104142<https://code.launchpad.net/%7Efboudra/linaro-license-protection/bug978711-create-latest-and-headers-symlinks-v2/+merge/104142>
> Your team Linaro Infrastructure is requested to review the proposed merge
> of
> lp:~fboudra/linaro-license-protection/bug978711-create-latest-and-headers-symlinks-v2
> into lp:linaro-license-protection.
>
> === modified file 'scripts/publish_to_snapshots.py'
> --- scripts/publish_to_snapshots.py 2012-04-25 11:25:15 +0000
> +++ scripts/publish_to_snapshots.py 2012-04-30 16:22:20 +0000
> @@ -129,15 +129,22 @@
>
> return build_dir_path, target_dir_path
>
> - def create_symlink(self, target_dir_path):
> - target_parent_dir = os.path.dirname(target_dir_path)
>

We can probably leave this as is and use the target_parent_dir path in the
symlink_path = os.path.join(...)
This will help us to stick to the 80 column rule and also reduce duplicae
call to os.path.dirname.

> - symlink_path = os.path.join(target_parent_dir, "lastSuccessful")
> + def create_symlink(self, args, target_dir_path):
> + header_path = os.path.join(target_path, "HEADER.html")
> + header_symlink_path = os.path.join(target_dir_path, "HEADER.html")
> +
> + if args.job_type == "android":
> + symlink_path = os.path.join(os.path.dirname(target_dir_path),
> "lastSuccessful")
> + else:
> + symlink_path = os.path.join(os.path.dirname(target_dir_path),
> "latest")
> +
> try:
> if os.path.islink(symlink_path):
> os.unlink(symlink_path)
>
> + os.symlink(header_path, header_symlink_path)
>

Do you want to create symlink from /tmp/www/precise/images/nano/1/ to
/tmp/www/HEADER.html ??
I think we should have a symlink from /tmp/www/precise/images/nano/1/ to
/tmp/www/precise/HEADER.html ?
Between the content of the HEADER.html is empty is this going to be copied
from somewhere or generate on fly ?

> os.symlink(target_dir_path, symlink_path)
> - print "The lastSuccessful build is now linked to ",
> target_dir_path
> + print "The latest build is now linked to ", target_dir_path
> return PASS
> except Exception, details:
> print "Fail...

Read more...

Revision history for this message
Fathi Boudra (fboudra) wrote :
Download full text (5.5 KiB)

On 1 May 2012 09:40, Deepti B. Kalakeri <email address hidden> wrote:
> On Mon, Apr 30, 2012 at 9:53 PM, Fathi Boudra <email address hidden>wrote:
>
>> Fathi Boudra has proposed merging
>> lp:~fboudra/linaro-license-protection/bug978711-create-latest-and-headers-symlinks-v2
>> into lp:linaro-license-protection.
>>
>> Requested reviews:
>>  Linaro Infrastructure (linaro-infrastructure)
>> Related bugs:
>>  Bug #978711 in Linaro CI: "Create latest and headers symlinks for
>> published images"
>>  https://bugs.launchpad.net/linaro-ci/+bug/978711
>>
>> For more details, see:
>>
>> https://code.launchpad.net/~fboudra/linaro-license-protection/bug978711-create-latest-and-headers-symlinks-v2/+merge/104142<https://code.launchpad.net/%7Efboudra/linaro-license-protection/bug978711-create-latest-and-headers-symlinks-v2/+merge/104142>
>>
>> Create latest and HEADER.html symlinks for Ubuntu images. (LP: #978711)
>> --
>>
>> https://code.launchpad.net/~fboudra/linaro-license-protection/bug978711-create-latest-and-headers-symlinks-v2/+merge/104142<https://code.launchpad.net/%7Efboudra/linaro-license-protection/bug978711-create-latest-and-headers-symlinks-v2/+merge/104142>
>> Your team Linaro Infrastructure is requested to review the proposed merge
>> of
>> lp:~fboudra/linaro-license-protection/bug978711-create-latest-and-headers-symlinks-v2
>> into lp:linaro-license-protection.
>>
>> === modified file 'scripts/publish_to_snapshots.py'
>> --- scripts/publish_to_snapshots.py     2012-04-25 11:25:15 +0000
>> +++ scripts/publish_to_snapshots.py     2012-04-30 16:22:20 +0000
>> @@ -129,15 +129,22 @@
>>
>>         return build_dir_path, target_dir_path
>>
>> -    def create_symlink(self, target_dir_path):
>> -        target_parent_dir = os.path.dirname(target_dir_path)
>>
>
> We can probably leave this as is and use the target_parent_dir path in the
> symlink_path = os.path.join(...)
> This will help us to stick to the 80 column rule and also reduce duplicae
> call to os.path.dirname.

We don't have duplicate call to os.path.dirname. We have only one call
happening (different code path).

>> -        symlink_path = os.path.join(target_parent_dir, "lastSuccessful")
>> +    def create_symlink(self, args, target_dir_path):
>> +        header_path = os.path.join(target_path, "HEADER.html")
>> +        header_symlink_path = os.path.join(target_dir_path, "HEADER.html")
>> +
>> +        if args.job_type == "android":
>> +            symlink_path = os.path.join(os.path.dirname(target_dir_path),
>> "lastSuccessful")
>> +        else:
>> +            symlink_path = os.path.join(os.path.dirname(target_dir_path),
>> "latest")
>> +
>>         try:
>>             if os.path.islink(symlink_path):
>>                 os.unlink(symlink_path)
>>
>> +            os.symlink(header_path, header_symlink_path)
>>
>
> Do you want to create symlink from /tmp/www/precise/images/nano/1/ to
> /tmp/www/HEADER.html ??
> I think we should have a symlink from  /tmp/www/precise/images/nano/1/ to
> /tmp/www/precise/HEADER.html ?

We want to create /path/to/images/nano/1/HEADER.html -> /path/to/HEADER.html
The content of the file is generic for all snapshots. It only pulls css theme.

> Be...

Read more...

65. By Fathi Boudra

mp review: 80 columns rule.

Revision history for this message
Deepti B. Kalakeri (deeptik) wrote :
Download full text (6.0 KiB)

> On 1 May 2012 09:40, Deepti B. Kalakeri <email address hidden> wrote:
> > On Mon, Apr 30, 2012 at 9:53 PM, Fathi Boudra
> <email address hidden>wrote:
> >
> >> Fathi Boudra has proposed merging
> >> lp:~fboudra/linaro-license-protection/bug978711-create-latest-and-headers-
> symlinks-v2
> >> into lp:linaro-license-protection.
> >>
> >> Requested reviews:
> >>  Linaro Infrastructure (linaro-infrastructure)
> >> Related bugs:
> >>  Bug #978711 in Linaro CI: "Create latest and headers symlinks for
> >> published images"
> >>  https://bugs.launchpad.net/linaro-ci/+bug/978711
> >>
> >> For more details, see:
> >>
> >> https://code.launchpad.net/~fboudra/linaro-license-protection/bug978711
> -create-latest-and-headers-
> symlinks-v2/+merge/104142<https://code.launchpad.net/%7Efboudra/linaro-
> license-protection/bug978711-create-latest-and-headers-
> symlinks-v2/+merge/104142>
> >>
> >> Create latest and HEADER.html symlinks for Ubuntu images. (LP: #978711)
> >> --
> >>
> >> https://code.launchpad.net/~fboudra/linaro-license-protection/bug978711
> -create-latest-and-headers-
> symlinks-v2/+merge/104142<https://code.launchpad.net/%7Efboudra/linaro-
> license-protection/bug978711-create-latest-and-headers-
> symlinks-v2/+merge/104142>
> >> Your team Linaro Infrastructure is requested to review the proposed merge
> >> of
> >> lp:~fboudra/linaro-license-protection/bug978711-create-latest-and-headers-
> symlinks-v2
> >> into lp:linaro-license-protection.
> >>
> >> === modified file 'scripts/publish_to_snapshots.py'
> >> --- scripts/publish_to_snapshots.py     2012-04-25 11:25:15 +0000
> >> +++ scripts/publish_to_snapshots.py     2012-04-30 16:22:20 +0000
> >> @@ -129,15 +129,22 @@
> >>
> >>         return build_dir_path, target_dir_path
> >>
> >> -    def create_symlink(self, target_dir_path):
> >> -        target_parent_dir = os.path.dirname(target_dir_path)
> >>
> >
> >
> > We can probably leave this as is and use the target_parent_dir path in the
> > symlink_path = os.path.join(...)
> > This will help us to stick to the 80 column rule and also reduce duplicae
> > call to os.path.dirname.
>
> We don't have duplicate call to os.path.dirname. We have only one call
> happening (different code path).

Yeah, true that we don't execute os.path.dirname() twice at any instance.
I only meant to say the call is duplicate code wise
>
> >> -        symlink_path = os.path.join(target_parent_dir, "lastSuccessful")
> >> +    def create_symlink(self, args, target_dir_path):
> >> +        header_path = os.path.join(target_path, "HEADER.html")
> >> +        header_symlink_path = os.path.join(target_dir_path, "HEADER.html")
> >> +
> >> +        if args.job_type == "android":
> >> +            symlink_path = os.path.join(os.path.dirname(target_dir_path),
> >> "lastSuccessful")
> >> +        else:
> >> +            symlink_path = os.path.join(os.path.dirname(target_dir_path),
> >> "latest")
> >> +
> >>         try:
> >>             if os.path.islink(symlink_path):
> >>                 os.unlink(symlink_path)
> >>
> >> +            os.symlink(header_path, header_symlink_path)
> >>
> >
> > Do you want to create symlink from /tmp/www/precise/images/nano/1/ to
> ...

Read more...

Revision history for this message
Deepti B. Kalakeri (deeptik) wrote :

Changes Looks good.
+1.

Thanks!!!
Deepti.

Revision history for this message
Deepti B. Kalakeri (deeptik) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/publish_to_snapshots.py'
2--- scripts/publish_to_snapshots.py 2012-04-25 11:25:15 +0000
3+++ scripts/publish_to_snapshots.py 2012-05-01 07:04:26 +0000
4@@ -129,15 +129,23 @@
5
6 return build_dir_path, target_dir_path
7
8- def create_symlink(self, target_dir_path):
9- target_parent_dir = os.path.dirname(target_dir_path)
10- symlink_path = os.path.join(target_parent_dir, "lastSuccessful")
11+ def create_symlink(self, args, target_dir_path):
12+ header_path = os.path.join(target_path, "HEADER.html")
13+ header_symlink_path = os.path.join(target_dir_path, "HEADER.html")
14+
15+ symlink_path = os.path.dirname(target_dir_path)
16+ if args.job_type == "android":
17+ symlink_path = os.path.join(symlink_path, "lastSuccessful")
18+ else:
19+ symlink_path = os.path.join(symlink_path, "latest")
20+
21 try:
22 if os.path.islink(symlink_path):
23 os.unlink(symlink_path)
24
25+ os.symlink(header_path, header_symlink_path)
26 os.symlink(target_dir_path, symlink_path)
27- print "The lastSuccessful build is now linked to ", target_dir_path
28+ print "The latest build is now linked to ", target_dir_path
29 return PASS
30 except Exception, details:
31 print "Failed to create symlink", symlink_path, ":", details
32@@ -157,7 +165,7 @@
33 if len(lines) != 0:
34 fd = open(fn, "w+")
35 for line in lines:
36- if not "MANIFEST" in line:
37+ if not "MANIFEST" or not "HEADER.html" in line:
38 fd.write(line)
39 fd.close()
40 else:
41@@ -205,8 +213,11 @@
42
43 self.move_dir_content(build_dir_path, target_dir_path)
44
45- if args.job_type == "android":
46- ret = self.create_symlink(target_dir_path)
47+ if args.job_type == "android" or\
48+ args.job_type == "ubuntu-hwpacks" or\
49+ args.job_type == "ubuntu-images" or\
50+ args.job_type == "ubuntu-sysroots":
51+ ret = self.create_symlink(args, target_dir_path)
52 if ret != PASS:
53 return ret
54
55
56=== modified file 'testing/test_publish_to_snapshots.py'
57--- testing/test_publish_to_snapshots.py 2012-04-24 13:08:18 +0000
58+++ testing/test_publish_to_snapshots.py 2012-05-01 07:04:26 +0000
59@@ -384,7 +384,7 @@
60 pass
61
62 stdout.seek(0)
63- msg = "The lastSuccessful build is now linked to " + target_dir_path
64+ msg = "The latest build is now linked to " + target_dir_path
65 self.assertIn(msg, stdout.read())
66
67 def test_create_manifest_file_option(self):

Subscribers

People subscribed via source and target branches