#1080 frontend: python3-flask-script-removal - chroot commands
Merged 4 years ago by frostyx. Opened 4 years ago by thrnciar.

@@ -1,43 +1,43 @@ 

  import datetime

- from flask_script import Option

+ import click

+ 

  from coprs import db_session_scope

  from coprs import app

  from coprs import exceptions

  from coprs.logic import coprs_logic

- from commands.create_chroot import ChrootCommand

- 

- 

- class AlterChrootCommand(ChrootCommand):

- 

-     "Activates or deactivates a chroot"

+ from commands.create_chroot import print_invalid_format, print_doesnt_exist

  

-     def run(self, chroot_names, action):

-         activate = (action == "activate")

-         for chroot_name in chroot_names:

-             try:

-                 with db_session_scope():

-                     mock_chroot = coprs_logic.MockChrootsLogic.edit_by_name(

-                         chroot_name, activate)

  

-                     if action != "eol":

-                         continue

+ @click.command()

+ @click.argument(

+     "chroot_names",

+     nargs=-1

+ )

+ @click.option(

+     "--action", "-a", "action",

+     help="Action to take - currently activate or deactivate",

+     required=True,

+     type=click.Choice(["activate", "deactivate", "eol"])

+ )

+ def alter_chroot(chroot_names, action):

+     """Activates or deactivates a chroot"""

+     activate = (action == "activate")

+     for chroot_name in chroot_names:

+         try:

+             with db_session_scope():

+                 mock_chroot = coprs_logic.MockChrootsLogic.edit_by_name(

+                     chroot_name, activate)

  

-                     for copr_chroot in mock_chroot.copr_chroots:

-                         delete_after_days = app.config["DELETE_EOL_CHROOTS_AFTER"] + 1

-                         delete_after_timestamp = datetime.datetime.now() + datetime.timedelta(delete_after_days)

-                         # Workarounding an auth here

-                         coprs_logic.CoprChrootsLogic.update_chroot(copr_chroot.copr.user, copr_chroot,

-                                                                    delete_after=delete_after_timestamp)

-             except exceptions.MalformedArgumentException:

-                 self.print_invalid_format(chroot_name)

-             except exceptions.NotFoundException:

-                 self.print_doesnt_exist(chroot_name)

+                 if action != "eol":

+                     continue

  

-     option_list = ChrootCommand.option_list + (

-         Option("--action",

-                "-a",

-                dest="action",

-                help="Action to take - currently activate or deactivate",

-                choices=["activate", "deactivate", "eol"],

-                required=True),

-     )

+                 for copr_chroot in mock_chroot.copr_chroots:

+                     delete_after_days = app.config["DELETE_EOL_CHROOTS_AFTER"] + 1

+                     delete_after_timestamp = datetime.datetime.now() + datetime.timedelta(delete_after_days)

+                     # Workarounding an auth here

+                     coprs_logic.CoprChrootsLogic.update_chroot(copr_chroot.copr.user, copr_chroot,

+                                                                 delete_after=delete_after_timestamp)

+         except exceptions.MalformedArgumentException:

+             print_invalid_format(chroot_name)

+         except exceptions.NotFoundException:

+             print_doesnt_exist(chroot_name)

@@ -1,42 +1,36 @@ 

- from flask_script import Command, Option

+ import click

  from coprs.logic import coprs_logic

  

- from commands.create_chroot import CreateChrootCommand

- from commands.rawhide_to_release import RawhideToReleaseCommand

+ from commands.create_chroot import create_chroot

+ from commands.rawhide_to_release import rawhide_to_release

  

  

- class BranchFedoraCommand(Command):

+ @click.command()

+ @click.argument(

+     "fedora_version",

+     type=int

+ )

+ @click.option(

+     "--dist-git-branch", "-b", "branch",

+     help="Branch name for this set of new chroots"

+ )

+ def branch_fedora(fedora_version, branch=None):

      """

      Branch fedora-rawhide-* chroots to fedora-N* and execute rawhide_to_release

      on them

      """

+     rawhide_chroots = coprs_logic.MockChrootsLogic.get_from_name(

+         "fedora-rawhide",

+         active_only=True,

+         noarch=True).all()

  

-     option_list = [

-         Option("fedora_version",

-                help="The version of Fedora to branch Rawhide into, e.g. 32",

-                type=int),

-         Option(

-             "--dist-git-branch",

-             "-b",

-             dest="branch",

-             help="Branch name for this set of new chroots"),

-     ]

+     chroot_pairs = {

+         'fedora-{}-{}'.format(fedora_version, rch.arch):

+         'fedora-rawhide-{}'.format(rch.arch)

+         for rch in rawhide_chroots

+     }

  

-     def run(self, fedora_version, branch=None):

-         rawhide_chroots = coprs_logic.MockChrootsLogic.get_from_name(

-             "fedora-rawhide",

-             active_only=True,

-             noarch=True).all()

+     create_chroot(chroot_pairs.keys(), branch, True)

  

-         chroot_pairs = {

-             'fedora-{}-{}'.format(fedora_version, rch.arch):

-             'fedora-rawhide-{}'.format(rch.arch)

-             for rch in rawhide_chroots

-         }

- 

-         c_cmd = CreateChrootCommand()

-         c_cmd.run(chroot_pairs.keys(), branch, True)

- 

-         r2r_cmd = RawhideToReleaseCommand()

-         for new_chroot, rawhide_chroot in chroot_pairs.items():

-             r2r_cmd.run(rawhide_chroot, new_chroot)

+     for new_chroot, rawhide_chroot in chroot_pairs.items():

+         rawhide_to_release(rawhide_chroot, new_chroot)

@@ -1,23 +1,24 @@ 

- from flask_script import Command, Option

+ import click

  from coprs import db

  from coprs.logic.coprs_logic import MockChrootsLogic

  

  

- class CommentChrootCommand(Command):

- 

+ @click.command()

+ @click.option(

+     "--chroot", "-r", "chrootname",

+     required=True

+ )

+ @click.option(

+     "--comment", "-c", "comment",

+     required=True

+ )

+ def comment_chroot(chrootname, comment):

      """

      Add comment to a mock_chroot.

      """

- 

-     def run(self, chrootname, comment):

-         chroot = MockChrootsLogic.get_from_name(chrootname).first()

-         if not chroot:

-             print("There is no mock chroot named {0}.".format(chrootname))

-             return

-         chroot.comment = comment

-         db.session.commit()

- 

-     option_list = (

-         Option("chrootname"),

-         Option("comment"),

-     )

+     chroot = MockChrootsLogic.get_from_name(chrootname).first()

+     if not chroot:

+         print("There is no mock chroot named {0}.".format(chrootname))

+         return

+     chroot.comment = comment

+     db.session.commit()

@@ -1,3 +1,5 @@ 

+ import click

+ 

  from flask_script import Command, Option

  from coprs import exceptions

  from coprs import db
@@ -5,55 +7,52 @@ 

  from coprs.logic import coprs_logic

  

  

- class ChrootCommand(Command):

- 

-     def print_invalid_format(self, chroot_name):

-         print(

-             "{0} - invalid chroot format, must be '{release}-{version}-{arch}'."

-                 .format(chroot_name))

- 

-     def print_already_exists(self, chroot_name):

-         print("{0} - already exists.".format(chroot_name))

- 

-     def print_doesnt_exist(self, chroot_name):

-         print("{0} - chroot doesn\"t exist.".format(chroot_name))

- 

-     option_list = (

-         Option("chroot_names",

-                help="Chroot name, e.g. fedora-18-x86_64.",

-                nargs="+"),

-     )

- 

- 

- class CreateChrootCommand(ChrootCommand):

- 

-     "Creates a mock chroot in DB"

- 

-     def __init__(self):

-         self.option_list += (

-             Option(

-                 "--dist-git-branch",

-                 "-b",

-                 dest="branch",

-                 help="Branch name for this set of new chroots"),

-             Option(

-                 "--deactivated",

-                 action="store_true",

-                 help="Activate the chroot later, manually by `alter_chroot`"

-             ),

-         )

- 

-     def run(self, chroot_names, branch=None, deactivated=False):

-         for chroot_name in chroot_names:

-             if not branch:

-                 branch = chroot_to_branch(chroot_name)

-             branch_object = coprs_logic.BranchesLogic.get_or_create(branch)

-             try:

-                 chroot = coprs_logic.MockChrootsLogic.add(chroot_name)

-                 chroot.distgit_branch = branch_object

-                 chroot.is_active = not deactivated

-                 db.session.commit()

-             except exceptions.MalformedArgumentException:

-                 self.print_invalid_format(chroot_name)

-             except exceptions.DuplicateException:

-                 self.print_already_exists(chroot_name)

+ def print_invalid_format(chroot_name):

+     print(

+         "{0} - invalid chroot format, must be '{release}-{version}-{arch}'."

+             .format(chroot_name))

+ 

+ 

+ def print_already_exists(chroot_name):

+     print("{0} - already exists.".format(chroot_name))

+ 

+ 

+ def print_doesnt_exist(chroot_name):

+     print("{0} - chroot doesn\"t exist.".format(chroot_name))

+ 

+ 

+ def create_chroot(chroot_names, branch=None, activated=True):

+     """Creates a mock chroot in DB"""

+     for chroot_name in chroot_names:

+         if not branch:

+             branch = chroot_to_branch(chroot_name)

+         branch_object = coprs_logic.BranchesLogic.get_or_create(branch)

+         try:

+             chroot = coprs_logic.MockChrootsLogic.add(chroot_name)

+             chroot.distgit_branch = branch_object

+             chroot.is_active = activated

+             db.session.commit()

+         except exceptions.MalformedArgumentException:

+             print_invalid_format(chroot_name)

+         except exceptions.DuplicateException:

+             print_already_exists(chroot_name)

+ 

+ 

+ @click.command()

+ @click.argument(

+     "chroot_names",

+     nargs=-1,

+     required=True

+ )

+ @click.option(

+     "--dist-git-branch", "-b", "branch",

+     help="Branch name for this set of new chroots"

+ )

+ @click.option(

+     "--activated/--deactivated",

+     help="Activate the chroot later, manually by `alter_chroot`",

+     default=True

+ )

+ def create_chroot_command(chroot_names, branch=None, activated=True):

+     """Creates a mock chroot in DB"""

+     return create_chroot(chroot_names, branch, activated)

@@ -1,23 +1,16 @@ 

- from flask_script import Command, Option

+ import click

  from coprs.logic import coprs_logic

  

  

- class DisplayChrootsCommand(Command):

+ @click.command()

+ @click.option(

+     "--active-only/--all", "active_only",

+     help="Display only active chroots.",

+     default=True

+ )

+ def display_chroots(active_only):

+     """Displays current mock chroots"""

+     for ch in coprs_logic.MockChrootsLogic.get_multiple(

+             active_only=active_only).all():

  

-     "Displays current mock chroots"

- 

-     def run(self, active_only):

-         for ch in coprs_logic.MockChrootsLogic.get_multiple(

-                 active_only=active_only).all():

- 

-             print(ch.name)

- 

-     option_list = (

-         Option("--active-only",

-                "-a",

-                dest="active_only",

-                help="Display only active chroots",

-                required=False,

-                action="store_true",

-                default=False),

-     )

+         print(ch.name)

@@ -1,18 +1,25 @@ 

+ import click

+ 

  from coprs import exceptions

  from coprs import db

  from coprs.logic import coprs_logic

- from commands.create_chroot import ChrootCommand

- 

- class DropChrootCommand(ChrootCommand):

+ from commands.create_chroot import print_invalid_format

+ from commands.create_chroot import print_doesnt_exist

  

-     "Activates or deactivates a chroot"

  

-     def run(self, chroot_names):

-         for chroot_name in chroot_names:

-             try:

-                 coprs_logic.MockChrootsLogic.delete_by_name(chroot_name)

-                 db.session.commit()

-             except exceptions.MalformedArgumentException:

-                 self.print_invalid_format(chroot_name)

-             except exceptions.NotFoundException:

-                 self.print_doesnt_exist(chroot_name)

+ @click.command()

+ @click.option(

+     "--chroot", "-r", "chroot_names",

+     help="Chroot name, e.g. fedora-18-x86_64.",

+     multiple=True

+ )

+ def drop_chroot(chroot_names):

+     """Deactivates a chroot"""

+     for chroot_name in chroot_names:

+         try:

+             coprs_logic.MockChrootsLogic.delete_by_name(chroot_name)

+             db.session.commit()

+         except exceptions.MalformedArgumentException:

+             print_invalid_format(chroot_name)

+         except exceptions.NotFoundException:

+             print_doesnt_exist(chroot_name)

@@ -1,3 +1,4 @@ 

+ import click

  from sqlalchemy import func

  from sqlalchemy.orm import joinedload

  
@@ -8,104 +9,106 @@ 

  from coprs.logic import coprs_logic, actions_logic, builds_logic, packages_logic

  

  

- class RawhideToReleaseCommand(Command):

- 

-     option_list = (

-         Option("rawhide_chroot", help="Rawhide chroot name, e.g. fedora-rawhide-x86_64."),

-         Option("dest_chroot", help="Destination chroot, e.g. fedora-24-x86_64."),

+ @click.command()

+ @click.argument(

+     "rawhide_chroot",

+     required=True

+ )

+ @click.argument(

+     "dest_chroot",

+     required=True

+ )

+ def rawhide_to_release(rawhide_chroot, dest_chroot):

+     mock_chroot = coprs_logic.MockChrootsLogic.get_from_name(dest_chroot).first()

+     if not mock_chroot:

+         print("Given chroot does not exist. Please run:")

+         print("    sudo python3 manage.py create_chroot {}".format(dest_chroot))

+         return

+ 

+     mock_rawhide_chroot = coprs_logic.MockChrootsLogic.get_from_name(rawhide_chroot).first()

+     if not mock_rawhide_chroot:

+         print("Given rawhide chroot does not exist. Didnt you mistyped?:")

+         print("    {}".format(rawhide_chroot))

+         return

+ 

+     coprs_query = (

+         coprs_logic.CoprsLogic.get_all()

+         .join(models.CoprChroot)

+         .filter(models.Copr.follow_fedora_branching == True)

+         .filter(models.CoprChroot.mock_chroot == mock_rawhide_chroot)

+         .options(joinedload('copr_chroots').joinedload('mock_chroot'))

      )

  

-     def run(self, rawhide_chroot, dest_chroot):

-         mock_chroot = coprs_logic.MockChrootsLogic.get_from_name(dest_chroot).first()

-         if not mock_chroot:

-             print("Given chroot does not exist. Please run:")

-             print("    sudo python3 manage.py create_chroot {}".format(dest_chroot))

-             return

+     for copr in coprs_query:

+         print("Handling builds in copr '{}', chroot '{}'".format(

+             copr.full_name, mock_rawhide_chroot.name))

+         turn_on_the_chroot_for_copr(copr, rawhide_chroot, mock_chroot)

  

-         mock_rawhide_chroot = coprs_logic.MockChrootsLogic.get_from_name(rawhide_chroot).first()

-         if not mock_rawhide_chroot:

-             print("Given rawhide chroot does not exist. Didnt you mistyped?:")

-             print("    {}".format(rawhide_chroot))

-             return

+         data = {"projectname": copr.name,

+                 "ownername": copr.owner_name,

+                 "rawhide_chroot": rawhide_chroot,

+                 "dest_chroot": dest_chroot,

+                 "builds": []}

  

-         coprs_query = (

-             coprs_logic.CoprsLogic.get_all()

-             .join(models.CoprChroot)

-             .filter(models.Copr.follow_fedora_branching == True)

-             .filter(models.CoprChroot.mock_chroot == mock_rawhide_chroot)

-             .options(joinedload('copr_chroots').joinedload('mock_chroot'))

+         latest_pkg_builds_in_rawhide = (

+             db.session.query(

+                 func.max(models.Build.id),

+             )

+             .join(models.BuildChroot)

+             .join(models.Package)

+             .filter(models.BuildChroot.mock_chroot_id == mock_rawhide_chroot.id)

+             .filter(models.BuildChroot.status == StatusEnum("succeeded"))

+             .filter(models.Package.copr_dir == copr.main_dir)

+             .group_by(models.Package.name)

          )

  

-         for copr in coprs_query:

-             print("Handling builds in copr '{}', chroot '{}'".format(

-                 copr.full_name, mock_rawhide_chroot.name))

-             self.turn_on_the_chroot_for_copr(copr, rawhide_chroot, mock_chroot)

- 

-             data = {"projectname": copr.name,

-                     "ownername": copr.owner_name,

-                     "rawhide_chroot": rawhide_chroot,

-                     "dest_chroot": dest_chroot,

-                     "builds": []}

- 

-             latest_pkg_builds_in_rawhide = (

-                 db.session.query(

-                     func.max(models.Build.id),

-                 )

-                 .join(models.BuildChroot)

-                 .join(models.Package)

-                 .filter(models.BuildChroot.mock_chroot_id == mock_rawhide_chroot.id)

-                 .filter(models.BuildChroot.status == StatusEnum("succeeded"))

-                 .filter(models.Package.copr_dir == copr.main_dir)

-                 .group_by(models.Package.name)

-             )

+         fork_builds = (

+             db.session.query(models.Build)

+             .options(joinedload('build_chroots').joinedload('mock_chroot'))

+             .filter(models.Build.id.in_(latest_pkg_builds_in_rawhide.subquery()))

+         ).all()

  

-             fork_builds = (

-                 db.session.query(models.Build)

-                 .options(joinedload('build_chroots').joinedload('mock_chroot'))

-                 .filter(models.Build.id.in_(latest_pkg_builds_in_rawhide.subquery()))

-             ).all()

  

+         # no builds to fork in this copr

+         if not len(fork_builds):

+             continue

  

-             # no builds to fork in this copr

-             if not len(fork_builds):

+         for build in fork_builds:

+             if mock_chroot in build.chroots:

+                 # forked chroot already exists, from previous run?

                  continue

  

-             for build in fork_builds:

-                 if mock_chroot in build.chroots:

-                     # forked chroot already exists, from previous run?

-                     continue

- 

-                 # rbc means rawhide_build_chroot (we needed short variable)

-                 rbc = None

-                 for rbc in build.build_chroots:

-                     if rbc.mock_chroot == mock_rawhide_chroot:

-                         break

- 

-                 dest_build_chroot = models.BuildChroot(**rbc.to_dict())

-                 dest_build_chroot.mock_chroot_id = mock_chroot.id

-                 dest_build_chroot.mock_chroot = mock_chroot

-                 dest_build_chroot.status = StatusEnum("forked")

-                 db.session.add(dest_build_chroot)

- 

-                 data['builds'].append(build.result_dir)

- 

-             if len(data["builds"]):

-                 actions_logic.ActionsLogic.send_rawhide_to_release(data)

- 

-             db.session.commit()

- 

-     def turn_on_the_chroot_for_copr(self, copr, rawhide_name, mock_chroot):

-         rawhide_chroot = None

-         for chroot in copr.copr_chroots:

-             if chroot.name == rawhide_name:

-                 rawhide_chroot = chroot

-             if chroot.name == mock_chroot.name:

-                 # already created

-                 return

- 

-         create_kwargs = {

-             "buildroot_pkgs": rawhide_chroot.buildroot_pkgs,

-             "comps": rawhide_chroot.comps,

-             "comps_name": rawhide_chroot.comps_name,

-         }

-         coprs_logic.CoprChrootsLogic.create_chroot(copr.user, copr, mock_chroot, **create_kwargs)

+             # rbc means rawhide_build_chroot (we needed short variable)

+             rbc = None

+             for rbc in build.build_chroots:

+                 if rbc.mock_chroot == mock_rawhide_chroot:

+                     break

+ 

+             dest_build_chroot = models.BuildChroot(**rbc.to_dict())

+             dest_build_chroot.mock_chroot_id = mock_chroot.id

+             dest_build_chroot.mock_chroot = mock_chroot

+             dest_build_chroot.status = StatusEnum("forked")

+             db.session.add(dest_build_chroot)

+ 

+             data['builds'].append(build.result_dir)

+ 

+         if len(data["builds"]):

+             actions_logic.ActionsLogic.send_rawhide_to_release(data)

+ 

+         db.session.commit()

+ 

+ def turn_on_the_chroot_for_copr(copr, rawhide_name, mock_chroot):

+     rawhide_chroot = None

+     for chroot in copr.copr_chroots:

+         if chroot.name == rawhide_name:

+             rawhide_chroot = chroot

+         if chroot.name == mock_chroot.name:

+             # already created

+             return

+ 

+     create_kwargs = {

+         "buildroot_pkgs": rawhide_chroot.buildroot_pkgs,

+         "comps": rawhide_chroot.comps,

+         "comps_name": rawhide_chroot.comps_name,

+     }

+     coprs_logic.CoprChrootsLogic.create_chroot(copr.user, copr, mock_chroot, **create_kwargs)

@@ -10,20 +10,20 @@ 

  import commands.create_sqlite_file

  import commands.create_db

  import commands.drop_db

+ import commands.create_chroot

+ import commands.alter_chroot

+ import commands.display_chroots

+ import commands.drop_chroot

+ import commands.branch_fedora

+ import commands.comment_chroot

+ 

+ import commands.rawhide_to_release

  

  from flask_script import Manager

  from coprs import app

  

  

  commands_old = {

-     # Chroot commands

-     "create_chroot": "CreateChrootCommand",

-     "alter_chroot": "AlterChrootCommand",

-     "display_chroots": "DisplayChrootsCommand",

-     "drop_chroot": "DropChrootCommand",

-     "branch_fedora": "BranchFedoraCommand",

-     "comment_chroot": "CommentChrootCommand",

- 

      # User commands

      "alter_user": "AlterUserCommand",

      "add_user": "AddUserCommand",
@@ -37,8 +37,6 @@ 

      # Other

      "get_admins": "GetAdminsCommand",

      "fail_build": "FailBuildCommand",

-     "rawhide_to_release": "RawhideToReleaseCommand",

-     "backend_rawhide_to_release": "BackendRawhideToReleaseCommand",

      "update_graphs": "UpdateGraphsDataCommand",

      "vacuum_graphs": "RemoveGraphsDataCommand",

      "notify_outdated_chroots": "NotifyOutdatedChrootsCommand",
@@ -60,17 +58,40 @@ 

      cls = getattr(module, clsname)

      manager.add_command(cmdname, cls())

  

- app.cli.add_command(commands.test.test, "test")

- app.cli.add_command(commands.create_sqlite_file.create_sqlite_file_command, "create_sqlite_file")

- app.cli.add_command(commands.create_db.create_db, "create_db")

- app.cli.add_command(commands.drop_db.drop_db, "drop_db")

+     # General commands

+     app.cli.add_command(commands.test.test, "test")

+ 

+     # Database commands

+     app.cli.add_command(commands.create_sqlite_file.create_sqlite_file_command, "create_sqlite_file")

+     app.cli.add_command(commands.create_db.create_db, "create_db")

+     app.cli.add_command(commands.drop_db.drop_db, "drop_db")

+ 

+     # Chroot commands

+     app.cli.add_command(commands.create_chroot.create_chroot_command, "create_chroot")

+     app.cli.add_command(commands.alter_chroot.alter_chroot, "alter_chroot")

+     app.cli.add_command(commands.display_chroots.display_chroots, "display_chroots")

+     app.cli.add_command(commands.drop_chroot.drop_chroot, "drop_chroot")

+     app.cli.add_command(commands.branch_fedora.branch_fedora, "branch_fedora")

+     app.cli.add_command(commands.comment_chroot.comment_chroot, "comment_chroot")

+ 

+     # User commands

+     #TODO

+ 

+     # Whooshee indexes

+     #TODO

+ 

+     # Other

+     #TODO

+     app.cli.add_command(commands.rawhide_to_release.rawhide_to_release, "rawhide_to_release")

  

  if __name__ == "__main__":

      # This is just temporary while migrating to flask script,

      # values in arrays are already migrated parameters.

      # Else part will be removed once migration is complete.

-     if sys.argv[1] in ['test', 'create_sqlite_file', 'create_db', 'drop_db']:

-         with app.app_context():

-             app.cli()

+     if sys.argv[1] in [

+         'test', 'create_sqlite_file', 'create_db', 'drop_db',

+         'create_chroot', 'alter_chroot', 'display_chroots', 'drop_chroot',

+         'branch_fedora', 'comment_chroot', 'rawhide_to_release']:

+         app.cli()

      else:

          manager.run()

commands/alter_chroot.py - done
commands/branch_fedora.py - done
commands/comment_chroot.py - done
commands/create_chroot.py - done
commands/display_chroots.py - done
commands/drop_chroot.py - done
commands/rawhide_to_release.py - done

rebased onto 3359dcdfae90df27333a0fce5cbb39997a0218b7

4 years ago

Maybe we could go with -r instead of -cn for chroot name since we are used to it from Mock

The sequence of chroot_name -> chroot_names -> chrootname is too cumbersome. Would something like storing the --chroot_name options into a differently named variable - chroot_names work? Argparse would do this by dest='chroot_names' ... maybe this will work for click?

For an option with ('-f', '--filename', 'dest'), the parameter name is dest.

https://click.palletsprojects.com/en/7.x/parameters/#parameter-names

AFAIK the shortened version of a parameter name should be just one letter, so you can do e.g. -abcd instead of -a -b -c -d.

Also, parameters use to be named --fedora-version instead of --fedora_version

PEP8: https://www.python.org/dev/peps/pep-0008/#blank-lines

Surround top-level function and class definitions with two blank lines.

IMHO the correct indentation is to align the first elements of each line to start on the same position, but since this is a temporary code (I know the jokes about temporary code, but this one is really temporary :D), it doesn't matter.

Thank you for the PR @thrnciar.
I've made some notes in the comment section

rebased onto 3a1e2d1c32e96b99bc806b7cfcc70e1dced282ca

4 years ago

rebased onto 35423663d3fbbc88831e7e7d245d48f93c93777f

4 years ago

I am still not sure about the -rc param. AFAIK there is not a formally-written standard, but it is very unusual to have a single-dash parameter with more than one letter.

I would rather go with --rc and --dc if we want to have shortened versions of those parameters.

Also, there are still --rawhide_chroot and --dest_chroot instead of --rawhide-chroot and --dest-chroot

I just realized, are there any interface changes making our documentation obsolete? In that case, we should also update the documentation.

rebased onto 82533bd344d52971f793408f4304d4e66cbe3a98

4 years ago

rebased onto f3106466da0723ea18c2d297528836eb3fa2f3cd

4 years ago

rebased onto 8bde905

4 years ago

Pull-Request has been merged by frostyx

4 years ago