Skip to content
New issue

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

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

Already on GitHub? # to your account

Add --only PKG option #76

Merged
merged 16 commits into from
Oct 30, 2017
Merged

Add --only PKG option #76

merged 16 commits into from
Oct 30, 2017

Conversation

allenh1
Copy link
Contributor

@allenh1 allenh1 commented Oct 23, 2017

This set of changes adds an option to generate a single package by name, and will also include a refactor of generate_packages.py so that it can be relocated outside the ebuild folder (this will eliminate a lot of redundancy).

ToDo:

  • add the --only PKG flag to generate a single package
  • refactor & separate gentoo-specific logic
  • modify regenerate_manifests to only regenerate changed packages

@allenh1
Copy link
Contributor Author

allenh1 commented Oct 24, 2017

@tfoote I'm working on this right now before I look into more unit tests and making the yocto stuff better in an effort to reduce the duplicate sections of code.

My line of thought here is to make a gen_package_list function that the entry points call. This function should return the a list of the packages to be built, together with metadata. This list gets passed to an entry point specific target, and the target does with it whatever it's supposed to do (so generating ebuilds and generating manifests, or bitbake stuff).

I think this would also make things better in the future for extending things, and I can't figure out what went wrong in my head wherein I didn't write it this way the first time.

Does this sound like a good step to you?

@allenh1 allenh1 mentioned this pull request Oct 25, 2017
@allenh1
Copy link
Contributor Author

allenh1 commented Oct 26, 2017

Rebased on top of #77

@allenh1 allenh1 force-pushed the add-only-option branch 2 times, most recently from f9ee362 to 5b9bac0 Compare October 26, 2017 03:07
@allenh1 allenh1 requested a review from tfoote October 26, 2017 21:26
@allenh1
Copy link
Contributor Author

allenh1 commented Oct 26, 2017

@tfoote I was going to remove the Open Embedded dependency with this PR, then I noticed how many commits in I was. I'll adapt there after this one, I think.

Copy link
Member

@tfoote tfoote left a comment

Choose a reason for hiding this comment

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

I've put in a few suggestions on how to cleaup/improve. Deferring the open embedded separation seems like a good decision.

results = 'Generated {0} / {1}'.format(succeeded, failed + succeeded)
results += ' for distro {0}'.format(distro_name)
info("------ {0} ------".format(results))
print()
Copy link
Member

Choose a reason for hiding this comment

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

It's weird to use print in addition to the logging functions. Maybe just add a newline to the above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ya, that's definitely true. I might just remove it all together.

distro_name, # ros distro name
overlay, # repo instance
gen_pkg_func, # function to call for generating
update=True # are we in update mode?
Copy link
Member

Choose a reason for hiding this comment

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

What does update mean here? I thought it was forcing an update but https://github.com/ros-infrastructure/superflore/pull/76/files#diff-22c1a4ad79cb71ae0b51b9ef9621bf80R60 doesn't make sense in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, update gets set to True to keep the ebuilds that are currently there (so quite the opposite). I'll change it back to preserve_existing, which it was previously.



def make_dir(dirname):
def regenerate_pkg(overlay, pkg, distro_name=None, distro=None, update=False):
Copy link
Member

Choose a reason for hiding this comment

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

Do you really need both distro and distro_name support? That seems like it is just going to be more to test. Since it's only a one line command to get the distro. It would be better to do that from the calling instance and not have the ambiguous API.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since it's only a one line command to get the distro. It would be better to do that from the calling instance and not have the ambiguous API.

Ya, that's true. I was going for an optimization here, but I don't think I really saved myself anything.

parser.add_argument(
'--only',
help='generate only the specified package',
type=str
Copy link
Member

Choose a reason for hiding this comment

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

I'd recommend supporting mutiple listed packages. You can use nargs='+' https://docs.python.org/3/library/argparse.html#nargs

Note you'll slightly need to change the logic https://github.com/ros-infrastructure/superflore/pull/76/files#diff-5a7657ae13022a44815efc96706d2233R147 to iterate over the multiple arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was wondering how one would go about this. ;) Thanks for the resources. I'll definitely add this in.

@allenh1 allenh1 force-pushed the add-only-option branch 2 times, most recently from f1726cf to cd2ddc8 Compare October 28, 2017 17:22
@allenh1
Copy link
Contributor Author

allenh1 commented Oct 30, 2017

@tfoote Ok, ready for round two.

@allenh1 allenh1 merged commit fef7c79 into master Oct 30, 2017
@allenh1 allenh1 deleted the add-only-option branch October 30, 2017 19:24
zffgithub pushed a commit to zffgithub/superflore that referenced this pull request Apr 11, 2023
* Creating an option to only regenerate a specified package.

* Regeneration of a single package is now working. Next is refactoring.

* Add unused installer list from regenerate function.

* Unify printing functions

* Forgot one of the print calls, and moved a variable accidently.

* Added util print functions to run.py.

* Make the exception handling for make_dir more strict.

* Linting after rebase.

* Removing duplicated logic from gen_packages function

* Moved generate installers function to its own file, outside of the gentoo directory.

* Remove all gentoo specific logic from gen_packages, and add logic to handle missing dependencies.

* Fixed issue with unresolved dependencies not being reported.

* Modify regenerate package logic to only regenerate manifests for packages with changes.

* Fix regen logic for a single package.

* Addresses comments by @tfoote.

* Added nargs='+' to the '--only' option so that multiple packages can be selected.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants