mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-15 06:55:48 +00:00
add possibility to run full update
In case if packages are not set from web, the spawner will run full repository update
This commit is contained in:
@ -86,10 +86,12 @@ class Spawn(Thread, LazyLogging):
|
||||
packages(Iterable[str]): packages list to add
|
||||
now(bool): build packages now
|
||||
"""
|
||||
if not packages:
|
||||
return self.spawn_process("repo-update")
|
||||
kwargs = {"source": PackageSource.AUR.value} # avoid abusing by building non-aur packages
|
||||
if now:
|
||||
kwargs["now"] = ""
|
||||
self.spawn_process("add", *packages, **kwargs)
|
||||
return self.spawn_process("package-add", *packages, **kwargs)
|
||||
|
||||
def packages_remove(self, packages: Iterable[str]) -> None:
|
||||
"""
|
||||
@ -98,7 +100,7 @@ class Spawn(Thread, LazyLogging):
|
||||
Args:
|
||||
packages(Iterable[str]): packages list to remove
|
||||
"""
|
||||
self.spawn_process("remove", *packages)
|
||||
self.spawn_process("package-remove", *packages)
|
||||
|
||||
def spawn_process(self, command: str, *args: str, **kwargs: str) -> None:
|
||||
"""
|
||||
|
@ -17,7 +17,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import HTTPBadRequest, HTTPFound
|
||||
from aiohttp.web import HTTPFound
|
||||
|
||||
from ahriman.models.user_access import UserAccess
|
||||
from ahriman.web.views.base import BaseView
|
||||
@ -47,11 +47,8 @@ class AddView(BaseView):
|
||||
HTTPBadRequest: if bad data is supplied
|
||||
HTTPFound: in case of success response
|
||||
"""
|
||||
try:
|
||||
data = await self.extract_data(["packages"])
|
||||
packages = data["packages"]
|
||||
except Exception as e:
|
||||
raise HTTPBadRequest(reason=str(e))
|
||||
data = await self.extract_data(["packages"])
|
||||
packages = data.get("packages", [])
|
||||
|
||||
self.spawner.packages_add(packages, now=True)
|
||||
|
||||
|
Reference in New Issue
Block a user