Skip to content

Commit

Permalink
0.9.27
Browse files Browse the repository at this point in the history
  • Loading branch information
vinifmor authored Feb 11, 2022
2 parents c4be425 + fb55a1f commit edd2b8c
Show file tree
Hide file tree
Showing 11 changed files with 244 additions and 139 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ dist
*.egg-info
build
*.db
linux_dist/appimage/AppDir
linux_dist/appimage/appimage-builder-cache
linux_dist/appimage/*.zsync
linux_dist/appimage/*.AppImage
linux_dist/appimage/*.gz
linux_dist/appimage/bauh-*

25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,31 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [0.9.27] 2022-02-11

### Improvements
- Arch:
- preventing AUR's installed packages from not being mapped in cases the communication with the API fails
- code refactoring (String formatting method)

- Setup
- able to install bauh with python/pip without enforcing requirements through the environment variable `BAUH_SETUP_NO_REQS=1`

- Distribution
- AppImage: -~32% size reduction (141.93 MB -> 96.32 MB)


### Fixes
- Arch
- silent crash when handling and displaying transaction sub-status
- AUR: not detecting installed packages anymore due to recent AUR API changes
- installation fails when several dependent packages conflict with the installed ones
- removing a duplicate call to checking for AUR updates

- AppImage
- search: displaying duplicate installed apps for some cases


## [0.9.26] 2022-01-31

### Improvements
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Key features
## Index
1. [Installation](#installation)
- [AppImage](#inst_appimage)
- [Ubuntu-based distros (20.04)](#inst_ubuntu)
- [Ubuntu 20.04 based distros (Linux Mint, PopOS, ...)](#inst_ubuntu)
- [Arch-based distros](#inst_arch)
2. [Isolated installation](#inst_iso)
3. [Desktop entry / menu shortcut](#desk_entry)
Expand Down Expand Up @@ -56,7 +56,7 @@ Key features
- Run the following command through a terminal: `chmod a+x bauh-${version}-x86_64.AppImage` (replace `${version}` by the respective downloaded version)
- Launch it: `./bauh-${version}-x86_64.AppImage`

#### <a name="inst_ubuntu">Ubuntu-based distros (20.04)</a>
#### <a name="inst_ubuntu">Ubuntu 20.04 based distros (Linux Mint, PopOS, ...)</a>

##### Required dependencies

Expand All @@ -66,6 +66,7 @@ Key features

`sudo pip3 install bauh`


##### Optional dependencies (they should be installed with apt-get/apt)

- `timeshift`: system backup
Expand Down
2 changes: 1 addition & 1 deletion bauh/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.9.26'
__version__ = '0.9.27'
__app_name__ = 'bauh'

import os
Expand Down
2 changes: 1 addition & 1 deletion bauh/gems/appimage/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def search(self, words: str, disk_loader: DiskCacheLoader, limit: int = -1, is_u
installed_found.append(appim)
found = True

if not found and lower_words in appim.name.lower() or (appim.description and lower_words in appim.description.lower()):
if not found and (lower_words in appim.name.lower() or (appim.description and lower_words in appim.description.lower())):
installed_found.append(appim)
try:
apps_conn.close()
Expand Down
79 changes: 50 additions & 29 deletions bauh/gems/arch/aur.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,30 @@ def __init__(self, http_client: HttpClient, logger: logging.Logger, x86_64: bool
def search(self, words: str) -> dict:
return self.http_client.get_json(URL_SEARCH + words)

def get_info(self, names: Iterable[str]) -> List[dict]:
try:
res = self.http_client.get_json(URL_INFO + self._map_names_as_queries(names))
return res['results'] if res and res.get('results') else []
except:
return []
def get_info(self, names: Iterable[str]) -> Optional[List[dict]]:
if names:
try:
res = self.http_client.get_json(URL_INFO + self._map_names_as_queries(names))
except requests.exceptions.ConnectionError:
self.logger.warning('Could not retrieve installed AUR packages API data. It seems the internet connection is off.')
return

if res is None:
self.logger.warning("Call to AUR API's info endpoint has failed")
return

error = res.get('error')

if error:
self.logger.warning(f"AUR API's info endpoint returned an unexpected error: {error}")
return

results = res.get('results')

if results is not None:
return results

self.logger.warning(f"AUR API's info endpoint returned an unexpected response: {res}")

def map_provided(self, pkgname: str, pkgver: str, provided: Optional[Iterable[str]] = None, strip_epoch: bool = True) -> Set[str]:
all_provided = {pkgname, f"{pkgname}={pkgver.split('-')[0] if strip_epoch else pkgver}"}
Expand All @@ -130,31 +148,34 @@ def map_provided(self, pkgname: str, pkgver: str, provided: Optional[Iterable[st
return all_provided

def gen_updates_data(self, names: Iterable[str]) -> Generator[Tuple[str, dict], None, None]:
for package in self.get_info(names):
pkgname, pkgver = package['Name'], package['Version'].split('-')[0]
pkgs_info = self.get_info(names)

if pkgs_info:
for package in pkgs_info:
pkgname, pkgver = package['Name'], package['Version'].split('-')[0]

deps = set()
deps = set()

for dtype in ('Depends', 'MakeDepends', 'CheckDepends'):
dep_set = package.get(dtype)
if dep_set:
deps.update(dep_set)
for dtype in ('Depends', 'MakeDepends', 'CheckDepends'):
dep_set = package.get(dtype)
if dep_set:
deps.update(dep_set)

conflicts = set()
pkg_conflicts = package.get('Conflicts')
conflicts = set()
pkg_conflicts = package.get('Conflicts')

if pkg_conflicts:
conflicts.update(pkg_conflicts)
if pkg_conflicts:
conflicts.update(pkg_conflicts)

yield pkgname, {
'v': pkgver,
'b': package.get('PackageBase', pkgname),
'r': 'aur',
'p': self.map_provided(pkgname=pkgname, pkgver=pkgver, provided=package.get('Provides'), strip_epoch=False),
'd': deps,
'c': conflicts,
'ds': None,
's': None}
yield pkgname, {
'v': pkgver,
'b': package.get('PackageBase', pkgname),
'r': 'aur',
'p': self.map_provided(pkgname=pkgname, pkgver=pkgver, provided=package.get('Provides'), strip_epoch=False),
'd': deps,
'c': conflicts,
'ds': None,
's': None}

def get_src_info(self, name: str, real_name: Optional[str] = None) -> dict:
srcinfo = self.srcinfo_cache.get(name)
Expand All @@ -175,7 +196,7 @@ def get_src_info(self, name: str, real_name: Optional[str] = None) -> dict:
self.logger.warning('No .SRCINFO found for {}'.format(name))
self.logger.info('Checking if {} is based on another package'.format(name))
# if was not found, it may be based on another package.
infos = self.get_info({name})
infos = self.get_info((name,))

if infos:
info = infos[0]
Expand Down Expand Up @@ -214,8 +235,8 @@ def get_required_dependencies(self, name: str) -> Set[str]:

return self.extract_required_dependencies(info)

def _map_names_as_queries(self, names) -> str:
return '&'.join(['arg[{}]={}'.format(i, urllib.parse.quote(n)) for i, n in enumerate(names)])
def _map_names_as_queries(self, names: Iterable[str]) -> str:
return '&'.join((f'arg[]={urllib.parse.quote(n)}' for n in names))

def read_local_index(self) -> dict:
self.logger.info('Checking if the cached AUR index file exists')
Expand Down
Loading

0 comments on commit edd2b8c

Please sign in to comment.