pmbootstrap pull: new action (!1848)

Add a shortcut for "git pull --ff-only" in all repositories cloned by
pmbootstrap (currently pmaports and aports_upstream, new pmdevices
repository coming soon).

'pmbootstrap pull' will only update the repositories, if:
* they are on an officially supported branch (e.g. master)
* the history is not conflicting (fast-forward is possible)
* the git workdirs are clean

Otherwise it shows the user a descriptive message about what to do. The
list of supported branches is only "master" right now, and will be
extended in later commits, so we can have a stable branch for pmaports
based on Alpine's releases. More about that in the project direction
2020 issue.

Closes: #1858
This commit is contained in:
Oliver Smith 2020-01-06 06:39:57 +01:00 committed by Alexey Min
parent 16e2d3c77c
commit e04712a636
No known key found for this signature in database
GPG key ID: EBF5ECFFFEE34DED
5 changed files with 283 additions and 3 deletions

View file

@ -34,6 +34,7 @@ import pmb.chroot.initfs
import pmb.chroot.other
import pmb.export
import pmb.flasher
import pmb.helpers.git
import pmb.helpers.logging
import pmb.helpers.pkgrel_bump
import pmb.helpers.pmaports
@ -388,3 +389,29 @@ def bootimg_analyze(args):
for line in pmb.aportgen.device.generate_deviceinfo_fastboot_content(args, bootimg).split("\n"):
tmp_output += "\n" + line.lstrip()
logging.info(tmp_output)
def pull(args):
failed = []
for repo in pmb.config.git_repos.keys():
if pmb.helpers.git.pull(args, repo) < 0:
failed.append(repo)
if not failed:
return True
logging.info("---")
logging.info("WARNING: failed to update: " + ", ".join(failed))
logging.info("")
logging.info("'pmbootstrap pull' will only update the repositories, if:")
logging.info("* they are on an officially supported branch (e.g. master)")
logging.info("* the history is not conflicting (fast-forward is possible)")
logging.info("* the git workdirs are clean")
logging.info("You have changed mentioned repositories, so they don't meet")
logging.info("these conditions anymore.")
logging.info("")
logging.info("Fix and try again:")
for name_repo in failed:
logging.info("* " + pmb.helpers.git.get_path(args, name_repo))
logging.info("---")
return False