Source code for meta_package_manager.managers.opkg
# Copyright Kevin Deldycke <kevin@deldycke.com> and contributors.## This program is Free Software; you can redistribute it and/or# modify it under the terms of the GNU General Public License# as published by the Free Software Foundation; either version 2# of the License, or (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.from__future__importannotationsimportrefromtypingimportIteratorfromextra_platformsimportUNIX_WITHOUT_MACOSfrommeta_package_manager.baseimportPackage,PackageManagerfrommeta_package_manager.capabilitiesimport(search_capabilities,version_not_implemented,)
[docs]@search_capabilities(extended_support=False,exact_support=False)defsearch(self,query:str,extended:bool,exact:bool)->Iterator[Package]:"""Fetch matching packages. .. warning:: There is no search command so we simulate it by listing all packages. .. caution:: Search does not support extended or exact matching. So we returns the best subset of results and let :py:meth:`meta_package_manager.base.PackageManager.refiltered_search` refine them. .. code-block:: shell-session ► opkg list """output=self.run_cli("list")regexp=re.compile(r""" (?P<package_id>\S+) \ -\ (?P<version>\S+) \ -\ (?P<description>.+) """,re.VERBOSE|re.MULTILINE,)forpackage_id,version,descriptioninregexp.findall(output):yieldself.package(id=package_id,description=description,latest_version=version,)
[docs]defupgrade_all_cli(self)->tuple[str,...]:"""Generates the CLI to upgrade all packages (default) or only the one provided as parameter. .. code-block:: shell-session ► opkg upgrade """returnself.build_cli("upgrade")
@version_not_implementeddefupgrade_one_cli(self,package_id:str,version:str|None=None,)->tuple[str,...]:"""Generates the CLI to upgrade all packages (default) or only the one provided as parameter. .. code-block:: shell-session ► opkg upgrade enigma2-hotplug """returnself.build_cli("upgrade",package_id)