Skip to content

Update.py: New feature - update a branch instead of a fork, plus general improvements. #4093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 24, 2017

Conversation

adbridge
Copy link
Contributor

Added the ability to specify a branch to update rather than a fork
Replaced print commands with the use of a logger
Updated the run_cmd functions in line with previous improvements

Tested locally , branch option tested during oob for 5.4.1 and standard updates tested for full 5.4.1 release.

Added the ability to specify a branch to update rather than a fork
Replaced print commands with the use of a logger
Updated the run_cmd functions in line with previous improvements
@adbridge
Copy link
Contributor Author

@bridadan @theotherjimmy please review updates.

Copy link
Contributor

@bridadan bridadan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good!

# OOB branch does not exist thus create it and then check it out
cmd = ['git', 'checkout', '-b', branch]
return_code = run_cmd(cmd)
if not return_code:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've done such a nice job with handling errors all over this script, do you want to handle the failure case here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will take a look

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bridadan Do you mean checking the return code for line 227 ? If so that is purposefully designed to drop through to the check on line 232

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact all the failures in that section are designed to drop through to 232 , so that one general error with branching covers them...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and I totally missed that, thanks for pointing it out!

@theotherjimmy
Copy link
Contributor

theotherjimmy commented Mar 31, 2017

Could you change the PR title to say the feature instead of leaving it as "add an extra feature"? You also probably don't need "script udpated to".

import os
from os.path import dirname, abspath, basename
import sys
import sys, logging
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not consistent with the other imports in this module.

import sys
import logging

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the 'nitiest' comment to date ! ;-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do I win?

""" Passes a command to the system and returns a True/False result once the
command has been executed, indicating success/failure. Commands are passed
as a list of tokens.
E.g. The command 'git remote -v' would be passed in as ['git', 'remote', '-v']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally have a single sentence summary (SSS) 😝 at the beginning of our funcitons, followed by a newline and an expanded description.

exit_on_failure - If True exit the program on failure (default = False)

Returns:
result - True/False indicating the success/failure of the command
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result - is redundant here.

exit_on_failure - If True exit the program on failure (default = False)

Returns:
result - True/False indicating the success/failure of the command
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be named returncode right?

# Set logging level
logging.basicConfig(level=level)

update_log = logging.getLogger("Update")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a global? have you run the script to verify that you get the correct logger when running the other functions in this file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checked and yes. This is not working like you think it is.

Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the logging global issue.

@adbridge adbridge changed the title Update.py: script updated to add an extra feature and general improvements. Update.py: New feature and general improvements. Apr 6, 2017
@theotherjimmy
Copy link
Contributor

New feature is just as vague as add an extra feature. At least it's shorter...

@adbridge adbridge changed the title Update.py: New feature and general improvements. Update.py: New feature - update a branch instead of a fork, plus general improvements. Apr 6, 2017
The function headers have been updated to follow the standard format
that should be being used for tools in mbed. This is a one line summary
followed by a descriptive block with more detail.
Updated the handling of the main function so that the logger becomes
global and thus works across all the functions. This has been tested
with both the fork and branch options, and for levels INFO and DEBUG.
@adbridge
Copy link
Contributor Author

/test morph-nightly

@adbridge
Copy link
Contributor Author

@theotherjimmy logger seems to be working globally for me now. Please do a quick re-review

@adbridge
Copy link
Contributor Author

/morph test

Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

superduper 👍

@theotherjimmy
Copy link
Contributor

I think that the Description: is overkill but /shrug

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 63

All builds and test passed!

@theotherjimmy theotherjimmy merged commit 0b5b6cb into ARMmbed:master Apr 24, 2017
@adbridge adbridge deleted the update branch May 4, 2017 10:18
exmachina-auto-deployer pushed a commit to exmachina-dev/mbed-os that referenced this pull request May 16, 2017
…lwip_broadcast

Release mbed OS 5.4.5 and mbed lib v142

Ports for Upcoming Targets

Fixes and Changes

4059: [Silicon Labs] Rename targets ARMmbed#4059
4115: Support for Qt Creator Generic project export and associated Makefile ARMmbed#4115
3915: Feature vscode ARMmbed#3915
4205: tests: race test - add not supported for single threaded env ARMmbed#4205
4187: [NCS36510] Reduce default heap size allocated by IAR to 1/4 of RAM ARMmbed#4187
4145: test - add nanostack to examples.json file ARMmbed#4145
4093: Update.py: New feature - update a branch instead of a fork, plus general improvements. ARMmbed#4093
4225: fixed missing device_name for xDot and removed progen ARMmbed#4225
4243: Config: config header file should contain new line ARMmbed#4243
4251: Fix C++11 build error w/ u-blox EVK-ODIN-W2 ARMmbed#4251
4236: STM32 Fixed warning related to __packed redefinition ARMmbed#4236
4224: Add `mbed new .` output to export ARMmbed#4224
4190: LPC4088: Enable LWIP feature ARMmbed#4190
4136: Error when bootloader is specified but does not exist ARMmbed#4136
3881: Remove debug links to printf/exit in NDEBUG builds ARMmbed#3881
4260: Inherit Xadow M0 target from LPC11U35_501 ARMmbed#4260
4249: Add consistent button names across targets ARMmbed#4249
4254: Removed unused variable in TARGET_NXP/lpc17_emac.c ARMmbed#4254
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants