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
=== 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-05-01 07:04:26 +0000
@@ -129,15 +129,23 @@
129129
130 return build_dir_path, target_dir_path130 return build_dir_path, target_dir_path
131131
132 def create_symlink(self, target_dir_path):132 def create_symlink(self, args, target_dir_path):
133 target_parent_dir = os.path.dirname(target_dir_path)133 header_path = os.path.join(target_path, "HEADER.html")
134 symlink_path = os.path.join(target_parent_dir, "lastSuccessful")134 header_symlink_path = os.path.join(target_dir_path, "HEADER.html")
135
136 symlink_path = os.path.dirname(target_dir_path)
137 if args.job_type == "android":
138 symlink_path = os.path.join(symlink_path, "lastSuccessful")
139 else:
140 symlink_path = os.path.join(symlink_path, "latest")
141
135 try:142 try:
136 if os.path.islink(symlink_path):143 if os.path.islink(symlink_path):
137 os.unlink(symlink_path)144 os.unlink(symlink_path)
138145
146 os.symlink(header_path, header_symlink_path)
139 os.symlink(target_dir_path, symlink_path)147 os.symlink(target_dir_path, symlink_path)
140 print "The lastSuccessful build is now linked to ", target_dir_path148 print "The latest build is now linked to ", target_dir_path
141 return PASS149 return PASS
142 except Exception, details:150 except Exception, details:
143 print "Failed to create symlink", symlink_path, ":", details151 print "Failed to create symlink", symlink_path, ":", details
@@ -157,7 +165,7 @@
157 if len(lines) != 0:165 if len(lines) != 0:
158 fd = open(fn, "w+")166 fd = open(fn, "w+")
159 for line in lines:167 for line in lines:
160 if not "MANIFEST" in line:168 if not "MANIFEST" or not "HEADER.html" in line:
161 fd.write(line)169 fd.write(line)
162 fd.close()170 fd.close()
163 else:171 else:
@@ -205,8 +213,11 @@
205213
206 self.move_dir_content(build_dir_path, target_dir_path)214 self.move_dir_content(build_dir_path, target_dir_path)
207215
208 if args.job_type == "android":216 if args.job_type == "android" or\
209 ret = self.create_symlink(target_dir_path)217 args.job_type == "ubuntu-hwpacks" or\
218 args.job_type == "ubuntu-images" or\
219 args.job_type == "ubuntu-sysroots":
220 ret = self.create_symlink(args, target_dir_path)
210 if ret != PASS:221 if ret != PASS:
211 return ret222 return ret
212223
213224
=== modified file 'testing/test_publish_to_snapshots.py'
--- testing/test_publish_to_snapshots.py 2012-04-24 13:08:18 +0000
+++ testing/test_publish_to_snapshots.py 2012-05-01 07:04:26 +0000
@@ -384,7 +384,7 @@
384 pass384 pass
385385
386 stdout.seek(0)386 stdout.seek(0)
387 msg = "The lastSuccessful build is now linked to " + target_dir_path387 msg = "The latest build is now linked to " + target_dir_path
388 self.assertIn(msg, stdout.read())388 self.assertIn(msg, stdout.read())
389389
390 def test_create_manifest_file_option(self):390 def test_create_manifest_file_option(self):

Subscribers

People subscribed via source and target branches