Merge lp://staging/~kentb/ubuntu/quantal/ubiquity/add-custom-dm-scripts into lp://staging/ubiquity
Proposed by
Kent Baxley
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 5541 | ||||
Proposed branch: | lp://staging/~kentb/ubuntu/quantal/ubiquity/add-custom-dm-scripts | ||||
Merge into: | lp://staging/ubiquity | ||||
Diff against target: |
74 lines (+33/-1) (has conflicts) 2 files modified
bin/ubiquity-dm (+24/-1) debian/changelog (+9/-0) Text conflict in debian/changelog |
||||
To merge this branch: | bzr merge lp://staging/~kentb/ubuntu/quantal/ubiquity/add-custom-dm-scripts | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson (community) | Approve | ||
Review via email:
|
To post a comment you must log in.
review needs-fixing
Thanks for your patch. I'm fine with the general notion, but have a few
comments which I think need to be tidied up.
On Tue, Jun 26, 2012 at 09:24:25PM -0000, Kent Baxley wrote: 'GVFS_DISABLE_ FUSE' ] = '1' session( self.uid)
> === modified file 'bin/ubiquity-dm'
> --- bin/ubiquity-dm 2012-06-20 08:53:56 +0000
> +++ bin/ubiquity-dm 2012-06-26 21:23:22 +0000
> @@ -261,6 +261,20 @@
> os.environ[
>
> ck_open_
> +
> + #run simple, custom scripts during install time
Space after #.
> + if sys.argv[4] == '/usr/bin/ ubiquity' :
I know you're copying an existing bug (feel free to fix it), but this
should really be program[0] rather than sys.argv[4], and it should use
os.path.basename so that it won't break if we stop passing a full path
to the program.
Rather than doing this multiple times, perhaps you could extract the
basename of the program being called at the top of DM.run, and then
these two new checks plus the one existing check could use it?
> + for root, dirs, files in os.walk( "/usr/lib/ ubiquity/ dm-scripts/ install" ): Popen(install_ script, stdin=null, stdout=logfile, stderr=logfile, preexec_ fn=self. drop_privileges )
> + for file in files:
> + install_script = os.path.join(root, file)
> + subprocess.
Please wrap to no more than 79 characters. (Yes, not all the existing
code follows this, but that's a bug.)
> + for root, dirs, files in os.walk( "/usr/lib/ ubiquity/ dm-scripts/ oem"): Popen(oem_ script, stdin=null, stdout=logfile, stderr=logfile, preexec_ fn=self. drop_privileges )
> + for file in files:
> + oem_script = os.path.join(root, file)
> + subprocess.
Please use four-space indents consistently.
The repetition here suggests that a helper method might be in order,
something like:
def run_hooks(self, hookdir): isdir(hookdir) :
script = os.path.join(root, file)
subproces s.Popen(
script, stdin=null, stdout=logfile, stderr=logfile,
preexec_ fn=self. drop_privileges )
if os.path.
for root, dirs, files in os.walk(hookdir):
for file in files:
I'm uncomfortable with the way this uses subprocess.Popen rather than
subprocess.call. I know that in your specific use case you want to fire
something off in the background, but maybe the next person who uses this
facility will want to do something synchronously instead. If you use
subprocess.call, then the hook script can always use things like "&" in
shell to background commands it runs. If you use subprocess.Popen, the
hook script has no way to move commands into the foreground.
Finally, I think it's overkill to do a recursive directory walk here. I
would just do something like this, much like the code for running
target-config hooks:
if os.path. isdir(hookdir) :
if '.' not in entry]
# Exclude hooks containing '.', so that *.dpkg-* et al are avoided.
hooks = [entry for entry in os.listdir(hookdir)
for hookentry in hooks:
...