[
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Please also attach the output of these commands to your bug**\n```\ncat /etc/os-release\n(cd /etc/zypp/repos.d; \\ls | while read line ; do echo -e \"\\n----\\n$(ls -l $line):\"; cat \"$line\" ; done)\n```\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Is your feature request related to a problem? Please describe.**\nA clear and concise description of what the problem is. Ex. I'm always frustrated when [...]\n\n**Describe the solution you'd like**\nA clear and concise description of what you want to happen.\n\n**Describe alternatives you've considered**\nA clear and concise description of any alternative solutions or features you've considered.\n\n**Additional context**\nAdd any other context or screenshots about the feature request here.\n"
  },
  {
    "path": ".github/workflows/ci.yaml",
    "content": "name: CI\non:\n  push:\n    branches: [ master ]\n  pull_request:\n    branches: [ master ]\n\n  # Allows you to run this workflow manually from the Actions tab\n  workflow_dispatch:\n\njobs:\n  Tumbleweed:\n    # The type of runner that the job will run on\n    runs-on: ubuntu-latest\n\n    # Steps represent a sequence of tasks that will be executed as part of the job\n    steps:\n      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it\n      - uses: actions/checkout@v4\n\n      # Runs a single command using the runners shell\n      - name: Run testsuite\n        run: ./test/run_all.sh opensuse/tumbleweed\n  Leap:\n    runs-on: ubuntu-latest\n    steps:\n      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it\n      - uses: actions/checkout@v4\n\n      # Runs a single command using the runners shell\n      - name: Run testsuite\n        run: ./test/run_all.sh opensuse/leap\n  MicroOS:\n    runs-on: ubuntu-latest\n    steps:\n      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it\n      - uses: actions/checkout@v4\n\n      # Runs a single command using the runners shell\n      - name: Run testsuite\n        run: ./test/run_all.sh opensuse/microos\n"
  },
  {
    "path": ".gitignore",
    "content": "!Build/\n.last_cover_stats\n/META.yml\n/META.json\n/MYMETA.*\n*.o\n*.pm.tdy\n*.bs\n\n# Devel::Cover\ncover_db/\n\n# Devel::NYTProf\nnytprof.out\n\n# Dizt::Zilla\n/.build/\n\n# Module::Build\n_build/\nBuild\nBuild.bat\n\n# Module::Install\ninc/\n\n# ExtUtils::MakeMaker\n/blib/\n/_eumm/\n/*.gz\n/Makefile\n/Makefile.old\n/MANIFEST.bak\n/pm_to_blib\n/*.zip\n/search.xml\n\n.*.swp\n__pycache__\n\n# Distribution / packaging\n.Python\nenv/\nbuild/\ndevelop-eggs/\ndist/\ndownloads/\neggs/\n.eggs/\nlib/\nlib64/\nparts/\nsdist/\nvar/\nwheels/\n*.egg-info/\n.installed.cfg\n*.egg\n\nconfig.json\n.idea\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": "# OPI\n\n**O**BS **P**ackage **I**nstaller\n\nSearch and install almost all packages available for openSUSE and SLE:\n\n1. openSUSE Build Service\n2. Packman\n3. Popular packages for Microsoft and other vendors\n\n## System Requirements\n\n- openSUSE Tumbleweed, openSUSE Leap 42.1+, SLE 12+\n- python3\n- python3-requests\n- python3-lxml\n- python3-termcolor\n\n## Install\n\n### openSUSE Tumbleweed and Leap\n\n```\nsudo zypper install opi\n```\n\n### SLE\n\n```\n# eg. for SLE 15 SP4\nsudo SUSEConnect -p PackageHub/15.4/x86_64\n\nsudo zypper refresh\nsudo zypper install opi\n```\n\n## Use\n\nRun:\n\n```\nopi [package_name]\n```\n\nExample:\n\n```\nopi filezilla\n```\n\nDemo:\n\n![Screenshot](demo.gif)\n\n### Config options\n\nChange the config by editing the content of `/etc/opi.cfg`.\n\n#### Disabling auto-refresh for new repositories\n\nIf you want to, you can disable auto-refreshing of new repositories.\n\n```cfg\nnew_repo_auto_refresh = false\n```\n\nIf you want to reactivate auto-refreshing for new repositories, just change the value of `new_repo_auto_refresh` back to `true`.\n\n### Packages from Other Repositories\n\n**Packman Codecs** (enable you to play MP4 videos and YouTube)\n\n```\nopi packman\n\n# or\n\nopi codecs\n```\n\n```\nusage: opi [-h] [-v] [-n] [-P] [-m] [query ...]\n\nopenSUSE Package Installer\n==========================\n\nSearch and install almost all packages available for openSUSE and SLE:\n  1. openSUSE Build Service\n  2. Packman\n  3. Popular packages for various vendors\n\npositional arguments:\n  query          can be any package name or part of it and will be searched for both at the openSUSE Build Service and Packman.\n                 If multiple query arguments are provided only results matching all of them are returned.\n                 Please use the -m option if you want to use the query arguments as individual package queries.\n\noptions:\n  -h, --help     show this help message and exit\n  -v, --version  show program's version number and exit\n  -n             run in non interactive mode\n  -P             don't run any plugins - only search repos, OBS and Packman\n  -m             use query args as space separated package queries\n\nAlso these queries (provided by plugins) can be used to install packages from various other vendors:\n  anydesk           AnyDesk remote access\n  atom              Atom Text Editor\n  brave             Brave web browser\n  chrome            Google Chrome web browser\n  codecs            Media Codecs from Packman and official repo\n  collabora         Collabora desktop office\n  dotnet            Microsoft .NET framework\n  freeoffice        Office suite from SoftMaker (See OSS alternative libreoffice)\n  jami              Jami p2p messenger\n  libation          Tool for managing audible audiobooks\n  maptool           Virtual Tabletop for playing roleplaying games\n  megasync          Mega Desktop App\n  msedge            Microsoft Edge web browser\n  ocenaudio         Audio Editor\n  orcaslicer        Slicer and controller for Bambu and other 3D printers\n  plex              Plex Media Server (See OSS alternative jellyfin)\n  resilio-sync      Decentralized file sync between devices using bittorrent protocol (See OSS alternative syncthing)\n  skype             Microsoft Skype\n  slack             Slack messenger\n  spotify           Listen to music for a monthly fee\n  sublime           Editor for code, markup and prose\n  teams-for-linux   Unofficial Microsoft Teams for Linux client\n  teamviewer        TeamViewer remote access\n  vivaldi           Vivaldi web browser\n  vscode            Microsoft Visual Studio Code\n  vscodium          Visual Studio Codium\n  yandex-browser    Yandex web browser\n  yandex-disk       Yandex.Disk cloud storage client\n  zoom              Zoom Video Conference\n```\n"
  },
  {
    "path": "bin/opi",
    "content": "#!/usr/bin/python3\n\nimport os\nimport sys\nimport re\nimport argparse\nimport textwrap\nimport subprocess\nfrom termcolor import colored, cprint\n\nsys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + '/..'))\nimport opi\nfrom opi.plugins import PluginManager\nfrom opi.version import __version__\nfrom opi.state import global_state\n\n\nclass PreserveWhiteSpaceWrapRawTextHelpFormatter(argparse.RawTextHelpFormatter):\n\tdef __add_whitespace(self, idx, iWSpace, text):\n\t\tif idx == 0:\n\t\t\treturn text\n\t\treturn (' ' * iWSpace) + text\n\n\tdef _split_lines(self, text, width):\n\t\ttextRows = text.splitlines()\n\t\tfor idx,line in enumerate(textRows):\n\t\t\tsearch = re.search(r'\\s*[\\d\\-]*\\.?\\s*', line)\n\t\t\tif line.strip() == '':\n\t\t\t\ttextRows[idx] = ' '\n\t\t\telif search:\n\t\t\t\tlWSpace = search.end()\n\t\t\t\tlines = [self.__add_whitespace(i,lWSpace,x) for i,x in enumerate(textwrap.wrap(line, width))]\n\t\t\t\ttextRows[idx] = lines\n\t\treturn [item for sublist in textRows for item in sublist]\n\n\ndef setup_argparser(plugin_manager):\n\tap = argparse.ArgumentParser(\n\t\tformatter_class=PreserveWhiteSpaceWrapRawTextHelpFormatter,\n\t\tdescription=textwrap.dedent('''\\\n\t\t\topenSUSE Package Installer\n\t\t\t==========================\n\n\t\t\tSearch and install almost all packages available for openSUSE and SLE:\n\t\t\t  1. openSUSE Build Service\n\t\t\t  2. Packman\n\t\t\t  3. Popular packages for various vendors\n\n\t\t'''),\n\t\tepilog=textwrap.dedent('''\\\n\t\t\tAlso these queries (provided by plugins) can be used to install packages from various other vendors:\n\t\t''') + plugin_manager.get_plugin_string(' ' * 2))\n\n\tap.add_argument('query', nargs='*', type=str, help=textwrap.dedent('''\\\n\t\tcan be any package name or part of it and will be searched for both at the openSUSE Build Service and Packman.\n\t\tIf multiple query arguments are provided only results matching all of them are returned.\n\t\tPlease use the -m option if you want to use the query arguments as individual package queries.\n\t'''))\n\tap.add_argument('-V', '--version', action='version', version=f'opi version {__version__}')\n\tap.add_argument('-n', dest='non_interactive', action='store_true', help='run in non interactive mode')\n\tap.add_argument('-P', dest='no_plugins', action='store_true', help=\"don't run any plugins - only search repos, OBS and Packman\")\n\tap.add_argument('-m', dest='multi_install', action='store_true', help='use query args as space separated package queries')\n\tap.add_argument('-v', '--verbose', dest='verbose_mode', action='store_true', help='make the operation more talkative')\n\n\treturn ap\n\n\ndef repo_query(query):\n\ttry:\n\t\tprint(f'Searching repos for: {(\" \".join(query) if isinstance(query, list) else query)}')\n\n\t\tpackages = []\n\t\tpackages.extend(opi.search_published_packages('openSUSE', query))\n\t\tpackages.extend(opi.search_published_packages('Packman', query))\n\t\tpackages = opi.sort_uniq_packages(packages)\n\t\tif len(packages) == 0:\n\t\t\tprint('No package found.')\n\t\t\treturn\n\n\t\t# Print and select a package name option\n\t\tpackage_names = opi.get_package_names(packages)\n\t\tselected_pkg_name = opi.ask_for_option(package_names)\n\t\tprint('You have selected package name:', selected_pkg_name)\n\n\t\t# Inject packages from local repos\n\t\tpackages = opi.search_local_repos(selected_pkg_name) + packages\n\n\t\tinstable_pkg_options = [pkg for pkg in packages if pkg.name == selected_pkg_name]\n\n\t\t# Print and select a package option\n\t\tselected_pkg = opi.ask_for_option(instable_pkg_options, option_filter=opi.format_pkg_option, disable_pager=True)\n\t\tprint('You have selected package:', opi.format_pkg_option(selected_pkg, table=False))\n\t\tif isinstance(selected_pkg, opi.OBSPackage):\n\t\t\tif selected_pkg.is_from_personal_project():\n\t\t\t\tcprint(\n\t\t\t\t\t'BE CAREFUL! The package is from a personal repository and NOT reviewed by others.\\n'\n\t\t\t\t\t'You can ask the author to submit the package to development projects and openSUSE:Factory.\\n'\n\t\t\t\t\t'Learn more at https://en.opensuse.org/openSUSE:How_to_contribute_to_Factory',\n\t\t\t\t\t'red'\n\t\t\t\t)\n\t\t\telif selected_pkg.project == 'openSUSE:Factory':\n\t\t\t\tcprint(\n\t\t\t\t\t'BE CAREFUL! You are about to add the Factory Repository.\\n'\n\t\t\t\t\t'This repo contains the unreleased Tumbleweed distro before openQA tests have been run.\\n'\n\t\t\t\t\t'Only proceed if you know what you are doing!',\n\t\t\t\t\t'yellow'\n\t\t\t\t)\n\t\t\t\tif not opi.ask_yes_or_no('Do you want to continue?', default_answer='n'):\n\t\t\t\t\treturn\n\t\t\telif selected_pkg.project.startswith('openSUSE:Factory:Staging'):\n\t\t\t\tcprint(\n\t\t\t\t\t'BE CAREFUL! You are about to add a Factory Staging Repository.\\n'\n\t\t\t\t\t'This repo is used to test submissions to the Factory repo (the unreleased Tumbleweed distro before openQA tests have been run).\\n'\n\t\t\t\t\t'Only proceed if you know what you are doing!',\n\t\t\t\t\t'yellow'\n\t\t\t\t)\n\t\t\t\tif not opi.ask_yes_or_no('Do you want to continue?', default_answer='n'):\n\t\t\t\t\treturn\n\n\t\t# Install selected package\n\t\tselected_pkg.install()\n\texcept (opi.NoOptionSelected, opi.HTTPError):\n\t\treturn\n\n\nif __name__ == '__main__':\n\ttry:\n\t\tpm = PluginManager()\n\t\tap = setup_argparser(pm)\n\t\targs = ap.parse_args()\n\n\t\tif not args.query:\n\t\t\tap.print_help()\n\t\t\tsys.exit()\n\n\t\tif args.verbose_mode:\n\t\t\tglobal_state.arg_verbose_mode = True\n\n\t\tif args.non_interactive:\n\t\t\tglobal_state.arg_non_interactive = True\n\t\t\tif subprocess.run(['sudo', '-n', 'true']).returncode != 0:\n\t\t\t\tprint('Error: In non-interactive mode this command must be run as root')\n\t\t\t\tprint('       or sudo must not require interaction.')\n\t\t\t\tsys.exit(1)\n\n\t\t# Search plugins\n\t\tif not args.no_plugins:\n\t\t\t# Iterate over queries, copy list as modifying it from within the loop\n\t\t\tfor query in list(args.query):\n\t\t\t\t# Try to find a matching plugin for the query (and run it); runs just first query if not in multi_install mode\n\t\t\t\tif pm.run(query):\n\t\t\t\t\t# After plugin successfully ran, remove from queries to not try again in repo search\n\t\t\t\t\targs.query.remove(query)\n\t\t\t\t\tif not args.multi_install:\n\t\t\t\t\t\tsys.exit()\n\n\t\t# Search repos\n\t\tif not args.multi_install:\n\t\t\trepo_query(args.query)\n\t\telse:\n\t\t\tfor query in args.query:\n\t\t\t\trepo_query(query)\n\n\texcept KeyboardInterrupt:\n\t\tprint()\n"
  },
  {
    "path": "opi/__init__.py",
    "content": "import os\nimport sys\nimport subprocess\nimport re\nimport tempfile\nimport configparser\nfrom functools import cmp_to_key\nfrom collections import defaultdict\n\nimport requests\nimport lxml.etree\nimport rpm\n\nfrom termcolor import colored, cprint\n\nfrom opi import pager\nfrom opi import config\nfrom opi.state import global_state\n\nOBS_APIROOT = {\n\t'openSUSE': 'https://api.opensuse.org',\n\t'Packman': 'https://pmbs.links2linux.de'\n}\nPROXY_URL = 'https://opi-proxy.opensuse.org/'\n\nREPO_DIR = '/etc/zypp/repos.d/'\n\n##################\n### Exceptions ###\n##################\n\nclass NoOptionSelected(Exception):\n\tpass\n\nclass HTTPError(Exception):\n\tpass\n\n###################\n### System Info ###\n###################\n\ncpu_arch = None\ndef get_cpu_arch():\n\t\"\"\"\n\t\treturns e.g. x86_64, aarch64\n\t\"\"\"\n\tglobal cpu_arch\n\tif not cpu_arch:\n\t\tcpu_arch = os.uname().machine\n\t\tif re.match(r'^i.86$', cpu_arch):\n\t\t\tcpu_arch = 'i586'\n\treturn cpu_arch\n\nos_release = {}\ndef get_os_release():\n\tglobal os_release\n\tif not os_release:\n\t\twith open('/etc/os-release') as f:\n\t\t\tfor line in f.readlines():\n\t\t\t\tline = line.strip()\n\t\t\t\tif line.startswith('#') or '=' not in line:\n\t\t\t\t\tcontinue\n\t\t\t\tkey, value = line.split('=', 1)\n\t\t\t\tkey = key.strip()\n\t\t\t\tvalue = value.strip()\n\t\t\t\tif '\"' in value:\n\t\t\t\t\tvalue = value.split('\"', 1)[1].split('\"', 1)[0]\n\t\t\t\tos_release[key] = value\n\treturn os_release\n\ndef get_distribution(prefix=False, use_releasever_variable=False):\n\tos_release = get_os_release()\n\tname = os_release['NAME']\n\tversion = os_release.get('VERSION') # VERSION is not set for TW\n\tif version:\n\t\t# strip prerelease suffix (eg. ' Alpha')\n\t\tversion = version.split(' ', 1)[0]\n\tif name in ('openSUSE Tumbleweed', 'openSUSE MicroOS'):\n\t\tproject = 'openSUSE:Factory'\n\telif name in ('openSUSE Tumbleweed-Slowroll', 'openSUSE MicroOS-Slowroll'):\n\t\tproject = 'openSUSE:Slowroll'\n\telif name == 'openSUSE Leap':\n\t\tif use_releasever_variable:\n\t\t\tproject = 'openSUSE:Leap:$releasever'\n\t\telse:\n\t\t\tproject = 'openSUSE:Leap:' + version\n\telif name == 'openSUSE Leap Micro':\n\t\t# Leap Micro major version seems to be 10 lower than Leap the version it is based on\n\t\tif use_releasever_variable:\n\t\t\tproject = 'openSUSE:Leap:1$releasever'\n\t\telse:\n\t\t\tproject = 'openSUSE:Leap:1' + version\n\telif name.startswith('SLE'):\n\t\tproject = 'SLE' + version\n\tif prefix:\n\t\tproject = 'openSUSE.org:' + project\n\treturn project\n\ndef get_version() -> str:\n\tos_release = get_os_release()\n\tversion = os_release.get('VERSION') # VERSION is not set for TW\n\treturn version\n\ndef expand_vars(s: str) -> str:\n\ts = s.replace('${releasever}', get_version() or '${releasever}')\n\ts = s.replace('$releasever', get_version() or '$releasever')\n\ts = s.replace('${basearch}', get_cpu_arch() or '${basearch}')\n\ts = s.replace('$basearch', get_cpu_arch() or '$basearch')\n\treturn s\n\n\n###############\n### PACKMAN ###\n###############\n\ndef add_packman_repo(dup=False):\n\trepos_by_alias = {repo.alias: repo for repo in get_repos()}\n\tif 'packman' in repos_by_alias:\n\t\tprint(\"Installing from existing packman repo\")\n\telse:\n\t\tprint(\"Adding packman repo\")\n\t\tpackman_mirrors = {\n\t\t\t\"ftp.fau.de                 - University of Erlangen, Germany  -  1h sync\": \"https://ftp.fau.de/packman\",\n\t\t\t\"ftp.halifax.rwth-aachen.de - University of Aachen, Germany    -  1h sync\": \"https://ftp.halifax.rwth-aachen.de/packman\",\n\t\t\t\"ftp.gwdg.de                - University of Göttingen, Germany -  4h sync\": \"https://ftp.gwdg.de/pub/linux/misc/packman\",\n\t\t\t\"mirror.karneval.cz         - TES Media, Czech Republic        -  1h sync\": \"https://mirror.karneval.cz/pub/linux/packman\",\n\t\t\t\"mirrors.aliyun.com         - Alibaba Cloud, China             - 24h sync\": \"https://mirrors.aliyun.com/packman\",\n\t\t}\n\t\tmirror = ask_for_option(list(packman_mirrors.keys()), 'Pick a mirror near your location (0 to quit):')\n\t\tmirror = packman_mirrors[mirror]\n\n\t\tproject = get_distribution(use_releasever_variable=config.get_key_from_config('use_releasever_var'))\n\t\tproject = project.replace(':', '_')\n\t\tproject = project.replace('Factory', 'Tumbleweed')\n\t\tadd_repo(\n\t\t\tfilename = 'packman',\n\t\t\tname = 'Packman',\n\t\t\turl = f'{mirror}/suse/{project}/',\n\t\t\tgpgkey = f'https://ftp.fau.de/packman/suse/{project}/repodata/repomd.xml.key', # always fetch gpgkey from FAU server\n\t\t\tauto_refresh = config.get_key_from_config('new_repo_auto_refresh'),\n\t\t\tpriority = 70\n\t\t)\n\n\tif dup:\n\t\tdist_upgrade(from_repo='packman', allow_downgrade=True, allow_vendor_change=True)\n\ndef add_openh264_repo(dup=False):\n\tproject = get_os_release()['NAME']\n\tproject = project.replace('-Slowroll', '')\n\tproject = project.replace('openSUSE MicroOS', 'openSUSE Tumbleweed')\n\tproject = project.replace('openSUSE Leap Micro', 'openSUSE Leap')\n\tversion = get_version()\n\tif version and int(float(version)) == 16:\n\t\tproject = project.replace('openSUSE Leap', 'openSUSE Leap 16')\n\tproject = project.replace(':', '_').replace(' ', '_')\n\n\turl = f'https://codecs.opensuse.org/openh264/{project}/'\n\texisting_repo = get_enabled_repo_by_url(url)\n\tif existing_repo:\n\t\tprint(f\"Installing from existing repo '{existing_repo.name_expanded()}'\")\n\t\trepo = existing_repo.alias\n\telse:\n\t\trepo = 'openh264'\n\t\tprint(f\"Adding repo '{repo}'\")\n\t\tadd_repo(\n\t\t\tfilename = repo,\n\t\t\tname = repo,\n\t\t\turl = url,\n\t\t\tgpgkey = f\"{url.replace('http://', 'https://')}repodata/repomd.xml.key\",\n\t\t\tauto_refresh = config.get_key_from_config('new_repo_auto_refresh'),\n\t\t\tpriority = 70\n\t\t)\n\n\tif dup:\n\t\tdist_upgrade(from_repo=repo, allow_downgrade=True, allow_vendor_change=True)\n\ndef install_packman_packages(packages, **kwargs):\n\tinstall_packages(packages, from_repo='packman', **kwargs)\n\n\n################\n### ZYPP/DNF ###\n################\n\nclass Repository:\n\tdef __init__(self, alias: str, name: str, url: str, auto_refresh: bool, gpgkey: str = None, filename: str = None):\n\t\tself.alias = alias\n\t\tself.name = name\n\t\tself.url = url\n\t\tself.auto_refresh = auto_refresh\n\t\tself.gpgkey = gpgkey\n\t\tself.filename = filename or alias\n\n\tdef name_expanded(self):\n\t\t\"\"\" Return name with all supported vars expanded \"\"\"\n\t\treturn expand_vars(self.name)\n\n\tdef url_expanded(self):\n\t\t\"\"\" Return url with all supported vars expanded \"\"\"\n\t\treturn expand_vars(self.url)\n\ndef search_local_repos(package):\n\t\"\"\"\n\t\tSearch local default repos\n\t\"\"\"\n\tsearch_results = defaultdict(list)\n\ttry:\n\t\tzc = tempfile.NamedTemporaryFile('w')\n\t\tzc.file.write(f'[main]\\nshowAlias = true\\n')\n\t\tzc.file.flush()\n\t\tos.chmod(zc.name, 0o644)\n\t\t# ensure to run as non-root as this allows the cmd to run even if rpmdb is locked\n\t\tuser = None if os.getuid() else 'nobody'\n\t\tcmd = ['zypper', '-ntc', zc.name, '--no-refresh', 'se', '-sx', '-tpackage', package]\n\t\tenv = {'LANG': 'c'}\n\t\ttry:\n\t\t\tsr = subprocess.check_output(cmd, env=env, user=user).decode()\n\t\texcept TypeError:\n\t\t\t# no user arg on old python versions\n\t\t\tsr = subprocess.check_output(cmd, env=env).decode()\n\t\tfor line in re.split(r'-\\+-+\\n', sr, re.MULTILINE)[1].strip().split('\\n'):\n\t\t\tversion, arch, repo_alias = [s.strip() for s in line.split('|')[3:]]\n\t\t\tversion, release = version.split('-')\n\t\t\tif arch not in (get_cpu_arch(), 'noarch'):\n\t\t\t\tcontinue\n\t\t\tif repo_alias == '(System Packages)':\n\t\t\t\tcontinue\n\t\t\tsearch_results[repo_alias].append({'version': version, 'release': release, 'arch': arch})\n\texcept subprocess.CalledProcessError as e:\n\t\tif e.returncode == 104:\n\t\t\t# 104 ZYPPER_EXIT_INF_CAP_NOT_FOUND is returned if there are no results\n\t\t\tpass\n\t\telif e.returncode == 7:\n\t\t\t# 7 ZYPPER_EXIT_ZYPP_LOCKED - error is already printed by zypper\n\t\t\tsys.exit(1)\n\t\telif e.returncode == 106:\n\t\t\t# 106 - ZYPPER_EXIT_INF_REPOS_SKIPPED - some repos have no cache\n\t\t\tcprint(\"Warning: The repos listed above have no local cache and will be ignored for this query.\", 'yellow')\n\t\t\tcprint(\"         Run 'zypper refresh' as root to fix this.\", 'yellow')\n\t\telse:\n\t\t\traise # TODO: don't exit program, use exception that will be handled in repo_query except block\n\n\trepos_by_alias = {repo.alias: repo for repo in get_repos()}\n\tlocal_installables = []\n\tfor repo_alias, installables in search_results.items():\n\t\t# get the newest package for each repo\n\t\ttry:\n\t\t\tinstallables.sort(key=lambda p: cmp_to_key(rpm.labelCompare)(\"%(version)s-%(release)s\" % p))\n\t\texcept TypeError:\n\t\t\t# rpm 4.14 needs a tuple of (epoch, version, release) - rpm 4.18 can handle a string\n\t\t\tinstallables.sort(key=lambda p: cmp_to_key(rpm.labelCompare)(['1', p['version'], p['release']]))\n\t\tinstallable = installables[-1]\n\n\t\tinstallable['repository'] = repos_by_alias[repo_alias]\n\t\tinstallable['name'] = package\n\t\t# filter out OBS/Packman repos as they are already searched via OBS/Packman API\n\t\tif 'download.opensuse.org/repositories' in installable['repository'].url:\n\t\t\tcontinue\n\t\tif installable['repository'].filename == 'packman':\n\t\t\tcontinue\n\t\tlocal_installables.append(LocalPackage(**installable))\n\treturn local_installables\n\ndef url_normalize(url):\n\treturn expand_vars(re.sub(r'^https?', '', url).rstrip('/'))\n\ndef get_repos():\n\tfor repo_file in os.listdir(REPO_DIR):\n\t\tif not repo_file.endswith('.repo'):\n\t\t\tcontinue\n\t\ttry:\n\t\t\tcp = configparser.ConfigParser()\n\t\t\tcp.read(os.path.join(REPO_DIR, repo_file))\n\t\t\tfor alias in cp.sections():\n\t\t\t\tif not bool(int(cp.get(alias, 'enabled'))):\n\t\t\t\t\tcontinue\n\t\t\t\trepo = {\n\t\t\t\t\t'alias': alias,\n\t\t\t\t\t'filename': re.sub(r'\\.repo$', '', repo_file),\n\t\t\t\t\t'name': cp[alias].get('name', alias),\n\t\t\t\t\t'url': cp[alias].get('baseurl'),\n\t\t\t\t\t'auto_refresh': bool(int(cp[alias].get('autorefresh', '0'))),\n\t\t\t\t}\n\t\t\t\tif cp.has_option(alias, 'gpgkey'):\n\t\t\t\t\trepo['gpgkey'] = cp[alias].get('gpgkey')\n\t\t\t\tyield Repository(**repo)\n\t\texcept Exception as e:\n\t\t\tprint(f\"Error parsing '{repo_file}': {e}\")\n\ndef get_enabled_repo_by_url(url):\n\tfor repo in get_repos():\n\t\tif url_normalize(repo.url) == url_normalize(url):\n\t\t\treturn repo\n\ndef add_repo(filename, name, url, enabled=True, gpgcheck=True, gpgkey=None, repo_type='rpm-md', auto_import_keys=False, auto_refresh=False, priority=None):\n\ttf = tempfile.NamedTemporaryFile('w')\n\ttf.file.write(f'[{filename}]\\n')\n\ttf.file.write(f'name={name}\\n')\n\ttf.file.write(f'baseurl={url}\\n')\n\ttf.file.write(f'enabled={enabled:d}\\n')\n\ttf.file.write(f'type={repo_type}\\n')\n\ttf.file.write(f'gpgcheck={gpgcheck:d}\\n')\n\tif gpgkey:\n\t\task_import_key(gpgkey)\n\t\ttf.file.write(f'gpgkey={gpgkey}\\n')\n\tif auto_refresh:\n\t\ttf.file.write('autorefresh=1\\n')\n\tif priority:\n\t\ttf.file.write(f'priority={priority}\\n')\n\ttf.file.flush()\n\trepo_file = os.path.join(REPO_DIR, f'{filename}.repo')\n\tsubprocess.call(['sudo', 'cp', tf.name, repo_file])\n\tsubprocess.call(['sudo', 'chmod', '644', repo_file])\n\ttf.file.close()\n\tif global_state.arg_verbose_mode:\n\t\tprint(f\"Wrote {repo_file}:\\n{'-'*8}\\n{open(repo_file).read()}{'-'*8}\")\n\trefresh_repos(auto_import_keys=auto_import_keys)\n\ndef refresh_repos(repo_alias=None, auto_import_keys=False):\n\trefresh_cmd = []\n\trefresh_cmd = ['sudo', 'zypper']\n\tif auto_import_keys:\n\t\trefresh_cmd.append('--gpg-auto-import-keys')\n\trefresh_cmd.append('ref')\n\tif repo_alias:\n\t\trefresh_cmd.append(repo_alias)\n\tsubprocess.call(refresh_cmd)\n\ndef normalize_key(pem):\n\tnew_lines = []\n\tfor line in pem.split('\\n'):\n\t\tline = line.strip()\n\t\tif not line:\n\t\t\tcontinue\n\t\tif line.lower().startswith('version:'):\n\t\t\tcontinue\n\t\tnew_lines.append(line)\n\tnew_lines.insert(1, '')\n\treturn '\\n'.join(new_lines)\n\ndef split_keys(keys):\n\tfor key in keys.split('-----BEGIN PGP PUBLIC KEY BLOCK-----')[1:]:\n\t\tyield '-----BEGIN PGP PUBLIC KEY BLOCK-----' + key\n\ndef get_keys_from_rpmdb():\n\ts = subprocess.check_output(['rpm', '-q', 'gpg-pubkey', '--qf',\n\t    '%{NAME}-%{VERSION}\\n%{PACKAGER}\\n%{DESCRIPTION}\\nOPI-SPLIT-TOKEN-TO-TELL-KEY-PACKAGES-APART\\n'])\n\tkeys = []\n\tfor raw_kpkg in s.decode().strip().split('OPI-SPLIT-TOKEN-TO-TELL-KEY-PACKAGES-APART'):\n\t\traw_kpkg = raw_kpkg.strip()\n\t\tif not raw_kpkg:\n\t\t\tcontinue\n\t\tkid, name, pubkey = raw_kpkg.strip().split('\\n', 2)\n\t\tkeys.append({\n\t\t\t'kid': kid,\n\t\t\t'name': name,\n\t\t\t'pubkey': normalize_key(pubkey)\n\t\t})\n\treturn keys\n\ndef install_packages(packages, **kwargs):\n\tpkgmgr_action('in', packages, **kwargs)\n\ndef dist_upgrade(**kwargs):\n\tpkgmgr_action('dup', **kwargs)\n\ndef pkgmgr_action(action, packages=[], from_repo=None, allow_vendor_change=False, allow_arch_change=False, allow_downgrade=False, allow_name_change=False, allow_unsigned=False, no_recommends=False, non_interactive=False):\n\targs = ['sudo', 'zypper']\n\tif global_state.arg_non_interactive or non_interactive:\n\t\targs.append('-n')\n\tif allow_unsigned:\n\t\targs.append('--no-gpg-checks')\n\targs.append(action)\n\tif from_repo:\n\t\targs.extend(['--from', from_repo])\n\tif allow_downgrade:\n\t\targs.append('--allow-downgrade')\n\tif allow_arch_change:\n\t\targs.append('--allow-arch-change')\n\tif allow_name_change:\n\t\targs.append('--allow-name-change')\n\tif allow_vendor_change:\n\t\targs.append('--allow-vendor-change')\n\tif action == 'in':\n\t\targs.append('--oldpackage')\n\t\tif no_recommends:\n\t\t\targs.append('--no-recommends')\n\targs.extend(packages)\n\tsubprocess.call(args)\n\n\n###########\n### OBS ###\n###########\n\nclass Installable:\n\tdef __init__(self, name: str, version: str, release: str, arch: str):\n\t\tself.name = name # e.g. MozillaFirefox\n\t\tself.version = version # e.g. 1.2.3\n\t\tself.release = release # e.g. 150500.1.1\n\t\tself.arch = arch # e.g. x86_64, aarch64 or noarch\n\n\tdef install(self):\n\t\traise NotImplemented()\n\n\tdef name_with_arch(self):\n\t\treturn f'{self.name}.{self.arch}'\n\n\tdef _install_from_existing_repo(self, repo: Repository):\n\t\t# Install from existing repos (don't add a repo)\n\t\tprint(f\"Installing from existing repo '{repo.name_expanded()}'\")\n\t\t# ensure that this repo is up to date if no auto_refresh is configured\n\t\tif not repo.auto_refresh:\n\t\t\trefresh_repos(repo.alias)\n\t\tinstall_packages([self.name_with_arch()], from_repo=repo.alias)\n\nclass OBSPackage(Installable):\n\t\"\"\" Package returned from OBS API \"\"\"\n\tdef __init__(self,\n\t             name: str, version: str, release: str, arch: str,\n\t             package: str, project: str, repository: str, obs_instance: str):\n\t\tsuper().__init__(name, version, release, arch)\n\t\tself.package = package # same as name unless this is a subpackage (then package is name of parent)\n\t\tself.project = project # e.g. devel:languages:perl\n\t\tself.repository = repository # e.g. openSUSE_Tumbleweed\n\t\tself.obs_instance = obs_instance # openSUSE or Packman\n\n\tdef install(self):\n\t\tif self.obs_instance == 'Packman':\n\t\t\t# Install from Packman Repo\n\t\t\tadd_packman_repo()\n\t\t\tinstall_packman_packages([self.name_with_arch()])\n\t\t\treturn\n\n\t\trepo_alias = self.project.replace(':', '_')\n\t\tproject_path = self.project.replace(':', ':/')\n\t\trepository = self.repository\n\t\tif config.get_key_from_config('use_releasever_var'):\n\t\t\tversion = get_version()\n\t\t\tif version:\n\t\t\t\t# version is None on tw\n\t\t\t\trepository = repository.replace(version, '$releasever')\n\t\turl = f'https://download.opensuse.org/repositories/{project_path}/{repository}/'\n\t\tgpgkey = url + 'repodata/repomd.xml.key'\n\t\texisting_repo = get_enabled_repo_by_url(url)\n\n\t\tif existing_repo:\n\t\t\tself._install_from_existing_repo(existing_repo)\n\t\telse:\n\t\t\tprint(f\"Adding repo '{self.project}'\")\n\t\t\tadd_repo(\n\t\t\t\tfilename = repo_alias,\n\t\t\t\tname = self.project,\n\t\t\t\turl = url,\n\t\t\t\tgpgkey = gpgkey,\n\t\t\t\tgpgcheck = True,\n\t\t\t\tauto_refresh = config.get_key_from_config('new_repo_auto_refresh')\n\t\t\t)\n\t\t\tinstall_packages([self.name_with_arch()], from_repo=repo_alias,\n\t\t\t\tallow_downgrade=True,\n\t\t\t\tallow_arch_change=True,\n\t\t\t\tallow_name_change=True,\n\t\t\t\tallow_vendor_change=True\n\t\t\t)\n\t\t\task_keep_repo(repo_alias)\n\n\tdef weight(self):\n\t\tweight = 0\n\n\t\tdash_count = self.name.count('-')\n\t\tweight += 1e5 * (0.5 ** dash_count)\n\n\t\tweight -= 1e4 * len(self.name)\n\n\t\tif self.is_from_official_project():\n\t\t\tweight += 2e3\n\t\telif not self.is_from_personal_project():\n\t\t\tweight += 1e3\n\n\t\tif self.name == self.package:\n\t\t\t# this rpm is the main or only subpackage\n\t\t\tweight += 1e2\n\n\t\tif not (get_cpu_arch() == 'x86_64' and self.arch == 'i586'):\n\t\t\tweight += 1e1\n\n\t\tif self.repository.startswith('openSUSE_Tumbleweed'):\n\t\t\tweight += 2\n\t\telif self.repository.startswith('openSUSE_Factory'):\n\t\t\tweight += 1\n\t\telif self.repository == 'standard':\n\t\t\tweight += 0\n\n\t\treturn weight\n\n\tdef __lt__(self, other):\n\t\t\"\"\" Note that we sort from high weight to low weight \"\"\"\n\t\treturn self.weight() > other.weight()\n\n\tdef is_from_official_project(self):\n\t\treturn self.project.startswith('openSUSE:')\n\n\tdef is_from_personal_project(self):\n\t\treturn self.project.startswith('home:') or self.project.startswith('isv:')\n\nclass LocalPackage(Installable):\n\t\"\"\" Package found in local repo (metadata) cache \"\"\"\n\tdef __init__(self, name: str, version: str, release: str, arch: str, repository: Repository):\n\t\tsuper().__init__(name, version, release, arch)\n\t\tself.repository = repository\n\n\tdef install(self):\n\t\tself._install_from_existing_repo(self.repository)\n\ndef search_published_packages(obs_instance, query):\n\tdistribution = get_distribution(prefix=(obs_instance != 'openSUSE'))\n\tendpoint = '/search/published/binary/id'\n\turl = OBS_APIROOT[obs_instance] + endpoint\n\tif isinstance(query, list):\n\t\txquery = \"'\" + \"', '\".join(query) + \"'\"\n\telse:\n\t\txquery = f\"'{query}'\"\n\txpath = f\"contains-ic(@name, {xquery}) and path/project='{distribution}'\"\n\turl = requests.Request('GET', url, params={'match': xpath, 'limit': 0}).prepare().url\n\ttry:\n\t\tr = requests.get(PROXY_URL, params={'obs_api_link': url, 'obs_instance': obs_instance})\n\t\tr.raise_for_status()\n\n\t\tdom = lxml.etree.fromstring(r.text)\n\t\tpackages = []\n\t\tfor binary in dom.xpath('/collection/binary'):\n\t\t\tbinary_data = {k: v for k, v in binary.items()}\n\t\t\tbinary_data['obs_instance'] = obs_instance\n\n\t\t\tdel binary_data['filename']\n\t\t\tdel binary_data['filepath']\n\t\t\tdel binary_data['baseproject']\n\t\t\tdel binary_data['type']\n\t\t\tfor k in ('name', 'project', 'repository', 'version', 'release', 'arch'):\n\t\t\t\tassert k in binary_data, f\"Key '{k}' missing\"\n\n\t\t\t# Filter out ghost binary\n\t\t\t# (package has been deleted, but binary still exists)\n\t\t\tif not binary_data.get('package'):\n\t\t\t\tcontinue\n\n\t\t\tpackage = OBSPackage(**binary_data)\n\n\t\t\t# Filter out branch projects\n\t\t\tif ':branches:' in package.project:\n\t\t\t\tcontinue\n\n\t\t\t# Filter out Packman personal projects\n\t\t\tif package.obs_instance != 'openSUSE' and package.is_from_personal_project():\n\t\t\t\tcontinue\n\n\t\t\t# Filter out debuginfo, debugsource, devel, buildsymbols, lang and docs packages\n\t\t\tregex = r'-(debuginfo|debugsource|buildsymbols|devel|lang|l10n|trans|doc|docs)(-.+)?$'\n\t\t\tif re.match(regex, package.name):\n\t\t\t\tcontinue\n\n\t\t\t# Filter out source packages\n\t\t\tif package.arch == 'src':\n\t\t\t\tcontinue\n\n\t\t\t# Filter architecture\n\t\t\tcpu_arch = get_cpu_arch()\n\t\t\tif package.arch not in (cpu_arch, 'noarch'):\n\t\t\t\tcontinue\n\n\t\t\t# Filter repo architecture\n\t\t\tif package.repository == 'openSUSE_Factory' and (cpu_arch not in ('x86_64' 'i586')):\n\t\t\t\tcontinue\n\t\t\telif package.repository == 'openSUSE_Factory_ARM' and not cpu_arch.startswith('arm') and not cpu_arch == 'aarch64':\n\t\t\t\tcontinue\n\t\t\telif package.repository == 'openSUSE_Factory_PowerPC' and not cpu_arch.startswith('ppc'):\n\t\t\t\tcontinue\n\t\t\telif package.repository == 'openSUSE_Factory_zSystems' and not cpu_arch.startswith('s390'):\n\t\t\t\tcontinue\n\t\t\telif package.repository == 'openSUSE_Factory_RISCV' and not cpu_arch.startswith('risc'):\n\t\t\t\tcontinue\n\n\t\t\tpackages.append(package)\n\n\t\treturn packages\n\texcept requests.exceptions.HTTPError as e:\n\t\tif e.response.status_code == 413:\n\t\t\tprint('Please use different search keywords. Some short keywords cause OBS timeout.')\n\t\telse:\n\t\t\tprint('HTTPError:', e)\n\t\traise HTTPError()\n\ndef get_package_names(packages: list):\n\t\"\"\" return a list of package names but without duplicates \"\"\"\n\tnames = []\n\tfor pkg in packages:\n\t\tname = pkg.name\n\t\tif name not in names:\n\t\t\tnames.append(name)\n\treturn names\n\ndef sort_uniq_packages(packages: list):\n\t\"\"\" sort -u for packages; sort by weight and keep only the one with the best repo \"\"\"\n\tpackages = sorted(packages)\n\tnew_packages = []\n\tadded_packages = set()\n\tfor package in packages:\n\t\t# only select the first package for each name/project combination\n\t\t# which will be the one with the highest repo weight\n\t\tquery = (package.name, package.project)\n\t\tif query not in added_packages:\n\t\t\tnew_packages.append(package)\n\t\t\tadded_packages.add(query)\n\treturn new_packages\n\n########################\n### User Interaction ###\n########################\n\ndef ask_yes_or_no(question, default_answer='y'):\n\tq = question + ' '\n\tif default_answer == 'y':\n\t\tq += '(Y/n)'\n\telse:\n\t\tq += '(y/N)'\n\tq += ' '\n\tif global_state.arg_non_interactive:\n\t\tprint(q)\n\t\tanswer = default_answer\n\telse:\n\t\tanswer = input(q) or default_answer\n\treturn answer.strip().lower() == 'y'\n\ndef ask_for_option(options, question='Pick a number (0 to quit):', option_filter=lambda a: a, disable_pager=False):\n\t\"\"\"\n\t\tAsk the user for a number to pick in order to select an option.\n\t\tExit if the number is 0.\n\t\tSpecify the number with question and the corresponding option will be returned.\n\t\tVia option_filter a callback function to format option entries can be supplied,\n\t\tbut this doesn't work with the pager.\n\t\tIf needed, a pager will be used, unless disable_pager is True.\n\t\"\"\"\n\n\tpadding_len = len(str(len(options)))\n\ti = 1\n\tnumbered_options = []\n\tterminal_width = os.get_terminal_size().columns - 1 if sys.stdout.isatty() else 0\n\tfor option in options:\n\t\tnumber = f'{i:{padding_len}}. '\n\t\tnumbered_option = number + option_filter(option)\n\t\tif terminal_width and not disable_pager:\n\t\t\t# break too long lines:\n\t\t\t# if pager is disabled this might mean that we get terminal sequences here\n\t\t\t# which might get broken by some spaces and newlines.\n\t\t\t# also too long lines are not fatal outside of the pager\n\t\t\twhile len(numbered_option) > terminal_width:\n\t\t\t\tnumbered_options.append(numbered_option[:terminal_width])\n\t\t\t\tnumbered_option = ' ' * len(number) + numbered_option[terminal_width:]\n\t\tnumbered_options.append(numbered_option)\n\t\ti += 1\n\tif config.get_key_from_config('list_in_reverse'):\n\t\tnumbered_options.reverse()\n\ttext = '\\n'.join(numbered_options)\n\tif global_state.arg_non_interactive:\n\t\tinput_string = '1' # default to first option in the list\n\t\tprint(f\"{text}\\n{question} {input_string}\")\n\telif not sys.stdout.isatty() or len(numbered_options) < (os.get_terminal_size().lines - 1) or disable_pager:\n\t\t# no pager needed\n\t\tprint(text)\n\t\tinput_string = input(question + ' ')\n\telse:\n\t\tinput_string = pager.ask_number_with_pager(text, question, start_at_bottom=config.get_key_from_config('list_in_reverse'))\n\n\tinput_string = input_string.strip() or '0'\n\tnum = int(input_string) if input_string.isdecimal() else -1\n\tif num == 0:\n\t\traise NoOptionSelected()\n\telif not (num >= 1 and num <= len(options)):\n\t\treturn ask_for_option(options, question, option_filter, disable_pager)\n\telse:\n\t\treturn options[num - 1]\n\ndef ask_import_key(keyurl):\n\tkeys = requests.get(expand_vars(keyurl)).text\n\tdb_keys = get_keys_from_rpmdb()\n\tfor key in split_keys(keys):\n\t\tfor line in subprocess.check_output(['gpg', '--quiet', '--show-keys', '--with-colons', '-'], input=key.encode()).decode().strip().split('\\n'):\n\t\t\tif line.startswith('uid:'):\n\t\t\t\tkey_info = line.split(':')[9].replace('\\\\x3a', ':')\n\t\t\telif line.startswith('pub:'):\n\t\t\t\tkid = f\"gpg-pubkey-{line.split(':')[4][-8:].lower()}\"\n\t\tif [db_key for db_key in db_keys if normalize_key(key) in normalize_key(db_key['pubkey'])]:\n\t\t\tprint(f\"Package signing key {kid} ('{key_info}) is already present.\")\n\t\telse:\n\t\t\tif ask_yes_or_no(f\"Import package signing key {kid} ({key_info})\"):\n\t\t\t\ttf = tempfile.NamedTemporaryFile('w')\n\t\t\t\ttf.file.write(key)\n\t\t\t\ttf.file.flush()\n\t\t\t\tsubprocess.call(['sudo', 'rpm', '--import', tf.name])\n\t\t\t\ttf.file.close()\n\ndef ask_keep_key(keyurl, repo_alias=None):\n\t\"\"\"\n\t\tAsk to remove the key given by url to key file.\n\t\tWarns about all repos still using the key except the repo given by repo_alias param.\n\t\"\"\"\n\turlkeys = split_keys(requests.get(expand_vars(keyurl)).text)\n\turlkeys_normalized = [normalize_key(urlkey) for urlkey in urlkeys]\n\tdb_keys = get_keys_from_rpmdb()\n\tkeys_to_ask_user = [key for key in db_keys if key['pubkey'] in urlkeys_normalized]\n\tfor key in keys_to_ask_user:\n\t\trepos_using_this_key = []\n\t\tfor repo in get_repos():\n\t\t\tif repo_alias and repo.filename == repo_alias:\n\t\t\t\tcontinue\n\t\t\tif repo.gpgkey:\n\t\t\t\trepokey = normalize_key(requests.get(repo.gpgkey).text)\n\t\t\t\tif repokey == key['pubkey']:\n\t\t\t\t\trepos_using_this_key.append(repo)\n\t\tif repos_using_this_key:\n\t\t\tdefault_answer = 'y'\n\t\t\tprint('This key is still in use by the following remaining repos - removal is NOT recommended:')\n\t\t\tprint(' - ' + '\\n - '.join([repo.filename for repo in repos_using_this_key]))\n\t\telse:\n\t\t\tdefault_answer = 'n'\n\t\t\tprint('This key is not in use by any remaining repos.')\n\t\tprint('Keeping the key will allow additional packages signed by this key to be installed in the future without further warning.')\n\t\tif not ask_yes_or_no(f\"Keep package signing key {key['kid']} ({key['name']})?\", default_answer):\n\t\t\tsubprocess.call(['sudo', 'rpm', '-e', key['kid']])\n\ndef ask_keep_repo(repo_alias):\n\tif not ask_yes_or_no(f\"Do you want to keep the repo '{repo_alias}'?\"):\n\t\trepo = next((r for r in get_repos() if r.filename == repo_alias))\n\t\tsubprocess.call(['sudo', 'zypper', 'rr', repo_alias])\n\t\tif repo.gpgkey:\n\t\t\task_keep_key(repo.gpgkey, repo)\n\ndef format_pkg_option(package, table=True):\n\tif isinstance(package, LocalPackage):\n\t\tcolor = 'green'\n\t\tsymbol = '+'\n\telif package.is_from_official_project():\n\t\tcolor = 'yellow'\n\t\tsymbol = '-'\n\telif package.is_from_personal_project():\n\t\tcolor = 'red'\n\t\tsymbol = '!'\n\telse:\n\t\tcolor = 'cyan'\n\t\tsymbol = '?'\n\n\tif isinstance(package, LocalPackage):\n\t\tproject = package.repository.name_expanded()\n\telse:\n\t\tproject = package.project\n\t\tif package.obs_instance != 'openSUSE':\n\t\t\tproject = f\"{package.obs_instance} {project}\"\n\n\tcolored_name = colored(f'{project[:39]} {symbol}', color)\n\n\tif table:\n\t\treturn f\"{colored_name:50} | {package.version[:25]:25} | {package.arch}\"\n\telse:\n\t\treturn f\"{colored_name} | {package.version} | {package.arch}\"\n"
  },
  {
    "path": "opi/config/__init__.py",
    "content": "import os\nimport configparser\n\ndefault_config = {\n\t'use_releasever_var': True,\n\t'new_repo_auto_refresh': True,\n\t'list_in_reverse': False,\n}\n\nclass ConfigError(Exception):\n\tpass\n\nconfig_cache = None\ndef get_key_from_config(key: str):\n\tglobal config_cache\n\tif not config_cache:\n\t\tconfig_cache = default_config.copy()\n\t\tpath = os.environ.get('OPI_CONFIG', '/etc/opi.cfg')\n\t\tif os.path.exists(path):\n\t\t\tcp = configparser.ConfigParser()\n\t\t\tcp.read(path)\n\t\t\tocfg = cp['opi']\n\t\t\tconfig_cache.update({\n\t\t\t\t'use_releasever_var': ocfg.getboolean('use_releasever_var'),\n\t\t\t\t'new_repo_auto_refresh': ocfg.getboolean('new_repo_auto_refresh'),\n\t\t\t\t'list_in_reverse': ocfg.getboolean('list_in_reverse'),\n\t\t\t})\n\treturn config_cache[key]\n"
  },
  {
    "path": "opi/deb.py",
    "content": "import os\nimport subprocess\nfrom shutil import which\nfrom opi import install_packages\n\ndef extract_deb(deb, target_dir):\n\tif not which('bsdtar'):\n\t\tprint(\"Installing requirement: bsdtar\")\n\t\tinstall_packages(['bsdtar'], no_recommends=True, non_interactive=True)\n\tos.makedirs(target_dir, exist_ok=True)\n\tsubprocess.check_call(['bsdtar', 'xf', deb, '--directory', target_dir])\n\tdata_tar = os.path.join(target_dir, 'data.tar.xz')\n\tsubprocess.check_call(['bsdtar', 'xf', data_tar, '--directory', target_dir])\n\tos.unlink(data_tar)\n"
  },
  {
    "path": "opi/github.py",
    "content": "import requests\nimport opi\nfrom opi.state import global_state\n\ndef http_get_json(url):\n\tr = requests.get(url)\n\tr.raise_for_status()\n\treturn r.json()\n\ndef get_releases(org, repo, filter_prereleases=True, filters=[]):\n\treleases = http_get_json(f'https://api.github.com/repos/{org}/{repo}/releases')\n\tif filter_prereleases:\n\t\treleases = [release for release in releases if not release['prerelease']]\n\tfor f in filters:\n\t\treleases = [r for r in releases if f(r)]\n\treturn releases\n\ndef get_latest_release(org, repo, filter_prereleases=True, filters=[]):\n\treleases = get_releases(org, repo, filter_prereleases, filters)\n\treturn releases[0] if releases else None\n\ndef get_release_assets(release):\n\treturn [{'name': a['name'], 'url': a['browser_download_url']} for a in http_get_json(release['assets_url'])]\n\ndef get_release_asset(release, filters=[]):\n\tassets = get_release_assets(release)\n\tfor f in filters:\n\t\tassets = [r for r in assets if f(r)]\n\treturn assets[0] if assets else None\n\ndef install_rpm_release(org, repo, filters=[lambda a: a['name'].endswith('.rpm')], allow_unsigned=False):\n\tlatest_release = get_latest_release(org, repo)\n\tif not latest_release:\n\t\tprint(f'No release found for {org}/{repo}')\n\t\treturn\n\tasset = get_release_asset(latest_release, filters=filters)\n\tif not asset:\n\t\tprint(f\"No RPM asset found for {org}/{repo} release {latest_release['tag_name']}\")\n\t\treturn\n\tif global_state.arg_verbose_mode:\n\t\tprint(f\"Found: {asset['url']}\")\n\tif not opi.ask_yes_or_no(f\"Do you want to install {repo} release {latest_release['tag_name']} RPM from {org} github repo?\"):\n\t\treturn\n\topi.install_packages([asset['url']], allow_unsigned=allow_unsigned)\n"
  },
  {
    "path": "opi/http.py",
    "content": "import os\nimport requests\n\ndef download_file(url, local_filename):\n\tresponse = requests.get(url, stream=True)\n\tresponse.raise_for_status()\n\n\ttotal_size = int(response.headers.get('content-length', 0))\n\tblock_size = 1024*512\n\n\tos.makedirs(os.path.dirname(local_filename), exist_ok=True)\n\n\tprint(f\"Downloading to {local_filename}:\")\n\twith open(local_filename, 'wb') as local_file:\n\t\ttotal_bytes_received = 0\n\t\tfor data in response.iter_content(chunk_size=block_size):\n\t\t\tlocal_file.write(data)\n\t\t\ttotal_bytes_received += len(data)\n\t\t\tprint_progress(total_bytes_received, total_size)\n\tprint()\n\ndef print_progress(bytes_received, total_size):\n\tprogress = (bytes_received / total_size) * 100\n\tprogress = min(100, progress)\n\tprint(f\"Progress: [{int(progress)}%] [{'=' * int(progress / 2)}{' ' * (50 - int(progress / 2))}]\", end='\\r')\n"
  },
  {
    "path": "opi/pager.py",
    "content": "import sys\n\nimport curses\n\ndef ask_number_with_pager(text, question='Pick a number (0 to quit):', start_at_bottom=False):\n\ttry:\n\t\tstdscr = curses.initscr()\n\t\tcurses.noecho()\n\t\tcurses.cbreak() # react on keys without enter\n\n\t\ttext_len_lines = len(text.split('\\n'))\n\t\tmax_top_line = text_len_lines - (curses.LINES - 2)\n\t\tscrollarea = curses.newpad(text_len_lines, curses.COLS)\n\t\tscrollarea.addstr(0, 0, text)\n\t\tscrollarea_topline_ptr = max_top_line if start_at_bottom else 0\n\t\tdef ensure_scrollarea_bounds(scrollarea_topline_ptr):\n\t\t\tscrollarea_topline_ptr = max(scrollarea_topline_ptr, 0)\n\t\t\tscrollarea_topline_ptr = min(scrollarea_topline_ptr, max_top_line)\n\t\t\treturn scrollarea_topline_ptr\n\t\tdef scrollarea_refresh():\n\t\t\tscrollarea.refresh(scrollarea_topline_ptr, 0, 0, 0, curses.LINES - 3, curses.COLS - 1)\n\t\t\t# remove artefacts due to smaller status line when scrolling up\n\t\t\tcontrolbar.addstr(0, 0, ' ' * curses.COLS)\n\t\t\tcontrolbar.addstr(0, 0,\n\t\t\t\t'Use arrow keys or PgUp/PgDown to scroll - lines %i-%i/%i %i%%' % (\n\t\t\t\t\tscrollarea_topline_ptr,\n\t\t\t\t\tscrollarea_topline_ptr + (curses.LINES - 2),\n\t\t\t\t\ttext_len_lines,\n\t\t\t\t\tint(100 * scrollarea_topline_ptr / max_top_line)\n\t\t\t\t),\n\t\t\t\tcurses.A_REVERSE\n\t\t\t)\n\n\t\tcontrolbar = stdscr.subwin(2, curses.COLS, curses.LINES - 2, 0)\n\t\tcontrolbar.keypad(True) # enable key bindings and conversions\n\t\t# ensure clean line\n\t\tcontrolbar.addstr(1, 0, ' ' * (curses.COLS - 1))\n\t\tcontrolbar.addstr(1, 0, question, curses.A_BOLD)\n\t\tcontrolbar.refresh()\n\t\tscrollarea_refresh()\n\n\t\tquestion += ' '\n\t\tinput_string = ''\n\t\twhile not input_string.endswith('\\n'):\n\t\t\tc = controlbar.getkey(1, len(question) + len(input_string))\n\t\t\tif c == 'KEY_PPAGE':\n\t\t\t\tscrollarea_topline_ptr -= (curses.LINES - 2) // 2\n\t\t\t\tscrollarea_topline_ptr = ensure_scrollarea_bounds(scrollarea_topline_ptr)\n\t\t\t\tscrollarea_refresh()\n\t\t\telif c == 'KEY_NPAGE':\n\t\t\t\tscrollarea_topline_ptr += (curses.LINES - 2) // 2\n\t\t\t\tscrollarea_topline_ptr = ensure_scrollarea_bounds(scrollarea_topline_ptr)\n\t\t\t\tscrollarea_refresh()\n\t\t\telif c == 'KEY_UP':\n\t\t\t\tscrollarea_topline_ptr -= 1\n\t\t\t\tscrollarea_topline_ptr = ensure_scrollarea_bounds(scrollarea_topline_ptr)\n\t\t\t\tscrollarea_refresh()\n\t\t\telif c == 'KEY_DOWN':\n\t\t\t\tscrollarea_topline_ptr += 1\n\t\t\t\tscrollarea_topline_ptr = ensure_scrollarea_bounds(scrollarea_topline_ptr)\n\t\t\t\tscrollarea_refresh()\n\t\t\telif c == 'KEY_HOME':\n\t\t\t\tscrollarea_topline_ptr = 0\n\t\t\t\tscrollarea_topline_ptr = ensure_scrollarea_bounds(scrollarea_topline_ptr)\n\t\t\t\tscrollarea_refresh()\n\t\t\telif c == 'KEY_END':\n\t\t\t\tscrollarea_topline_ptr = sys.maxsize\n\t\t\t\tscrollarea_topline_ptr = ensure_scrollarea_bounds(scrollarea_topline_ptr)\n\t\t\t\tscrollarea_refresh()\n\t\t\telif c == 'KEY_BACKSPACE':\n\t\t\t\tinput_string = input_string[:-1]\n\t\t\t\tcontrolbar.addstr(1, len(question) + len(input_string), ' ')\n\t\t\t#elif c == 'KEY_LEFT' or c == 'KEY_RIGHT':\n\t\t\t#\tpass\n\t\t\telif c.startswith('KEY_') or len(c) > 1:\n\t\t\t\tpass\n\t\t\telse:\n\t\t\t\tinput_string += c\n\t\t\t\tif c != '\\n':\n\t\t\t\t\tcontrolbar.addstr(1, 0, question, curses.A_BOLD)\n\t\t\t\t\tcontrolbar.addstr(1, len(question), input_string)\n\t\treturn input_string\n\tfinally:\n\t\tcurses.nocbreak()\n\t\tstdscr.keypad(False)\n\t\tcurses.echo()\n\t\tcurses.endwin()\n"
  },
  {
    "path": "opi/plugins/__init__.py",
    "content": "import os\nfrom importlib import import_module\nimport inspect\nfrom opi import NoOptionSelected\n\nclass BasePlugin:\n\tmain_query = ''\n\tdescription = ''\n\tqueries = []\n\n\t@classmethod\n\tdef matches(cls, query):\n\t\treturn query in cls.queries\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tpass\n\nclass PluginManager:\n\tdef __init__(self):\n\t\tself.plugins = []\n\t\tfor module in os.listdir(os.path.dirname(__file__)):\n\t\t\tif module == '__init__.py' or not module.endswith('.py') or module == '__pycache__':\n\t\t\t\tcontinue\n\t\t\tm = import_module(f'opi.plugins.{module[:-3]}')\n\t\t\tfor name, obj in inspect.getmembers(m):\n\t\t\t\tif inspect.isclass(obj) and issubclass(obj, BasePlugin) and obj is not BasePlugin:\n\t\t\t\t\tself.plugins.append(obj)\n\t\t\tself.plugins.sort(key=lambda p: p.main_query)\n\n\tdef run(self, query):\n\t\tquery = query.lower()\n\t\tfor plugin in self.plugins:\n\t\t\tif plugin.matches(query):\n\t\t\t\ttry:\n\t\t\t\t\tplugin.run(query)\n\t\t\t\texcept NoOptionSelected:\n\t\t\t\t\tpass\n\t\t\t\treturn True\n\n\tdef get_plugin_string(self, indent=''):\n\t\tplugins = ''\n\t\tfor plugin in self.plugins:\n\t\t\tdescription = plugin.description.replace('\\n', '\\n' + (' ' * 16) + '  ')\n\t\t\tplugins += f'{indent}{plugin.main_query:16}  {description}\\n'\n\t\treturn plugins\n"
  },
  {
    "path": "opi/plugins/antigravity.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass Antigravity(BasePlugin):\n    main_query = 'antigravity'\n    description = 'IDE with AI from Google'\n    queries = [main_query]\n\n    @classmethod\n    def run(cls, query):\n        if not opi.ask_yes_or_no('Do you want to install Antigravity from Google repository?'):\n            return\n\n        opi.add_repo(\n            filename = 'antigravity',\n            name = 'antigravity',\n            url = 'https://us-central1-yum.pkg.dev/projects/antigravity-auto-updater-dev/antigravity-rpm',\n            gpgkey = 'https://us-central1-yum.pkg.dev/doc/repo-signing-key.gpg'\n        )\n\n        opi.install_packages(['antigravity'])\n        opi.ask_keep_repo('antigravity')\n"
  },
  {
    "path": "opi/plugins/anydesk.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass AnyDesk(BasePlugin):\n    main_query = 'anydesk'\n    description = 'AnyDesk remote access'\n    queries = ['anydesk']\n\n    @classmethod\n    def run(cls, query):\n        if not opi.ask_yes_or_no('Do you want to install AnyDesk from AnyDesk repository?'):\n            return\n\n        opi.add_repo(\n            filename = 'anydesk',\n            name = 'anydesk',\n            url = 'https://rpm.anydesk.com/opensuse/$basearch/',\n            gpgkey = 'https://keys.anydesk.com/repos/RPM-GPG-KEY'\n        )\n\n        opi.install_packages(['anydesk'])\n        opi.ask_keep_repo('anydesk')\n"
  },
  {
    "path": "opi/plugins/atom.py",
    "content": "import opi\n\nfrom opi.plugins import BasePlugin\n\nclass Atom(BasePlugin):\n\tmain_query = 'atom'\n\tdescription = 'Atom Text Editor'\n\tqueries = ['atom', 'atom-editor']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install Atom from Atom repository?'):\n\t\t\treturn\n\n\t\topi.add_repo(\n\t\t\tfilename = 'atom',\n\t\t\tname = 'Atom',\n\t\t\turl = 'https://packagecloud.io/AtomEditor/atom/el/7/x86_64/?type=rpm',\n\t\t\tgpgkey = 'https://packagecloud.io/AtomEditor/atom/gpgkey'\n\t\t)\n\n\t\topi.install_packages(['atom'])\n\n\t\topi.ask_keep_repo('atom')\n"
  },
  {
    "path": "opi/plugins/brave.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\nimport subprocess\n\nclass BraveBrowser(BasePlugin):\n\tmain_query = 'brave'\n\tdescription = 'Brave web browser'\n\tqueries = ['brave', 'brave-browser']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install Brave from Brave repository?'):\n\t\t\treturn\n\n\t\topi.add_repo(\n\t\t\tfilename = 'brave-browser',\n\t\t\tname = 'Brave Browser',\n\t\t\turl = 'https://brave-browser-rpm-release.s3.brave.com/x86_64/',\n\t\t\tgpgkey = 'https://brave-browser-rpm-release.s3.brave.com/brave-core.asc'\n\t\t)\n\n\t\t# prevent post install script from messing with our repos\n\t\tsubprocess.call(['sudo', 'rm', '-f', '/etc/default/brave-browser'])\n\t\tsubprocess.call(['sudo', 'touch', '/etc/default/brave-browser'])\n\n\t\topi.install_packages(['brave-browser'])\n\t\topi.ask_keep_repo('brave-browser')\n"
  },
  {
    "path": "opi/plugins/chrome.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\nimport subprocess\n\nclass GoogleChrome(BasePlugin):\n\tmain_query = 'chrome'\n\tdescription = 'Google Chrome web browser'\n\tqueries = ['chrome', 'google-chrome']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install Chrome from Google repository?'):\n\t\t\treturn\n\n\t\tprint('Which version do you want to install?')\n\t\toption = opi.ask_for_option(options=[\n\t\t\t'google-chrome-stable',\n\t\t\t'google-chrome-beta',\n\t\t\t'google-chrome-unstable',\n\t\t\t'google-chrome-canary',\n\t\t])\n\t\topi.add_repo(\n\t\t\tfilename = 'google-chrome',\n\t\t\tname = 'google-chrome',\n\t\t\turl = 'https://dl.google.com/linux/chrome/rpm/stable/x86_64',\n\t\t\tgpgkey = 'https://dl.google.com/linux/linux_signing_key.pub'\n\t\t)\n\n\t\t# prevent post install script from messing with our repos\n\t\tdefaults_file = option.replace('-stable', '')\n\t\tsubprocess.call(['sudo', 'rm', '-f', f'/etc/default/{defaults_file}'])\n\t\tsubprocess.call(['sudo', 'touch', f'/etc/default/{defaults_file}'])\n\n\t\topi.install_packages([option])\n\t\topi.ask_keep_repo('google-chrome')\n"
  },
  {
    "path": "opi/plugins/collabora.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass collabora(BasePlugin):\n\tmain_query = 'collabora'\n\tdescription = 'Collabora desktop office'\n\tqueries = ['collabora', 'collaboraoffice', 'collaboraoffice-desktop']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install collaboraoffice-desktop from collaboraoffice repository?'):\n\t\t\treturn\n\n\t\topi.add_repo(\n\t\t\tfilename = 'collabora-office',\n\t\t\tname = 'Collabora Office 24.04 Snapshot',\n\t\t\turl = 'https://www.collaboraoffice.com/downloads/Collabora-Office-24-Snapshot/Linux/yum',\n\t\t\tgpgkey = 'https://www.collaboraoffice.com/downloads/Collabora-Office-24-Snapshot/Linux/yum/repodata/repomd.xml.key',\n\t\t\tgpgcheck = True\n\t\t)\n\n\t\topi.install_packages(['collaboraoffice-desktop'])\n\t\topi.ask_keep_repo('collabora-office')\n"
  },
  {
    "path": "opi/plugins/dotnet.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass MSDotnet(BasePlugin):\n\tmain_query = 'dotnet'\n\tdescription = 'Microsoft .NET framework'\n\tqueries = ['dotnet-sdk', 'dotnet']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install .NET from Microsoft repository?'):\n\t\t\treturn\n\n\t\topi.add_repo(\n\t\t\tfilename = 'dotnet',\n\t\t\tname = 'Microsoft .NET',\n\t\t\turl = 'https://packages.microsoft.com/opensuse/15/prod/',\n\t\t\tgpgkey = 'https://packages.microsoft.com/keys/microsoft.asc'\n\t\t)\n\n\t\topi.install_packages(['dotnet-sdk-9.0', 'libatomic1'])\n\t\topi.ask_keep_repo('dotnet')\n"
  },
  {
    "path": "opi/plugins/freeoffice.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass SoftMakerFreeOffice(BasePlugin):\n\tmain_query = 'freeoffice'\n\tdescription = 'Office suite from SoftMaker (See OSS alternative libreoffice)'\n\tqueries = ['freeoffice']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install FreeOffice from SoftMaker repository?'):\n\t\t\treturn\n\n\t\topi.add_repo(\n\t\t\tfilename = 'SoftMaker',\n\t\t\tname = 'SoftMaker',\n\t\t\turl = 'https://shop.softmaker.com/repo/rpm',\n\t\t\tgpgkey = 'https://shop.softmaker.com/repo/linux-repo-public.key'\n\t\t)\n\n\t\topi.install_packages(['softmaker-freeoffice-2024'])\n\t\topi.ask_keep_repo('SoftMaker')\n"
  },
  {
    "path": "opi/plugins/jami.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass Jami(BasePlugin):\n\tmain_query = 'jami'\n\tdescription = 'Jami p2p messenger'\n\tqueries = [main_query, 'jami-qt', 'jami-gnome', 'jami-daemon']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install jami from jami repository?'):\n\t\t\treturn\n\n\t\tprint('Which version do you want to install?')\n\t\toption = opi.ask_for_option(options=[\n\t\t\t'jami',\n\t\t\t'jami-qt',\n\t\t\t'jami-gnome',\n\t\t\t'jami-daemon',\n\t\t])\n\n\t\tprint('You have chosen', option)\n\n\t\tif opi.get_distribution().startswith('openSUSE:Leap'):\n\t\t\trepourl = f'https://dl.jami.net/nightly/opensuse-leap_{opi.get_version()}/'\n\t\telse:\n\t\t\trepourl = 'https://dl.jami.net/nightly/opensuse-tumbleweed/'\n\n\t\topi.add_repo(\n\t\t\tfilename = 'jami',\n\t\t\tname = 'jami',\n\t\t\turl = repourl,\n\t\t\tgpgkey = 'https://dl.jami.net/jami.pub.key',\n\t\t\tgpgcheck = False\n\t\t)\n\n\t\topi.install_packages([option])\n\t\topi.ask_keep_repo('jami')\n"
  },
  {
    "path": "opi/plugins/libation.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\nfrom opi import github\n\nclass Libation(BasePlugin):\n\tmain_query = 'libation'\n\tdescription = 'Tool for managing audible audiobooks'\n\tqueries = [main_query, 'Libation']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tarch = opi.get_cpu_arch().replace('aarch64', 'arm64').replace('x86_64', 'amd64')\n\t\tgithub.install_rpm_release('rmcrackan', 'Libation',\n\t\t\tfilters=[lambda a: a['name'].endswith(f'{arch}.rpm')],\n\t\t\tallow_unsigned=True # no key available\n\t\t)\n"
  },
  {
    "path": "opi/plugins/librewolf.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass librewolf(BasePlugin):\n\tmain_query = 'librewolf'\n\tdescription = 'Custom version of Firefox, focused on privacy, security and freedom'\n\tqueries = ['librewolf', 'Librewolf', 'LibreWolf']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install librewolf from librewolf repository?'):\n\t\t\treturn\n\n\t\topi.add_repo(\n\t\t\tfilename = 'librewolf',\n\t\t\tname = 'librewolf',\n\t\t\turl = 'https://rpm.librewolf.net',\n\t\t\tgpgkey = 'https://rpm.librewolf.net/pubkey.gpg'\n\t\t)\n\n\t\topi.install_packages(['librewolf'])\n\t\topi.ask_keep_repo('librewolf')\n"
  },
  {
    "path": "opi/plugins/localsend.py",
    "content": "import os\nimport opi\nfrom opi.plugins import BasePlugin\nfrom opi.state import global_state\nfrom opi import github\nfrom opi import http\nfrom opi import rpmbuild\nfrom opi import deb\n\nclass LocalSend(BasePlugin):\n\tmain_query = 'localsend'\n\tdescription = 'Share files to nearby devices'\n\tqueries = [main_query]\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tlatest_release = github.get_latest_release('localsend', 'localsend')\n\t\tif not latest_release:\n\t\t\tprint(f'No release found for LocalSend')\n\t\t\treturn\n\n\t\tmatch_filename_suffix = f'{opi.get_cpu_arch().replace(\"aarch64\", \"arm-64\").replace(\"_\", \"-\")}.deb'\n\t\tasset = github.get_release_asset(latest_release, filters=[lambda a: a['name'].endswith(match_filename_suffix)])\n\t\tif not asset:\n\t\t\tprint(f\"No DEB asset found for LocalSend release {latest_release['tag_name']}\")\n\t\t\treturn\n\t\tif global_state.arg_verbose_mode:\n\t\t\tprint(f\"Found: {asset['url']}\")\n\t\tif not opi.ask_yes_or_no(f\"Do you want to install LocalSend DEB release {latest_release['tag_name']} converted to RPM from LocalSend github repo?\"):\n\t\t\treturn\n\n\t\tbinary_path = 'usr/bin/localsend'\n\t\tdata_path = 'usr/share/localsend_app'\n\n\t\trpm = rpmbuild.RPMBuild('localsend', latest_release['tag_name'], cls.description, opi.get_cpu_arch(), \n\t\t\tfiles = [\n\t\t\t\tf\"/{binary_path}\",\n\t\t\t\tf\"/{data_path}\"\n\t\t\t]\n\t\t)\n\n\t\tdeb_path = os.path.join(rpm.tmpdir.name, 'localsend.deb')\n\t\tdeb_path_extracted = os.path.join(rpm.tmpdir.name, 'localsend')\n\t\thttp.download_file(asset['url'], deb_path)\n\t\tdeb.extract_deb(deb_path, deb_path_extracted)\n\n\t\tos.makedirs(os.path.join(rpm.buildroot, os.path.dirname(binary_path)), exist_ok=True)\n\t\tos.symlink(\"../share/localsend_app/localsend_app\", os.path.join(rpm.buildroot, binary_path))\n\n\t\trpmbuild.copy(os.path.join(deb_path_extracted, data_path), os.path.join(rpm.buildroot, data_path))\n\n\t\trpm.add_desktop_file(cmd=\"localsend %U\", icon=\"/usr/share/localsend_app/data/flutter_assets/assets/img/logo-256.png\",\n\t\t                     Categories=\"GTK;FileTransfer;Utility;\",\n\t\t                     Keywords=\"Sharing;LAN;Files;\",\n\t\t                     StartupNotify=\"true\"\n\t\t)\n\n\t\trpm.build()\n\t\topi.install_packages([rpm.rpmfile_path], allow_unsigned=True)\n"
  },
  {
    "path": "opi/plugins/maptool.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\nfrom opi import github\n\nclass MapTool(BasePlugin):\n\tmain_query = 'maptool'\n\tdescription = 'Virtual Tabletop for playing roleplaying games'\n\tqueries = ['maptool', 'MapTool']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tgithub.install_rpm_release('RPTools', 'maptool', allow_unsigned=True) # no key available\n"
  },
  {
    "path": "opi/plugins/megasync.py",
    "content": "import opi\n\nfrom opi.plugins import BasePlugin\nfrom shutil import which\n\nclass MEGAsync(BasePlugin):\n\tmain_query = 'megasync'\n\tdescription = 'Mega Desktop App'\n\tqueries = ['megasync', 'megasyncapp']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install MEGAsync from MEGAsync repository?'):\n\t\t\treturn\n\n\t\topi.add_repo(\n\t\t\tfilename = 'megasync',\n\t\t\tname = 'MEGAsync',\n\t\t\turl = 'https://mega.nz/linux/repo/openSUSE_Tumbleweed/',\n\t\t\tgpgkey = 'https://mega.nz/linux/repo/openSUSE_Tumbleweed/repodata/repomd.xml.key'\n\t\t)\n\n\t\tpackages = ['megasync']\n\n\t\tif which('nautilus'):\n\t\t\tpackages.append('nautilus-megasync')\n\n\t\tif which('nemo'):\n\t\t\tpackages.append('nemo-megasync')\n\t\t\n\t\tif which('thunar'):\n\t\t\tpackages.append('thunar-megasync')\n\t\t\n\t\tif which('dolphin'):\n\t\t\tpackages.append('dolphin-megasync')\n\n\t\topi.install_packages(packages)\n\n\t\topi.ask_keep_repo('megasync')\n"
  },
  {
    "path": "opi/plugins/ms_edge.py",
    "content": "import opi\nimport subprocess\n\nfrom opi.plugins import BasePlugin\n\nclass MSEdge(BasePlugin):\n\tmain_query = 'msedge'\n\tdescription = 'Microsoft Edge web browser'\n\tqueries = ['microsoft-edge', 'msedge', 'edge']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install Microsoft Edge from Microsoft repository?'):\n\t\t\treturn\n\n\t\tprint('Which version do you want to install?')\n\t\toption = opi.ask_for_option(options=[\n\t\t\t'microsoft-edge-stable',\n\t\t\t'microsoft-edge-beta',\n\t\t\t'microsoft-edge-dev',\n\t\t])\n\n\t\topi.add_repo(\n\t\t\tfilename = 'microsoft-edge',\n\t\t\tname = 'Microsoft Edge',\n\t\t\turl = 'https://packages.microsoft.com/yumrepos/edge',\n\t\t\tgpgkey = 'https://packages.microsoft.com/keys/microsoft.asc'\n\t\t)\n\n\t\t# prevent post install script from messing with our repos\n\t\tdefaults_file = option.replace('-stable', '')\n\t\tsubprocess.call(['sudo', 'rm', '-f', f'/etc/default/{defaults_file}'])\n\t\tsubprocess.call(['sudo', 'touch', f'/etc/default/{defaults_file}'])\n\n\t\topi.install_packages([option])\n\t\topi.ask_keep_repo('microsoft-edge')\n"
  },
  {
    "path": "opi/plugins/mullvad-browser.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\nimport subprocess\n\nclass MullvadBrowser(BasePlugin):\n\tmain_query = 'mullvad-browser'\n\tdescription = 'Mullvad web browser'\n\tqueries = ['mullvad', 'mullvad-browser']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install mullvad-browser from Mullvad repository?'):\n\t\t\treturn\n\n\t\topi.add_repo(\n\t\t\tfilename = 'mullvad',\n\t\t\tname = 'Mullvad VPN',\n\t\t\turl = 'https://repository.mullvad.net/rpm/stable/$basearch/',\n                        gpgkey = 'https://repository.mullvad.net/rpm/mullvad-keyring.asc',\n                        gpgcheck = 1\n\t\t)\n\n\t\topi.install_packages(['mullvad-browser'])\n\t\topi.ask_keep_repo('mullvad')\n"
  },
  {
    "path": "opi/plugins/ocenaudio.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass Ocenaudio(BasePlugin):\n\tmain_query = 'ocenaudio'\n\tdescription = 'Audio Editor'\n\tqueries = [main_query]\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install ocenaudio from ocenaudio.com?'):\n\t\t\treturn\n\n\t\topi.install_packages(['https://www.ocenaudio.com/downloads/index.php/ocenaudio_opensuse15.rpm'], allow_unsigned=True) # rpm is unsigned\n"
  },
  {
    "path": "opi/plugins/onlyoffice.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\nfrom opi import github\n\n# only available for x86_64\nif opi.get_cpu_arch() == 'x86_64':\n    class OnlyOffice(BasePlugin):\n        main_query = 'onlyoffice'\n        description = 'Office suite'\n        queries = [main_query]\n\n        @classmethod\n        def run(cls, query):\n            f1 = lambda a: a['name'] == 'onlyoffice-desktopeditors.suse12.x86_64.rpm'\n            github.install_rpm_release('ONLYOFFICE', 'DesktopEditors', filters=[f1], allow_unsigned=True) # no key available\n            print(\"Installation done.\\nIf you experience scaling issues with the UI, try calling:\\nonlyoffice-desktopeditors --force-scale=1\")\n"
  },
  {
    "path": "opi/plugins/orca_slicer.py",
    "content": "import os\nimport opi\nfrom opi.plugins import BasePlugin\nfrom opi import github\nfrom opi import rpmbuild\nfrom opi import http\n\nclass OrcaSlicer(BasePlugin):\n\tmain_query = 'orcaslicer'\n\tdescription = 'Slicer and controller for Bambu and other 3D printers'\n\tqueries = [main_query, 'orca-slicer', 'OrcaSlicer']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\torg = 'SoftFever'\n\t\trepo = 'OrcaSlicer'\n\t\tlatest_release = github.get_latest_release(org, repo)\n\t\tif not latest_release:\n\t\t\tprint(f'No release found for {org}/{repo}')\n\t\t\treturn\n\t\tversion = latest_release['tag_name'].lstrip('v').replace('-', '_')\n\t\tif not opi.ask_yes_or_no(f\"Do you want to install {repo} release {version} from {org} github repo?\"):\n\t\t\treturn\n\t\tasset = github.get_release_asset(latest_release, filters=[lambda a: a['name'].endswith('.AppImage')])\n\t\tif not asset:\n\t\t\tprint(f\"No asset found for {org}/{repo} release {version}\")\n\t\t\treturn\n\t\turl = asset['url']\n\n\t\tbinary_path = 'usr/bin/OrcaSlicer'\n\t\ticon_path = 'usr/share/pixmaps/OrcaSlicer.svg'\n\n\t\trpm = rpmbuild.RPMBuild('OrcaSlicer', version, cls.description, \"x86_64\", files=[\n\t\t\tf\"/{binary_path}\",\n\t\t\tf\"/{icon_path}\"\n\t\t])\n\n\t\tbinary_abspath = os.path.join(rpm.buildroot, binary_path)\n\t\thttp.download_file(url, binary_abspath)\n\t\tos.chmod(binary_abspath, 0o755)\n\n\t\ticon_abspath = os.path.join(rpm.buildroot, icon_path)\n\t\ticon_url = \"https://raw.githubusercontent.com/SoftFever/OrcaSlicer/2d849f/resources/images/OrcaSlicer.svg\"\n\t\thttp.download_file(icon_url, icon_abspath)\n\n\t\trpm.add_desktop_file(cmd=\"OrcaSlicer\", icon=f\"/{icon_path}\")\n\n\t\trpm.build()\n\n\t\topi.install_packages([rpm.rpmfile_path], allow_unsigned=True)\n"
  },
  {
    "path": "opi/plugins/packman.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass PackmanCodecsPlugin(BasePlugin):\n\tmain_query = 'codecs'\n\tdescription = 'Media Codecs from Packman and official repo'\n\tqueries = ['packman', 'codecs']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\t# Install Packman Codecs\n\t\tif not opi.ask_yes_or_no('Do you want to install codecs from Packman repository?'):\n\t\t\treturn\n\n\t\topi.add_packman_repo(dup=True)\n\t\tpackman_packages = [\n\t\t\t'ffmpeg',\n\t\t\t'libavcodec-full',\n\t\t\t'vlc-codecs',\n\t\t\t'gstreamer-plugins-bad-codecs',\n\t\t\t'gstreamer-plugins-ugly-codecs',\n\t\t\t'gstreamer-plugins-libav',\n\t\t\t'libfdk-aac2',\n\t\t]\n\t\tif opi.get_version() not in ('15.4', '15.5'):\n\t\t\tpackman_packages.append('pipewire-aptx')\n\t\t\tpackman_packages.append('ffmpeg>=5')\n\t\topi.install_packman_packages(packman_packages)\n\n\t\topi.install_packages([\n\t\t\t'gstreamer-plugins-good',\n\t\t\t'gstreamer-plugins-good-extra',\n\t\t\t'gstreamer-plugins-bad',\n\t\t\t'gstreamer-plugins-ugly',\n\t\t\t'dav1d',\n\t\t])\n\n\t\tif not opi.ask_yes_or_no('Do you want to install openh264 codecs from openSUSE openh264 repository?'):\n\t\t\treturn\n\t\topi.add_openh264_repo(dup=True)\n\n\t\topenh264_packages = [\n\t\t\t'mozilla-openh264',\n\t\t]\n\t\t# install something like gstreamer-1.20-plugin-openh264 without actually specifying any version number\n\t\tgstreamer_plugin_openh264_pkg = 'libgstopenh264.so()'\n\t\tif not (opi.get_cpu_arch() == 'i586' or opi.get_cpu_arch().startswith('armv7')):\n\t\t\tgstreamer_plugin_openh264_pkg += '(64bit)'\n\t\topenh264_packages.append(gstreamer_plugin_openh264_pkg)\n\t\topi.install_packages(openh264_packages)\n"
  },
  {
    "path": "opi/plugins/plex.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass PlexMediaServer(BasePlugin):\n\tmain_query = 'plex'\n\tdescription = 'Plex Media Server (See OSS alternative jellyfin or emby)'\n\tqueries = ['plex', 'plexmediaserver']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install plexmediaserver from Plex repository?'):\n\t\t\treturn\n\n\t\topi.add_repo(\n\t\t\tfilename = 'PlexRepo',\n\t\t\tname = 'PlexRepo',\n\t\t\turl = 'https://repo.plex.tv/rpm/',\n\t\t\tgpgkey = 'https://downloads.plex.tv/plex-keys/PlexSign.v2.key'\n\t\t)\n\n\t\topi.install_packages(['plexmediaserver'])\n\t\topi.ask_keep_repo('PlexRepo')\n"
  },
  {
    "path": "opi/plugins/resilio-sync.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass ResilioSync(BasePlugin):\n\tmain_query = 'resilio-sync'\n\tdescription = 'Decentralized file sync between devices using bittorrent protocol (See OSS alternative syncthing)'\n\tqueries = ['resilio-sync', 'resilio', 'rslsync']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install resilio-sync from resilio-sync repository?'):\n\t\t\treturn\n\n\t\topi.add_repo(\n\t\t\tfilename = 'resilio-sync',\n\t\t\tname = 'resilio-sync',\n\t\t\turl = 'https://linux-packages.resilio.com/resilio-sync/rpm/$basearch',\n\t\t\tgpgkey = 'https://linux-packages.resilio.com/resilio-sync/key.asc',\n\t\t\tgpgcheck = False\n\t\t)\n\n\t\topi.install_packages(['resilio-sync'])\n\t\topi.ask_keep_repo('resilio-sync')\n"
  },
  {
    "path": "opi/plugins/rustdesk.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\nfrom opi import github\n\nclass RustDesk(BasePlugin):\n\tmain_query = 'rustdesk'\n\tdescription = 'Open Source remote desktop application'\n\tqueries = ['rustdesk', 'RustDesk']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tarch = opi.get_cpu_arch()\n\t\tgithub.install_rpm_release('rustdesk', 'rustdesk',\n\t\t\tfilters=[lambda a: a['name'].endswith(f'{arch}-suse.rpm')],\n\t\t\tallow_unsigned=True # no key available\n\t\t)\n"
  },
  {
    "path": "opi/plugins/skype.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass Skype(BasePlugin):\n\tmain_query = 'skype'\n\tdescription = 'Microsoft Skype'\n\tqueries = ['skype']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install Skype from Microsoft repository?'):\n\t\t\treturn\n\n\t\topi.add_repo(\n\t\t\tfilename = 'skype-stable',\n\t\t\tname = 'Microsoft Skype',\n\t\t\turl = 'https://repo.skype.com/rpm/stable/',\n\t\t\tgpgkey = 'https://repo.skype.com/data/SKYPE-GPG-KEY'\n\t\t)\n\n\t\topi.install_packages(['skypeforlinux'])\n\t\topi.ask_keep_repo('skype-stable')\n"
  },
  {
    "path": "opi/plugins/slack.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\nimport subprocess\n\nclass Slack(BasePlugin):\n\tmain_query = 'slack'\n\tdescription = 'Slack messenger'\n\tqueries = ['slack']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install slack from the slack repository?'):\n\t\t\treturn\n\n\t\topi.add_repo(\n\t\t\tfilename = 'slack',\n\t\t\tname = 'slack',\n\t\t\turl = 'https://packagecloud.io/slacktechnologies/slack/fedora/21/$basearch',\n\t\t\tgpgkey = 'https://packagecloud.io/slacktechnologies/slack/gpgkey'\n\t\t)\n\n\t\t# tell slack cron not to mess with our repos\n\t\tsubprocess.call(['sudo', 'rm', '-f', '/etc/default/slack'])\n\t\tsubprocess.call(['sudo', 'touch', '/etc/default/slack'])\n\n\t\topi.install_packages(['slack'])\n\t\topi.ask_keep_repo('slack')\n"
  },
  {
    "path": "opi/plugins/spotify.py",
    "content": "import os\nimport opi\nimport shutil\nfrom opi.plugins import BasePlugin\nfrom opi import rpmbuild\nfrom opi import snap\nfrom opi import http\n\nclass Spotify(BasePlugin):\n\tmain_query = 'spotify'\n\tdescription = 'Listen to music for a monthly fee'\n\tqueries = [main_query]\n\n\t@classmethod\n\tdef run(cls, query):\n\t\ts = snap.get_snap('spotify')\n\t\tif not opi.ask_yes_or_no(f\"Do you want to install spotify release {s['version']} converted to RPM from snapcraft repo?\"):\n\t\t\treturn\n\n\t\tbinary_path = 'usr/bin/spotify'\n\t\tdata_path = 'usr/share/spotify'\n\n\t\trpm = rpmbuild.RPMBuild('spotify', s['version'], cls.description, \"x86_64\", \n\t\t\tconflicts = [\"spotify-client\"],\n\t\t\trequires = [\n\t\t\t\t\"libasound2\",\n\t\t\t\t\"libatk-bridge-2_0-0\",\n\t\t\t\t\"libatomic1\",\n\t\t\t\t\"libcurl4\",\n\t\t\t\t\"libgbm1\",\n\t\t\t\t\"libglib-2_0-0\",\n\t\t\t\t\"libgtk-3-0\",\n\t\t\t\t\"mozilla-nss\",\n\t\t\t\t\"libopenssl1_1\",\n\t\t\t\t\"libxshmfence1\",\n\t\t\t\t\"libXss1\",\n\t\t\t\t\"libXtst6\",\n\t\t\t\t\"xdg-utils\",\n\t\t\t\t\"libayatana-appindicator3-1\",\n\t\t\t],\n\t\t\tautoreq = False,\n\t\t\trecommends = [\n\t\t\t\t\"libavcodec.so\",\n\t\t\t\t\"libavformat.so\",\n\t\t\t],\n\t\t\tsuggests = [\"libnotify4\"],\n\t\t\tfiles = [\n\t\t\t\tf\"/{binary_path}\",\n\t\t\t\tf\"/{data_path}\"\n\t\t\t]\n\t\t)\n\n\t\tsnap_path = os.path.join(rpm.tmpdir.name, 'spotify.snap')\n\t\tsnap_path_extracted = os.path.join(rpm.tmpdir.name, 'spotify')\n\t\thttp.download_file(s['url'], snap_path)\n\t\tsnap.extract_snap(snap_path, snap_path_extracted)\n\n\t\tbinary_abspath = os.path.join(rpm.buildroot, binary_path)\n\t\trpmbuild.copy(os.path.join(snap_path_extracted, binary_path), binary_abspath)\n\n\t\tdata_abspath = os.path.join(rpm.buildroot, data_path)\n\t\trpmbuild.copy(os.path.join(snap_path_extracted, data_path), data_abspath)\n\n\t\trpm.add_desktop_file(cmd=\"spotify %U\", icon=\"/usr/share/spotify/icons/spotify_icon.ico\",\n\t\t                     Categories=\"Audio;Music;Player;AudioVideo;\",\n\t\t                     MimeType=\"x-scheme-handler/spotify\"\n\t\t)\n\n\t\trpm.build()\n\t\topi.install_packages([rpm.rpmfile_path], allow_unsigned=True)\n"
  },
  {
    "path": "opi/plugins/sublime.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass SublimeText(BasePlugin):\n\tmain_query = 'sublime'\n\tdescription = 'Editor for code, markup and prose'\n\tqueries = ['sublime', 'sublime-text', 'sublimetext']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install sublime-text from sublime-text repository?'):\n\t\t\treturn\n\n\t\topi.add_repo(\n\t\t\tfilename = 'sublime-text',\n\t\t\tname = 'sublime-text',\n\t\t\turl = 'https://download.sublimetext.com/rpm/stable/x86_64',\n\t\t\tgpgkey = 'https://download.sublimetext.com/sublimehq-rpm-pub.gpg'\n\t\t)\n\n\t\topi.install_packages(['sublime-text'])\n\t\topi.ask_keep_repo('sublime-text')\n"
  },
  {
    "path": "opi/plugins/teams-for-linux.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass TeamsForLinux(BasePlugin):\n\tmain_query = 'teams-for-linux'\n\tdescription = 'Unofficial Microsoft Teams for Linux client'\n\tqueries = ['teams-for-linux','teams']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install teams-for-linux from teamsforlinux.de repository?'):\n\t\t\treturn\n\n\t\topi.add_repo(\n\t\t\tfilename = 'teams-for-linux',\n\t\t\tname = 'Unofficial Teams for Linux',\n\t\t\turl = 'https://repo.teamsforlinux.de/rpm/',\n\t\t\tgpgkey = 'https://repo.teamsforlinux.de/teams-for-linux.asc'\n\t\t)\n\n\t\topi.install_packages(['teams-for-linux'])\n\t\topi.ask_keep_repo('teams-for-linux')\n"
  },
  {
    "path": "opi/plugins/teamviewer.py",
    "content": "import opi\nimport os\nfrom opi.plugins import BasePlugin\nimport subprocess\n\nclass Teamviewer(BasePlugin):\n\tmain_query = 'teamviewer'\n\tdescription = 'TeamViewer remote access'\n\tqueries = ['teamviewer']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install Teamviewer from Teamviewer repository?'):\n\t\t\treturn\n\n\t\topi.add_repo(\n\t\t\tfilename = 'teamviewer',\n\t\t\tname = 'Teamviewer',\n\t\t\turl = 'https://linux.teamviewer.com/yum/stable/main/binary-$basearch/',\n\t\t\tgpgkey = 'https://linux.teamviewer.com/pubkey/currentkey.asc'\n\t\t)\n\n\t\topi.install_packages(['teamviewer-suse'])\n\t\t# Teamviewer packages its own repo file so our repo file got saved as rpmorig\n\t\tsubprocess.call(['sudo', 'rm', '-f', os.path.join(opi.REPO_DIR, 'teamviewer.repo.rpmorig')])\n\t\topi.ask_keep_repo('teamviewer')\n"
  },
  {
    "path": "opi/plugins/vagrant.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass Vagrant(BasePlugin):\n\tmain_query = 'vagrant'\n\tdescription = 'Tool for building and distributing development environments'\n\tqueries = [main_query]\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install Vagrant from Hashicorp repository?'):\n\t\t\treturn\n\n\t\topi.add_repo(\n\t\t\tfilename = 'hashicorp',\n\t\t\tname = 'Hashicorp',\n\t\t\turl = 'https://rpm.releases.hashicorp.com/AmazonLinux/latest/$basearch/stable',\n\t\t\tgpgkey = 'https://rpm.releases.hashicorp.com/gpg'\n\t\t)\n\n\t\topi.install_packages(['vagrant'])\n\t\topi.ask_keep_repo('hashicorp')\n"
  },
  {
    "path": "opi/plugins/vivaldi.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass Vivaldi(BasePlugin):\n\tmain_query = 'vivaldi'\n\tdescription = 'Vivaldi web browser'\n\tqueries = ['vivaldi']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install Vivaldi from Vivaldi repository?'):\n\t\t\treturn\n\n\t\toption = opi.ask_for_option(options=[\n\t\t\t'vivaldi-stable',\n\t\t\t'vivaldi-snapshot',\n\t\t])\n\n\t\topi.add_repo(\n\t\t\tfilename = 'vivaldi',\n\t\t\tname = 'vivaldi',\n\t\t\turl = 'https://repo.vivaldi.com/archive/rpm/$basearch',\n\t\t\tgpgkey = 'https://repo.vivaldi.com/archive/linux_signing_key.pub'\n\t\t)\n\n\t\topi.install_packages([option])\n\t\topi.ask_keep_repo('vivaldi')\n"
  },
  {
    "path": "opi/plugins/vs_code.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass VSCode(BasePlugin):\n\tmain_query = 'vscode'\n\tdescription = 'Microsoft Visual Studio Code'\n\tqueries = ['visualstudiocode', 'vscode', 'vsc']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install VS Code from Microsoft repository?'):\n\t\t\treturn\n\n\t\toption = opi.ask_for_option(options=[\n\t\t\t'code',\n\t\t\t'code-exploration',\n\t\t\t'code-insiders',\n\t\t])\n\n\t\topi.add_repo(\n\t\t\tfilename = 'vscode',\n\t\t\tname = 'Visual Studio Code',\n\t\t\turl = 'https://packages.microsoft.com/yumrepos/vscode',\n\t\t\tgpgkey = 'https://packages.microsoft.com/keys/microsoft.asc'\n\t\t)\n\n\t\topi.install_packages([option])\n\t\topi.ask_keep_repo('vscode')\n"
  },
  {
    "path": "opi/plugins/vs_codium.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass VSCodium(BasePlugin):\n\tmain_query = 'vscodium'\n\tdescription = 'Visual Studio Codium'\n\tqueries = ['visualstudiocodium', 'vscodium', 'codium']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install VS Codium from paulcarroty_vscodium repository?'):\n\t\t\treturn\n\n\t\topi.add_repo(\n\t\t\tfilename = 'vscodium',\n\t\t\tname = 'Visual Studio Codium',\n\t\t\turl = 'https://paulcarroty.gitlab.io/vscodium-deb-rpm-repo/rpms',\n\t\t\tgpgkey = 'https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg'\n\t\t)\n\n\t\topi.install_packages(['codium'])\n\t\topi.ask_keep_repo('vscodium')\n"
  },
  {
    "path": "opi/plugins/yandex-browser.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass YandexBrowser(BasePlugin):\n\tmain_query = 'yandex-browser'\n\tdescription = 'Yandex web browser'\n\tqueries = ['yandex-browser-stable', 'yandex-browser-beta', 'yandex-browser']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install yandex-browser from yandex-browser repository?'):\n\t\t\treturn\n\n\t\tprint('Which version do you want to install?')\n\t\toption = opi.ask_for_option(options=[\n\t\t\t'yandex-browser-stable',\n\t\t\t'yandex-browser-beta',\n\t\t])\n\n\t\trelease = option.split('-')[-1]\n\t\tprint('You have chosen', release)\n\n\t\topi.add_repo(\n\t\t\tfilename = option,\n\t\t\tname = option,\n\t\t\turl = f'https://repo.yandex.ru/yandex-browser/rpm/{release}/$basearch/',\n\t\t\tgpgkey = 'https://repo.yandex.ru/yandex-browser/YANDEX-BROWSER-KEY.GPG',\n\t\t\tgpgcheck = False\n\t\t)\n\n\t\topi.install_packages([option])\n\t\topi.ask_keep_repo(option)\n"
  },
  {
    "path": "opi/plugins/yandex-disk.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass YandexDisk(BasePlugin):\n\tmain_query = 'yandex-disk'\n\tdescription = 'Yandex.Disk cloud storage client'\n\tqueries = ['yandex-disk']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install yandex-disk from yandex-disk repository?'):\n\t\t\treturn\n\n\t\topi.add_repo(\n\t\t\tfilename = 'yandex-disk',\n\t\t\tname = 'yandex-disk',\n\t\t\turl = 'https://repo.yandex.ru/yandex-disk/rpm/stable/$basearch/',\n\t\t\tgpgkey = 'https://repo.yandex.ru/yandex-disk/YANDEX-DISK-KEY.GPG',\n\t\t\tgpgcheck = False\n\t\t)\n\n\t\topi.install_packages(['yandex-disk'])\n\t\topi.ask_keep_repo('yandex-disk')\n"
  },
  {
    "path": "opi/plugins/zellij.py",
    "content": "import os\nimport subprocess\nimport opi\nfrom opi.plugins import BasePlugin\nfrom opi import github\nfrom opi import rpmbuild\nfrom opi import http\n\n# VERSION is only set on leap based distros - not tumbleweed, where this package is available via default repos\nif opi.get_version():\n    class Zellij(BasePlugin):\n        main_query = 'zellij'\n        description = 'A terminal workspace with batteries included'\n        queries = [main_query]\n\n        @classmethod\n        def run(cls, query):\n            org = \"zellij-org\"\n            repo = \"zellij\"\n            latest_release = github.get_latest_release(org, repo)\n            if not latest_release:\n                print(f'No release found for {org}/{repo}')\n                return\n            version = latest_release['tag_name'].lstrip('v')\n            if not opi.ask_yes_or_no(f\"Do you want to install {repo} release {version} from {org} github repo?\"):\n                return\n            arch = opi.get_cpu_arch()\n            asset_name = f'zellij-{arch}-unknown-linux-musl.tar.gz'\n            asset = github.get_release_asset(latest_release, filters=[lambda e: e['name'] == asset_name])\n            if not asset:\n                print(f\"No asset found for {org}/{repo} release {version}\")\n                return\n            url = asset['url']\n\n            binary_path = 'usr/bin/zellij'\n\n            rpm = rpmbuild.RPMBuild('zellij', version, cls.description, arch, files=[\n                f\"/{binary_path}\",\n            ])\n\n            bindir_abspath = os.path.join(rpm.buildroot, os.path.dirname(binary_path))\n            binary_abspath = os.path.join(rpm.buildroot, binary_path)\n            tarball_abspath = os.path.join(rpm.tmpdir.name, asset_name)\n\n            http.download_file(url, tarball_abspath)\n            os.makedirs(bindir_abspath, exist_ok=True)\n            subprocess.call(['tar', 'xvf', tarball_abspath, '-C', bindir_abspath, 'zellij'])\n            os.chmod(binary_abspath, 0o755)\n\n            rpm.build()\n            opi.install_packages([rpm.rpmfile_path], allow_unsigned=True)\n"
  },
  {
    "path": "opi/plugins/zoom.py",
    "content": "import opi\nfrom opi.plugins import BasePlugin\n\nclass Zoom(BasePlugin):\n\tmain_query = 'zoom'\n\tdescription = 'Zoom Video Conference'\n\tqueries = ['zoom']\n\n\t@classmethod\n\tdef run(cls, query):\n\t\tif not opi.ask_yes_or_no('Do you want to install Zoom from zoom.us?'):\n\t\t\treturn\n\n\t\tkey_url = 'https://zoom.us/linux/download/pubkey?version=5-12-6'\n\t\topi.ask_import_key(key_url)\n\t\topi.install_packages(['https://zoom.us/client/latest/zoom_openSUSE_x86_64.rpm'])\n\t\topi.ask_keep_key(key_url)\n"
  },
  {
    "path": "opi/rpmbuild.py",
    "content": "import os\nimport tempfile\nimport re\nimport subprocess\nimport glob\nimport shutil\nfrom shutil import which\nfrom opi import install_packages\n\ndef copy(src, dst):\n\t\"\"\"\n\t\tCopy src to dst using hardlinks.\n\t\tdst will be the full final path.\n\t\tDirectories will be created as needed.\n\t\"\"\"\n\tif os.path.islink(src) or os.path.isfile(src):\n\t\tos.makedirs(os.path.dirname(dst), exist_ok=True)\n\tif os.path.islink(src):\n\t\tlink_target = os.readlink(src)\n\t\tos.symlink(link_target, dst)\n\telif os.path.isfile(src):\n\t\tshutil.copy2(src, dst)\n\telse:\n\t\tshutil.copytree(src, dst, copy_function=os.link, symlinks=True, ignore_dangling_symlinks=False)\n\ndef dedent(s):\n\t\"\"\" Other than textwrap's implementation this one has no problems with some lines unindented.\n\t    It will unconditionally strip any leading whitespaces for each line.\n\t\"\"\"\n\treturn re.sub(r\"^\\s*\", \"\", s, flags=re.M)\n\nclass RPMBuild:\n\tdef __init__(self, name, version, description, buildarch=\"noarch\",\n\t             requires=[], recommends=[], provides=[], suggests=[], conflicts=[], autoreq=True,\n\t\t         files=[], dirs=[], config=[]):\n\t\tself.name = name\n\t\tself.version = version\n\t\tself.description = description\n\t\tself.buildarch = buildarch\n\t\tself.requires = requires\n\t\tself.recommends = recommends\n\t\tself.provides = provides\n\t\tself.suggests = suggests\n\t\tself.conflicts = conflicts\n\t\tself.autoreq = autoreq\n\t\tself.files = files\n\t\tself.dirs = dirs\n\t\tself.config = config\n\n\t\tself.tmpdir = tempfile.TemporaryDirectory()\n\n\t\tself.buildroot = os.path.join(self.tmpdir.name, \"buildroot\") # buildroot where plugins copy files to\n\t\tself.spec_path = os.path.join(self.tmpdir.name, \"specfile.spec\")\n\t\tself.rpm_out_dir = os.path.join(self.tmpdir.name, \"rpms\")\n\n\t\tos.mkdir(self.buildroot)\n\t\tos.mkdir(self.rpm_out_dir)\n\n\t\tif not which('rpmbuild'):\n\t\t\tprint(\"Installing requirement: rpm-build\")\n\t\t\tinstall_packages(['rpm-build'], no_recommends=True, non_interactive=True)\n\n\tdef mkspec(self):\n\t\tnl = \"\\n\"\n\t\tspec = dedent(f\"\"\"\n\t\t\tName:      {self.name}\n\t\t\tVersion:   {self.version}\n\t\t\tRelease:   0\n\t\t\tSummary:   {self.description}\n\t\t\tLicense:   n/a\n\t\t\tBuildArch: {self.buildarch}\n\t\t\t{nl.join(f\"Requires: {r}\" for r in self.requires)}\n\t\t\t{nl.join(f\"Recommends: {r}\" for r in self.recommends)}\n\t\t\t{nl.join(f\"Provides: {r}\" for r in self.provides)}\n\t\t\t{nl.join(f\"Suggests: {r}\" for r in self.suggests)}\n\t\t\t{nl.join(f\"Conflicts: {r}\" for r in self.conflicts)}\n\t\t\t{\"AutoReq: no\" if not self.autoreq else ''}\n\n\t\t\t%description\n\t\t\t{self.description}\n\t\t\tBuilt locally using OPI.\n\n\t\t\t%files\n\t\t\t{nl.join(self.files)}\n\t\t\t{nl.join(f\"%dir {d}\" for d in self.dirs)}\n\t\t\t{nl.join(f\"%config {c}\" for c in self.config)}\n\n\t\t\t%changelog\n\t\t\"\"\")\n\t\treturn spec\n\n\tdef add_desktop_file(self, cmd, icon, **kwargs):\n\t\tos.makedirs(os.path.join(self.buildroot, 'usr/share/applications'))\n\t\tdesktop_path = f'usr/share/applications/{self.name}.desktop'\n\t\tdesktop_abspath = os.path.join(self.buildroot, desktop_path)\n\t\tself.files.append(f\"/{desktop_path}\")\n\t\twith open(desktop_abspath, 'w') as f:\n\t\t\tnl = \"\\n\"\n\t\t\tf.write(dedent(f\"\"\"\n\t\t\t\t[Desktop Entry]\n\t\t\t\tName={self.name}\n\t\t\t\tComment={self.description}\n\t\t\t\tExec={cmd}\n\t\t\t\tIcon={icon}\n\t\t\t\tType=Application\n\t\t\t\t{nl.join([\"%s=%s\" % (k, v) for k, v in kwargs.items()])}\n\t\t\t\"\"\"))\n\n\tdef build(self):\n\t\tprint(f\"Creating RPM for {self.name}\")\n\t\twith open(self.spec_path, 'w') as f:\n\t\t\tspec = self.mkspec()\n\t\t\tf.write(spec)\n\t\tsubprocess.check_call([\n\t\t\t\"rpmbuild\", \"-bb\", \"--build-in-place\",\n\t\t\t\"--buildroot\", self.buildroot,\n\t\t\t\"--define\", f\"_rpmdir {self.rpm_out_dir}\",\n\t\t\t\"specfile.spec\"\n\t\t], cwd=self.tmpdir.name)\n\t\trpmfile = glob.glob(f\"{self.rpm_out_dir}/*/*.rpm\")[0]\n\t\tself.rpmfile_path = rpmfile\n\t\treturn rpmfile\n"
  },
  {
    "path": "opi/snap.py",
    "content": "import subprocess\nimport requests\nfrom shutil import which\nfrom opi import install_packages\n\ndef http_get_json(url):\n\tr = requests.get(url, headers={'Snap-Device-Series': '16'})\n\tr.raise_for_status()\n\treturn r.json()\n\ndef get_snap(snap, channel='stable', arch=None):\n\tchannels = http_get_json(f'https://api.snapcraft.io/v2/snaps/info/{snap}')['channel-map']\n\tif arch:\n\t\tarch.replace('x86_64', 'amd64')\n\t\tchannels = [c for c in channels if c['channel']['architecture'] == arch]\n\tchannels = [c for c in channels if c['channel']['name'] == channel]\n\tc = channels[0]\n\treturn {\"version\": c['version'], \"url\": c['download']['url']}\n\ndef extract_snap(snap, target_dir):\n\tif not which('unsquashfs'):\n\t\tprint(\"Installing requirement: squashfs\")\n\t\tinstall_packages(['squashfs'], no_recommends=True, non_interactive=True)\n\tsubprocess.check_call(['unsquashfs', '-d', target_dir, snap])\n"
  },
  {
    "path": "opi/state.py",
    "content": "class GlobalState:\n\tdefault_state = {\n\t\t'arg_non_interactive': False,\n\t\t'arg_verbose_mode': False,\n\t}\n\tstate = {\n\t}\n\n\tdef __setattr__(self, key, value):\n\t\ttype(self).state[key] = value\n\n\tdef __getattr__(self, key):\n\t\treturn type(self).state.get(key, type(self).default_state[key])\n\nglobal_state = GlobalState()\n"
  },
  {
    "path": "opi/version.py",
    "content": "__version__ = '5.12.0'\n"
  },
  {
    "path": "opi.changes",
    "content": "-------------------------------------------------------------------\nFri Mar 13 14:49:59 UTC 2026 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.12.0\n  * Fix plex repo cleanup\n  * plex repo update\n  * Harden the systemd service\n  * fetch openh264 repos via https\n  * get anydesk repo via https\n  * get chrome repos via https\n\n-------------------------------------------------------------------\nFri Feb 13 14:53:11 UTC 2026 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.11.0\n  * Explicitly install libatomic1 required by dotnet\n\n-------------------------------------------------------------------\nMon Jan 19 10:50:51 UTC 2026 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.10.0\n  * Add antigravity (fixes #214)\n\n-------------------------------------------------------------------\nThu Nov 13 15:26:52 UTC 2025 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.9.0\n  * Add onlyoffice\n\n-------------------------------------------------------------------\nTue Oct  7 22:08:09 UTC 2025 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.8.10\n  * Fix handling of None version on Tumbleweed\n\n-------------------------------------------------------------------\nMon Oct  6 08:34:17 UTC 2025 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.8.9\n  * Fix VERSION KeyError in Tumbleweed\n\n-------------------------------------------------------------------\nTue Sep 30 12:08:54 UTC 2025 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.8.8\n  * Fix adding openh264 repo on leap 16.0\n\n-------------------------------------------------------------------\nThu Sep  4 09:23:19 UTC 2025 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.8.7\n  * Fix ocenaudio url\n  * Add LocalSend plugin\n  * Run all tests in verbose mode\n  * Print written repo files in verbose mode\n  * Increase timeouts in test/06_install_non_interactive.py\n  * Remove DNF references from README.md\n\n-------------------------------------------------------------------\nMon Jun  2 10:16:26 UTC 2025 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.8.5\n  * add librewolf plugin (#205)\n  * Install .NET 9\n  * Add verbose mode\n  * Change the order of the process in the github module\n  * Add rustdesk plugin\n\n-------------------------------------------------------------------\nMon May 26 10:40:34 UTC 2025 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.8.4\n  * Use arm64 rpm for libation on aarch64\n\n-------------------------------------------------------------------\nTue Apr 22 11:55:07 UTC 2025 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.8.3\n  * Install dependencies rpm-build and squashfs at runtime if needed\n  * Drop DNF support\n\n-------------------------------------------------------------------\nTue Apr 22 08:08:34 UTC 2025 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.8.2\n  * Warn about adding staging repos\n  * Gracefully handle zypper exit code 106 (repos without cache present)\n\n-------------------------------------------------------------------\nWed Mar 12 11:07:52 UTC 2025 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.8.1\n  * Fix SyntaxWarning: invalid escape sequence '\\s'\n\n-------------------------------------------------------------------\nMon Feb 24 11:39:20 UTC 2025 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.8.0\n  * Add mullvad-brower\n\n-------------------------------------------------------------------\nSun Feb 16 16:13:17 UTC 2025 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.7.0\n  * Add leap-only plugin to install zellij from github release\n  * Don't use subprocess.run user kwarg on 15.6\n  * Fix tests: Use helloworld-opi-tests instead of zfs\n  * Perform search despite locked rpmdb\n  * Simplify backend code\n\n-------------------------------------------------------------------\nThu Jan 23 13:53:06 UTC 2025 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.6.0\n  * Add plugin to install vagrant from hashicorp repo\n\n-------------------------------------------------------------------\nTue Jan 14 15:35:14 UTC 2025 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.5.0\n  * Update opi/plugins/collabora.py\n  * add collabora office desktop\n  * Omit unsupported cli args on leap in 99_install_opi.py\n  * Switch to PEP517 install\n  * Fix 09_install_with_multi_repos_in_single_file_non_interactive.py\n  * Fix 07_install_multiple.py on tumbleweed\n  * Fix test suite on tumbleweed\n  * Update available apps in opi - README.md\n\n-------------------------------------------------------------------\nMon Nov  4 12:13:42 UTC 2024 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.4.0\n  * Show key ID when importing or deleting package signing keys\n  * Add option to install google-chrome-canary\n\n-------------------------------------------------------------------\nFri Oct 25 12:03:28 UTC 2024 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.3.0\n  * Fix tests for new zypper version\n  * fix doblue slash in packman repo url\n  * Add Plugin to install Libation\n\n-------------------------------------------------------------------\nMon Jun 24 09:04:47 UTC 2024 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.2.1\n  * Update freeoffice.py: Install version 2024\n\n-------------------------------------------------------------------\nTue Jun 11 14:12:30 UTC 2024 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.2.0\n  * Add config option to reverse option order\n\n-------------------------------------------------------------------\nFri Jun  7 13:17:38 UTC 2024 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.1.0\n  * Use checkout@v4 for CI\n  * Update issue templates\n  * Increase prio from 90 to 70 for packman/openh264 repos\n\n-------------------------------------------------------------------\nThu Feb  1 09:41:57 UTC 2024 - Dominik Heidler <dheidler@suse.de>\n\n- Version 5.0.0\n  * Allow selecting mirror 1st time when adding packman repo\n  * Add Plugin for SoftMaker Freeoffice\n  * Use new osc service run cmd syntax\n  * Codecs: Install AV1 decoder for mpv\n  * Bump .NET SDK plugin to .NET 8.0\n\n-------------------------------------------------------------------\nTue Jan  2 13:54:28 UTC 2024 - Dominik Heidler <dheidler@suse.de>\n\n- Version 4.4.0\n  * Match repos by alias when searching local repos\n  * Rephrase OSS alternative hints\n  * Fix typo in rpmbuild.py\n\n-------------------------------------------------------------------\nFri Dec 15 18:09:52 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 4.3.0\n  * Hint open source alternatives\n  * Fix issue with installing from existing openh264 repo\n\n-------------------------------------------------------------------\nTue Dec 12 12:40:20 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 4.2.0\n  * Support multiple repos defined in a single .repo file\n  * Automatically import packman key in non-interactive mode\n  * Restructure code: Add classes for Repository, OBSPackage and LocalPackage\n  * Hide package release for pkgs from local repos (same as with OBS pkgs)\n  * Use tumbleweed repo for openh264 on Slowroll\n  * Expand repovar $basearch (to e.g. x86_64 or aarch64)\n\n-------------------------------------------------------------------\nThu Dec  7 10:30:24 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 4.1.0\n  * Add support for Slowroll\n  * Replace $releasever also with ${releasever} syntax\n  * Update changelog prefix to *\n\n-------------------------------------------------------------------\nFri Nov 17 14:05:21 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 4.0.0\n  * Simplify rpmbuild by removing %install\n  * Add opi new dependencies to testsuite: rpm-build, squashfs\n  * Rename rpmbuild internal dirs to uppercase\n  * Fix building RPMs for Leap 15.5\n  * Update opi-proxy .service file to listen on IPv6 as well\n  * Add Snap library and Spotify plugin\n  * Allow installing non-rpm applications (add OrcaSlicer)\n  * chore: update multi_install description\n  * Indent changes in changelog further than version\n\n-------------------------------------------------------------------\nWed Oct 11 10:08:35 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 3.6.0\n- Increase timeouts in testsuite and improve output\n- test: remove yandex-disk from multi-install test\n- Run testsuite for (fake) MicroOS\n- Fix repo URL generation for MicroOS and Leap Micro (fixes #158)\n- Add multi package option\n- Add ocenaudio audio editor (fixes #155)\n- Ignore gpg check for unsigned pkgs (or pkgs without published key)\n\n-------------------------------------------------------------------\nMon Sep 25 13:23:05 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 3.5.0\n- Expand releasever for local repo names\n- Make resilio comment shorter\n- Add option to skip plugins\n- Update repo URL for MEGASync\n\n-------------------------------------------------------------------\nWed Aug 30 13:32:14 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 3.4.0\n- Add unofficial Teams-for-linux client\n- Improve non interactive tests\n- Strip test module name\n- chore: fix indentation\n- docs: add config options, update opi help page\n\n-------------------------------------------------------------------\nFri Jul 28 10:01:21 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 3.3.0\n- Add tests and tweak weighting algorithm for non interactive mode\n- Allow running without user interaction\n- Add config option to disable auto refresh\n\n-------------------------------------------------------------------\nThu Jul 13 09:12:57 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 3.2.0\n- fix: add missing format string marks, remove empty lines\n- Make release.sh more robust\n\n-------------------------------------------------------------------\nTue Jul 11 18:07:59 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 3.1.0\n- Add MapTool RPM tool\n\n-------------------------------------------------------------------\nMon Jun 19 08:56:53 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 3.0.0\n- Use best repo for each project (fixes #113)\n- Use new rpm signing key for zoom (fixes #133)\n- cleanup code\n- Remove MS teams as it is discontinued\n\n-------------------------------------------------------------------\nMon Apr  3 12:49:29 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 2.17.0\n- Codecs: Don't force ffmpeg>=5 on leap 15.5\n- Use new checkout version in ci.yaml\n\n-------------------------------------------------------------------\nMon Apr  3 10:23:42 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 2.16.0\n- dotnet: Install dotnet-sdk-7.0 (#124)\n- Add jami p2p messenger plugin (#121)\n\n-------------------------------------------------------------------\nSat Feb 18 22:42:32 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 2.15.0\n- Fix repo name encoding when asking for new key addition\n\n-------------------------------------------------------------------\nMon Feb 13 16:35:28 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 2.14.0\n- Install openh264 according to arch\n- Use http instead of https for openh264 repo\n\n-------------------------------------------------------------------\nMon Feb 13 10:27:03 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 2.13.0\n- Add openh264 (#119)\n\n-------------------------------------------------------------------\nMon Feb 13 09:41:31 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 2.12.0\n- Enforce ffmpeg>=5 on tumbleweed\n\n-------------------------------------------------------------------\nMon Jan 30 14:41:42 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 2.11.0\n- Handle repos with multiple keys in key file (fixes #118)\n\n-------------------------------------------------------------------\nWed Jan 25 12:57:21 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 2.10.0\n- Ask for submit in release.sh\n- Fix packman plugin for 15.4\n- Introduce repo key handling (bsc#1207334)\n\n-------------------------------------------------------------------\nMon Jan  2 11:27:29 UTC 2023 - Dominik Heidler <dheidler@suse.de>\n\n- Version 2.9.0\n- Install selected package explicitly from the selected repo\n- Switch to resilio-sync for testsuite\n- add resilio-sync\n\n-------------------------------------------------------------------\nTue Aug  9 13:58:57 UTC 2022 - Dominik Heidler <dheidler@suse.de>\n\n- Version 2.8.0\n- add anydesk\n- add yandex browser\n- Use list for plugin queries and check for conflicts\n- Don't show projects with non-matching repo\n\n-------------------------------------------------------------------\nMon Jun 13 09:08:05 UTC 2022 - Dominik Heidler <dheidler@suse.de>\n\n- Version 2.7.0\n- Make repo parsing more stable and improve error handling\n\n-------------------------------------------------------------------\nTue May 31 14:44:14 UTC 2022 - Dominik Heidler <dheidler@suse.de>\n\n- Version 2.6.0\n- Move to global config in /etc/opi.cfg\n- Check if desired repo is already added instead of relying on prefix\n- Add config option use_releasever_var\n\n-------------------------------------------------------------------\nMon May 16 15:07:53 UTC 2022 - Dominik Heidler <dheidler@suse.de>\n\n- Version 2.5.0\n- Run ci for both tumbleweed and leap\n- Use $releasever in repo creation on Leap\n\n-------------------------------------------------------------------\nMon Apr 25 08:54:45 UTC 2022 - Dominik Heidler <dheidler@suse.de>\n\n- Version 2.4.7\n- Fix numbering in --help\n- Add release helper script\n\n-------------------------------------------------------------------\nFri Apr 22 12:43:05 UTC 2022 - Dominik Heidler <dheidler@suse.de>\n\n- Version 2.4.6\n- Update .NET SDK to 6.0\n\n-------------------------------------------------------------------\nTue Mar  1 17:44:14 UTC 2022 - Dominik Heidler <dheidler@suse.de>\n\n- Version 2.4.5\n- Update packman codecs plugin to reflect recent changes\n  that apply to Tumbleweed and releases after 15.4\n  see https://lists.opensuse.org/archives/list/factory@lists.opensuse.org/thread/VMXOWQWC4WW3W6PM7WPZDRMNCV26KKGY/\n\n-------------------------------------------------------------------\nFri Jan 28 11:07:25 UTC 2022 - Dominik Heidler <dheidler@suse.de>\n\n- Version 2.4.4\n- Fix for Alpha/Beta dist versions\n\n-------------------------------------------------------------------\nMon Jan 24 11:23:50 UTC 2022 - Dominik Heidler <dheidler@suse.de>\n\n- Version 2.4.3\n- Fix for tumbleweed based MicroOS\n\n-------------------------------------------------------------------\n\n- Version 2.4.2 - 2021-10-25\n\n## Changed\n\n- Switched to opensuse provided opi proxy\n\n-------------------------------------------------------------------\n\n- Version 2.4.1 - 2021-10-11\n\n## Changed\n\n- Don't expect output to be a tty\n\n-------------------------------------------------------------------\n\n- Version 2.4.0 - 2021-10-11\n\n## Added\n\n- Scroll results if they not fit on the screen\n- Plugin for atom editor\n\n-------------------------------------------------------------------\n\n# Version 2.3.0 - 2021-06-06\n\n### Changed\n\n- Fixed gpgcheck entry in `add_repo()`\n- Allowed using multiple query keywords that are combined using AND\n\n### Added\n\n- Plugin for sublime text\n- Plugin for yandex-disk\n\n-------------------------------------------------------------------\n\n- Version 2.2.0 - 2021-08-20\n\n### Added\n\n- Plugin for MEGA\n- Plugin for Edge Beta\n- Argument parser with option for reverse output order\n\n-------------------------------------------------------------------\n\n- Version 2.1.1 - 2021-08-10\n\n### Added\n\n- Plugin for Brave Browser [#60](https://github.com/openSUSE/opi/pull/60)\n\n-------------------------------------------------------------------\n\n- Version 2.1.0 - 2021-07-05\n\n### Added\n\n- Support for dnf backend [#58](https://github.com/openSUSE/opi/pull/58)\n\n### Changed\n\n- Deduplicated packman repo creation code\n\n-------------------------------------------------------------------\n\n- Version 2.0.0 - 2021-05-03\n\n### Added\n\n- [Automated tests](https://github.com/openSUSE/opi/actions)\n- Extensible Plugin interface for plugins (eg. [this one](https://github.com/openSUSE/opi/blob/master/opi/plugins/vivaldi.py))\n- Added plugins for chrome, dotnet, edge, teams, packman, plex, skype, slack, teamviewer, vivaldi, vscode, vscodium, zoom\n\n### Changed\n\n- Rewrote the complete tool in python3\n\n-------------------------------------------------------------------\n\n- Version 0.10.0 - 2021-01-17\n\n### Added\n\n- Microsoft Teams installer [#34](https://github.com/openSUSE/opi/pulls/34)\n- Warning for personal repository [#35](https://github.com/openSUSE/opi/pulls/35)\n\n-------------------------------------------------------------------\n\n- Version 0.9.0 - 2020-10-03\n\n### Added\n\n- Help (-h, --help) and version (-v, --version) option\n\n### Changed\n\n- Filter out -devel, -docs and -lang packages [#30](https://github.com/openSUSE/opi/pulls/30)\n- Don't show i586 packages on x86_64 system\n\n-------------------------------------------------------------------\n\n- Version 0.8.3 - 2020-07-25\n\n### Fixed\n\n- ffmpeg/libav packages due to Packman update\n\n-------------------------------------------------------------------\n\n- Version 0.8.2 - 2020-05-16\n\n### Fixed\n\n- Ghost process on XML parsing failure [#27](https://github.com/openSUSE/opi/pulls/27)\n\n-------------------------------------------------------------------\n\n- Version 0.8.1 - 2020-04-03\n\n### Fixed\n\n- OBS limit error when searching php, test, etc.\n\n-------------------------------------------------------------------\n\n- Version 0.8.0\n\n### Changed\n\n- Type number `0` to exit [#26](https://github.com/openSUSE/opi/pulls/26)\n\n-------------------------------------------------------------------\n\n- Version 0.7.1\n\n### Fixed\n\n- Missing `use File::Temp;` [#24](https://github.com/openSUSE/opi/issues/24)\n\n-------------------------------------------------------------------\n\n- Version 0.7.0\n\n### Changed\n\n- Force repo URL to HTTPS [#22](https://github.com/openSUSE/opi/issues/22)\n\n### Fixed\n\n- Ctrl + C handling of spinner\n\n-------------------------------------------------------------------\n\n- Version 0.6.0\n\n### Added\n\n- Search spinner [#21](https://github.com/openSUSE/opi/issues/21)\n\n### Fixed\n\n- Packman repo doesn't have *.repo file [#19](https://github.com/openSUSE/opi/issues/19)\n- Long version numbers are cutted [#17](https://github.com/openSUSE/opi/issues/17)\n\n-------------------------------------------------------------------\n\n- Version 0.5.2\n\n### Fixed\n\n- Trim \"NAME\" and \"VERSION\" string [#13](https://github.com/openSUSE/opi/issues/13)\n\n-------------------------------------------------------------------\n\n- Version 0.5.1\n\n### Fixed\n\n- Fix dependency not found issue [#11](https://github.com/openSUSE/opi/issues/11)\n\n-------------------------------------------------------------------\n\n- Version 0.5.0\n\n### Added\n\n- API proxy server to prevent hard-coded passwords in the script [#4](https://github.com/openSUSE/opi/issues/4)\n\n-------------------------------------------------------------------\n\n- Version 0.4.0\n\n### Added\n\n- PMBS (Packman Build Service) support [#5](https://github.com/openSUSE/opi/issues/5)\n\n-------------------------------------------------------------------\n\n- Version 0.3.2\n\n### Fixed\n\n- `opi opi` cannot find `opi` [#9](https://github.com/openSUSE/opi/issues/9)\n\n-------------------------------------------------------------------\n\n- Version 0.3.1\n\n### Fixed\n\n- Remove quotes from version number. So Leap and SLE can search packages.\n\n-------------------------------------------------------------------\n\n- Version 0.3.0\n\n### Added\n\n- Support SLE [#8](https://github.com/openSUSE/opi/issues/8)\n\n### Changed\n\n- Better print column alignment\n\n-------------------------------------------------------------------\n\n- Version 0.2.0\n\n### Added\n\n- Install Packman Codecs with `opi packman` or `opi codecs` [#6](https://github.com/openSUSE/opi/issues/6)\n- Install Skype with `opi skype` [#6](https://github.com/openSUSE/opi/issues/6)\n- Install VS Code with `opi vs code` [#6](https://github.com/openSUSE/opi/issues/6)\n\n-------------------------------------------------------------------\n\n- Version 0.1.2\n\n### Fixed\n\n- Fixed lost of \"noarch\" packages [#3](https://github.com/openSUSE/opi/issues/3)\n- Be able to search with dashes in keywords [#2](https://github.com/openSUSE/opi/issues/2)\n\n-------------------------------------------------------------------\n\n- Version 0.1.1\n\n### Fixed\n\n- Removed XML dump which may cause problems.\n\n-------------------------------------------------------------------\n\n- Version 0.1.0\n\n### Added\n\n- Search packages from OBS\n- List properly sorted search result\n- Use different colors for official, experimental and personal projects\n- Choose package and install\n- Keep or remove repository after installation\n\n[Unreleased]: https://github.com/openSUSE/opi/compare/v0.10.0...HEAD\n[0.10.0]: https://github.com/openSUSE/opi/compare/v0.9.0...v0.10.0\n[0.9.0]: https://github.com/openSUSE/opi/compare/v0.8.3...v0.9.0\n[0.8.3]: https://github.com/openSUSE/opi/compare/v0.8.2...v0.8.3\n[0.8.2]: https://github.com/openSUSE/opi/compare/v0.8.1...v0.8.2\n[0.8.1]: https://github.com/openSUSE/opi/compare/v0.8.0...v0.8.1\n[0.8.0]: https://github.com/openSUSE/opi/compare/v0.7.1...v0.8.0\n[0.7.1]: https://github.com/openSUSE/opi/compare/v0.7.0...v0.7.1\n[0.7.0]: https://github.com/openSUSE/opi/compare/v0.6.0...v0.7.0\n[0.6.0]: https://github.com/openSUSE/opi/compare/v0.5.2...v0.6.0\n[0.5.2]: https://github.com/openSUSE/opi/compare/v0.5.1...v0.5.2\n[0.5.1]: https://github.com/openSUSE/opi/compare/v0.5.0...v0.5.1\n[0.5.0]: https://github.com/openSUSE/opi/compare/v0.4.0...v0.5.0\n[0.4.0]: https://github.com/openSUSE/opi/compare/v0.3.2...v0.4.0\n[0.3.2]: https://github.com/openSUSE/opi/compare/v0.3.1...v0.3.2\n[0.3.1]: https://github.com/openSUSE/opi/compare/v0.3.0...v0.3.1\n[0.3.0]: https://github.com/openSUSE/opi/compare/v0.2.0...v0.3.0\n[0.2.0]: https://github.com/openSUSE/opi/compare/v0.1.2...v0.2.0\n[0.1.2]: https://github.com/openSUSE/opi/compare/v0.1.1...v0.1.2\n[0.1.1]: https://github.com/openSUSE/opi/compare/v0.1.0...v0.1.1\n[0.1.0]: https://github.com/openSUSE/opi/releases/tag/v0.1.0\n"
  },
  {
    "path": "opi.default.cfg",
    "content": "[opi]\nuse_releasever_var = true\nnew_repo_auto_refresh = true\nlist_in_reverse = false\n"
  },
  {
    "path": "org.openSUSE.opi.appdata.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<component type=\"console-application\">\n  <id>org.openSUSE.opi</id>\n  <metadata_license>CC0-1.0</metadata_license>\n  <name>OPI</name>\n  <summary>openSUSE Package Installer</summary>\n  <description>\n    <p>\n      Search and install almost all packages available for openSUSE and SLE:\n    </p>\n    <ol>\n        <li>openSUSE Build Service</li>\n        <li>Packman Build Service</li>\n    </ol>\n  </description>\n  <url type=\"homepage\">https://github.com/openSUSE/opi</url>\n  <url type=\"bugtracker\">https://github.com/openSUSE/opi/issues</url>\n  <url type=\"donation\">https://www.patreon.com/guoyunhe/creators</url>\n  <url type=\"help\">https://github.com/openSUSE/opi</url>\n</component>\n"
  },
  {
    "path": "proxy/.gitignore",
    "content": "vendor\nconfig.php\n"
  },
  {
    "path": "proxy/README.txt",
    "content": "This proxy application is needed as OBS requires\nauthentication for certain API calls.\n"
  },
  {
    "path": "proxy/config.sample.json",
    "content": "{\n\t\"openSUSE\": {\n\t\t\"user\": \"OBS_USERNAME\",\n\t\t\"pass\": \"OBS_PASS\",\n\t\t\"url\": \"https://api.opensuse.org/\"\n\t},\n\t\"Packman\": {\n\t\t\"user\": \"PMBS_USERNAME\",\n\t\t\"pass\": \"PMBS_PASS\",\n\t\t\"url\": \"https://pmbs.links2linux.de/\"\n\t}\n}\n"
  },
  {
    "path": "proxy/dependencies.txt",
    "content": "python3-gunicorn python3-Flask python3-requests python3-gevent\n"
  },
  {
    "path": "proxy/install.sh",
    "content": "#!/bin/bash\n\npython3 setup.py install -f\ncp -v opi-proxy.service /etc/systemd/system/\nsystemctl daemon-reload\ntest -e /etc/opi-proxy.json || cp -v config.sample.json /etc/opi-proxy.json\n"
  },
  {
    "path": "proxy/opi-proxy.service",
    "content": "[Unit]\nDescription=OPI Proxy\nAfter=syslog.target\n\n[Service]\nExecStart=/usr/bin/gunicorn -b [::]:80 opi_proxy:app -k gevent -u nobody -g nogroup --log-syslog\nEnvironment=CONFIG=/etc/opi-proxy.json\nRestart=always\nType=simple\n# Filesystem isolation\nProtectSystem=strict\nProtectHome=yes\nPrivateTmp=yes\n# Device access\nPrivateDevices=yes\nDevicePolicy=closed\n# Syscall filtering\nSystemCallFilter=@system-service\n# Kernel/system protection\nProtectKernelTunables=yes\nProtectKernelModules=yes\nProtectKernelLogs=yes\nProtectControlGroups=yes\nProtectClock=yes\nProtectHostname=yes\nRestrictNamespaces=yes\nRestrictRealtime=yes\nRestrictSUIDSGID=yes\nLockPersonality=yes\nMemoryDenyWriteExecute=yes\n\n[Install]\nWantedBy=multi-user.target\n"
  },
  {
    "path": "proxy/opi_proxy/__init__.py",
    "content": "#!/usr/bin/python3\n\nimport os\nimport json\n\nimport requests\nfrom flask import Flask, request, Response\n\napp = Flask(__name__)\n\nCONFIG_FILE = os.environ.get('CONFIG', 'config.json')\nconfig = json.load(open(CONFIG_FILE))\n\n@app.route('/')\ndef endpoint():\n\tc = config[request.args['obs_instance']]\n\tassert request.args['obs_api_link'].startswith(c['url'])\n\tr = requests.get(request.args['obs_api_link'], auth=(c['user'], c['pass']))\n\tr.raise_for_status()\n\treturn Response(\n\t\tr.text,\n\t\tstatus=r.status_code,\n\t\theaders={\n\t\t\t'Access-Control-Allow-Origin': '*'\n\t\t},\n\t\tmimetype=r.headers.get('content-type', 'text/plain')\n\t)\n\nif __name__ == '__main__':\n\tapp.run(host='0.0.0.0', debug=True)\n"
  },
  {
    "path": "proxy/setup.py",
    "content": "#!/usr/bin/python3\n\nfrom distutils.core import setup\n\nsetup(\n    name='opi_proxy',\n    version='1.0',\n    license='GPLv3',\n    description='Proxy server for communication between OPI and OBS/PMBS',\n    author='Dominik Heidler',\n    author_email='dheidler@suse.de',\n    requires=['requests', 'Flask'],\n    packages=['opi_proxy'],\n)\n"
  },
  {
    "path": "release.sh",
    "content": "#!/bin/bash -ex\n\nversion=$1\nchanges=$(git log $(git describe --tags --abbrev=0)..HEAD --no-merges --format=\"  * %s\")\n\necho \"__version__ = '${version}'\" > opi/version.py\nosc vc -m \"Version ${version}\\n${changes}\" opi.changes\nvi opi.changes\ngit commit opi/version.py opi.changes -m \"Version ${version}\"\ngit tag \"v${version}\"\nread -p \"Push now? \"\ngit push\ngit push --tags\ngh release create \"v${version}\"  --generate-notes\n\nread -p \"Update RPM? \"\ncd ~/devel/obs/utilities/opi\nosc up\nsed -i -e \"s/^\\(Version: *\\)[^ ]*$/\\1${version}/\" opi.spec\nosc vc -m \"Version ${version}\\n${changes}\"\nvi opi.changes\nosc rm --force opi-*.tar.gz\nosc service run\nosc add opi-*.tar.gz\nosc st\nosc diff|bat\n\nread -p \"Submit RPM? \"\nosc ci\nosc sr\n"
  },
  {
    "path": "setup.py",
    "content": "#!/usr/bin/python3\n\nfrom setuptools import setup, find_packages\nimport os\n\n# Load __version__ from opi/version.py\nexec(open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'opi/version.py')).read())\n\nsetup(\n    name='opi',\n    version=__version__,\n    license='GPLv3',\n    description='Tool to Search and install almost all packages available for openSUSE and SLE',\n    long_description=open('README.md').read(),\n    long_description_content_type='text/markdown',\n    author='Guo Yunhe, Dominik Heidler, KaratekHD',\n    author_email='i@guoyunhe.me, dheidler@suse.de, karatek@karatek.net',\n    install_requires=['lxml', 'requests', 'termcolor', 'curses'],\n    packages=['opi', 'opi.plugins', 'opi.config'],\n    scripts=['bin/opi'],\n)\n"
  },
  {
    "path": "test/01_install_from_packman.py",
    "content": "#!/usr/bin/python3\n\nimport sys\nimport pexpect\nimport subprocess\nimport time\n\nc = pexpect.spawn('./bin/opi -v x265', logfile=sys.stdout.buffer, echo=False)\n\nc.expect('1. x265\\r\\n')\nc.sendline('q')\nc.expect('Pick a number')\nc.sendline('1')\n\nc.expect('1. .*Packman Essentials', timeout=10)\nc.sendline('1')\n\nc.expect('Pick a mirror near your location', timeout=10)\nc.sendline('2')\n\nc.expect('Import package signing key', timeout=10)\nc.sendline('y')\n\nc.expect('Package install size change', timeout=60)\nc.expect('Continue', timeout=60)\ntime.sleep(3)\nc.sendline('y')\nc.interact()\nc.wait()\nc.close()\nassert c.exitstatus == 0, f'Exit code: {c.exitstatus}'\n\nsubprocess.check_call(['rpm', '-qi', 'x265'])\n"
  },
  {
    "path": "test/02_install_from_home.py",
    "content": "#!/usr/bin/python3\n\nimport sys\nimport pexpect\nimport subprocess\n\nc = pexpect.spawn('./bin/opi -v rtl8812au', logfile=sys.stdout.buffer, echo=False)\n\nc.expect('1. rtl8812au\\r\\n')\nc.sendline('q')\nc.expect('Pick a number')\nc.sendline('1')\n\nc.expect(r'([0-9]+)\\. [^ ]*hardware', timeout=10)\nhwentryid = c.match.groups()[0]\nprint(f'PEXPECT: Found hardware entry id {hwentryid!r}')\nc.sendline(hwentryid)\n\nc.expect('Import package signing key', timeout=10)\nc.sendline('y')\n\nc.expect('new packages? to install', timeout=60)\nc.expect('Continue', timeout=60)\nc.sendline('y')\n\nc.expect('Do you want to keep the repo', timeout=350)\nc.sendline('n')\n\nc.expect('Keep package signing key', timeout=10)\nc.sendline('n')\n\nc.interact()\nc.wait()\nc.close()\nassert c.exitstatus == 0, f'Exit code: {c.exitstatus}'\n\nsubprocess.check_call(['rpm', '-qi', 'rtl8812au'])\nsubprocess.check_call('! zypper lr -u | grep hardware', shell=True)\nsubprocess.check_call('! rpm -q gpg-pubkey --qf \"%{NAME}-%{VERSION}\\t%{PACKAGER}\\n\" | grep hardware', shell=True)\n"
  },
  {
    "path": "test/03_install_using_plugin.py",
    "content": "#!/usr/bin/python3\n\nimport sys\nimport pexpect\nimport subprocess\n\nc = pexpect.spawn('./bin/opi -v resilio-sync', logfile=sys.stdout.buffer, echo=False)\n\nc.expect('Do you want to install')\nc.sendline('y')\n\nc.expect('Import package signing key', timeout=10)\nc.sendline('y')\n\nc.expect('Continue')\nc.sendline('y')\n\nc.expect('Do you want to keep', timeout=500)\nc.sendline('y')\n\nc.interact()\nc.wait()\nc.close()\nassert c.exitstatus == 0, f'Exit code: {c.exitstatus}'\n\nsubprocess.check_call(['rpm', '-qi', 'resilio-sync'])\nsubprocess.check_call('zypper lr | grep resilio-sync', shell=True)\n"
  },
  {
    "path": "test/04_check_plugins.py",
    "content": "#!/usr/bin/python3\n\nimport os\nimport sys\nsys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + '/..'))\n\nfrom opi.plugins import PluginManager\n\npm = PluginManager()\n\nfor plugin in pm.plugins:\n\tprint('Checking plugin:', plugin)\n\tassert plugin.main_query != ''\n\tassert plugin.description != ''\n\tassert isinstance(plugin.queries, list)\n\tassert plugin.main_query in plugin.queries, 'Plugin main query must be in queries list'\n\tfor other_plugin in pm.plugins:\n\t\tif plugin == other_plugin:\n\t\t\tcontinue\n\t\tcommon_queries = set(plugin.queries) & set(other_plugin.queries)\n\t\tassert not common_queries, f'Conflict in queries between {plugin} and {other_plugin}: Both have {common_queries}'\n"
  },
  {
    "path": "test/05_install_from_local_repo.py",
    "content": "#!/usr/bin/python3\n\nimport sys\nimport pexpect\n\nc = pexpect.spawn('./bin/opi -v htop', logfile=sys.stdout.buffer, echo=False)\n\nc.expect(r'([0-9]+)\\. htop', timeout=10)\nentry_id = c.match.groups()[0]\nprint(f'PEXPECT: Found entry id {entry_id!r}')\nc.expect('Pick a number')\nc.sendline(entry_id)\n\nc.expect(r'([0-9]+)\\. [^ ]*(openSUSE-Tumbleweed-Oss|Main Repository)', timeout=10)\nentry_id = c.match.groups()[0]\nprint(f'PEXPECT: Found entry id {entry_id!r}')\nc.sendline(entry_id)\n\nc.expect('Installing from existing repo', timeout=10)\nc.expect('Continue?', timeout=10)\nc.sendline('n')\n\nc.interact()\nc.wait()\nc.close()\nprint()\nassert c.exitstatus == 0, f'Exit code: {c.exitstatus}'\n"
  },
  {
    "path": "test/06_install_non_interactive.py",
    "content": "#!/usr/bin/python3\n\nimport sys\nimport pexpect\nimport subprocess\n\nc = pexpect.spawn('./bin/opi -v -n bottom', logfile=sys.stdout.buffer, echo=False)\n\nc.expect(r'([0-9]+)\\. bottom', timeout=20)\nc.expect('Pick a number')\nc.expect(r'([0-9]+)\\. [^ ]*(openSUSE-Tumbleweed-Oss|Main Repository)', timeout=20)\nc.expect('Installing from existing repo', timeout=20)\nc.expect('Continue?', timeout=60)\nc.interact()\nc.wait()\nc.close()\nprint()\nassert c.exitstatus == 0, f'Exit code: {c.exitstatus}'\nsubprocess.check_call(['rpm', '-qi', 'bottom'])\n\n\nc = pexpect.spawn('./bin/opi -v -n helloworld-opi-tests', logfile=sys.stdout.buffer, echo=False)\n\nc.expect(r'([0-9]+)\\. helloworld-opi-tests', timeout=20)\nc.expect('Pick a number')\nc.expect(r'([0-9]+)\\. [^ ]*(home:dheidler:opitests)', timeout=20)\nc.expect('Adding repo \\'home:dheidler:opitests\\'', timeout=20)\nc.expect('Continue?', timeout=60)\nc.interact()\nc.wait()\nc.close()\nprint()\nassert c.exitstatus == 0, f'Exit code: {c.exitstatus}'\nsubprocess.check_call(['rpm', '-qi', 'helloworld-opi-tests'])\n"
  },
  {
    "path": "test/07_install_multiple.py",
    "content": "#!/usr/bin/python3\n\nimport sys\nimport pexpect\nimport subprocess\n\nc = pexpect.spawn('./bin/opi -v -nm helloworld-opi-tests resilio-sync tmux', logfile=sys.stdout.buffer, echo=False)\n\n# plugins are installed first\nc.expect('Do you want to install')\nc.expect('Import package signing key', timeout=10)\nc.expect('Continue')\nc.expect('Do you want to keep', timeout=500)\n\n# packages come after plugins\nc.expect(r'([0-9]+)\\. helloworld-opi-tests', timeout=10)\nc.expect('Pick a number')\nc.expect(r'([0-9]+)\\. [^ ]*(home:dheidler:opitests)', timeout=10)\nc.expect('Adding repo \\'home:dheidler:opitests\\'', timeout=10)\nc.expect('Continue?', timeout=60)\n\nc.expect(r'([0-9]+)\\. tmux', timeout=60)\nc.expect('Pick a number')\nc.expect(r'([0-9]+)\\. [^ ]*(openSUSE-Tumbleweed-Oss|Main Repository)', timeout=10)\nc.expect('Installing from existing repo', timeout=10)\nc.expect('Continue?', timeout=60)\n\nc.interact()\nc.wait()\nc.close()\nprint()\nassert c.exitstatus == 0, f'Exit code: {c.exitstatus}'\nsubprocess.check_call(['rpm', '-qi', 'resilio-sync'])\nsubprocess.check_call(['rpm', '-qi', 'helloworld-opi-tests'])\nsubprocess.check_call(['rpm', '-qi', 'tmux'])\n"
  },
  {
    "path": "test/08_install_from_packman_non_interactive.py",
    "content": "#!/usr/bin/python3\n\nimport sys\nimport pexpect\nimport subprocess\n\nc = pexpect.spawn('./bin/opi -v -n x265', logfile=sys.stdout.buffer, echo=False)\n\nc.expect('1. x265\\r\\n')\nc.expect('Pick a number')\n\nc.expect('1. .*Packman Essentials', timeout=10)\n\nc.expect('Package install size change', timeout=60)\nc.interact()\nc.wait()\nc.close()\nassert c.exitstatus == 0, f'Exit code: {c.exitstatus}'\n\nsubprocess.check_call(['rpm', '-qi', 'x265'])\n"
  },
  {
    "path": "test/09_install_with_multi_repos_in_single_file_non_interactive.py",
    "content": "#!/usr/bin/python3\n\nimport sys\nimport pexpect\nimport subprocess\n\nsubprocess.check_call(\"cat /etc/zypp/repos.d/*.repo > /tmp/singlefile.repo\", shell=True)\nsubprocess.check_call(\"rm -v /etc/zypp/repos.d/*.repo\", shell=True)\nsubprocess.check_call(\"mv -v /tmp/singlefile.repo /etc/zypp/repos.d/\", shell=True)\n\nc = pexpect.spawn('./bin/opi -v -n tmux', logfile=sys.stdout.buffer, echo=False)\n\nc.expect(r'([0-9]+)\\. tmux', timeout=10)\nc.expect('Pick a number')\nc.expect(r'([0-9]+)\\. [^ ]*(openSUSE-Tumbleweed-Oss|Main Repository)', timeout=10)\nc.expect('Installing from existing repo', timeout=10)\nc.expect('Continue?', timeout=60)\nc.interact()\nc.wait()\nc.close()\nprint()\nassert c.exitstatus == 0, f'Exit code: {c.exitstatus}'\nsubprocess.check_call(['rpm', '-qi', 'tmux'])\n\n\nc = pexpect.spawn('./bin/opi -v -n helloworld-opi-tests', logfile=sys.stdout.buffer, echo=False)\n\nc.expect(r'([0-9]+)\\. helloworld-opi-tests', timeout=10)\nc.expect('Pick a number')\nc.expect(r'([0-9]+)\\. [^ ]*(home:dheidler:opitests)', timeout=10)\nc.expect('Adding repo \\'home:dheidler:opitests\\'', timeout=10)\nc.expect('Continue?', timeout=60)\nc.interact()\nc.wait()\nc.close()\nprint()\nassert c.exitstatus == 0, f'Exit code: {c.exitstatus}'\nsubprocess.check_call(['rpm', '-qi', 'helloworld-opi-tests'])\n"
  },
  {
    "path": "test/99_install_opi.py",
    "content": "#!/usr/bin/python3\n\nimport subprocess\n\ndef run(cmd, **kwargs):\n    print('% ' + (' '.join(cmd) if isinstance(cmd, list) else cmd))\n    subprocess.check_call(cmd, **kwargs)\n\nversion = subprocess.check_output(['python3', 'setup.py', '--version']).decode().strip()\nrun(['python3', '-mpip', 'wheel', '--verbose', '--progress-bar', 'off', '--disable-pip-version-check', '--use-pep517', '--no-build-isolation', '--no-deps', '--wheel-dir', './build', '.'])\ncmd = ['python3', '-mpip', 'install', '--root-user-action=ignore', '--break-system-packages', '--verbose', '--progress-bar', 'off', '--disable-pip-version-check', '--no-compile', '--ignore-installed', '--no-deps', '--no-index', '--find-links', './build', f\"opi=={version}\"]\nif subprocess.run('grep \"openSUSE Leap\" /etc/os-release', shell=True).returncode == 0:\n    cmd.remove('--root-user-action=ignore')\n    cmd.remove('--break-system-packages')\nrun(cmd)\nrun(f'opi --version | grep {version}', shell=True)\nrun('opi --help | grep --color -A1000 -B1000 Microsoft', shell=True)\n"
  },
  {
    "path": "test/run.sh",
    "content": "#!/bin/bash\n\necho \"$(tput bold)$(tput setaf 6)===== Running test: $1 =====$(tput sgr0)\"\n\ncd /opi/\n./test/$1\nresult=$?\n\necho \"$(tput bold)$(tput setaf 6)===== Finished test: $1 =====$(tput sgr0)\"\n\nif [[ \"$result\" == \"0\" ]] ; then\n\techo \"$(tput bold)$(tput setaf 2)>>>>> PASSED <<<<<$(tput sgr0)\"\nelse\n\techo \"$(tput bold)$(tput setaf 1)!!!!! FAILED !!!!!$(tput sgr0)\"\nfi\n\nexit $result\n"
  },
  {
    "path": "test/run_all.sh",
    "content": "#!/bin/bash\n\ntest_dir=\"$(dirname \"$(pwd)/$0\")\"\ncd \"$test_dir\"\n\n\nfailed_tests=0\ntotal_tests=0\n\nfor t in *.py ; do\n\tlet total_tests++\n\tif ! sudo ./run_container_test.sh \"$t\" \"$1\" ; then\n\t\tlet failed_tests++\n\tfi\ndone\n\nif [[ \"$failed_tests\" != \"0\" ]] ; then\n\techo \"$(tput bold)$(tput setaf 1)Error: ${failed_tests} out of ${total_tests} failed!$(tput sgr0)\"\n\texit 1\nelse\n\techo \"$(tput bold)$(tput setaf 2)All ${total_tests} tests succedeed!$(tput sgr0)\"\nfi\n"
  },
  {
    "path": "test/run_container_test.sh",
    "content": "#!/bin/bash -x\n\nbase_image=\"${2:-opensuse/tumbleweed}\"\nopi_base_image=\"opi_base_${base_image/\\//_}\"\n\nif [[ \"$2\" == \"opensuse/microos\" ]] ; then\n\tbase_image=\"opensuse/tumbleweed\"\n\topi_base_image=\"opi_base_opensuse_microos\"\nfi\n\n# prepare container image\nif ! podman image exists $opi_base_image ; then\n\techo \"Preparing container\"\n\tpodman run -td --dns=1.1.1.1 --name=opi_base $base_image\n\tpodman exec -it opi_base zypper -n ref\n\n\tif [[ \"$2\" == \"opensuse/microos\" ]] ; then\n\t\t# fake MicroOS\n\t\tpodman exec -it opi_base zypper -n install --force-resolution MicroOS-release\n\tfi\n\n\t# opi dependencies\n\tpodman exec -it opi_base zypper -n install sudo python3 python3-requests python3-lxml python3-termcolor python3-curses python3-rpm curl python3-pip python3-setuptools python3-wheel\n\n\t# test dependencies\n\tpodman exec -it opi_base zypper -n install python3-pexpect shadow\n\n\tpodman commit opi_base $opi_base_image\n\tpodman kill opi_base\n\tpodman rm opi_base\nfi\n\n\n\nopi_dir=\"$(dirname $(pwd)/$0)/../\"\ntest_module=$(basename $1)\npodman run -ti --rm --volume \"${opi_dir}:/opi/\" $opi_base_image /opi/test/run.sh $test_module\nexit $?\n"
  }
]