mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-29 01:37:17 +00:00
Compare commits
4 Commits
e58ccdc8ad
...
233dda8420
Author | SHA1 | Date | |
---|---|---|---|
233dda8420 | |||
9556779ee2 | |||
8b32bd43db | |||
0eadef597a |
338
docs/ahriman.1
338
docs/ahriman.1
@ -1,9 +1,9 @@
|
|||||||
.TH AHRIMAN "1" Manual
|
.TH AHRIMAN "1" "2022\-11\-10" "ahriman" "Generated Python Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
ahriman
|
ahriman
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B ahriman
|
.B ahriman
|
||||||
[-h] [-a ARCHITECTURE] [-c CONFIGURATION] [--force] [-l LOCK] [--no-report] [-q] [--unsafe] [-V] {aur-search,search,daemon,help,help-commands-unsafe,key-import,package-add,add,package-update,package-remove,remove,package-status,status,package-status-remove,package-status-update,status-update,patch-add,patch-list,patch-remove,patch-set-add,repo-backup,repo-check,check,repo-clean,clean,repo-config,config,repo-rebuild,rebuild,repo-remove-unknown,remove-unknown,repo-report,report,repo-restore,repo-setup,init,repo-init,setup,repo-sign,sign,repo-status-update,repo-sync,sync,repo-triggers,repo-update,update,shell,user-add,user-list,user-remove,version,web} ...
|
[-h] [-a ARCHITECTURE] [-c CONFIGURATION] [--force] [-l LOCK] [--report | --no-report] [-q] [--unsafe] [-V] {aur-search,search,daemon,help,help-commands-unsafe,key-import,package-add,add,package-update,package-remove,remove,package-status,status,package-status-remove,package-status-update,status-update,patch-add,patch-list,patch-remove,patch-set-add,repo-backup,repo-check,check,repo-clean,clean,repo-config,config,repo-rebuild,rebuild,repo-remove-unknown,remove-unknown,repo-report,report,repo-restore,repo-setup,init,repo-init,setup,repo-sign,sign,repo-status-update,repo-sync,sync,repo-triggers,repo-update,update,shell,user-add,user-list,user-remove,version,web} ...
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
ArcH linux ReposItory MANager
|
ArcH linux ReposItory MANager
|
||||||
|
|
||||||
@ -25,8 +25,8 @@ force run, remove file lock
|
|||||||
lock file
|
lock file
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-no\-report\fR
|
\fB\-\-report\fR, \fB\-\-no\-report\fR
|
||||||
force disable reporting to web service
|
force enable or disable reporting to web service (default: True)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-q\fR, \fB\-\-quiet\fR
|
\fB\-q\fR, \fB\-\-quiet\fR
|
||||||
@ -43,7 +43,7 @@ show program's version number and exit
|
|||||||
.SH
|
.SH
|
||||||
COMMAND
|
COMMAND
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,aur-search\/\fR
|
\fBahriman\fR \fI\,aur\-search\/\fR
|
||||||
search for package
|
search for package
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,daemon\/\fR
|
\fBahriman\fR \fI\,daemon\/\fR
|
||||||
@ -52,91 +52,91 @@ run application as daemon
|
|||||||
\fBahriman\fR \fI\,help\/\fR
|
\fBahriman\fR \fI\,help\/\fR
|
||||||
show help message
|
show help message
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,help-commands-unsafe\/\fR
|
\fBahriman\fR \fI\,help\-commands\-unsafe\/\fR
|
||||||
list unsafe commands
|
list unsafe commands
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,key-import\/\fR
|
\fBahriman\fR \fI\,key\-import\/\fR
|
||||||
import PGP key
|
import PGP key
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,package-add\/\fR
|
\fBahriman\fR \fI\,package\-add\/\fR
|
||||||
add package
|
add package
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,package-remove\/\fR
|
\fBahriman\fR \fI\,package\-remove\/\fR
|
||||||
remove package
|
remove package
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,package-status\/\fR
|
\fBahriman\fR \fI\,package\-status\/\fR
|
||||||
get package status
|
get package status
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,package-status-remove\/\fR
|
\fBahriman\fR \fI\,package\-status\-remove\/\fR
|
||||||
remove package status
|
remove package status
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,package-status-update\/\fR
|
\fBahriman\fR \fI\,package\-status\-update\/\fR
|
||||||
update package status
|
update package status
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,patch-add\/\fR
|
\fBahriman\fR \fI\,patch\-add\/\fR
|
||||||
add patch for PKGBUILD function
|
add patch for PKGBUILD function
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,patch-list\/\fR
|
\fBahriman\fR \fI\,patch\-list\/\fR
|
||||||
list patch sets
|
list patch sets
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,patch-remove\/\fR
|
\fBahriman\fR \fI\,patch\-remove\/\fR
|
||||||
remove patch set
|
remove patch set
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,patch-set-add\/\fR
|
\fBahriman\fR \fI\,patch\-set\-add\/\fR
|
||||||
add patch set
|
add patch set
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,repo-backup\/\fR
|
\fBahriman\fR \fI\,repo\-backup\/\fR
|
||||||
backup repository data
|
backup repository data
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,repo-check\/\fR
|
\fBahriman\fR \fI\,repo\-check\/\fR
|
||||||
check for updates
|
check for updates
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,repo-clean\/\fR
|
\fBahriman\fR \fI\,repo\-clean\/\fR
|
||||||
clean local caches
|
clean local caches
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,repo-config\/\fR
|
\fBahriman\fR \fI\,repo\-config\/\fR
|
||||||
dump configuration
|
dump configuration
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,repo-rebuild\/\fR
|
\fBahriman\fR \fI\,repo\-rebuild\/\fR
|
||||||
rebuild repository
|
rebuild repository
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,repo-remove-unknown\/\fR
|
\fBahriman\fR \fI\,repo\-remove\-unknown\/\fR
|
||||||
remove unknown packages
|
remove unknown packages
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,repo-report\/\fR
|
\fBahriman\fR \fI\,repo\-report\/\fR
|
||||||
generate report
|
generate report
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,repo-restore\/\fR
|
\fBahriman\fR \fI\,repo\-restore\/\fR
|
||||||
restore repository data
|
restore repository data
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,repo-setup\/\fR
|
\fBahriman\fR \fI\,repo\-setup\/\fR
|
||||||
initial service configuration
|
initial service configuration
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,repo-sign\/\fR
|
\fBahriman\fR \fI\,repo\-sign\/\fR
|
||||||
sign packages
|
sign packages
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,repo-status-update\/\fR
|
\fBahriman\fR \fI\,repo\-status\-update\/\fR
|
||||||
update repository status
|
update repository status
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,repo-sync\/\fR
|
\fBahriman\fR \fI\,repo\-sync\/\fR
|
||||||
sync repository
|
sync repository
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,repo-triggers\/\fR
|
\fBahriman\fR \fI\,repo\-triggers\/\fR
|
||||||
run triggers
|
run triggers
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,repo-update\/\fR
|
\fBahriman\fR \fI\,repo\-update\/\fR
|
||||||
update packages
|
update packages
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,shell\/\fR
|
\fBahriman\fR \fI\,shell\/\fR
|
||||||
envoke python shell
|
envoke python shell
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,user-add\/\fR
|
\fBahriman\fR \fI\,user\-add\/\fR
|
||||||
create or update user
|
create or update user
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,user-list\/\fR
|
\fBahriman\fR \fI\,user\-list\/\fR
|
||||||
user known users and their access
|
user known users and their access
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,user-remove\/\fR
|
\fBahriman\fR \fI\,user\-remove\/\fR
|
||||||
remove user
|
remove user
|
||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,version\/\fR
|
\fBahriman\fR \fI\,version\/\fR
|
||||||
@ -144,9 +144,10 @@ application version
|
|||||||
.TP
|
.TP
|
||||||
\fBahriman\fR \fI\,web\/\fR
|
\fBahriman\fR \fI\,web\/\fR
|
||||||
web server
|
web server
|
||||||
.SH COMMAND \fI\,'ahriman aur-search'\/\fR
|
|
||||||
usage: ahriman aur-search [-h] [-e] [-i]
|
.SH COMMAND \fI\,'ahriman aur\-search'\/\fR
|
||||||
[--sort-by {description,first_submitted,id,last_modified,maintainer,name,num_votes,out_of_date,package_base,package_base_id,popularity,repository,url,url_path,version}]
|
usage: ahriman aur\-search [\-h] [\-e] [\-\-info | \-\-no\-info]
|
||||||
|
[\-\-sort\-by {description,first_submitted,id,last_modified,maintainer,name,num_votes,out_of_date,package_base,package_base_id,popularity,repository,url,url_path,version}]
|
||||||
search [search ...]
|
search [search ...]
|
||||||
|
|
||||||
search for package in AUR using API
|
search for package in AUR using API
|
||||||
@ -155,14 +156,14 @@ search for package in AUR using API
|
|||||||
\fBsearch\fR
|
\fBsearch\fR
|
||||||
search terms, can be specified multiple times, result will match all terms
|
search terms, can be specified multiple times, result will match all terms
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman aur-search'\/\fR
|
.SH OPTIONS \fI\,'ahriman aur\-search'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-e\fR, \fB\-\-exit\-code\fR
|
\fB\-e\fR, \fB\-\-exit\-code\fR
|
||||||
return non\-zero exit status if result is empty
|
return non\-zero exit status if result is empty
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-i\fR, \fB\-\-info\fR
|
\fB\-\-info\fR, \fB\-\-no\-info\fR
|
||||||
show additional package information
|
show additional package information (default: False)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-sort\-by\fR \fI\,{description,first_submitted,id,last_modified,maintainer,name,num_votes,out_of_date,package_base,package_base_id,popularity,repository,url,url_path,version}\/\fR
|
\fB\-\-sort\-by\fR \fI\,{description,first_submitted,id,last_modified,maintainer,name,num_votes,out_of_date,package_base,package_base_id,popularity,repository,url,url_path,version}\/\fR
|
||||||
@ -170,7 +171,8 @@ sort field by this field. In case if two packages have the same value of the spe
|
|||||||
by name
|
by name
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman daemon'\/\fR
|
.SH COMMAND \fI\,'ahriman daemon'\/\fR
|
||||||
usage: ahriman daemon [-h] [-i INTERVAL] [--no-aur] [--no-local] [--no-manual] [--no-vcs]
|
usage: ahriman daemon [\-h] [\-i INTERVAL] [\-\-aur | \-\-no\-aur] [\-\-local | \-\-no\-local] [\-\-manual | \-\-no\-manual]
|
||||||
|
[\-\-vcs | \-\-no\-vcs] [\-y]
|
||||||
|
|
||||||
start process which periodically will run update process
|
start process which periodically will run update process
|
||||||
|
|
||||||
@ -180,23 +182,27 @@ start process which periodically will run update process
|
|||||||
interval between runs in seconds
|
interval between runs in seconds
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-no\-aur\fR
|
\fB\-\-aur\fR, \fB\-\-no\-aur\fR
|
||||||
do not check for AUR updates. Implies \-\-no\-vcs
|
enable or disable checking for AUR updates. Implies \-\-no\-vcs (default: True)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-no\-local\fR
|
\fB\-\-local\fR, \fB\-\-no\-local\fR
|
||||||
do not check local packages for updates
|
enable or disable checking of local packages for updates (default: True)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-no\-manual\fR
|
\fB\-\-manual\fR, \fB\-\-no\-manual\fR
|
||||||
do not include manual updates
|
include or exclude manual updates (default: True)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-no\-vcs\fR
|
\fB\-\-vcs\fR, \fB\-\-no\-vcs\fR
|
||||||
do not check VCS packages
|
enable or disable checking of VCS packages (default: True)
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fB\-y\fR, \fB\-\-refresh\fR
|
||||||
|
download fresh package databases from the mirror before actions, \-yy to force refresh even if up to date
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman help'\/\fR
|
.SH COMMAND \fI\,'ahriman help'\/\fR
|
||||||
usage: ahriman help [-h] [command]
|
usage: ahriman help [\-h] [command]
|
||||||
|
|
||||||
show help message for application or command and exit
|
show help message for application or command and exit
|
||||||
|
|
||||||
@ -204,19 +210,19 @@ show help message for application or command and exit
|
|||||||
\fBcommand\fR
|
\fBcommand\fR
|
||||||
show help message for specific command
|
show help message for specific command
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman help-commands-unsafe'\/\fR
|
.SH COMMAND \fI\,'ahriman help\-commands\-unsafe'\/\fR
|
||||||
usage: ahriman help-commands-unsafe [-h] [--command COMMAND]
|
usage: ahriman help\-commands\-unsafe [\-h] [\-\-command COMMAND]
|
||||||
|
|
||||||
list unsafe commands as defined in default args
|
list unsafe commands as defined in default args
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman help-commands-unsafe'\/\fR
|
.SH OPTIONS \fI\,'ahriman help\-commands\-unsafe'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-command\fR \fI\,COMMAND\/\fR
|
\fB\-\-command\fR \fI\,COMMAND\/\fR
|
||||||
instead of showing commands, just test command line for unsafe subcommand and return 0 in case if command is safe and 1
|
instead of showing commands, just test command line for unsafe subcommand and return 0 in case if command is safe and 1
|
||||||
otherwise
|
otherwise
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman key-import'\/\fR
|
.SH COMMAND \fI\,'ahriman key\-import'\/\fR
|
||||||
usage: ahriman key-import [-h] [--key-server KEY_SERVER] key
|
usage: ahriman key\-import [\-h] [\-\-key\-server KEY_SERVER] key
|
||||||
|
|
||||||
import PGP key from public sources to the repository user
|
import PGP key from public sources to the repository user
|
||||||
|
|
||||||
@ -224,14 +230,14 @@ import PGP key from public sources to the repository user
|
|||||||
\fBkey\fR
|
\fBkey\fR
|
||||||
PGP key to import from public server
|
PGP key to import from public server
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman key-import'\/\fR
|
.SH OPTIONS \fI\,'ahriman key\-import'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-key\-server\fR \fI\,KEY_SERVER\/\fR
|
\fB\-\-key\-server\fR \fI\,KEY_SERVER\/\fR
|
||||||
key server for key import
|
key server for key import
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman package-add'\/\fR
|
.SH COMMAND \fI\,'ahriman package\-add'\/\fR
|
||||||
usage: ahriman package-add [-h] [-e] [-n] [-s {auto,archive,aur,directory,local,remote,repository}]
|
usage: ahriman package\-add [\-h] [\-e] [\-n] [\-y] [\-s {auto,archive,aur,directory,local,remote,repository}]
|
||||||
[--without-dependencies]
|
[\-\-without\-dependencies]
|
||||||
package [package ...]
|
package [package ...]
|
||||||
|
|
||||||
add existing or new package to the build queue
|
add existing or new package to the build queue
|
||||||
@ -240,7 +246,7 @@ add existing or new package to the build queue
|
|||||||
\fBpackage\fR
|
\fBpackage\fR
|
||||||
package source (base name, path to local files, remote URL)
|
package source (base name, path to local files, remote URL)
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman package-add'\/\fR
|
.SH OPTIONS \fI\,'ahriman package\-add'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-e\fR, \fB\-\-exit\-code\fR
|
\fB\-e\fR, \fB\-\-exit\-code\fR
|
||||||
return non\-zero exit status if result is empty
|
return non\-zero exit status if result is empty
|
||||||
@ -249,6 +255,10 @@ return non\-zero exit status if result is empty
|
|||||||
\fB\-n\fR, \fB\-\-now\fR
|
\fB\-n\fR, \fB\-\-now\fR
|
||||||
run update function after
|
run update function after
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fB\-y\fR, \fB\-\-refresh\fR
|
||||||
|
download fresh package databases from the mirror before actions, \-yy to force refresh even if up to date
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-s\fR \fI\,{auto,archive,aur,directory,local,remote,repository}\/\fR, \fB\-\-source\fR \fI\,{auto,archive,aur,directory,local,remote,repository}\/\fR
|
\fB\-s\fR \fI\,{auto,archive,aur,directory,local,remote,repository}\/\fR, \fB\-\-source\fR \fI\,{auto,archive,aur,directory,local,remote,repository}\/\fR
|
||||||
explicitly specify the package source for this command
|
explicitly specify the package source for this command
|
||||||
@ -257,8 +267,8 @@ explicitly specify the package source for this command
|
|||||||
\fB\-\-without\-dependencies\fR
|
\fB\-\-without\-dependencies\fR
|
||||||
do not add dependencies
|
do not add dependencies
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman package-remove'\/\fR
|
.SH COMMAND \fI\,'ahriman package\-remove'\/\fR
|
||||||
usage: ahriman package-remove [-h] package [package ...]
|
usage: ahriman package\-remove [\-h] package [package ...]
|
||||||
|
|
||||||
remove package from the repository
|
remove package from the repository
|
||||||
|
|
||||||
@ -266,8 +276,8 @@ remove package from the repository
|
|||||||
\fBpackage\fR
|
\fBpackage\fR
|
||||||
package name or base
|
package name or base
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman package-status'\/\fR
|
.SH COMMAND \fI\,'ahriman package\-status'\/\fR
|
||||||
usage: ahriman package-status [-h] [--ahriman] [-e] [-i] [-s {unknown,pending,building,failed,success}] [package ...]
|
usage: ahriman package\-status [\-h] [\-\-ahriman] [\-e] [\-i] [\-s {unknown,pending,building,failed,success}] [package ...]
|
||||||
|
|
||||||
request status of the package
|
request status of the package
|
||||||
|
|
||||||
@ -275,7 +285,7 @@ request status of the package
|
|||||||
\fBpackage\fR
|
\fBpackage\fR
|
||||||
filter status by package base
|
filter status by package base
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman package-status'\/\fR
|
.SH OPTIONS \fI\,'ahriman package\-status'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-ahriman\fR
|
\fB\-\-ahriman\fR
|
||||||
get service status itself
|
get service status itself
|
||||||
@ -292,8 +302,8 @@ show additional package information
|
|||||||
\fB\-s\fR \fI\,{unknown,pending,building,failed,success}\/\fR, \fB\-\-status\fR \fI\,{unknown,pending,building,failed,success}\/\fR
|
\fB\-s\fR \fI\,{unknown,pending,building,failed,success}\/\fR, \fB\-\-status\fR \fI\,{unknown,pending,building,failed,success}\/\fR
|
||||||
filter packages by status
|
filter packages by status
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman package-status-remove'\/\fR
|
.SH COMMAND \fI\,'ahriman package\-status\-remove'\/\fR
|
||||||
usage: ahriman package-status-remove [-h] package [package ...]
|
usage: ahriman package\-status\-remove [\-h] package [package ...]
|
||||||
|
|
||||||
remove the package from the status page
|
remove the package from the status page
|
||||||
|
|
||||||
@ -301,8 +311,8 @@ remove the package from the status page
|
|||||||
\fBpackage\fR
|
\fBpackage\fR
|
||||||
remove specified packages
|
remove specified packages
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman package-status-update'\/\fR
|
.SH COMMAND \fI\,'ahriman package\-status\-update'\/\fR
|
||||||
usage: ahriman package-status-update [-h] [-s {unknown,pending,building,failed,success}] [package ...]
|
usage: ahriman package\-status\-update [\-h] [\-s {unknown,pending,building,failed,success}] [package ...]
|
||||||
|
|
||||||
update package status on the status page
|
update package status on the status page
|
||||||
|
|
||||||
@ -310,13 +320,13 @@ update package status on the status page
|
|||||||
\fBpackage\fR
|
\fBpackage\fR
|
||||||
set status for specified packages. If no packages supplied, service status will be updated
|
set status for specified packages. If no packages supplied, service status will be updated
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman package-status-update'\/\fR
|
.SH OPTIONS \fI\,'ahriman package\-status\-update'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-s\fR \fI\,{unknown,pending,building,failed,success}\/\fR, \fB\-\-status\fR \fI\,{unknown,pending,building,failed,success}\/\fR
|
\fB\-s\fR \fI\,{unknown,pending,building,failed,success}\/\fR, \fB\-\-status\fR \fI\,{unknown,pending,building,failed,success}\/\fR
|
||||||
new status
|
new status
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman patch-add'\/\fR
|
.SH COMMAND \fI\,'ahriman patch\-add'\/\fR
|
||||||
usage: ahriman patch-add [-h] package variable [patch]
|
usage: ahriman patch\-add [\-h] package variable [patch]
|
||||||
|
|
||||||
create or update patched PKGBUILD function or variable
|
create or update patched PKGBUILD function or variable
|
||||||
|
|
||||||
@ -332,8 +342,8 @@ PKGBUILD variable or function name. If variable is a function, it must end with
|
|||||||
\fBpatch\fR
|
\fBpatch\fR
|
||||||
path to file which contains function or variable value. If not set, the value will be read from stdin
|
path to file which contains function or variable value. If not set, the value will be read from stdin
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman patch-list'\/\fR
|
.SH COMMAND \fI\,'ahriman patch\-list'\/\fR
|
||||||
usage: ahriman patch-list [-h] [-e] [-v VARIABLE] [package]
|
usage: ahriman patch\-list [\-h] [\-e] [\-v VARIABLE] [package]
|
||||||
|
|
||||||
list available patches for the package
|
list available patches for the package
|
||||||
|
|
||||||
@ -341,7 +351,7 @@ list available patches for the package
|
|||||||
\fBpackage\fR
|
\fBpackage\fR
|
||||||
package base
|
package base
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman patch-list'\/\fR
|
.SH OPTIONS \fI\,'ahriman patch\-list'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-e\fR, \fB\-\-exit\-code\fR
|
\fB\-e\fR, \fB\-\-exit\-code\fR
|
||||||
return non\-zero exit status if result is empty
|
return non\-zero exit status if result is empty
|
||||||
@ -350,8 +360,8 @@ return non\-zero exit status if result is empty
|
|||||||
\fB\-v\fR \fI\,VARIABLE\/\fR, \fB\-\-variable\fR \fI\,VARIABLE\/\fR
|
\fB\-v\fR \fI\,VARIABLE\/\fR, \fB\-\-variable\fR \fI\,VARIABLE\/\fR
|
||||||
if set, show only patches for specified PKGBUILD variables
|
if set, show only patches for specified PKGBUILD variables
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman patch-remove'\/\fR
|
.SH COMMAND \fI\,'ahriman patch\-remove'\/\fR
|
||||||
usage: ahriman patch-remove [-h] [-v VARIABLE] package
|
usage: ahriman patch\-remove [\-h] [\-v VARIABLE] package
|
||||||
|
|
||||||
remove patches for the package
|
remove patches for the package
|
||||||
|
|
||||||
@ -359,14 +369,14 @@ remove patches for the package
|
|||||||
\fBpackage\fR
|
\fBpackage\fR
|
||||||
package base
|
package base
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman patch-remove'\/\fR
|
.SH OPTIONS \fI\,'ahriman patch\-remove'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-v\fR \fI\,VARIABLE\/\fR, \fB\-\-variable\fR \fI\,VARIABLE\/\fR
|
\fB\-v\fR \fI\,VARIABLE\/\fR, \fB\-\-variable\fR \fI\,VARIABLE\/\fR
|
||||||
should be used for single\-function patches in case if you wold like to remove only specified PKGBUILD variables. In case
|
should be used for single\-function patches in case if you wold like to remove only specified PKGBUILD variables. In case
|
||||||
if not set, it will remove all patches related to the package
|
if not set, it will remove all patches related to the package
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman patch-set-add'\/\fR
|
.SH COMMAND \fI\,'ahriman patch\-set\-add'\/\fR
|
||||||
usage: ahriman patch-set-add [-h] [-t TRACK] package
|
usage: ahriman patch\-set\-add [\-h] [\-t TRACK] package
|
||||||
|
|
||||||
create or update source patches
|
create or update source patches
|
||||||
|
|
||||||
@ -374,13 +384,13 @@ create or update source patches
|
|||||||
\fBpackage\fR
|
\fBpackage\fR
|
||||||
path to directory with changed files for patch addition/update
|
path to directory with changed files for patch addition/update
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman patch-set-add'\/\fR
|
.SH OPTIONS \fI\,'ahriman patch\-set\-add'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-t\fR \fI\,TRACK\/\fR, \fB\-\-track\fR \fI\,TRACK\/\fR
|
\fB\-t\fR \fI\,TRACK\/\fR, \fB\-\-track\fR \fI\,TRACK\/\fR
|
||||||
files which has to be tracked
|
files which has to be tracked
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman repo-backup'\/\fR
|
.SH COMMAND \fI\,'ahriman repo\-backup'\/\fR
|
||||||
usage: ahriman repo-backup [-h] path
|
usage: ahriman repo\-backup [\-h] path
|
||||||
|
|
||||||
backup settings and database
|
backup settings and database
|
||||||
|
|
||||||
@ -388,8 +398,8 @@ backup settings and database
|
|||||||
\fBpath\fR
|
\fBpath\fR
|
||||||
path of the output archive
|
path of the output archive
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman repo-check'\/\fR
|
.SH COMMAND \fI\,'ahriman repo\-check'\/\fR
|
||||||
usage: ahriman repo-check [-h] [-e] [--no-vcs] [package ...]
|
usage: ahriman repo\-check [\-h] [\-e] [\-\-vcs | \-\-no\-vcs] [\-y] [package ...]
|
||||||
|
|
||||||
check for packages updates. Same as update \-\-dry\-run \-\-no\-manual
|
check for packages updates. Same as update \-\-dry\-run \-\-no\-manual
|
||||||
|
|
||||||
@ -397,48 +407,57 @@ check for packages updates. Same as update \-\-dry\-run \-\-no\-manual
|
|||||||
\fBpackage\fR
|
\fBpackage\fR
|
||||||
filter check by package base
|
filter check by package base
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman repo-check'\/\fR
|
.SH OPTIONS \fI\,'ahriman repo\-check'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-e\fR, \fB\-\-exit\-code\fR
|
\fB\-e\fR, \fB\-\-exit\-code\fR
|
||||||
return non\-zero exit status if result is empty
|
return non\-zero exit status if result is empty
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-no\-vcs\fR
|
\fB\-\-vcs\fR, \fB\-\-no\-vcs\fR
|
||||||
do not check VCS packages
|
enable or disable checking of VCS packages (default: True)
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman repo-clean'\/\fR
|
.TP
|
||||||
usage: ahriman repo-clean [-h] [--cache] [--chroot] [--manual] [--packages]
|
\fB\-y\fR, \fB\-\-refresh\fR
|
||||||
|
download fresh package databases from the mirror before actions, \-yy to force refresh even if up to date
|
||||||
|
|
||||||
|
.SH COMMAND \fI\,'ahriman repo\-clean'\/\fR
|
||||||
|
usage: ahriman repo\-clean [\-h] [\-\-cache | \-\-no\-cache] [\-\-chroot | \-\-no\-chroot] [\-\-manual | \-\-no\-manual]
|
||||||
|
[\-\-packages | \-\-no\-packages] [\-\-pacman | \-\-no\-pacman]
|
||||||
|
|
||||||
remove local caches
|
remove local caches
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman repo-clean'\/\fR
|
.SH OPTIONS \fI\,'ahriman repo\-clean'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-cache\fR
|
\fB\-\-cache\fR, \fB\-\-no\-cache\fR
|
||||||
clear directory with package caches
|
clear directory with package caches (default: False)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-chroot\fR
|
\fB\-\-chroot\fR, \fB\-\-no\-chroot\fR
|
||||||
clear build chroot
|
clear build chroot (default: False)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-manual\fR
|
\fB\-\-manual\fR, \fB\-\-no\-manual\fR
|
||||||
clear manually added packages queue
|
clear manually added packages queue (default: False)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-packages\fR
|
\fB\-\-packages\fR, \fB\-\-no\-packages\fR
|
||||||
clear directory with built packages
|
clear directory with built packages (default: False)
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman repo-config'\/\fR
|
.TP
|
||||||
usage: ahriman repo-config [-h]
|
\fB\-\-pacman\fR, \fB\-\-no\-pacman\fR
|
||||||
|
clear directory with pacman local database cache (default: False)
|
||||||
|
|
||||||
|
.SH COMMAND \fI\,'ahriman repo\-config'\/\fR
|
||||||
|
usage: ahriman repo\-config [\-h]
|
||||||
|
|
||||||
dump configuration for the specified architecture
|
dump configuration for the specified architecture
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman repo-rebuild'\/\fR
|
.SH COMMAND \fI\,'ahriman repo\-rebuild'\/\fR
|
||||||
usage: ahriman repo-rebuild [-h] [--depends-on DEPENDS_ON] [--dry-run] [--from-database] [-e]
|
usage: ahriman repo\-rebuild [\-h] [\-\-depends\-on DEPENDS_ON] [\-\-dry\-run] [\-\-from\-database] [\-e]
|
||||||
|
|
||||||
force rebuild whole repository
|
force rebuild whole repository
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman repo-rebuild'\/\fR
|
.SH OPTIONS \fI\,'ahriman repo\-rebuild'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-depends\-on\fR \fI\,DEPENDS_ON\/\fR
|
\fB\-\-depends\-on\fR \fI\,DEPENDS_ON\/\fR
|
||||||
only rebuild packages that depend on specified package
|
only rebuild packages that depend on specified package
|
||||||
@ -457,27 +476,23 @@ original ahriman instance run with web service and have run repo\-update at leas
|
|||||||
\fB\-e\fR, \fB\-\-exit\-code\fR
|
\fB\-e\fR, \fB\-\-exit\-code\fR
|
||||||
return non\-zero exit status if result is empty
|
return non\-zero exit status if result is empty
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman repo-remove-unknown'\/\fR
|
.SH COMMAND \fI\,'ahriman repo\-remove\-unknown'\/\fR
|
||||||
usage: ahriman repo-remove-unknown [-h] [--dry-run] [-i]
|
usage: ahriman repo\-remove\-unknown [\-h] [\-\-dry\-run]
|
||||||
|
|
||||||
remove packages which are missing in AUR and do not have local PKGBUILDs
|
remove packages which are missing in AUR and do not have local PKGBUILDs
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman repo-remove-unknown'\/\fR
|
.SH OPTIONS \fI\,'ahriman repo\-remove\-unknown'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-dry\-run\fR
|
\fB\-\-dry\-run\fR
|
||||||
just perform check for packages without removal
|
just perform check for packages without removal
|
||||||
|
|
||||||
.TP
|
.SH COMMAND \fI\,'ahriman repo\-report'\/\fR
|
||||||
\fB\-i\fR, \fB\-\-info\fR
|
usage: ahriman repo\-report [\-h]
|
||||||
show additional package information
|
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman repo-report'\/\fR
|
|
||||||
usage: ahriman repo-report [-h]
|
|
||||||
|
|
||||||
generate repository report according to current settings
|
generate repository report according to current settings
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman repo-restore'\/\fR
|
.SH COMMAND \fI\,'ahriman repo\-restore'\/\fR
|
||||||
usage: ahriman repo-restore [-h] [-o OUTPUT] path
|
usage: ahriman repo\-restore [\-h] [\-o OUTPUT] path
|
||||||
|
|
||||||
restore settings and database
|
restore settings and database
|
||||||
|
|
||||||
@ -485,20 +500,20 @@ restore settings and database
|
|||||||
\fBpath\fR
|
\fBpath\fR
|
||||||
path of the input archive
|
path of the input archive
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman repo-restore'\/\fR
|
.SH OPTIONS \fI\,'ahriman repo\-restore'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-o\fR \fI\,OUTPUT\/\fR, \fB\-\-output\fR \fI\,OUTPUT\/\fR
|
\fB\-o\fR \fI\,OUTPUT\/\fR, \fB\-\-output\fR \fI\,OUTPUT\/\fR
|
||||||
root path of the extracted files
|
root path of the extracted files
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman repo-setup'\/\fR
|
.SH COMMAND \fI\,'ahriman repo\-setup'\/\fR
|
||||||
usage: ahriman repo-setup [-h] [--build-as-user BUILD_AS_USER] [--build-command BUILD_COMMAND]
|
usage: ahriman repo\-setup [\-h] [\-\-build\-as\-user BUILD_AS_USER] [\-\-build\-command BUILD_COMMAND]
|
||||||
[--from-configuration FROM_CONFIGURATION] [--no-multilib] --packager PACKAGER --repository
|
[\-\-from\-configuration FROM_CONFIGURATION] [\-\-multilib | \-\-no\-multilib] \-\-packager PACKAGER
|
||||||
REPOSITORY [--sign-key SIGN_KEY] [--sign-target {disabled,pacakges,repository}]
|
\-\-repository REPOSITORY [\-\-sign\-key SIGN_KEY] [\-\-sign\-target {disabled,pacakges,repository}]
|
||||||
[--web-port WEB_PORT]
|
[\-\-web\-port WEB_PORT]
|
||||||
|
|
||||||
create initial service configuration, requires root
|
create initial service configuration, requires root
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman repo-setup'\/\fR
|
.SH OPTIONS \fI\,'ahriman repo\-setup'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-build\-as\-user\fR \fI\,BUILD_AS_USER\/\fR
|
\fB\-\-build\-as\-user\fR \fI\,BUILD_AS_USER\/\fR
|
||||||
force makepkg user to the specific one
|
force makepkg user to the specific one
|
||||||
@ -512,8 +527,8 @@ build command prefix
|
|||||||
path to default devtools pacman configuration
|
path to default devtools pacman configuration
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-no\-multilib\fR
|
\fB\-\-multilib\fR, \fB\-\-no\-multilib\fR
|
||||||
do not add multilib repository
|
add or do not multilib repository (default: True)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-packager\fR \fI\,PACKAGER\/\fR
|
\fB\-\-packager\fR \fI\,PACKAGER\/\fR
|
||||||
@ -535,8 +550,8 @@ sign options
|
|||||||
\fB\-\-web\-port\fR \fI\,WEB_PORT\/\fR
|
\fB\-\-web\-port\fR \fI\,WEB_PORT\/\fR
|
||||||
port of the web service
|
port of the web service
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman repo-sign'\/\fR
|
.SH COMMAND \fI\,'ahriman repo\-sign'\/\fR
|
||||||
usage: ahriman repo-sign [-h] [package ...]
|
usage: ahriman repo\-sign [\-h] [package ...]
|
||||||
|
|
||||||
(re\-)sign packages and repository database according to current settings
|
(re\-)sign packages and repository database according to current settings
|
||||||
|
|
||||||
@ -544,23 +559,23 @@ usage: ahriman repo-sign [-h] [package ...]
|
|||||||
\fBpackage\fR
|
\fBpackage\fR
|
||||||
sign only specified packages
|
sign only specified packages
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman repo-status-update'\/\fR
|
.SH COMMAND \fI\,'ahriman repo\-status\-update'\/\fR
|
||||||
usage: ahriman repo-status-update [-h] [-s {unknown,pending,building,failed,success}]
|
usage: ahriman repo\-status\-update [\-h] [\-s {unknown,pending,building,failed,success}]
|
||||||
|
|
||||||
update repository status on the status page
|
update repository status on the status page
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman repo-status-update'\/\fR
|
.SH OPTIONS \fI\,'ahriman repo\-status\-update'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-s\fR \fI\,{unknown,pending,building,failed,success}\/\fR, \fB\-\-status\fR \fI\,{unknown,pending,building,failed,success}\/\fR
|
\fB\-s\fR \fI\,{unknown,pending,building,failed,success}\/\fR, \fB\-\-status\fR \fI\,{unknown,pending,building,failed,success}\/\fR
|
||||||
new status
|
new status
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman repo-sync'\/\fR
|
.SH COMMAND \fI\,'ahriman repo\-sync'\/\fR
|
||||||
usage: ahriman repo-sync [-h]
|
usage: ahriman repo\-sync [\-h]
|
||||||
|
|
||||||
sync repository files to remote server according to current settings
|
sync repository files to remote server according to current settings
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman repo-triggers'\/\fR
|
.SH COMMAND \fI\,'ahriman repo\-triggers'\/\fR
|
||||||
usage: ahriman repo-triggers [-h] [trigger ...]
|
usage: ahriman repo\-triggers [\-h] [trigger ...]
|
||||||
|
|
||||||
run triggers on empty build result as configured by settings
|
run triggers on empty build result as configured by settings
|
||||||
|
|
||||||
@ -568,8 +583,10 @@ run triggers on empty build result as configured by settings
|
|||||||
\fBtrigger\fR
|
\fBtrigger\fR
|
||||||
instead of running all triggers as set by configuration, just process specified ones oin order of metion
|
instead of running all triggers as set by configuration, just process specified ones oin order of metion
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman repo-update'\/\fR
|
.SH COMMAND \fI\,'ahriman repo\-update'\/\fR
|
||||||
usage: ahriman repo-update [-h] [--dry-run] [-e] [--no-aur] [--no-local] [--no-manual] [--no-vcs] [package ...]
|
usage: ahriman repo\-update [\-h] [\-\-dry\-run] [\-e] [\-\-aur | \-\-no\-aur] [\-\-local | \-\-no\-local] [\-\-manual | \-\-no\-manual]
|
||||||
|
[\-\-vcs | \-\-no\-vcs] [\-y]
|
||||||
|
[package ...]
|
||||||
|
|
||||||
check for packages updates and run build process if requested
|
check for packages updates and run build process if requested
|
||||||
|
|
||||||
@ -577,7 +594,7 @@ check for packages updates and run build process if requested
|
|||||||
\fBpackage\fR
|
\fBpackage\fR
|
||||||
filter check by package base
|
filter check by package base
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman repo-update'\/\fR
|
.SH OPTIONS \fI\,'ahriman repo\-update'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-dry\-run\fR
|
\fB\-\-dry\-run\fR
|
||||||
just perform check for updates, same as check command
|
just perform check for updates, same as check command
|
||||||
@ -587,28 +604,36 @@ just perform check for updates, same as check command
|
|||||||
return non\-zero exit status if result is empty
|
return non\-zero exit status if result is empty
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-no\-aur\fR
|
\fB\-\-aur\fR, \fB\-\-no\-aur\fR
|
||||||
do not check for AUR updates. Implies \-\-no\-vcs
|
enable or disable checking for AUR updates. Implies \-\-no\-vcs (default: True)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-no\-local\fR
|
\fB\-\-local\fR, \fB\-\-no\-local\fR
|
||||||
do not check local packages for updates
|
enable or disable checking of local packages for updates (default: True)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-no\-manual\fR
|
\fB\-\-manual\fR, \fB\-\-no\-manual\fR
|
||||||
do not include manual updates
|
include or exclude manual updates (default: True)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-no\-vcs\fR
|
\fB\-\-vcs\fR, \fB\-\-no\-vcs\fR
|
||||||
do not check VCS packages
|
enable or disable checking of VCS packages (default: True)
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fB\-y\fR, \fB\-\-refresh\fR
|
||||||
|
download fresh package databases from the mirror before actions, \-yy to force refresh even if up to date
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman shell'\/\fR
|
.SH COMMAND \fI\,'ahriman shell'\/\fR
|
||||||
usage: ahriman shell [-h]
|
usage: ahriman shell [\-h] [code]
|
||||||
|
|
||||||
drop into python shell while having created application
|
drop into python shell while having created application
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman user-add'\/\fR
|
.TP
|
||||||
usage: ahriman user-add [-h] [--as-service] [-p PASSWORD] [-r {unauthorized,read,reporter,full}] [-s] username
|
\fBcode\fR
|
||||||
|
instead of dropping into shell, just execute the specified code
|
||||||
|
|
||||||
|
.SH COMMAND \fI\,'ahriman user\-add'\/\fR
|
||||||
|
usage: ahriman user\-add [\-h] [\-\-as\-service] [\-p PASSWORD] [\-r {unauthorized,read,reporter,full}] [\-s] username
|
||||||
|
|
||||||
update user for web services with the given password and role. In case if password was not entered it will be asked interactively
|
update user for web services with the given password and role. In case if password was not entered it will be asked interactively
|
||||||
|
|
||||||
@ -616,7 +641,7 @@ update user for web services with the given password and role. In case if passwo
|
|||||||
\fBusername\fR
|
\fBusername\fR
|
||||||
username for web service
|
username for web service
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman user-add'\/\fR
|
.SH OPTIONS \fI\,'ahriman user\-add'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-as\-service\fR
|
\fB\-\-as\-service\fR
|
||||||
add user as service user
|
add user as service user
|
||||||
@ -634,8 +659,8 @@ user access level
|
|||||||
\fB\-s\fR, \fB\-\-secure\fR
|
\fB\-s\fR, \fB\-\-secure\fR
|
||||||
set file permissions to user\-only
|
set file permissions to user\-only
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman user-list'\/\fR
|
.SH COMMAND \fI\,'ahriman user\-list'\/\fR
|
||||||
usage: ahriman user-list [-h] [-e] [-r {unauthorized,read,reporter,full}] [username]
|
usage: ahriman user\-list [\-h] [\-e] [\-r {unauthorized,read,reporter,full}] [username]
|
||||||
|
|
||||||
list users from the user mapping and their roles
|
list users from the user mapping and their roles
|
||||||
|
|
||||||
@ -643,7 +668,7 @@ list users from the user mapping and their roles
|
|||||||
\fBusername\fR
|
\fBusername\fR
|
||||||
filter users by username
|
filter users by username
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman user-list'\/\fR
|
.SH OPTIONS \fI\,'ahriman user\-list'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-e\fR, \fB\-\-exit\-code\fR
|
\fB\-e\fR, \fB\-\-exit\-code\fR
|
||||||
return non\-zero exit status if result is empty
|
return non\-zero exit status if result is empty
|
||||||
@ -652,8 +677,8 @@ return non\-zero exit status if result is empty
|
|||||||
\fB\-r\fR \fI\,{unauthorized,read,reporter,full}\/\fR, \fB\-\-role\fR \fI\,{unauthorized,read,reporter,full}\/\fR
|
\fB\-r\fR \fI\,{unauthorized,read,reporter,full}\/\fR, \fB\-\-role\fR \fI\,{unauthorized,read,reporter,full}\/\fR
|
||||||
filter users by role
|
filter users by role
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman user-remove'\/\fR
|
.SH COMMAND \fI\,'ahriman user\-remove'\/\fR
|
||||||
usage: ahriman user-remove [-h] [-s] username
|
usage: ahriman user\-remove [\-h] [\-s] username
|
||||||
|
|
||||||
remove user from the user mapping and update the configuration
|
remove user from the user mapping and update the configuration
|
||||||
|
|
||||||
@ -661,18 +686,18 @@ remove user from the user mapping and update the configuration
|
|||||||
\fBusername\fR
|
\fBusername\fR
|
||||||
username for web service
|
username for web service
|
||||||
|
|
||||||
.SH OPTIONS \fI\,'ahriman user-remove'\/\fR
|
.SH OPTIONS \fI\,'ahriman user\-remove'\/\fR
|
||||||
.TP
|
.TP
|
||||||
\fB\-s\fR, \fB\-\-secure\fR
|
\fB\-s\fR, \fB\-\-secure\fR
|
||||||
set file permissions to user\-only
|
set file permissions to user\-only
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman version'\/\fR
|
.SH COMMAND \fI\,'ahriman version'\/\fR
|
||||||
usage: ahriman version [-h]
|
usage: ahriman version [\-h]
|
||||||
|
|
||||||
print application and its dependencies versions
|
print application and its dependencies versions
|
||||||
|
|
||||||
.SH COMMAND \fI\,'ahriman web'\/\fR
|
.SH COMMAND \fI\,'ahriman web'\/\fR
|
||||||
usage: ahriman web [-h]
|
usage: ahriman web [\-h]
|
||||||
|
|
||||||
start web server
|
start web server
|
||||||
|
|
||||||
@ -682,7 +707,8 @@ Argument list can also be read from file by using @ prefix.
|
|||||||
.SH AUTHORS
|
.SH AUTHORS
|
||||||
.nf
|
.nf
|
||||||
ahriman team
|
ahriman team
|
||||||
.fi.nf
|
.fi
|
||||||
|
.nf
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
|
@ -73,7 +73,8 @@ def _parser() -> argparse.ArgumentParser:
|
|||||||
parser.add_argument("--force", help="force run, remove file lock", action="store_true")
|
parser.add_argument("--force", help="force run, remove file lock", action="store_true")
|
||||||
parser.add_argument("-l", "--lock", help="lock file", type=Path,
|
parser.add_argument("-l", "--lock", help="lock file", type=Path,
|
||||||
default=Path(tempfile.gettempdir()) / "ahriman.lock")
|
default=Path(tempfile.gettempdir()) / "ahriman.lock")
|
||||||
parser.add_argument("--no-report", help="force disable reporting to web service", action="store_true")
|
parser.add_argument("--report", help="force enable or disable reporting to web service",
|
||||||
|
action=argparse.BooleanOptionalAction, default=True)
|
||||||
parser.add_argument("-q", "--quiet", help="force disable any logging", action="store_true")
|
parser.add_argument("-q", "--quiet", help="force disable any logging", action="store_true")
|
||||||
parser.add_argument("--unsafe", help="allow to run ahriman as non-ahriman user. Some actions might be unavailable",
|
parser.add_argument("--unsafe", help="allow to run ahriman as non-ahriman user. Some actions might be unavailable",
|
||||||
action="store_true")
|
action="store_true")
|
||||||
@ -134,11 +135,12 @@ def _set_aur_search_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
parser.add_argument("search", help="search terms, can be specified multiple times, result will match all terms",
|
parser.add_argument("search", help="search terms, can be specified multiple times, result will match all terms",
|
||||||
nargs="+")
|
nargs="+")
|
||||||
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if result is empty", action="store_true")
|
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if result is empty", action="store_true")
|
||||||
parser.add_argument("-i", "--info", help="show additional package information", action="store_true")
|
parser.add_argument("--info", help="show additional package information",
|
||||||
|
action=argparse.BooleanOptionalAction, default=False)
|
||||||
parser.add_argument("--sort-by", help="sort field by this field. In case if two packages have the same value of "
|
parser.add_argument("--sort-by", help="sort field by this field. In case if two packages have the same value of "
|
||||||
"the specified field, they will be always sorted by name",
|
"the specified field, they will be always sorted by name",
|
||||||
default="name", choices=sorted(handlers.Search.SORT_FIELDS))
|
default="name", choices=sorted(handlers.Search.SORT_FIELDS))
|
||||||
parser.set_defaults(handler=handlers.Search, architecture=[""], lock=None, no_report=True, quiet=True, unsafe=True)
|
parser.set_defaults(handler=handlers.Search, architecture=[""], lock=None, report=False, quiet=True, unsafe=True)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
@ -156,10 +158,14 @@ def _set_daemon_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
description="start process which periodically will run update process",
|
description="start process which periodically will run update process",
|
||||||
formatter_class=_formatter)
|
formatter_class=_formatter)
|
||||||
parser.add_argument("-i", "--interval", help="interval between runs in seconds", type=int, default=60 * 60 * 12)
|
parser.add_argument("-i", "--interval", help="interval between runs in seconds", type=int, default=60 * 60 * 12)
|
||||||
parser.add_argument("--no-aur", help="do not check for AUR updates. Implies --no-vcs", action="store_true")
|
parser.add_argument("--aur", help="enable or disable checking for AUR updates. Implies --no-vcs",
|
||||||
parser.add_argument("--no-local", help="do not check local packages for updates", action="store_true")
|
action=argparse.BooleanOptionalAction, default=True)
|
||||||
parser.add_argument("--no-manual", help="do not include manual updates", action="store_true")
|
parser.add_argument("--local", help="enable or disable checking of local packages for updates",
|
||||||
parser.add_argument("--no-vcs", help="do not check VCS packages", action="store_true")
|
action=argparse.BooleanOptionalAction, default=True)
|
||||||
|
parser.add_argument("--manual", help="include or exclude manual updates",
|
||||||
|
action=argparse.BooleanOptionalAction, default=True)
|
||||||
|
parser.add_argument("--vcs", help="enable or disable checking of VCS packages",
|
||||||
|
action=argparse.BooleanOptionalAction, default=True)
|
||||||
parser.add_argument("-y", "--refresh", help="download fresh package databases from the mirror before actions, "
|
parser.add_argument("-y", "--refresh", help="download fresh package databases from the mirror before actions, "
|
||||||
"-yy to force refresh even if up to date",
|
"-yy to force refresh even if up to date",
|
||||||
action="count", default=0)
|
action="count", default=0)
|
||||||
@ -181,7 +187,7 @@ def _set_help_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
description="show help message for application or command and exit",
|
description="show help message for application or command and exit",
|
||||||
formatter_class=_formatter)
|
formatter_class=_formatter)
|
||||||
parser.add_argument("command", help="show help message for specific command", nargs="?")
|
parser.add_argument("command", help="show help message for specific command", nargs="?")
|
||||||
parser.set_defaults(handler=handlers.Help, architecture=[""], lock=None, no_report=True, quiet=True,
|
parser.set_defaults(handler=handlers.Help, architecture=[""], lock=None, report=False, quiet=True,
|
||||||
unsafe=True, parser=_parser)
|
unsafe=True, parser=_parser)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@ -200,7 +206,7 @@ def _set_help_commands_unsafe_parser(root: SubParserAction) -> argparse.Argument
|
|||||||
description="list unsafe commands as defined in default args", formatter_class=_formatter)
|
description="list unsafe commands as defined in default args", formatter_class=_formatter)
|
||||||
parser.add_argument("--command", help="instead of showing commands, just test command line for unsafe subcommand "
|
parser.add_argument("--command", help="instead of showing commands, just test command line for unsafe subcommand "
|
||||||
"and return 0 in case if command is safe and 1 otherwise")
|
"and return 0 in case if command is safe and 1 otherwise")
|
||||||
parser.set_defaults(handler=handlers.UnsafeCommands, architecture=[""], lock=None, no_report=True, quiet=True,
|
parser.set_defaults(handler=handlers.UnsafeCommands, architecture=[""], lock=None, report=False, quiet=True,
|
||||||
unsafe=True, parser=_parser)
|
unsafe=True, parser=_parser)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@ -224,7 +230,7 @@ def _set_key_import_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
formatter_class=_formatter)
|
formatter_class=_formatter)
|
||||||
parser.add_argument("--key-server", help="key server for key import", default="pgp.mit.edu")
|
parser.add_argument("--key-server", help="key server for key import", default="pgp.mit.edu")
|
||||||
parser.add_argument("key", help="PGP key to import from public server")
|
parser.add_argument("key", help="PGP key to import from public server")
|
||||||
parser.set_defaults(handler=handlers.KeyImport, architecture=[""], lock=None, no_report=True)
|
parser.set_defaults(handler=handlers.KeyImport, architecture=[""], lock=None, report=False)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
@ -301,7 +307,7 @@ def _set_package_status_parser(root: SubParserAction) -> argparse.ArgumentParser
|
|||||||
parser.add_argument("-i", "--info", help="show additional package information", action="store_true")
|
parser.add_argument("-i", "--info", help="show additional package information", action="store_true")
|
||||||
parser.add_argument("-s", "--status", help="filter packages by status",
|
parser.add_argument("-s", "--status", help="filter packages by status",
|
||||||
type=BuildStatusEnum, choices=enum_values(BuildStatusEnum))
|
type=BuildStatusEnum, choices=enum_values(BuildStatusEnum))
|
||||||
parser.set_defaults(handler=handlers.Status, lock=None, no_report=True, quiet=True, unsafe=True)
|
parser.set_defaults(handler=handlers.Status, lock=None, report=False, quiet=True, unsafe=True)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
@ -321,7 +327,7 @@ def _set_package_status_remove_parser(root: SubParserAction) -> argparse.Argumen
|
|||||||
"clears the status page.",
|
"clears the status page.",
|
||||||
formatter_class=_formatter)
|
formatter_class=_formatter)
|
||||||
parser.add_argument("package", help="remove specified packages", nargs="+")
|
parser.add_argument("package", help="remove specified packages", nargs="+")
|
||||||
parser.set_defaults(handler=handlers.StatusUpdate, action=Action.Remove, lock=None, no_report=True, quiet=True,
|
parser.set_defaults(handler=handlers.StatusUpdate, action=Action.Remove, lock=None, report=False, quiet=True,
|
||||||
unsafe=True)
|
unsafe=True)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@ -343,7 +349,7 @@ def _set_package_status_update_parser(root: SubParserAction) -> argparse.Argumen
|
|||||||
nargs="*")
|
nargs="*")
|
||||||
parser.add_argument("-s", "--status", help="new status",
|
parser.add_argument("-s", "--status", help="new status",
|
||||||
type=BuildStatusEnum, choices=enum_values(BuildStatusEnum), default=BuildStatusEnum.Success)
|
type=BuildStatusEnum, choices=enum_values(BuildStatusEnum), default=BuildStatusEnum.Success)
|
||||||
parser.set_defaults(handler=handlers.StatusUpdate, action=Action.Update, lock=None, no_report=True, quiet=True,
|
parser.set_defaults(handler=handlers.StatusUpdate, action=Action.Update, lock=None, report=False, quiet=True,
|
||||||
unsafe=True)
|
unsafe=True)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@ -370,7 +376,7 @@ def _set_patch_add_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
"it must end with ()")
|
"it must end with ()")
|
||||||
parser.add_argument("patch", help="path to file which contains function or variable value. If not set, "
|
parser.add_argument("patch", help="path to file which contains function or variable value. If not set, "
|
||||||
"the value will be read from stdin", type=Path, nargs="?")
|
"the value will be read from stdin", type=Path, nargs="?")
|
||||||
parser.set_defaults(handler=handlers.Patch, action=Action.Update, architecture=[""], lock=None, no_report=True)
|
parser.set_defaults(handler=handlers.Patch, action=Action.Update, architecture=[""], lock=None, report=False)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
@ -390,7 +396,7 @@ def _set_patch_list_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if result is empty", action="store_true")
|
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if result is empty", action="store_true")
|
||||||
parser.add_argument("-v", "--variable", help="if set, show only patches for specified PKGBUILD variables",
|
parser.add_argument("-v", "--variable", help="if set, show only patches for specified PKGBUILD variables",
|
||||||
action="append")
|
action="append")
|
||||||
parser.set_defaults(handler=handlers.Patch, action=Action.List, architecture=[""], lock=None, no_report=True)
|
parser.set_defaults(handler=handlers.Patch, action=Action.List, architecture=[""], lock=None, report=False)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
@ -411,7 +417,7 @@ def _set_patch_remove_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
"to remove only specified PKGBUILD variables. In case if not set, "
|
"to remove only specified PKGBUILD variables. In case if not set, "
|
||||||
"it will remove all patches related to the package",
|
"it will remove all patches related to the package",
|
||||||
action="append")
|
action="append")
|
||||||
parser.set_defaults(handler=handlers.Patch, action=Action.Remove, architecture=[""], lock=None, no_report=True)
|
parser.set_defaults(handler=handlers.Patch, action=Action.Remove, architecture=[""], lock=None, report=False)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
@ -435,7 +441,7 @@ def _set_patch_set_add_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
parser.add_argument("package", help="path to directory with changed files for patch addition/update", type=Path)
|
parser.add_argument("package", help="path to directory with changed files for patch addition/update", type=Path)
|
||||||
parser.add_argument("-t", "--track", help="files which has to be tracked", action="append",
|
parser.add_argument("-t", "--track", help="files which has to be tracked", action="append",
|
||||||
default=["*.diff", "*.patch"])
|
default=["*.diff", "*.patch"])
|
||||||
parser.set_defaults(handler=handlers.Patch, action=Action.Update, architecture=[""], lock=None, no_report=True,
|
parser.set_defaults(handler=handlers.Patch, action=Action.Update, architecture=[""], lock=None, report=False,
|
||||||
variable=None)
|
variable=None)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@ -453,7 +459,7 @@ def _set_repo_backup_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
parser = root.add_parser("repo-backup", help="backup repository data",
|
parser = root.add_parser("repo-backup", help="backup repository data",
|
||||||
description="backup settings and database", formatter_class=_formatter)
|
description="backup settings and database", formatter_class=_formatter)
|
||||||
parser.add_argument("path", help="path of the output archive", type=Path)
|
parser.add_argument("path", help="path of the output archive", type=Path)
|
||||||
parser.set_defaults(handler=handlers.Backup, architecture=[""], lock=None, no_report=True, unsafe=True)
|
parser.set_defaults(handler=handlers.Backup, architecture=[""], lock=None, report=False, unsafe=True)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
@ -472,11 +478,12 @@ def _set_repo_check_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
formatter_class=_formatter)
|
formatter_class=_formatter)
|
||||||
parser.add_argument("package", help="filter check by package base", nargs="*")
|
parser.add_argument("package", help="filter check by package base", nargs="*")
|
||||||
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if result is empty", action="store_true")
|
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if result is empty", action="store_true")
|
||||||
parser.add_argument("--no-vcs", help="do not check VCS packages", action="store_true")
|
parser.add_argument("--vcs", help="enable or disable checking of VCS packages",
|
||||||
|
action=argparse.BooleanOptionalAction, default=True)
|
||||||
parser.add_argument("-y", "--refresh", help="download fresh package databases from the mirror before actions, "
|
parser.add_argument("-y", "--refresh", help="download fresh package databases from the mirror before actions, "
|
||||||
"-yy to force refresh even if up to date",
|
"-yy to force refresh even if up to date",
|
||||||
action="count", default=0)
|
action="count", default=0)
|
||||||
parser.set_defaults(handler=handlers.Update, dry_run=True, no_aur=False, no_local=False, no_manual=True)
|
parser.set_defaults(handler=handlers.Update, dry_run=True, aur=True, local=True, manual=False)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
@ -496,10 +503,15 @@ def _set_repo_clean_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
"you should not run this command manually. Also in case if you are going to clear "
|
"you should not run this command manually. Also in case if you are going to clear "
|
||||||
"the chroot directories you will need root privileges.",
|
"the chroot directories you will need root privileges.",
|
||||||
formatter_class=_formatter)
|
formatter_class=_formatter)
|
||||||
parser.add_argument("--cache", help="clear directory with package caches", action="store_true")
|
parser.add_argument("--cache", help="clear directory with package caches",
|
||||||
parser.add_argument("--chroot", help="clear build chroot", action="store_true")
|
action=argparse.BooleanOptionalAction, default=False)
|
||||||
parser.add_argument("--manual", help="clear manually added packages queue", action="store_true")
|
parser.add_argument("--chroot", help="clear build chroot", action=argparse.BooleanOptionalAction, default=False)
|
||||||
parser.add_argument("--packages", help="clear directory with built packages", action="store_true")
|
parser.add_argument("--manual", help="clear manually added packages queue",
|
||||||
|
action=argparse.BooleanOptionalAction, default=False)
|
||||||
|
parser.add_argument("--packages", help="clear directory with built packages",
|
||||||
|
action=argparse.BooleanOptionalAction, default=False)
|
||||||
|
parser.add_argument("--pacman", help="clear directory with pacman local database cache",
|
||||||
|
action=argparse.BooleanOptionalAction, default=False)
|
||||||
parser.set_defaults(handler=handlers.Clean, quiet=True, unsafe=True)
|
parser.set_defaults(handler=handlers.Clean, quiet=True, unsafe=True)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@ -517,7 +529,7 @@ def _set_repo_config_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
parser = root.add_parser("repo-config", aliases=["config"], help="dump configuration",
|
parser = root.add_parser("repo-config", aliases=["config"], help="dump configuration",
|
||||||
description="dump configuration for the specified architecture",
|
description="dump configuration for the specified architecture",
|
||||||
formatter_class=_formatter)
|
formatter_class=_formatter)
|
||||||
parser.set_defaults(handler=handlers.Dump, lock=None, no_report=True, quiet=True, unsafe=True)
|
parser.set_defaults(handler=handlers.Dump, lock=None, report=False, quiet=True, unsafe=True)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
@ -561,7 +573,6 @@ def _set_repo_remove_unknown_parser(root: SubParserAction) -> argparse.ArgumentP
|
|||||||
description="remove packages which are missing in AUR and do not have local PKGBUILDs",
|
description="remove packages which are missing in AUR and do not have local PKGBUILDs",
|
||||||
formatter_class=_formatter)
|
formatter_class=_formatter)
|
||||||
parser.add_argument("--dry-run", help="just perform check for packages without removal", action="store_true")
|
parser.add_argument("--dry-run", help="just perform check for packages without removal", action="store_true")
|
||||||
parser.add_argument("-i", "--info", help="show additional package information", action="store_true")
|
|
||||||
parser.set_defaults(handler=handlers.RemoveUnknown)
|
parser.set_defaults(handler=handlers.RemoveUnknown)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@ -598,7 +609,7 @@ def _set_repo_restore_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
description="restore settings and database", formatter_class=_formatter)
|
description="restore settings and database", formatter_class=_formatter)
|
||||||
parser.add_argument("path", help="path of the input archive", type=Path)
|
parser.add_argument("path", help="path of the input archive", type=Path)
|
||||||
parser.add_argument("-o", "--output", help="root path of the extracted files", type=Path, default=Path("/"))
|
parser.add_argument("-o", "--output", help="root path of the extracted files", type=Path, default=Path("/"))
|
||||||
parser.set_defaults(handler=handlers.Restore, architecture=[""], lock=None, no_report=True, unsafe=True)
|
parser.set_defaults(handler=handlers.Restore, architecture=[""], lock=None, report=False, unsafe=True)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
@ -620,14 +631,15 @@ def _set_repo_setup_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
parser.add_argument("--build-command", help="build command prefix", default="ahriman")
|
parser.add_argument("--build-command", help="build command prefix", default="ahriman")
|
||||||
parser.add_argument("--from-configuration", help="path to default devtools pacman configuration",
|
parser.add_argument("--from-configuration", help="path to default devtools pacman configuration",
|
||||||
type=Path, default=Path("/usr/share/devtools/pacman-extra.conf"))
|
type=Path, default=Path("/usr/share/devtools/pacman-extra.conf"))
|
||||||
parser.add_argument("--no-multilib", help="do not add multilib repository", action="store_true")
|
parser.add_argument("--multilib", help="add or do not multilib repository",
|
||||||
|
action=argparse.BooleanOptionalAction, default=True)
|
||||||
parser.add_argument("--packager", help="packager name and email", required=True)
|
parser.add_argument("--packager", help="packager name and email", required=True)
|
||||||
parser.add_argument("--repository", help="repository name", required=True)
|
parser.add_argument("--repository", help="repository name", required=True)
|
||||||
parser.add_argument("--sign-key", help="sign key id")
|
parser.add_argument("--sign-key", help="sign key id")
|
||||||
parser.add_argument("--sign-target", help="sign options", action="append",
|
parser.add_argument("--sign-target", help="sign options", action="append",
|
||||||
type=SignSettings.from_option, choices=enum_values(SignSettings))
|
type=SignSettings.from_option, choices=enum_values(SignSettings))
|
||||||
parser.add_argument("--web-port", help="port of the web service", type=int)
|
parser.add_argument("--web-port", help="port of the web service", type=int)
|
||||||
parser.set_defaults(handler=handlers.Setup, lock=None, no_report=True, quiet=True, unsafe=True)
|
parser.set_defaults(handler=handlers.Setup, lock=None, report=False, quiet=True, unsafe=True)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
@ -664,7 +676,7 @@ def _set_repo_status_update_parser(root: SubParserAction) -> argparse.ArgumentPa
|
|||||||
description="update repository status on the status page", formatter_class=_formatter)
|
description="update repository status on the status page", formatter_class=_formatter)
|
||||||
parser.add_argument("-s", "--status", help="new status",
|
parser.add_argument("-s", "--status", help="new status",
|
||||||
type=BuildStatusEnum, choices=enum_values(BuildStatusEnum), default=BuildStatusEnum.Success)
|
type=BuildStatusEnum, choices=enum_values(BuildStatusEnum), default=BuildStatusEnum.Success)
|
||||||
parser.set_defaults(handler=handlers.StatusUpdate, action=Action.Update, lock=None, no_report=True, package=[],
|
parser.set_defaults(handler=handlers.StatusUpdate, action=Action.Update, lock=None, report=False, package=[],
|
||||||
quiet=True, unsafe=True)
|
quiet=True, unsafe=True)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@ -722,10 +734,14 @@ def _set_repo_update_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
parser.add_argument("package", help="filter check by package base", nargs="*")
|
parser.add_argument("package", help="filter check by package base", nargs="*")
|
||||||
parser.add_argument("--dry-run", help="just perform check for updates, same as check command", action="store_true")
|
parser.add_argument("--dry-run", help="just perform check for updates, same as check command", action="store_true")
|
||||||
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if result is empty", action="store_true")
|
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if result is empty", action="store_true")
|
||||||
parser.add_argument("--no-aur", help="do not check for AUR updates. Implies --no-vcs", action="store_true")
|
parser.add_argument("--aur", help="enable or disable checking for AUR updates. Implies --no-vcs",
|
||||||
parser.add_argument("--no-local", help="do not check local packages for updates", action="store_true")
|
action=argparse.BooleanOptionalAction, default=True)
|
||||||
parser.add_argument("--no-manual", help="do not include manual updates", action="store_true")
|
parser.add_argument("--local", help="enable or disable checking of local packages for updates",
|
||||||
parser.add_argument("--no-vcs", help="do not check VCS packages", action="store_true")
|
action=argparse.BooleanOptionalAction, default=True)
|
||||||
|
parser.add_argument("--manual", help="include or exclude manual updates",
|
||||||
|
action=argparse.BooleanOptionalAction, default=True)
|
||||||
|
parser.add_argument("--vcs", help="enable or disable checking of VCS packages",
|
||||||
|
action=argparse.BooleanOptionalAction, default=True)
|
||||||
parser.add_argument("-y", "--refresh", help="download fresh package databases from the mirror before actions, "
|
parser.add_argument("-y", "--refresh", help="download fresh package databases from the mirror before actions, "
|
||||||
"-yy to force refresh even if up to date",
|
"-yy to force refresh even if up to date",
|
||||||
action="count", default=0)
|
action="count", default=0)
|
||||||
@ -746,8 +762,9 @@ def _set_shell_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
parser = root.add_parser("shell", help="envoke python shell",
|
parser = root.add_parser("shell", help="envoke python shell",
|
||||||
description="drop into python shell while having created application",
|
description="drop into python shell while having created application",
|
||||||
formatter_class=_formatter)
|
formatter_class=_formatter)
|
||||||
|
parser.add_argument("code", help="instead of dropping into shell, just execute the specified code", nargs="?")
|
||||||
parser.add_argument("-v", "--verbose", help=argparse.SUPPRESS, action="store_true")
|
parser.add_argument("-v", "--verbose", help=argparse.SUPPRESS, action="store_true")
|
||||||
parser.set_defaults(handler=handlers.Shell, lock=None, no_report=True)
|
parser.set_defaults(handler=handlers.Shell, lock=None, report=False)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
@ -772,7 +789,7 @@ def _set_user_add_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
parser.add_argument("-r", "--role", help="user access level",
|
parser.add_argument("-r", "--role", help="user access level",
|
||||||
type=UserAccess, choices=enum_values(UserAccess), default=UserAccess.Read)
|
type=UserAccess, choices=enum_values(UserAccess), default=UserAccess.Read)
|
||||||
parser.add_argument("-s", "--secure", help="set file permissions to user-only", action="store_true")
|
parser.add_argument("-s", "--secure", help="set file permissions to user-only", action="store_true")
|
||||||
parser.set_defaults(handler=handlers.Users, action=Action.Update, architecture=[""], lock=None, no_report=True,
|
parser.set_defaults(handler=handlers.Users, action=Action.Update, architecture=[""], lock=None, report=False,
|
||||||
quiet=True, unsafe=True)
|
quiet=True, unsafe=True)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@ -793,7 +810,7 @@ def _set_user_list_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
parser.add_argument("username", help="filter users by username", nargs="?")
|
parser.add_argument("username", help="filter users by username", nargs="?")
|
||||||
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if result is empty", action="store_true")
|
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if result is empty", action="store_true")
|
||||||
parser.add_argument("-r", "--role", help="filter users by role", type=UserAccess, choices=enum_values(UserAccess))
|
parser.add_argument("-r", "--role", help="filter users by role", type=UserAccess, choices=enum_values(UserAccess))
|
||||||
parser.set_defaults(handler=handlers.Users, action=Action.List, architecture=[""], lock=None, no_report=True, # nosec
|
parser.set_defaults(handler=handlers.Users, action=Action.List, architecture=[""], lock=None, report=False, # nosec
|
||||||
password="", quiet=True, unsafe=True)
|
password="", quiet=True, unsafe=True)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@ -813,7 +830,7 @@ def _set_user_remove_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
formatter_class=_formatter)
|
formatter_class=_formatter)
|
||||||
parser.add_argument("username", help="username for web service")
|
parser.add_argument("username", help="username for web service")
|
||||||
parser.add_argument("-s", "--secure", help="set file permissions to user-only", action="store_true")
|
parser.add_argument("-s", "--secure", help="set file permissions to user-only", action="store_true")
|
||||||
parser.set_defaults(handler=handlers.Users, action=Action.Remove, architecture=[""], lock=None, no_report=True, # nosec
|
parser.set_defaults(handler=handlers.Users, action=Action.Remove, architecture=[""], lock=None, report=False, # nosec
|
||||||
password="", quiet=True, unsafe=True)
|
password="", quiet=True, unsafe=True)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@ -830,7 +847,7 @@ def _set_version_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
"""
|
"""
|
||||||
parser = root.add_parser("version", help="application version",
|
parser = root.add_parser("version", help="application version",
|
||||||
description="print application and its dependencies versions", formatter_class=_formatter)
|
description="print application and its dependencies versions", formatter_class=_formatter)
|
||||||
parser.set_defaults(handler=handlers.Versions, architecture=[""], lock=None, no_report=True, quiet=True,
|
parser.set_defaults(handler=handlers.Versions, architecture=[""], lock=None, report=False, quiet=True,
|
||||||
unsafe=True)
|
unsafe=True)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@ -846,7 +863,7 @@ def _set_web_parser(root: SubParserAction) -> argparse.ArgumentParser:
|
|||||||
argparse.ArgumentParser: created argument parser
|
argparse.ArgumentParser: created argument parser
|
||||||
"""
|
"""
|
||||||
parser = root.add_parser("web", help="web server", description="start web server", formatter_class=_formatter)
|
parser = root.add_parser("web", help="web server", description="start web server", formatter_class=_formatter)
|
||||||
parser.set_defaults(handler=handlers.Web, lock=None, no_report=True, parser=_parser)
|
parser.set_defaults(handler=handlers.Web, lock=None, report=False, parser=_parser)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,12 +36,12 @@ class Application(ApplicationPackages, ApplicationRepository):
|
|||||||
>>> from ahriman.models.package_source import PackageSource
|
>>> from ahriman.models.package_source import PackageSource
|
||||||
>>>
|
>>>
|
||||||
>>> configuration = Configuration()
|
>>> configuration = Configuration()
|
||||||
>>> application = Application("x86_64", configuration, no_report=False, unsafe=False)
|
>>> application = Application("x86_64", configuration, report=True, unsafe=False)
|
||||||
>>> # add packages to build queue
|
>>> # add packages to build queue
|
||||||
>>> application.add(["ahriman"], PackageSource.AUR, without_dependencies=False)
|
>>> application.add(["ahriman"], PackageSource.AUR, without_dependencies=False)
|
||||||
>>>
|
>>>
|
||||||
>>> # check for updates
|
>>> # check for updates
|
||||||
>>> updates = application.updates([], no_aur=False, no_local=False, no_manual=False, no_vcs=False, log_fn=print)
|
>>> updates = application.updates([], aur=True, local=True, manual=True, vcs=True, log_fn=print)
|
||||||
>>> # updates for specified packages
|
>>> # updates for specified packages
|
||||||
>>> application.update(updates)
|
>>> application.update(updates)
|
||||||
|
|
||||||
|
@ -34,15 +34,15 @@ class ApplicationProperties(LazyLogging):
|
|||||||
repository(Repository): repository instance
|
repository(Repository): repository instance
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, architecture: str, configuration: Configuration,
|
def __init__(self, architecture: str, configuration: Configuration, *,
|
||||||
no_report: bool, unsafe: bool, refresh_pacman_database: int = 0) -> None:
|
report: bool, unsafe: bool, refresh_pacman_database: int = 0) -> None:
|
||||||
"""
|
"""
|
||||||
default constructor
|
default constructor
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
refresh_pacman_database(int): pacman database syncronization level, ``0`` is disabled
|
refresh_pacman_database(int): pacman database syncronization level, ``0`` is disabled
|
||||||
"""
|
"""
|
||||||
@ -50,4 +50,4 @@ class ApplicationProperties(LazyLogging):
|
|||||||
self.architecture = architecture
|
self.architecture = architecture
|
||||||
self.database = SQLite.load(configuration)
|
self.database = SQLite.load(configuration)
|
||||||
self.repository = Repository(architecture, configuration, self.database,
|
self.repository = Repository(architecture, configuration, self.database,
|
||||||
no_report, unsafe, refresh_pacman_database)
|
report=report, unsafe=unsafe, refresh_pacman_database=refresh_pacman_database)
|
||||||
|
@ -47,7 +47,7 @@ class ApplicationRepository(ApplicationProperties):
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def clean(self, cache: bool, chroot: bool, manual: bool, packages: bool) -> None:
|
def clean(self, *, cache: bool, chroot: bool, manual: bool, packages: bool, pacman: bool) -> None:
|
||||||
"""
|
"""
|
||||||
run all clean methods. Warning: some functions might not be available under non-root
|
run all clean methods. Warning: some functions might not be available under non-root
|
||||||
|
|
||||||
@ -56,6 +56,7 @@ class ApplicationRepository(ApplicationProperties):
|
|||||||
chroot(bool): clear build chroot
|
chroot(bool): clear build chroot
|
||||||
manual(bool): clear directory with manually added packages
|
manual(bool): clear directory with manually added packages
|
||||||
packages(bool): clear directory with built packages
|
packages(bool): clear directory with built packages
|
||||||
|
pacman(bool): clear directory with pacman databases
|
||||||
"""
|
"""
|
||||||
if cache:
|
if cache:
|
||||||
self.repository.clear_cache()
|
self.repository.clear_cache()
|
||||||
@ -65,6 +66,8 @@ class ApplicationRepository(ApplicationProperties):
|
|||||||
self.repository.clear_queue()
|
self.repository.clear_queue()
|
||||||
if packages:
|
if packages:
|
||||||
self.repository.clear_packages()
|
self.repository.clear_packages()
|
||||||
|
if pacman:
|
||||||
|
self.repository.clear_pacman()
|
||||||
|
|
||||||
def sign(self, packages: Iterable[str]) -> None:
|
def sign(self, packages: Iterable[str]) -> None:
|
||||||
"""
|
"""
|
||||||
@ -156,17 +159,17 @@ class ApplicationRepository(ApplicationProperties):
|
|||||||
|
|
||||||
return build_result
|
return build_result
|
||||||
|
|
||||||
def updates(self, filter_packages: Iterable[str], no_aur: bool, no_local: bool, no_manual: bool, no_vcs: bool,
|
def updates(self, filter_packages: Iterable[str], *,
|
||||||
log_fn: Callable[[str], None]) -> List[Package]:
|
aur: bool, local: bool, manual: bool, vcs: bool, log_fn: Callable[[str], None]) -> List[Package]:
|
||||||
"""
|
"""
|
||||||
get list of packages to run update process
|
get list of packages to run update process
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
filter_packages(Iterable[str]): do not check every package just specified in the list
|
filter_packages(Iterable[str]): do not check every package just specified in the list
|
||||||
no_aur(bool): do not check for aur updates
|
aur(bool): enable or disable checking for AUR updates
|
||||||
no_local(bool): do not check local packages for updates
|
local(bool): enable or disable checking of local packages for updates
|
||||||
no_manual(bool): do not check for manual updates
|
manual(bool): include or exclude manual updates
|
||||||
no_vcs(bool): do not check VCS packages
|
vcs(bool): enable or disable checking of VCS packages
|
||||||
log_fn(Callable[[str], None]): logger function to log updates
|
log_fn(Callable[[str], None]): logger function to log updates
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -174,11 +177,11 @@ class ApplicationRepository(ApplicationProperties):
|
|||||||
"""
|
"""
|
||||||
updates = {}
|
updates = {}
|
||||||
|
|
||||||
if not no_aur:
|
if aur:
|
||||||
updates.update({package.base: package for package in self.repository.updates_aur(filter_packages, no_vcs)})
|
updates.update({package.base: package for package in self.repository.updates_aur(filter_packages, vcs=vcs)})
|
||||||
if not no_local:
|
if local:
|
||||||
updates.update({package.base: package for package in self.repository.updates_local()})
|
updates.update({package.base: package for package in self.repository.updates_local()})
|
||||||
if not no_manual:
|
if manual:
|
||||||
updates.update({package.base: package for package in self.repository.updates_manual()})
|
updates.update({package.base: package for package in self.repository.updates_manual()})
|
||||||
|
|
||||||
local_versions = {package.base: package.version for package in self.repository.packages()}
|
local_versions = {package.base: package.version for package in self.repository.packages()}
|
||||||
|
@ -32,8 +32,8 @@ class Add(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -41,15 +41,17 @@ class Add(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, no_report, unsafe, args.refresh)
|
application = Application(architecture, configuration,
|
||||||
|
report=report, unsafe=unsafe, refresh_pacman_database=args.refresh)
|
||||||
application.on_start()
|
application.on_start()
|
||||||
application.add(args.package, args.source, args.without_dependencies)
|
application.add(args.package, args.source, args.without_dependencies)
|
||||||
if not args.now:
|
if not args.now:
|
||||||
return
|
return
|
||||||
|
|
||||||
packages = application.updates(args.package, True, True, False, True, application.logger.info)
|
packages = application.updates(args.package, aur=False, local=False, manual=True, vcs=False,
|
||||||
|
log_fn=application.logger.info)
|
||||||
result = application.update(packages)
|
result = application.update(packages)
|
||||||
Add.check_if_empty(args.exit_code, result.is_empty)
|
Add.check_if_empty(args.exit_code, result.is_empty)
|
||||||
|
@ -37,8 +37,8 @@ class Backup(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ class Backup(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
backup_paths = Backup.get_paths(configuration)
|
backup_paths = Backup.get_paths(configuration)
|
||||||
|
@ -32,8 +32,8 @@ class Clean(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -41,9 +41,10 @@ class Clean(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, no_report, unsafe)
|
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
||||||
application.on_start()
|
application.on_start()
|
||||||
application.clean(args.cache, args.chroot, args.manual, args.packages)
|
application.clean(cache=args.cache, chroot=args.chroot, manual=args.manual, packages=args.packages,
|
||||||
|
pacman=args.pacman)
|
||||||
|
@ -32,8 +32,8 @@ class Daemon(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -41,11 +41,12 @@ class Daemon(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
from ahriman.application.handlers import Update
|
from ahriman.application.handlers import Update
|
||||||
Update.run(args, architecture, configuration, no_report, unsafe)
|
Update.run(args, architecture, configuration, report=report, unsafe=unsafe)
|
||||||
timer = threading.Timer(args.interval, Daemon.run, (args, architecture, configuration, no_report, unsafe))
|
timer = threading.Timer(args.interval, Daemon.run, args=[args, architecture, configuration],
|
||||||
|
kwargs={"report": report, "unsafe": unsafe})
|
||||||
timer.start()
|
timer.start()
|
||||||
timer.join()
|
timer.join()
|
||||||
|
@ -34,8 +34,8 @@ class Dump(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False
|
ALLOW_AUTO_ARCHITECTURE_RUN = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ class Dump(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
dump = configuration.dump()
|
dump = configuration.dump()
|
||||||
|
@ -27,7 +27,7 @@ from typing import List, Type
|
|||||||
|
|
||||||
from ahriman.application.lock import Lock
|
from ahriman.application.lock import Lock
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.exceptions import ExitCode, MissingArchitecture, MultipleArchitectures
|
from ahriman.core.exceptions import ExitCode, MissingArchitectureError, MultipleArchitecturesError
|
||||||
from ahriman.models.repository_paths import RepositoryPaths
|
from ahriman.models.repository_paths import RepositoryPaths
|
||||||
|
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ class Handler:
|
|||||||
if not cls.ALLOW_AUTO_ARCHITECTURE_RUN and args.architecture is None:
|
if not cls.ALLOW_AUTO_ARCHITECTURE_RUN and args.architecture is None:
|
||||||
# for some parsers (e.g. config) we need to run with specific architecture
|
# for some parsers (e.g. config) we need to run with specific architecture
|
||||||
# for those cases architecture must be set explicitly
|
# for those cases architecture must be set explicitly
|
||||||
raise MissingArchitecture(args.command)
|
raise MissingArchitectureError(args.command)
|
||||||
if args.architecture: # architecture is specified explicitly
|
if args.architecture: # architecture is specified explicitly
|
||||||
return sorted(set(args.architecture))
|
return sorted(set(args.architecture))
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ class Handler:
|
|||||||
architectures = RepositoryPaths.known_architectures(root)
|
architectures = RepositoryPaths.known_architectures(root)
|
||||||
|
|
||||||
if not architectures: # well we did not find anything
|
if not architectures: # well we did not find anything
|
||||||
raise MissingArchitecture(args.command)
|
raise MissingArchitectureError(args.command)
|
||||||
return sorted(architectures)
|
return sorted(architectures)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -96,7 +96,7 @@ class Handler:
|
|||||||
try:
|
try:
|
||||||
configuration = Configuration.from_path(args.configuration, architecture, args.quiet)
|
configuration = Configuration.from_path(args.configuration, architecture, args.quiet)
|
||||||
with Lock(args, architecture, configuration):
|
with Lock(args, architecture, configuration):
|
||||||
cls.run(args, architecture, configuration, args.no_report, args.unsafe)
|
cls.run(args, architecture, configuration, report=args.report, unsafe=args.unsafe)
|
||||||
return True
|
return True
|
||||||
except ExitCode:
|
except ExitCode:
|
||||||
return False
|
return False
|
||||||
@ -124,7 +124,7 @@ class Handler:
|
|||||||
# actually we do not have to spawn another process if it is single-process application, do we?
|
# actually we do not have to spawn another process if it is single-process application, do we?
|
||||||
if len(architectures) > 1:
|
if len(architectures) > 1:
|
||||||
if not cls.ALLOW_MULTI_ARCHITECTURE_RUN:
|
if not cls.ALLOW_MULTI_ARCHITECTURE_RUN:
|
||||||
raise MultipleArchitectures(args.command)
|
raise MultipleArchitecturesError(args.command)
|
||||||
|
|
||||||
with Pool(len(architectures)) as pool:
|
with Pool(len(architectures)) as pool:
|
||||||
result = pool.starmap(
|
result = pool.starmap(
|
||||||
@ -135,8 +135,8 @@ class Handler:
|
|||||||
return 0 if all(result) else 1
|
return 0 if all(result) else 1
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ class Handler:
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
|
@ -33,8 +33,8 @@ class Help(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ class Help(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
parser: argparse.ArgumentParser = args.parser()
|
parser: argparse.ArgumentParser = args.parser()
|
||||||
|
@ -34,8 +34,8 @@ class KeyImport(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -43,8 +43,8 @@ class KeyImport(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, no_report, unsafe)
|
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
||||||
application.repository.sign.key_import(args.key_server, args.key)
|
application.repository.sign.key_import(args.key_server, args.key)
|
||||||
|
@ -39,8 +39,8 @@ class Patch(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -48,10 +48,10 @@ class Patch(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, no_report, unsafe)
|
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
||||||
application.on_start()
|
application.on_start()
|
||||||
|
|
||||||
if args.action == Action.Update and args.variable is not None:
|
if args.action == Action.Update and args.variable is not None:
|
||||||
|
@ -34,8 +34,8 @@ class Rebuild(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -43,12 +43,12 @@ class Rebuild(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
depends_on = set(args.depends_on) if args.depends_on else None
|
depends_on = set(args.depends_on) if args.depends_on else None
|
||||||
|
|
||||||
application = Application(architecture, configuration, no_report, unsafe)
|
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
||||||
application.on_start()
|
application.on_start()
|
||||||
|
|
||||||
if args.from_database:
|
if args.from_database:
|
||||||
|
@ -32,8 +32,8 @@ class Remove(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -41,9 +41,9 @@ class Remove(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, no_report, unsafe)
|
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
||||||
application.on_start()
|
application.on_start()
|
||||||
application.remove(args.package)
|
application.remove(args.package)
|
||||||
|
@ -33,8 +33,8 @@ class RemoveUnknown(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -42,16 +42,16 @@ class RemoveUnknown(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, no_report, unsafe)
|
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
||||||
application.on_start()
|
application.on_start()
|
||||||
unknown_packages = application.unknown()
|
unknown_packages = application.unknown()
|
||||||
|
|
||||||
if args.dry_run:
|
if args.dry_run:
|
||||||
for package in sorted(unknown_packages):
|
for package in sorted(unknown_packages):
|
||||||
StringPrinter(package).print(args.info)
|
StringPrinter(package).print(False)
|
||||||
return
|
return
|
||||||
|
|
||||||
application.remove(unknown_packages)
|
application.remove(unknown_packages)
|
||||||
|
@ -34,8 +34,8 @@ class Restore(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ class Restore(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
with TarFile(args.path) as archive:
|
with TarFile(args.path) as archive:
|
||||||
|
@ -26,7 +26,7 @@ from ahriman.application.application import Application
|
|||||||
from ahriman.application.handlers import Handler
|
from ahriman.application.handlers import Handler
|
||||||
from ahriman.core.alpm.remote import AUR, Official
|
from ahriman.core.alpm.remote import AUR, Official
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.exceptions import InvalidOption
|
from ahriman.core.exceptions import OptionError
|
||||||
from ahriman.core.formatters import AurPrinter
|
from ahriman.core.formatters import AurPrinter
|
||||||
from ahriman.models.aur_package import AURPackage
|
from ahriman.models.aur_package import AURPackage
|
||||||
|
|
||||||
@ -43,8 +43,8 @@ class Search(Handler):
|
|||||||
SORT_FIELDS = {field.name for field in fields(AURPackage) if field.default_factory is not list}
|
SORT_FIELDS = {field.name for field in fields(AURPackage) if field.default_factory is not list}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -52,10 +52,10 @@ class Search(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, no_report, unsafe)
|
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
||||||
|
|
||||||
official_packages_list = Official.multisearch(*args.search, pacman=application.repository.pacman)
|
official_packages_list = Official.multisearch(*args.search, pacman=application.repository.pacman)
|
||||||
aur_packages_list = AUR.multisearch(*args.search, pacman=application.repository.pacman)
|
aur_packages_list = AUR.multisearch(*args.search, pacman=application.repository.pacman)
|
||||||
@ -82,7 +82,7 @@ class Search(Handler):
|
|||||||
InvalidOption: if search fields is not in list of allowed ones
|
InvalidOption: if search fields is not in list of allowed ones
|
||||||
"""
|
"""
|
||||||
if sort_by not in Search.SORT_FIELDS:
|
if sort_by not in Search.SORT_FIELDS:
|
||||||
raise InvalidOption(sort_by)
|
raise OptionError(sort_by)
|
||||||
# always sort by package name at the last
|
# always sort by package name at the last
|
||||||
# well technically it is not a string, but we can deal with it
|
# well technically it is not a string, but we can deal with it
|
||||||
comparator: Callable[[AURPackage], Tuple[str, str]] =\
|
comparator: Callable[[AURPackage], Tuple[str, str]] =\
|
||||||
|
@ -46,8 +46,8 @@ class Setup(Handler):
|
|||||||
SUDOERS_DIR_PATH = Path("/etc/sudoers.d")
|
SUDOERS_DIR_PATH = Path("/etc/sudoers.d")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -55,19 +55,19 @@ class Setup(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
Setup.configuration_create_ahriman(args, architecture, args.repository, configuration.include,
|
Setup.configuration_create_ahriman(args, architecture, args.repository, configuration.include,
|
||||||
configuration.repository_paths)
|
configuration.repository_paths)
|
||||||
configuration.reload()
|
configuration.reload()
|
||||||
|
|
||||||
application = Application(architecture, configuration, no_report, unsafe)
|
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
||||||
|
|
||||||
Setup.configuration_create_makepkg(args.packager, application.repository.paths)
|
Setup.configuration_create_makepkg(args.packager, application.repository.paths)
|
||||||
Setup.executable_create(application.repository.paths, args.build_command, architecture)
|
Setup.executable_create(application.repository.paths, args.build_command, architecture)
|
||||||
Setup.configuration_create_devtools(args.build_command, architecture, args.from_configuration,
|
Setup.configuration_create_devtools(args.build_command, architecture, args.from_configuration,
|
||||||
args.no_multilib, args.repository, application.repository.paths)
|
args.multilib, args.repository, application.repository.paths)
|
||||||
Setup.configuration_create_sudo(application.repository.paths, args.build_command, architecture)
|
Setup.configuration_create_sudo(application.repository.paths, args.build_command, architecture)
|
||||||
|
|
||||||
application.repository.repo.init()
|
application.repository.repo.init()
|
||||||
@ -124,7 +124,7 @@ class Setup(Handler):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def configuration_create_devtools(prefix: str, architecture: str, source: Path,
|
def configuration_create_devtools(prefix: str, architecture: str, source: Path,
|
||||||
no_multilib: bool, repository: str, paths: RepositoryPaths) -> None:
|
multilib: bool, repository: str, paths: RepositoryPaths) -> None:
|
||||||
"""
|
"""
|
||||||
create configuration for devtools based on ``source`` configuration
|
create configuration for devtools based on ``source`` configuration
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ class Setup(Handler):
|
|||||||
prefix(str): command prefix in {prefix}-{architecture}-build
|
prefix(str): command prefix in {prefix}-{architecture}-build
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
source(Path): path to source configuration file
|
source(Path): path to source configuration file
|
||||||
no_multilib(bool): do not add multilib repository
|
multilib(bool): add or do not multilib repository
|
||||||
repository(str): repository name
|
repository(str): repository name
|
||||||
paths(RepositoryPaths): repository paths instance
|
paths(RepositoryPaths): repository paths instance
|
||||||
"""
|
"""
|
||||||
@ -154,7 +154,7 @@ class Setup(Handler):
|
|||||||
configuration.set_option("options", "Architecture", architecture)
|
configuration.set_option("options", "Architecture", architecture)
|
||||||
|
|
||||||
# add multilib
|
# add multilib
|
||||||
if not no_multilib:
|
if multilib:
|
||||||
configuration.set_option("multilib", "Include", str(Setup.MIRRORLIST_PATH))
|
configuration.set_option("multilib", "Include", str(Setup.MIRRORLIST_PATH))
|
||||||
|
|
||||||
# add repository itself
|
# add repository itself
|
||||||
|
@ -38,8 +38,8 @@ class Shell(Handler):
|
|||||||
ALLOW_MULTI_ARCHITECTURE_RUN = False
|
ALLOW_MULTI_ARCHITECTURE_RUN = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -47,13 +47,16 @@ class Shell(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
# pylint: disable=possibly-unused-variable
|
# pylint: disable=possibly-unused-variable
|
||||||
application = Application(architecture, configuration, no_report, unsafe)
|
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
# licensed by https://creativecommons.org/licenses/by-sa/3.0
|
# licensed by https://creativecommons.org/licenses/by-sa/3.0
|
||||||
path = Path(sys.prefix) / "share" / "ahriman" / "templates" / "shell"
|
path = Path(sys.prefix) / "share" / "ahriman" / "templates" / "shell"
|
||||||
StringPrinter(path.read_text(encoding="utf8")).print(verbose=False)
|
StringPrinter(path.read_text(encoding="utf8")).print(verbose=False)
|
||||||
|
if args.code is None:
|
||||||
code.interact(local=locals())
|
code.interact(local=locals())
|
||||||
|
else:
|
||||||
|
code.InteractiveConsole(locals=locals()).runcode(args.code)
|
||||||
|
@ -32,8 +32,8 @@ class Sign(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ class Sign(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
Application(architecture, configuration, no_report, unsafe).sign(args.package)
|
Application(architecture, configuration, report=report, unsafe=unsafe).sign(args.package)
|
||||||
|
@ -37,8 +37,8 @@ class Status(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False
|
ALLOW_AUTO_ARCHITECTURE_RUN = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -46,11 +46,11 @@ class Status(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
# we are using reporter here
|
# we are using reporter here
|
||||||
client = Application(architecture, configuration, no_report=False, unsafe=unsafe).repository.reporter
|
client = Application(architecture, configuration, report=True, unsafe=unsafe).repository.reporter
|
||||||
if args.ahriman:
|
if args.ahriman:
|
||||||
service_status = client.get_internal()
|
service_status = client.get_internal()
|
||||||
StatusPrinter(service_status.status).print(args.info)
|
StatusPrinter(service_status.status).print(args.info)
|
||||||
|
@ -35,8 +35,8 @@ class StatusUpdate(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False
|
ALLOW_AUTO_ARCHITECTURE_RUN = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -44,11 +44,11 @@ class StatusUpdate(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
# we are using reporter here
|
# we are using reporter here
|
||||||
client = Application(architecture, configuration, no_report=False, unsafe=unsafe).repository.reporter
|
client = Application(architecture, configuration, report=True, unsafe=unsafe).repository.reporter
|
||||||
|
|
||||||
if args.action == Action.Update and args.package:
|
if args.action == Action.Update and args.package:
|
||||||
# update packages statuses
|
# update packages statuses
|
||||||
|
@ -33,8 +33,8 @@ class Triggers(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -42,10 +42,10 @@ class Triggers(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, no_report, unsafe)
|
application = Application(architecture, configuration, report=report, unsafe=unsafe)
|
||||||
if args.trigger:
|
if args.trigger:
|
||||||
loader = application.repository.triggers
|
loader = application.repository.triggers
|
||||||
loader.triggers = [loader.load_trigger(trigger) for trigger in args.trigger]
|
loader.triggers = [loader.load_trigger(trigger) for trigger in args.trigger]
|
||||||
|
@ -35,8 +35,8 @@ class UnsafeCommands(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ class UnsafeCommands(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
parser = args.parser()
|
parser = args.parser()
|
||||||
@ -79,6 +79,7 @@ class UnsafeCommands(Handler):
|
|||||||
Returns:
|
Returns:
|
||||||
List[str]: list of commands with default unsafe flag
|
List[str]: list of commands with default unsafe flag
|
||||||
"""
|
"""
|
||||||
|
# should never fail
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
subparser = next(action for action in parser._actions if isinstance(action, argparse._SubParsersAction))
|
subparser = next(action for action in parser._actions if isinstance(action, argparse._SubParsersAction))
|
||||||
return [action_name for action_name, action in subparser.choices.items() if action.get_default("unsafe")]
|
return [action_name for action_name, action in subparser.choices.items() if action.get_default("unsafe")]
|
||||||
|
@ -32,8 +32,8 @@ class Update(Handler):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -41,13 +41,14 @@ class Update(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
application = Application(architecture, configuration, no_report, unsafe, args.refresh)
|
application = Application(architecture, configuration, report=report, unsafe=unsafe,
|
||||||
|
refresh_pacman_database=args.refresh)
|
||||||
application.on_start()
|
application.on_start()
|
||||||
packages = application.updates(args.package, args.no_aur, args.no_local, args.no_manual, args.no_vcs,
|
packages = application.updates(args.package, aur=args.aur, local=args.local, manual=args.manual, vcs=args.vcs,
|
||||||
Update.log_fn(application, args.dry_run))
|
log_fn=Update.log_fn(application, args.dry_run))
|
||||||
Update.check_if_empty(args.exit_code, not packages)
|
Update.check_if_empty(args.exit_code, not packages)
|
||||||
if args.dry_run:
|
if args.dry_run:
|
||||||
return
|
return
|
||||||
|
@ -39,8 +39,8 @@ class Users(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ class Users(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
database = SQLite.load(configuration)
|
database = SQLite.load(configuration)
|
||||||
|
@ -37,8 +37,8 @@ class Versions(Handler):
|
|||||||
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
ALLOW_AUTO_ARCHITECTURE_RUN = False # it should be called only as "no-architecture"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ class Versions(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
VersionPrinter(f"Module version {version.__version__}",
|
VersionPrinter(f"Module version {version.__version__}",
|
||||||
|
@ -35,8 +35,8 @@ class Web(Handler):
|
|||||||
ALLOW_MULTI_ARCHITECTURE_RUN = False # required to be able to spawn external processes
|
ALLOW_MULTI_ARCHITECTURE_RUN = False # required to be able to spawn external processes
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str,
|
def run(cls: Type[Handler], args: argparse.Namespace, architecture: str, configuration: Configuration, *,
|
||||||
configuration: Configuration, no_report: bool, unsafe: bool) -> None:
|
report: bool, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
callback for command line
|
callback for command line
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ class Web(Handler):
|
|||||||
args(argparse.Namespace): command line args
|
args(argparse.Namespace): command line args
|
||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
"""
|
"""
|
||||||
# we are using local import for optional dependencies
|
# we are using local import for optional dependencies
|
||||||
|
@ -27,7 +27,7 @@ from typing import Literal, Optional, Type
|
|||||||
|
|
||||||
from ahriman import version
|
from ahriman import version
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.exceptions import DuplicateRun
|
from ahriman.core.exceptions import DuplicateRunError
|
||||||
from ahriman.core.lazy_logging import LazyLogging
|
from ahriman.core.lazy_logging import LazyLogging
|
||||||
from ahriman.core.status.client import Client
|
from ahriman.core.status.client import Client
|
||||||
from ahriman.core.util import check_user
|
from ahriman.core.util import check_user
|
||||||
@ -73,7 +73,7 @@ class Lock(LazyLogging):
|
|||||||
self.unsafe = args.unsafe
|
self.unsafe = args.unsafe
|
||||||
|
|
||||||
self.paths = configuration.repository_paths
|
self.paths = configuration.repository_paths
|
||||||
self.reporter = Client() if args.no_report else Client.load(configuration)
|
self.reporter = Client.load(configuration) if args.report else Client()
|
||||||
|
|
||||||
def __enter__(self) -> Lock:
|
def __enter__(self) -> Lock:
|
||||||
"""
|
"""
|
||||||
@ -122,7 +122,7 @@ class Lock(LazyLogging):
|
|||||||
"""
|
"""
|
||||||
check if current user is actually owner of ahriman root
|
check if current user is actually owner of ahriman root
|
||||||
"""
|
"""
|
||||||
check_user(self.paths, self.unsafe)
|
check_user(self.paths, unsafe=self.unsafe)
|
||||||
|
|
||||||
def clear(self) -> None:
|
def clear(self) -> None:
|
||||||
"""
|
"""
|
||||||
@ -144,4 +144,4 @@ class Lock(LazyLogging):
|
|||||||
try:
|
try:
|
||||||
self.path.touch(exist_ok=self.force)
|
self.path.touch(exist_ok=self.force)
|
||||||
except FileExistsError:
|
except FileExistsError:
|
||||||
raise DuplicateRun()
|
raise DuplicateRunError()
|
||||||
|
@ -23,7 +23,7 @@ from typing import Any, Dict, List, Type
|
|||||||
|
|
||||||
from ahriman.core.alpm.pacman import Pacman
|
from ahriman.core.alpm.pacman import Pacman
|
||||||
from ahriman.core.alpm.remote import Remote
|
from ahriman.core.alpm.remote import Remote
|
||||||
from ahriman.core.exceptions import InvalidPackageInfo
|
from ahriman.core.exceptions import PackageInfoError, UnknownPackageError
|
||||||
from ahriman.core.util import exception_response_text
|
from ahriman.core.util import exception_response_text
|
||||||
from ahriman.models.aur_package import AURPackage
|
from ahriman.models.aur_package import AURPackage
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ class AUR(Remote):
|
|||||||
response_type = response["type"]
|
response_type = response["type"]
|
||||||
if response_type == "error":
|
if response_type == "error":
|
||||||
error_details = response.get("error", "Unknown API error")
|
error_details = response.get("error", "Unknown API error")
|
||||||
raise InvalidPackageInfo(error_details)
|
raise PackageInfoError(error_details)
|
||||||
return [AURPackage.from_json(package) for package in response["results"]]
|
return [AURPackage.from_json(package) for package in response["results"]]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -140,7 +140,10 @@ class AUR(Remote):
|
|||||||
AURPackage: package which match the package name
|
AURPackage: package which match the package name
|
||||||
"""
|
"""
|
||||||
packages = self.make_request("info", package_name)
|
packages = self.make_request("info", package_name)
|
||||||
|
try:
|
||||||
return next(package for package in packages if package.name == package_name)
|
return next(package for package in packages if package.name == package_name)
|
||||||
|
except StopIteration:
|
||||||
|
raise UnknownPackageError(package_name)
|
||||||
|
|
||||||
def package_search(self, *keywords: str, pacman: Pacman) -> List[AURPackage]:
|
def package_search(self, *keywords: str, pacman: Pacman) -> List[AURPackage]:
|
||||||
"""
|
"""
|
||||||
|
@ -23,7 +23,7 @@ from typing import Any, Dict, List, Type
|
|||||||
|
|
||||||
from ahriman.core.alpm.pacman import Pacman
|
from ahriman.core.alpm.pacman import Pacman
|
||||||
from ahriman.core.alpm.remote import Remote
|
from ahriman.core.alpm.remote import Remote
|
||||||
from ahriman.core.exceptions import InvalidPackageInfo
|
from ahriman.core.exceptions import PackageInfoError, UnknownPackageError
|
||||||
from ahriman.core.util import exception_response_text
|
from ahriman.core.util import exception_response_text
|
||||||
from ahriman.models.aur_package import AURPackage
|
from ahriman.models.aur_package import AURPackage
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ class Official(Remote):
|
|||||||
InvalidPackageInfo: for error API response
|
InvalidPackageInfo: for error API response
|
||||||
"""
|
"""
|
||||||
if not response["valid"]:
|
if not response["valid"]:
|
||||||
raise InvalidPackageInfo("API validation error")
|
raise PackageInfoError("API validation error")
|
||||||
return [AURPackage.from_repo(package) for package in response["results"]]
|
return [AURPackage.from_repo(package) for package in response["results"]]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -128,7 +128,10 @@ class Official(Remote):
|
|||||||
AURPackage: package which match the package name
|
AURPackage: package which match the package name
|
||||||
"""
|
"""
|
||||||
packages = self.make_request(package_name, by="name")
|
packages = self.make_request(package_name, by="name")
|
||||||
|
try:
|
||||||
return next(package for package in packages if package.name == package_name)
|
return next(package for package in packages if package.name == package_name)
|
||||||
|
except StopIteration:
|
||||||
|
raise UnknownPackageError(package_name)
|
||||||
|
|
||||||
def package_search(self, *keywords: str, pacman: Pacman) -> List[AURPackage]:
|
def package_search(self, *keywords: str, pacman: Pacman) -> List[AURPackage]:
|
||||||
"""
|
"""
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#
|
#
|
||||||
from ahriman.core.alpm.pacman import Pacman
|
from ahriman.core.alpm.pacman import Pacman
|
||||||
from ahriman.core.alpm.remote import Official
|
from ahriman.core.alpm.remote import Official
|
||||||
|
from ahriman.core.exceptions import UnknownPackageError
|
||||||
from ahriman.models.aur_package import AURPackage
|
from ahriman.models.aur_package import AURPackage
|
||||||
|
|
||||||
|
|
||||||
@ -48,4 +49,7 @@ class OfficialSyncdb(Official):
|
|||||||
Returns:
|
Returns:
|
||||||
AURPackage: package which match the package name
|
AURPackage: package which match the package name
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
return next(AURPackage.from_pacman(package) for package in pacman.package_get(package_name))
|
return next(AURPackage.from_pacman(package) for package in pacman.package_get(package_name))
|
||||||
|
except StopIteration:
|
||||||
|
raise UnknownPackageError(package_name)
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from ahriman.core.exceptions import BuildFailed
|
from ahriman.core.exceptions import BuildError
|
||||||
from ahriman.core.lazy_logging import LazyLogging
|
from ahriman.core.lazy_logging import LazyLogging
|
||||||
from ahriman.core.util import check_output
|
from ahriman.core.util import check_output
|
||||||
from ahriman.models.repository_paths import RepositoryPaths
|
from ahriman.models.repository_paths import RepositoryPaths
|
||||||
@ -72,7 +72,7 @@ class Repo(LazyLogging):
|
|||||||
"""
|
"""
|
||||||
Repo._check_output(
|
Repo._check_output(
|
||||||
"repo-add", *self.sign_args, "-R", str(self.repo_path), str(path),
|
"repo-add", *self.sign_args, "-R", str(self.repo_path), str(path),
|
||||||
exception=BuildFailed(path.name),
|
exception=BuildError(path.name),
|
||||||
cwd=self.paths.repository,
|
cwd=self.paths.repository,
|
||||||
logger=self.logger,
|
logger=self.logger,
|
||||||
user=self.uid)
|
user=self.uid)
|
||||||
@ -81,12 +81,8 @@ class Repo(LazyLogging):
|
|||||||
"""
|
"""
|
||||||
create empty repository database
|
create empty repository database
|
||||||
"""
|
"""
|
||||||
Repo._check_output(
|
Repo._check_output("repo-add", *self.sign_args, str(self.repo_path),
|
||||||
"repo-add", *self.sign_args, str(self.repo_path),
|
cwd=self.paths.repository, logger=self.logger, user=self.uid)
|
||||||
exception=None,
|
|
||||||
cwd=self.paths.repository,
|
|
||||||
logger=self.logger,
|
|
||||||
user=self.uid)
|
|
||||||
|
|
||||||
def remove(self, package: str, filename: Path) -> None:
|
def remove(self, package: str, filename: Path) -> None:
|
||||||
"""
|
"""
|
||||||
@ -103,7 +99,7 @@ class Repo(LazyLogging):
|
|||||||
# remove package from registry
|
# remove package from registry
|
||||||
Repo._check_output(
|
Repo._check_output(
|
||||||
"repo-remove", *self.sign_args, str(self.repo_path), package,
|
"repo-remove", *self.sign_args, str(self.repo_path), package,
|
||||||
exception=BuildFailed(package),
|
exception=BuildError(package),
|
||||||
cwd=self.paths.repository,
|
cwd=self.paths.repository,
|
||||||
logger=self.logger,
|
logger=self.logger,
|
||||||
user=self.uid)
|
user=self.uid)
|
||||||
|
@ -24,7 +24,7 @@ from typing import Optional, Type
|
|||||||
from ahriman.core.auth import Mapping
|
from ahriman.core.auth import Mapping
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.database import SQLite
|
from ahriman.core.database import SQLite
|
||||||
from ahriman.core.exceptions import InvalidOption
|
from ahriman.core.exceptions import OptionError
|
||||||
from ahriman.models.auth_settings import AuthSettings
|
from ahriman.models.auth_settings import AuthSettings
|
||||||
|
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ class OAuth(Mapping):
|
|||||||
except TypeError: # what if it is random string?
|
except TypeError: # what if it is random string?
|
||||||
is_oauth2_client = False
|
is_oauth2_client = False
|
||||||
if not is_oauth2_client:
|
if not is_oauth2_client:
|
||||||
raise InvalidOption(name)
|
raise OptionError(name)
|
||||||
return provider
|
return provider
|
||||||
|
|
||||||
def get_client(self) -> aioauth_client.OAuth2Client:
|
def get_client(self) -> aioauth_client.OAuth2Client:
|
||||||
|
@ -82,22 +82,18 @@ class Sources(LazyLogging):
|
|||||||
branch = remote.branch if remote is not None else instance.DEFAULT_BRANCH
|
branch = remote.branch if remote is not None else instance.DEFAULT_BRANCH
|
||||||
if is_initialized_git:
|
if is_initialized_git:
|
||||||
instance.logger.info("update HEAD to remote at %s using branch %s", sources_dir, branch)
|
instance.logger.info("update HEAD to remote at %s using branch %s", sources_dir, branch)
|
||||||
Sources._check_output("git", "fetch", "origin", branch,
|
Sources._check_output("git", "fetch", "origin", branch, cwd=sources_dir, logger=instance.logger)
|
||||||
exception=None, cwd=sources_dir, logger=instance.logger)
|
|
||||||
elif remote is not None:
|
elif remote is not None:
|
||||||
instance.logger.info("clone remote %s to %s using branch %s", remote.git_url, sources_dir, branch)
|
instance.logger.info("clone remote %s to %s using branch %s", remote.git_url, sources_dir, branch)
|
||||||
Sources._check_output("git", "clone", "--branch", branch, "--single-branch",
|
Sources._check_output("git", "clone", "--branch", branch, "--single-branch",
|
||||||
remote.git_url, str(sources_dir),
|
remote.git_url, str(sources_dir), cwd=sources_dir, logger=instance.logger)
|
||||||
exception=None, cwd=sources_dir, logger=instance.logger)
|
|
||||||
else:
|
else:
|
||||||
# it will cause an exception later
|
# it will cause an exception later
|
||||||
instance.logger.error("%s is not initialized, but no remote provided", sources_dir)
|
instance.logger.error("%s is not initialized, but no remote provided", sources_dir)
|
||||||
|
|
||||||
# and now force reset to our branch
|
# and now force reset to our branch
|
||||||
Sources._check_output("git", "checkout", "--force", branch,
|
Sources._check_output("git", "checkout", "--force", branch, cwd=sources_dir, logger=instance.logger)
|
||||||
exception=None, cwd=sources_dir, logger=instance.logger)
|
Sources._check_output("git", "reset", "--hard", f"origin/{branch}", cwd=sources_dir, logger=instance.logger)
|
||||||
Sources._check_output("git", "reset", "--hard", f"origin/{branch}",
|
|
||||||
exception=None, cwd=sources_dir, logger=instance.logger)
|
|
||||||
|
|
||||||
# move content if required
|
# move content if required
|
||||||
# we are using full path to source directory in order to make append possible
|
# we are using full path to source directory in order to make append possible
|
||||||
@ -116,7 +112,7 @@ class Sources(LazyLogging):
|
|||||||
bool: True in case if there is any remote and false otherwise
|
bool: True in case if there is any remote and false otherwise
|
||||||
"""
|
"""
|
||||||
instance = Sources()
|
instance = Sources()
|
||||||
remotes = Sources._check_output("git", "remote", exception=None, cwd=sources_dir, logger=instance.logger)
|
remotes = Sources._check_output("git", "remote", cwd=sources_dir, logger=instance.logger)
|
||||||
return bool(remotes)
|
return bool(remotes)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -129,7 +125,7 @@ class Sources(LazyLogging):
|
|||||||
"""
|
"""
|
||||||
instance = Sources()
|
instance = Sources()
|
||||||
Sources._check_output("git", "init", "--initial-branch", instance.DEFAULT_BRANCH,
|
Sources._check_output("git", "init", "--initial-branch", instance.DEFAULT_BRANCH,
|
||||||
exception=None, cwd=sources_dir, logger=instance.logger)
|
cwd=sources_dir, logger=instance.logger)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def load(sources_dir: Path, package: Package, patches: List[PkgbuildPatch], paths: RepositoryPaths) -> None:
|
def load(sources_dir: Path, package: Package, patches: List[PkgbuildPatch], paths: RepositoryPaths) -> None:
|
||||||
@ -182,8 +178,7 @@ class Sources(LazyLogging):
|
|||||||
instance = Sources()
|
instance = Sources()
|
||||||
instance.add(sources_dir, *pattern)
|
instance.add(sources_dir, *pattern)
|
||||||
instance.commit(sources_dir)
|
instance.commit(sources_dir)
|
||||||
Sources._check_output("git", "push", remote.git_url, remote.branch,
|
Sources._check_output("git", "push", remote.git_url, remote.branch, cwd=sources_dir, logger=instance.logger)
|
||||||
exception=None, cwd=sources_dir, logger=instance.logger)
|
|
||||||
|
|
||||||
def add(self, sources_dir: Path, *pattern: str) -> None:
|
def add(self, sources_dir: Path, *pattern: str) -> None:
|
||||||
"""
|
"""
|
||||||
@ -203,7 +198,7 @@ class Sources(LazyLogging):
|
|||||||
# add them to index
|
# add them to index
|
||||||
Sources._check_output("git", "add", "--intent-to-add",
|
Sources._check_output("git", "add", "--intent-to-add",
|
||||||
*[str(fn.relative_to(sources_dir)) for fn in found_files],
|
*[str(fn.relative_to(sources_dir)) for fn in found_files],
|
||||||
exception=None, cwd=sources_dir, logger=self.logger)
|
cwd=sources_dir, logger=self.logger)
|
||||||
|
|
||||||
def commit(self, sources_dir: Path, commit_message: Optional[str] = None) -> None:
|
def commit(self, sources_dir: Path, commit_message: Optional[str] = None) -> None:
|
||||||
"""
|
"""
|
||||||
@ -217,7 +212,7 @@ class Sources(LazyLogging):
|
|||||||
if commit_message is None:
|
if commit_message is None:
|
||||||
commit_message = f"Autogenerated commit at {datetime.datetime.utcnow()}"
|
commit_message = f"Autogenerated commit at {datetime.datetime.utcnow()}"
|
||||||
Sources._check_output("git", "commit", "--allow-empty", "--message", commit_message,
|
Sources._check_output("git", "commit", "--allow-empty", "--message", commit_message,
|
||||||
exception=None, cwd=sources_dir, logger=self.logger)
|
cwd=sources_dir, logger=self.logger)
|
||||||
|
|
||||||
def diff(self, sources_dir: Path) -> str:
|
def diff(self, sources_dir: Path) -> str:
|
||||||
"""
|
"""
|
||||||
@ -229,7 +224,7 @@ class Sources(LazyLogging):
|
|||||||
Returns:
|
Returns:
|
||||||
str: patch as plain string
|
str: patch as plain string
|
||||||
"""
|
"""
|
||||||
return Sources._check_output("git", "diff", exception=None, cwd=sources_dir, logger=self.logger)
|
return Sources._check_output("git", "diff", cwd=sources_dir, logger=self.logger)
|
||||||
|
|
||||||
def move(self, pkgbuild_dir: Path, sources_dir: Path) -> None:
|
def move(self, pkgbuild_dir: Path, sources_dir: Path) -> None:
|
||||||
"""
|
"""
|
||||||
@ -258,6 +253,6 @@ class Sources(LazyLogging):
|
|||||||
self.logger.info("apply patch %s from database at %s", patch.key, sources_dir)
|
self.logger.info("apply patch %s from database at %s", patch.key, sources_dir)
|
||||||
if patch.is_plain_diff:
|
if patch.is_plain_diff:
|
||||||
Sources._check_output("git", "apply", "--ignore-space-change", "--ignore-whitespace",
|
Sources._check_output("git", "apply", "--ignore-space-change", "--ignore-whitespace",
|
||||||
exception=None, cwd=sources_dir, input_data=patch.serialize(), logger=self.logger)
|
cwd=sources_dir, input_data=patch.serialize(), logger=self.logger)
|
||||||
else:
|
else:
|
||||||
patch.write(sources_dir / "PKGBUILD")
|
patch.write(sources_dir / "PKGBUILD")
|
||||||
|
@ -23,7 +23,7 @@ from typing import List
|
|||||||
from ahriman.core.build_tools.sources import Sources
|
from ahriman.core.build_tools.sources import Sources
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.database import SQLite
|
from ahriman.core.database import SQLite
|
||||||
from ahriman.core.exceptions import BuildFailed
|
from ahriman.core.exceptions import BuildError
|
||||||
from ahriman.core.lazy_logging import LazyLogging
|
from ahriman.core.lazy_logging import LazyLogging
|
||||||
from ahriman.core.util import check_output
|
from ahriman.core.util import check_output
|
||||||
from ahriman.models.package import Package
|
from ahriman.models.package import Package
|
||||||
@ -78,14 +78,14 @@ class Task(LazyLogging):
|
|||||||
|
|
||||||
Task._check_output(
|
Task._check_output(
|
||||||
*command,
|
*command,
|
||||||
exception=BuildFailed(self.package.base),
|
exception=BuildError(self.package.base),
|
||||||
cwd=sources_dir,
|
cwd=sources_dir,
|
||||||
logger=self.logger,
|
logger=self.logger,
|
||||||
user=self.uid)
|
user=self.uid)
|
||||||
|
|
||||||
# well it is not actually correct, but we can deal with it
|
# well it is not actually correct, but we can deal with it
|
||||||
packages = Task._check_output("makepkg", "--packagelist",
|
packages = Task._check_output("makepkg", "--packagelist",
|
||||||
exception=BuildFailed(self.package.base),
|
exception=BuildError(self.package.base),
|
||||||
cwd=sources_dir,
|
cwd=sources_dir,
|
||||||
logger=self.logger).splitlines()
|
logger=self.logger).splitlines()
|
||||||
return [Path(package) for package in packages]
|
return [Path(package) for package in packages]
|
||||||
|
@ -27,7 +27,7 @@ from logging.config import fileConfig
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, Generator, List, Optional, Tuple, Type
|
from typing import Any, Dict, Generator, List, Optional, Tuple, Type
|
||||||
|
|
||||||
from ahriman.core.exceptions import InitializeException
|
from ahriman.core.exceptions import InitializeError
|
||||||
from ahriman.models.repository_paths import RepositoryPaths
|
from ahriman.models.repository_paths import RepositoryPaths
|
||||||
|
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ class Configuration(configparser.RawConfigParser):
|
|||||||
InitializeException: in case if architecture and/or path are not set
|
InitializeException: in case if architecture and/or path are not set
|
||||||
"""
|
"""
|
||||||
if self.path is None or self.architecture is None:
|
if self.path is None or self.architecture is None:
|
||||||
raise InitializeException("Configuration path and/or architecture are not set")
|
raise InitializeError("Configuration path and/or architecture are not set")
|
||||||
return self.path, self.architecture
|
return self.path, self.architecture
|
||||||
|
|
||||||
def dump(self) -> Dict[str, Dict[str, str]]:
|
def dump(self) -> Dict[str, Dict[str, str]]:
|
||||||
|
@ -61,7 +61,7 @@ class Operations(LazyLogging):
|
|||||||
result[column[0]] = row[index]
|
result[column[0]] = row[index]
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def with_connection(self, query: Callable[[sqlite3.Connection], T], commit: bool = False) -> T:
|
def with_connection(self, query: Callable[[sqlite3.Connection], T], *, commit: bool = False) -> T:
|
||||||
"""
|
"""
|
||||||
perform operation in connection
|
perform operation in connection
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ from pathlib import Path
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
class BuildFailed(RuntimeError):
|
class BuildError(RuntimeError):
|
||||||
"""
|
"""
|
||||||
base exception for failed builds
|
base exception for failed builds
|
||||||
"""
|
"""
|
||||||
@ -36,7 +36,7 @@ class BuildFailed(RuntimeError):
|
|||||||
RuntimeError.__init__(self, f"Package {package_base} build failed, check logs for details")
|
RuntimeError.__init__(self, f"Package {package_base} build failed, check logs for details")
|
||||||
|
|
||||||
|
|
||||||
class DuplicateRun(RuntimeError):
|
class DuplicateRunError(RuntimeError):
|
||||||
"""
|
"""
|
||||||
exception which will be raised if there is another application instance
|
exception which will be raised if there is another application instance
|
||||||
"""
|
"""
|
||||||
@ -55,7 +55,13 @@ class ExitCode(RuntimeError):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class GitRemoteFailed(RuntimeError):
|
class ExtensionError(RuntimeError):
|
||||||
|
"""
|
||||||
|
exception being raised by trigger load in case of errors
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class GitRemoteError(RuntimeError):
|
||||||
"""
|
"""
|
||||||
git remote exception
|
git remote exception
|
||||||
"""
|
"""
|
||||||
@ -67,7 +73,7 @@ class GitRemoteFailed(RuntimeError):
|
|||||||
RuntimeError.__init__(self, "Git remote failed")
|
RuntimeError.__init__(self, "Git remote failed")
|
||||||
|
|
||||||
|
|
||||||
class InitializeException(RuntimeError):
|
class InitializeError(RuntimeError):
|
||||||
"""
|
"""
|
||||||
base service initialization exception
|
base service initialization exception
|
||||||
"""
|
"""
|
||||||
@ -82,58 +88,6 @@ class InitializeException(RuntimeError):
|
|||||||
RuntimeError.__init__(self, f"Could not load service: {details}")
|
RuntimeError.__init__(self, f"Could not load service: {details}")
|
||||||
|
|
||||||
|
|
||||||
class InvalidExtension(RuntimeError):
|
|
||||||
"""
|
|
||||||
exception being raised by trigger load in case of errors
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class InvalidOption(ValueError):
|
|
||||||
"""
|
|
||||||
exception which will be raised on configuration errors
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, value: Any) -> None:
|
|
||||||
"""
|
|
||||||
default constructor
|
|
||||||
|
|
||||||
Args:
|
|
||||||
value(Any): option value
|
|
||||||
"""
|
|
||||||
ValueError.__init__(self, f"Invalid or unknown option value `{value}`")
|
|
||||||
|
|
||||||
|
|
||||||
class InvalidPath(ValueError):
|
|
||||||
"""
|
|
||||||
exception which will be raised on path which is not belong to root directory
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, path: Path, root: Path) -> None:
|
|
||||||
"""
|
|
||||||
default constructor
|
|
||||||
|
|
||||||
Args:
|
|
||||||
path(Path): path which raised an exception
|
|
||||||
root(Path): repository root (i.e. ahriman home)
|
|
||||||
"""
|
|
||||||
ValueError.__init__(self, f"Path `{path}` does not belong to repository root `{root}`")
|
|
||||||
|
|
||||||
|
|
||||||
class InvalidPackageInfo(RuntimeError):
|
|
||||||
"""
|
|
||||||
exception which will be raised on package load errors
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, details: Any) -> None:
|
|
||||||
"""
|
|
||||||
default constructor
|
|
||||||
|
|
||||||
Args:
|
|
||||||
details(Any): error details
|
|
||||||
"""
|
|
||||||
RuntimeError.__init__(self, f"There are errors during reading package information: `{details}`")
|
|
||||||
|
|
||||||
|
|
||||||
class MigrationError(RuntimeError):
|
class MigrationError(RuntimeError):
|
||||||
"""
|
"""
|
||||||
exception which will be raised on migration error
|
exception which will be raised on migration error
|
||||||
@ -149,7 +103,7 @@ class MigrationError(RuntimeError):
|
|||||||
RuntimeError.__init__(self, details)
|
RuntimeError.__init__(self, details)
|
||||||
|
|
||||||
|
|
||||||
class MissingArchitecture(ValueError):
|
class MissingArchitectureError(ValueError):
|
||||||
"""
|
"""
|
||||||
exception which will be raised if architecture is required, but missing
|
exception which will be raised if architecture is required, but missing
|
||||||
"""
|
"""
|
||||||
@ -164,7 +118,7 @@ class MissingArchitecture(ValueError):
|
|||||||
ValueError.__init__(self, f"Architecture required for subcommand {command}, but missing")
|
ValueError.__init__(self, f"Architecture required for subcommand {command}, but missing")
|
||||||
|
|
||||||
|
|
||||||
class MultipleArchitectures(ValueError):
|
class MultipleArchitecturesError(ValueError):
|
||||||
"""
|
"""
|
||||||
exception which will be raised if multiple architectures are not supported by the handler
|
exception which will be raised if multiple architectures are not supported by the handler
|
||||||
"""
|
"""
|
||||||
@ -179,7 +133,53 @@ class MultipleArchitectures(ValueError):
|
|||||||
ValueError.__init__(self, f"Multiple architectures are not supported by subcommand {command}")
|
ValueError.__init__(self, f"Multiple architectures are not supported by subcommand {command}")
|
||||||
|
|
||||||
|
|
||||||
class ReportFailed(RuntimeError):
|
class OptionError(ValueError):
|
||||||
|
"""
|
||||||
|
exception which will be raised on configuration errors
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, value: Any) -> None:
|
||||||
|
"""
|
||||||
|
default constructor
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value(Any): option value
|
||||||
|
"""
|
||||||
|
ValueError.__init__(self, f"Invalid or unknown option value `{value}`")
|
||||||
|
|
||||||
|
|
||||||
|
class PackageInfoError(RuntimeError):
|
||||||
|
"""
|
||||||
|
exception which will be raised on package load errors
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, details: Any) -> None:
|
||||||
|
"""
|
||||||
|
default constructor
|
||||||
|
|
||||||
|
Args:
|
||||||
|
details(Any): error details
|
||||||
|
"""
|
||||||
|
RuntimeError.__init__(self, f"There are errors during reading package information: `{details}`")
|
||||||
|
|
||||||
|
|
||||||
|
class PathError(ValueError):
|
||||||
|
"""
|
||||||
|
exception which will be raised on path which is not belong to root directory
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, path: Path, root: Path) -> None:
|
||||||
|
"""
|
||||||
|
default constructor
|
||||||
|
|
||||||
|
Args:
|
||||||
|
path(Path): path which raised an exception
|
||||||
|
root(Path): repository root (i.e. ahriman home)
|
||||||
|
"""
|
||||||
|
ValueError.__init__(self, f"Path `{path}` does not belong to repository root `{root}`")
|
||||||
|
|
||||||
|
|
||||||
|
class ReportError(RuntimeError):
|
||||||
"""
|
"""
|
||||||
report generation exception
|
report generation exception
|
||||||
"""
|
"""
|
||||||
@ -191,22 +191,7 @@ class ReportFailed(RuntimeError):
|
|||||||
RuntimeError.__init__(self, "Report failed")
|
RuntimeError.__init__(self, "Report failed")
|
||||||
|
|
||||||
|
|
||||||
class SuccessFailed(ValueError):
|
class SynchronizationError(RuntimeError):
|
||||||
"""
|
|
||||||
exception for merging invalid statues
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, package_base: str) -> None:
|
|
||||||
"""
|
|
||||||
default constructor
|
|
||||||
|
|
||||||
Args:
|
|
||||||
package_base(str): package base name
|
|
||||||
"""
|
|
||||||
ValueError.__init__(self, f"Package base {package_base} had status failed, but new status is success")
|
|
||||||
|
|
||||||
|
|
||||||
class SyncFailed(RuntimeError):
|
|
||||||
"""
|
"""
|
||||||
remote synchronization exception
|
remote synchronization exception
|
||||||
"""
|
"""
|
||||||
@ -218,7 +203,7 @@ class SyncFailed(RuntimeError):
|
|||||||
RuntimeError.__init__(self, "Sync failed")
|
RuntimeError.__init__(self, "Sync failed")
|
||||||
|
|
||||||
|
|
||||||
class UnknownPackage(ValueError):
|
class UnknownPackageError(ValueError):
|
||||||
"""
|
"""
|
||||||
exception for status watcher which will be thrown on unknown package
|
exception for status watcher which will be thrown on unknown package
|
||||||
"""
|
"""
|
||||||
@ -233,7 +218,22 @@ class UnknownPackage(ValueError):
|
|||||||
ValueError.__init__(self, f"Package base {package_base} is unknown")
|
ValueError.__init__(self, f"Package base {package_base} is unknown")
|
||||||
|
|
||||||
|
|
||||||
class UnsafeRun(RuntimeError):
|
class UnprocessedPackageStatusError(ValueError):
|
||||||
|
"""
|
||||||
|
exception for merging invalid statues
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, package_base: str) -> None:
|
||||||
|
"""
|
||||||
|
default constructor
|
||||||
|
|
||||||
|
Args:
|
||||||
|
package_base(str): package base name
|
||||||
|
"""
|
||||||
|
ValueError.__init__(self, f"Package base {package_base} had status failed, but new status is success")
|
||||||
|
|
||||||
|
|
||||||
|
class UnsafeRunError(RuntimeError):
|
||||||
"""
|
"""
|
||||||
exception which will be raised in case if user is not owner of repository
|
exception which will be raised in case if user is not owner of repository
|
||||||
"""
|
"""
|
||||||
|
@ -24,7 +24,7 @@ from tempfile import TemporaryDirectory
|
|||||||
|
|
||||||
from ahriman.core.build_tools.sources import Sources
|
from ahriman.core.build_tools.sources import Sources
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.exceptions import GitRemoteFailed
|
from ahriman.core.exceptions import GitRemoteError
|
||||||
from ahriman.core.lazy_logging import LazyLogging
|
from ahriman.core.lazy_logging import LazyLogging
|
||||||
from ahriman.core.util import walk
|
from ahriman.core.util import walk
|
||||||
from ahriman.models.package_source import PackageSource
|
from ahriman.models.package_source import PackageSource
|
||||||
@ -87,4 +87,4 @@ class RemotePull(LazyLogging):
|
|||||||
self.repo_clone()
|
self.repo_clone()
|
||||||
except Exception:
|
except Exception:
|
||||||
self.logger.exception("git pull failed")
|
self.logger.exception("git pull failed")
|
||||||
raise GitRemoteFailed()
|
raise GitRemoteError()
|
||||||
|
@ -25,7 +25,7 @@ from typing import Generator
|
|||||||
|
|
||||||
from ahriman.core.build_tools.sources import Sources
|
from ahriman.core.build_tools.sources import Sources
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.exceptions import GitRemoteFailed
|
from ahriman.core.exceptions import GitRemoteError
|
||||||
from ahriman.core.lazy_logging import LazyLogging
|
from ahriman.core.lazy_logging import LazyLogging
|
||||||
from ahriman.models.package import Package
|
from ahriman.models.package import Package
|
||||||
from ahriman.models.package_source import PackageSource
|
from ahriman.models.package_source import PackageSource
|
||||||
@ -110,4 +110,4 @@ class RemotePush(LazyLogging):
|
|||||||
Sources.push(clone_dir, self.remote_source, *RemotePush.packages_update(result, clone_dir))
|
Sources.push(clone_dir, self.remote_source, *RemotePush.packages_update(result, clone_dir))
|
||||||
except Exception:
|
except Exception:
|
||||||
self.logger.exception("git push failed")
|
self.logger.exception("git push failed")
|
||||||
raise GitRemoteFailed()
|
raise GitRemoteError()
|
||||||
|
@ -22,7 +22,7 @@ from __future__ import annotations
|
|||||||
from typing import Iterable, Type
|
from typing import Iterable, Type
|
||||||
|
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.exceptions import ReportFailed
|
from ahriman.core.exceptions import ReportError
|
||||||
from ahriman.core.lazy_logging import LazyLogging
|
from ahriman.core.lazy_logging import LazyLogging
|
||||||
from ahriman.models.package import Package
|
from ahriman.models.package import Package
|
||||||
from ahriman.models.report_settings import ReportSettings
|
from ahriman.models.report_settings import ReportSettings
|
||||||
@ -121,4 +121,4 @@ class Report(LazyLogging):
|
|||||||
self.generate(packages, result)
|
self.generate(packages, result)
|
||||||
except Exception:
|
except Exception:
|
||||||
self.logger.exception("report generation failed")
|
self.logger.exception("report generation failed")
|
||||||
raise ReportFailed()
|
raise ReportError()
|
||||||
|
@ -66,6 +66,14 @@ class Cleaner(RepositoryProperties):
|
|||||||
for package in self.packages_built():
|
for package in self.packages_built():
|
||||||
package.unlink()
|
package.unlink()
|
||||||
|
|
||||||
|
def clear_pacman(self) -> None:
|
||||||
|
"""
|
||||||
|
clear directory with pacman databases
|
||||||
|
"""
|
||||||
|
self.logger.info("clear pacman database directory")
|
||||||
|
for pacman in self.paths.pacman.iterdir():
|
||||||
|
shutil.rmtree(pacman)
|
||||||
|
|
||||||
def clear_queue(self) -> None:
|
def clear_queue(self) -> None:
|
||||||
"""
|
"""
|
||||||
clear packages which were queued for the update
|
clear packages which were queued for the update
|
||||||
|
@ -21,7 +21,7 @@ import shutil
|
|||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from tempfile import TemporaryDirectory
|
from tempfile import TemporaryDirectory
|
||||||
from typing import Iterable, List, Optional, Set
|
from typing import Iterable, List, Optional
|
||||||
|
|
||||||
from ahriman.core.build_tools.task import Task
|
from ahriman.core.build_tools.task import Task
|
||||||
from ahriman.core.repository.cleaner import Cleaner
|
from ahriman.core.repository.cleaner import Cleaner
|
||||||
@ -187,8 +187,12 @@ class Executor(Cleaner):
|
|||||||
self.reporter.set_success(local)
|
self.reporter.set_success(local)
|
||||||
result.add_success(local)
|
result.add_success(local)
|
||||||
|
|
||||||
current_package_archives: Set[str] = next(
|
current_package_archives = {
|
||||||
(set(current.packages) for current in current_packages if current.base == local.base), set())
|
package
|
||||||
|
for current in current_packages
|
||||||
|
if current.base == local.base
|
||||||
|
for package in current.packages
|
||||||
|
}
|
||||||
removed_packages.extend(current_package_archives.difference(local.packages))
|
removed_packages.extend(current_package_archives.difference(local.packages))
|
||||||
except Exception:
|
except Exception:
|
||||||
self.reporter.set_failed(local.base)
|
self.reporter.set_failed(local.base)
|
||||||
|
@ -39,7 +39,7 @@ class Repository(Executor, UpdateHandler):
|
|||||||
>>>
|
>>>
|
||||||
>>> configuration = Configuration()
|
>>> configuration = Configuration()
|
||||||
>>> database = SQLite.load(configuration)
|
>>> database = SQLite.load(configuration)
|
||||||
>>> repository = Repository("x86_64", configuration, database, no_report=False, unsafe=False)
|
>>> repository = Repository("x86_64", configuration, database, report=True, unsafe=False)
|
||||||
>>> known_packages = repository.packages()
|
>>> known_packages = repository.packages()
|
||||||
>>>
|
>>>
|
||||||
>>> build_result = repository.process_build(known_packages)
|
>>> build_result = repository.process_build(known_packages)
|
||||||
|
@ -21,7 +21,7 @@ from ahriman.core.alpm.pacman import Pacman
|
|||||||
from ahriman.core.alpm.repo import Repo
|
from ahriman.core.alpm.repo import Repo
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.database import SQLite
|
from ahriman.core.database import SQLite
|
||||||
from ahriman.core.exceptions import UnsafeRun
|
from ahriman.core.exceptions import UnsafeRunError
|
||||||
from ahriman.core.lazy_logging import LazyLogging
|
from ahriman.core.lazy_logging import LazyLogging
|
||||||
from ahriman.core.sign.gpg import GPG
|
from ahriman.core.sign.gpg import GPG
|
||||||
from ahriman.core.status.client import Client
|
from ahriman.core.status.client import Client
|
||||||
@ -47,8 +47,8 @@ class RepositoryProperties(LazyLogging):
|
|||||||
triggers(TriggerLoader): triggers holder
|
triggers(TriggerLoader): triggers holder
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, architecture: str, configuration: Configuration, database: SQLite,
|
def __init__(self, architecture: str, configuration: Configuration, database: SQLite, *,
|
||||||
no_report: bool, unsafe: bool, refresh_pacman_database: int = 0) -> None:
|
report: bool, unsafe: bool, refresh_pacman_database: int = 0) -> None:
|
||||||
"""
|
"""
|
||||||
default constructor
|
default constructor
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ class RepositoryProperties(LazyLogging):
|
|||||||
architecture(str): repository architecture
|
architecture(str): repository architecture
|
||||||
configuration(Configuration): configuration instance
|
configuration(Configuration): configuration instance
|
||||||
database(SQLite): database instance
|
database(SQLite): database instance
|
||||||
no_report(bool): force disable reporting
|
report(bool): force enable or disable reporting
|
||||||
unsafe(bool): if set no user check will be performed before path creation
|
unsafe(bool): if set no user check will be performed before path creation
|
||||||
refresh_pacman_database(int): pacman database syncronization level, ``0`` is disabled
|
refresh_pacman_database(int): pacman database syncronization level, ``0`` is disabled
|
||||||
"""
|
"""
|
||||||
@ -68,14 +68,14 @@ class RepositoryProperties(LazyLogging):
|
|||||||
|
|
||||||
self.paths = configuration.repository_paths
|
self.paths = configuration.repository_paths
|
||||||
try:
|
try:
|
||||||
check_user(self.paths, unsafe)
|
check_user(self.paths, unsafe=unsafe)
|
||||||
self.paths.tree_create()
|
self.paths.tree_create()
|
||||||
except UnsafeRun:
|
except UnsafeRunError:
|
||||||
self.logger.warning("root owner differs from the current user, skipping tree creation")
|
self.logger.warning("root owner differs from the current user, skipping tree creation")
|
||||||
|
|
||||||
self.ignore_list = configuration.getlist("build", "ignore_packages", fallback=[])
|
self.ignore_list = configuration.getlist("build", "ignore_packages", fallback=[])
|
||||||
self.pacman = Pacman(architecture, configuration, refresh_database=refresh_pacman_database)
|
self.pacman = Pacman(architecture, configuration, refresh_database=refresh_pacman_database)
|
||||||
self.sign = GPG(architecture, configuration)
|
self.sign = GPG(architecture, configuration)
|
||||||
self.repo = Repo(self.name, self.paths, self.sign.repository_sign_args)
|
self.repo = Repo(self.name, self.paths, self.sign.repository_sign_args)
|
||||||
self.reporter = Client() if no_report else Client.load(configuration)
|
self.reporter = Client.load(configuration) if report else Client()
|
||||||
self.triggers = TriggerLoader(architecture, configuration)
|
self.triggers = TriggerLoader(architecture, configuration)
|
||||||
|
@ -42,13 +42,13 @@ class UpdateHandler(Cleaner):
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def updates_aur(self, filter_packages: Iterable[str], no_vcs: bool) -> List[Package]:
|
def updates_aur(self, filter_packages: Iterable[str], *, vcs: bool) -> List[Package]:
|
||||||
"""
|
"""
|
||||||
check AUR for updates
|
check AUR for updates
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
filter_packages(Iterable[str]): do not check every package just specified in the list
|
filter_packages(Iterable[str]): do not check every package just specified in the list
|
||||||
no_vcs(bool): do not check VCS packages
|
vcs(bool): enable or disable checking of VCS packages
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
List[Package]: list of packages which are out-of-dated
|
List[Package]: list of packages which are out-of-dated
|
||||||
@ -58,7 +58,7 @@ class UpdateHandler(Cleaner):
|
|||||||
for local in self.packages():
|
for local in self.packages():
|
||||||
if local.base in self.ignore_list:
|
if local.base in self.ignore_list:
|
||||||
continue
|
continue
|
||||||
if local.is_vcs and no_vcs:
|
if local.is_vcs and not vcs:
|
||||||
continue
|
continue
|
||||||
if filter_packages and local.base not in filter_packages:
|
if filter_packages and local.base not in filter_packages:
|
||||||
continue
|
continue
|
||||||
|
@ -23,7 +23,7 @@ from pathlib import Path
|
|||||||
from typing import List, Optional, Set, Tuple
|
from typing import List, Optional, Set, Tuple
|
||||||
|
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.exceptions import BuildFailed
|
from ahriman.core.exceptions import BuildError
|
||||||
from ahriman.core.lazy_logging import LazyLogging
|
from ahriman.core.lazy_logging import LazyLogging
|
||||||
from ahriman.core.util import check_output, exception_response_text
|
from ahriman.core.util import check_output, exception_response_text
|
||||||
from ahriman.models.sign_settings import SignSettings
|
from ahriman.models.sign_settings import SignSettings
|
||||||
@ -138,7 +138,7 @@ class GPG(LazyLogging):
|
|||||||
key(str): key ID to import
|
key(str): key ID to import
|
||||||
"""
|
"""
|
||||||
key_body = self.key_download(server, key)
|
key_body = self.key_download(server, key)
|
||||||
GPG._check_output("gpg", "--import", input_data=key_body, exception=None, logger=self.logger)
|
GPG._check_output("gpg", "--import", input_data=key_body, logger=self.logger)
|
||||||
|
|
||||||
def process(self, path: Path, key: str) -> List[Path]:
|
def process(self, path: Path, key: str) -> List[Path]:
|
||||||
"""
|
"""
|
||||||
@ -153,7 +153,7 @@ class GPG(LazyLogging):
|
|||||||
"""
|
"""
|
||||||
GPG._check_output(
|
GPG._check_output(
|
||||||
*GPG.sign_command(path, key),
|
*GPG.sign_command(path, key),
|
||||||
exception=BuildFailed(path.name),
|
exception=BuildError(path.name),
|
||||||
logger=self.logger)
|
logger=self.logger)
|
||||||
return [path, path.parent / f"{path.name}.sig"]
|
return [path, path.parent / f"{path.name}.sig"]
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ class Spawn(Thread, LazyLogging):
|
|||||||
result = callback(args, architecture)
|
result = callback(args, architecture)
|
||||||
queue.put((process_id, result))
|
queue.put((process_id, result))
|
||||||
|
|
||||||
def packages_add(self, packages: Iterable[str], now: bool) -> None:
|
def packages_add(self, packages: Iterable[str], *, now: bool) -> None:
|
||||||
"""
|
"""
|
||||||
add packages
|
add packages
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ from typing import Dict, List, Optional, Tuple
|
|||||||
|
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.database import SQLite
|
from ahriman.core.database import SQLite
|
||||||
from ahriman.core.exceptions import UnknownPackage
|
from ahriman.core.exceptions import UnknownPackageError
|
||||||
from ahriman.core.lazy_logging import LazyLogging
|
from ahriman.core.lazy_logging import LazyLogging
|
||||||
from ahriman.core.repository import Repository
|
from ahriman.core.repository import Repository
|
||||||
from ahriman.models.build_status import BuildStatus, BuildStatusEnum
|
from ahriman.models.build_status import BuildStatus, BuildStatusEnum
|
||||||
@ -52,7 +52,7 @@ class Watcher(LazyLogging):
|
|||||||
"""
|
"""
|
||||||
self.architecture = architecture
|
self.architecture = architecture
|
||||||
self.database = database
|
self.database = database
|
||||||
self.repository = Repository(architecture, configuration, database, no_report=True, unsafe=False)
|
self.repository = Repository(architecture, configuration, database, report=False, unsafe=False)
|
||||||
|
|
||||||
self.known: Dict[str, Tuple[Package, BuildStatus]] = {}
|
self.known: Dict[str, Tuple[Package, BuildStatus]] = {}
|
||||||
self.status = BuildStatus()
|
self.status = BuildStatus()
|
||||||
@ -83,7 +83,7 @@ class Watcher(LazyLogging):
|
|||||||
try:
|
try:
|
||||||
return self.known[base]
|
return self.known[base]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise UnknownPackage(base)
|
raise UnknownPackageError(base)
|
||||||
|
|
||||||
def load(self) -> None:
|
def load(self) -> None:
|
||||||
"""
|
"""
|
||||||
@ -127,7 +127,7 @@ class Watcher(LazyLogging):
|
|||||||
try:
|
try:
|
||||||
package, _ = self.known[package_base]
|
package, _ = self.known[package_base]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise UnknownPackage(package_base)
|
raise UnknownPackageError(package_base)
|
||||||
full_status = BuildStatus(status)
|
full_status = BuildStatus(status)
|
||||||
self.known[package_base] = (package, full_status)
|
self.known[package_base] = (package, full_status)
|
||||||
self.database.package_update(package, full_status)
|
self.database.package_update(package, full_status)
|
||||||
|
@ -110,7 +110,7 @@ class Tree:
|
|||||||
>>>
|
>>>
|
||||||
>>> configuration = Configuration()
|
>>> configuration = Configuration()
|
||||||
>>> database = SQLite.load(configuration)
|
>>> database = SQLite.load(configuration)
|
||||||
>>> repository = Repository("x86_64", configuration, database, no_report=False, unsafe=False)
|
>>> repository = Repository("x86_64", configuration, database, report=True, unsafe=False)
|
||||||
>>> packages = repository.packages()
|
>>> packages = repository.packages()
|
||||||
>>>
|
>>>
|
||||||
>>> tree = Tree.load(packages, configuration.repository_paths, database)
|
>>> tree = Tree.load(packages, configuration.repository_paths, database)
|
||||||
|
@ -26,7 +26,7 @@ from types import ModuleType
|
|||||||
from typing import Generator, Iterable
|
from typing import Generator, Iterable
|
||||||
|
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.exceptions import InvalidExtension
|
from ahriman.core.exceptions import ExtensionError
|
||||||
from ahriman.core.lazy_logging import LazyLogging
|
from ahriman.core.lazy_logging import LazyLogging
|
||||||
from ahriman.core.triggers import Trigger
|
from ahriman.core.triggers import Trigger
|
||||||
from ahriman.models.package import Package
|
from ahriman.models.package import Package
|
||||||
@ -136,7 +136,7 @@ class TriggerLoader(LazyLogging):
|
|||||||
try:
|
try:
|
||||||
return importlib.import_module(package)
|
return importlib.import_module(package)
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
raise InvalidExtension(f"Module {package} not found")
|
raise ExtensionError(f"Module {package} not found")
|
||||||
|
|
||||||
def load_trigger(self, module_path: str) -> Trigger:
|
def load_trigger(self, module_path: str) -> Trigger:
|
||||||
"""
|
"""
|
||||||
@ -163,15 +163,15 @@ class TriggerLoader(LazyLogging):
|
|||||||
|
|
||||||
trigger_type = getattr(module, class_name, None)
|
trigger_type = getattr(module, class_name, None)
|
||||||
if not isinstance(trigger_type, type):
|
if not isinstance(trigger_type, type):
|
||||||
raise InvalidExtension(f"{class_name} of {package_or_path} is not a type")
|
raise ExtensionError(f"{class_name} of {package_or_path} is not a type")
|
||||||
self.logger.info("loaded type %s of package %s", class_name, package_or_path)
|
self.logger.info("loaded type %s of package %s", class_name, package_or_path)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
trigger = trigger_type(self.architecture, self.configuration)
|
trigger = trigger_type(self.architecture, self.configuration)
|
||||||
except Exception:
|
except Exception:
|
||||||
raise InvalidExtension(f"Could not load instance of trigger from {class_name} of {package_or_path}")
|
raise ExtensionError(f"Could not load instance of trigger from {class_name} of {package_or_path}")
|
||||||
if not isinstance(trigger, Trigger):
|
if not isinstance(trigger, Trigger):
|
||||||
raise InvalidExtension(f"Class {class_name} of {package_or_path} is not a Trigger")
|
raise ExtensionError(f"Class {class_name} of {package_or_path} is not a Trigger")
|
||||||
|
|
||||||
return trigger
|
return trigger
|
||||||
|
|
||||||
|
@ -58,4 +58,4 @@ class Rsync(Upload):
|
|||||||
path(Path): local path to sync
|
path(Path): local path to sync
|
||||||
built_packages(Iterable[Package]): list of packages which has just been built
|
built_packages(Iterable[Package]): list of packages which has just been built
|
||||||
"""
|
"""
|
||||||
Rsync._check_output(*self.command, str(path), self.remote, exception=None, logger=self.logger)
|
Rsync._check_output(*self.command, str(path), self.remote, logger=self.logger)
|
||||||
|
@ -23,7 +23,7 @@ from pathlib import Path
|
|||||||
from typing import Iterable, Type
|
from typing import Iterable, Type
|
||||||
|
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.exceptions import SyncFailed
|
from ahriman.core.exceptions import SynchronizationError
|
||||||
from ahriman.core.lazy_logging import LazyLogging
|
from ahriman.core.lazy_logging import LazyLogging
|
||||||
from ahriman.models.package import Package
|
from ahriman.models.package import Package
|
||||||
from ahriman.models.upload_settings import UploadSettings
|
from ahriman.models.upload_settings import UploadSettings
|
||||||
@ -108,7 +108,7 @@ class Upload(LazyLogging):
|
|||||||
self.sync(path, built_packages)
|
self.sync(path, built_packages)
|
||||||
except Exception:
|
except Exception:
|
||||||
self.logger.exception("remote sync failed")
|
self.logger.exception("remote sync failed")
|
||||||
raise SyncFailed()
|
raise SynchronizationError()
|
||||||
|
|
||||||
def sync(self, path: Path, built_packages: Iterable[Package]) -> None:
|
def sync(self, path: Path, built_packages: Iterable[Package]) -> None:
|
||||||
"""
|
"""
|
||||||
|
@ -29,7 +29,7 @@ from logging import Logger
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, Generator, IO, Iterable, List, Optional, Type, Union
|
from typing import Any, Dict, Generator, IO, Iterable, List, Optional, Type, Union
|
||||||
|
|
||||||
from ahriman.core.exceptions import InvalidOption, UnsafeRun
|
from ahriman.core.exceptions import OptionError, UnsafeRunError
|
||||||
from ahriman.models.repository_paths import RepositoryPaths
|
from ahriman.models.repository_paths import RepositoryPaths
|
||||||
|
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ __all__ = ["check_output", "check_user", "exception_response_text", "filter_json
|
|||||||
"package_like", "pretty_datetime", "pretty_size", "safe_filename", "walk"]
|
"package_like", "pretty_datetime", "pretty_size", "safe_filename", "walk"]
|
||||||
|
|
||||||
|
|
||||||
def check_output(*args: str, exception: Optional[Exception], cwd: Optional[Path] = None,
|
def check_output(*args: str, exception: Optional[Exception] = None, cwd: Optional[Path] = None,
|
||||||
input_data: Optional[str] = None, logger: Optional[Logger] = None, user: Optional[int] = None) -> str:
|
input_data: Optional[str] = None, logger: Optional[Logger] = None, user: Optional[int] = None) -> str:
|
||||||
"""
|
"""
|
||||||
subprocess wrapper
|
subprocess wrapper
|
||||||
@ -59,7 +59,7 @@ def check_output(*args: str, exception: Optional[Exception], cwd: Optional[Path]
|
|||||||
Examples:
|
Examples:
|
||||||
Simply call the function::
|
Simply call the function::
|
||||||
|
|
||||||
>>> check_output("echo", "hello world", exception=None)
|
>>> check_output("echo", "hello world")
|
||||||
|
|
||||||
The more complicated calls which include result logging and input data are also possible::
|
The more complicated calls which include result logging and input data are also possible::
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ def check_output(*args: str, exception: Optional[Exception], cwd: Optional[Path]
|
|||||||
>>>
|
>>>
|
||||||
>>> logger = logging.getLogger()
|
>>> logger = logging.getLogger()
|
||||||
>>> check_output("python", "-c", "greeting = input('say hello: '); print(); print(greeting)",
|
>>> check_output("python", "-c", "greeting = input('say hello: '); print(); print(greeting)",
|
||||||
>>> exception=None, input_data="hello world", logger=logger)
|
>>> input_data="hello world", logger=logger)
|
||||||
|
|
||||||
An additional argument ``exception`` can be supplied in order to override the default exception::
|
An additional argument ``exception`` can be supplied in order to override the default exception::
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ def check_output(*args: str, exception: Optional[Exception], cwd: Optional[Path]
|
|||||||
return "\n".join(result)
|
return "\n".join(result)
|
||||||
|
|
||||||
|
|
||||||
def check_user(paths: RepositoryPaths, unsafe: bool) -> None:
|
def check_user(paths: RepositoryPaths, *, unsafe: bool) -> None:
|
||||||
"""
|
"""
|
||||||
check if current user is the owner of the root
|
check if current user is the owner of the root
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ def check_user(paths: RepositoryPaths, unsafe: bool) -> None:
|
|||||||
current_uid = os.getuid()
|
current_uid = os.getuid()
|
||||||
root_uid, _ = paths.root_owner
|
root_uid, _ = paths.root_owner
|
||||||
if current_uid != root_uid:
|
if current_uid != root_uid:
|
||||||
raise UnsafeRun(current_uid, root_uid)
|
raise UnsafeRunError(current_uid, root_uid)
|
||||||
|
|
||||||
|
|
||||||
def enum_values(enum: Type[Enum]) -> List[str]:
|
def enum_values(enum: Type[Enum]) -> List[str]:
|
||||||
@ -261,7 +261,7 @@ def pretty_size(size: Optional[float], level: int = 0) -> str:
|
|||||||
return "MiB"
|
return "MiB"
|
||||||
if level == 3:
|
if level == 3:
|
||||||
return "GiB"
|
return "GiB"
|
||||||
raise InvalidOption(level) # must never happen actually
|
raise OptionError(level) # must never happen actually
|
||||||
|
|
||||||
if size is None:
|
if size is None:
|
||||||
return ""
|
return ""
|
||||||
|
@ -29,7 +29,7 @@ from typing import Any, Dict, Iterable, List, Optional, Set, Type
|
|||||||
|
|
||||||
from ahriman.core.alpm.pacman import Pacman
|
from ahriman.core.alpm.pacman import Pacman
|
||||||
from ahriman.core.alpm.remote import AUR, Official, OfficialSyncdb
|
from ahriman.core.alpm.remote import AUR, Official, OfficialSyncdb
|
||||||
from ahriman.core.exceptions import InvalidPackageInfo
|
from ahriman.core.exceptions import PackageInfoError
|
||||||
from ahriman.core.lazy_logging import LazyLogging
|
from ahriman.core.lazy_logging import LazyLogging
|
||||||
from ahriman.core.util import check_output, full_version
|
from ahriman.core.util import check_output, full_version
|
||||||
from ahriman.models.package_description import PackageDescription
|
from ahriman.models.package_description import PackageDescription
|
||||||
@ -183,10 +183,10 @@ class Package(LazyLogging):
|
|||||||
Raises:
|
Raises:
|
||||||
InvalidPackageInfo: if there are parsing errors
|
InvalidPackageInfo: if there are parsing errors
|
||||||
"""
|
"""
|
||||||
srcinfo_source = Package._check_output("makepkg", "--printsrcinfo", exception=None, cwd=path)
|
srcinfo_source = Package._check_output("makepkg", "--printsrcinfo", cwd=path)
|
||||||
srcinfo, errors = parse_srcinfo(srcinfo_source)
|
srcinfo, errors = parse_srcinfo(srcinfo_source)
|
||||||
if errors:
|
if errors:
|
||||||
raise InvalidPackageInfo(errors)
|
raise PackageInfoError(errors)
|
||||||
packages = {key: PackageDescription() for key in srcinfo["packages"]}
|
packages = {key: PackageDescription() for key in srcinfo["packages"]}
|
||||||
version = full_version(srcinfo.get("epoch"), srcinfo["pkgver"], srcinfo["pkgrel"])
|
version = full_version(srcinfo.get("epoch"), srcinfo["pkgver"], srcinfo["pkgrel"])
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ class Package(LazyLogging):
|
|||||||
return cls(base=dump["base"], version=dump["version"], remote=RemoteSource.from_json(remote), packages=packages)
|
return cls(base=dump["base"], version=dump["version"], remote=RemoteSource.from_json(remote), packages=packages)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_official(cls: Type[Package], name: str, pacman: Pacman, use_syncdb: bool = True) -> Package:
|
def from_official(cls: Type[Package], name: str, pacman: Pacman, *, use_syncdb: bool = True) -> Package:
|
||||||
"""
|
"""
|
||||||
construct package properties from official repository page
|
construct package properties from official repository page
|
||||||
|
|
||||||
@ -254,10 +254,10 @@ class Package(LazyLogging):
|
|||||||
package_name = package_name.split(symbol)[0]
|
package_name = package_name.split(symbol)[0]
|
||||||
return package_name
|
return package_name
|
||||||
|
|
||||||
srcinfo_source = Package._check_output("makepkg", "--printsrcinfo", exception=None, cwd=path)
|
srcinfo_source = Package._check_output("makepkg", "--printsrcinfo", cwd=path)
|
||||||
srcinfo, errors = parse_srcinfo(srcinfo_source)
|
srcinfo, errors = parse_srcinfo(srcinfo_source)
|
||||||
if errors:
|
if errors:
|
||||||
raise InvalidPackageInfo(errors)
|
raise PackageInfoError(errors)
|
||||||
makedepends = extract_packages(srcinfo.get("makedepends", []))
|
makedepends = extract_packages(srcinfo.get("makedepends", []))
|
||||||
# sum over each package
|
# sum over each package
|
||||||
depends = extract_packages(srcinfo.get("depends", []))
|
depends = extract_packages(srcinfo.get("depends", []))
|
||||||
@ -281,10 +281,10 @@ class Package(LazyLogging):
|
|||||||
Raises:
|
Raises:
|
||||||
InvalidPackageInfo: if there are parsing errors
|
InvalidPackageInfo: if there are parsing errors
|
||||||
"""
|
"""
|
||||||
srcinfo_source = Package._check_output("makepkg", "--printsrcinfo", exception=None, cwd=path)
|
srcinfo_source = Package._check_output("makepkg", "--printsrcinfo", cwd=path)
|
||||||
srcinfo, errors = parse_srcinfo(srcinfo_source)
|
srcinfo, errors = parse_srcinfo(srcinfo_source)
|
||||||
if errors:
|
if errors:
|
||||||
raise InvalidPackageInfo(errors)
|
raise PackageInfoError(errors)
|
||||||
return set(srcinfo.get("arch", []))
|
return set(srcinfo.get("arch", []))
|
||||||
|
|
||||||
def actual_version(self, paths: RepositoryPaths) -> str:
|
def actual_version(self, paths: RepositoryPaths) -> str:
|
||||||
@ -310,13 +310,13 @@ class Package(LazyLogging):
|
|||||||
try:
|
try:
|
||||||
# update pkgver first
|
# update pkgver first
|
||||||
Package._check_output("makepkg", "--nodeps", "--nobuild",
|
Package._check_output("makepkg", "--nodeps", "--nobuild",
|
||||||
exception=None, cwd=paths.cache_for(self.base), logger=self.logger)
|
cwd=paths.cache_for(self.base), logger=self.logger)
|
||||||
# generate new .SRCINFO and put it to parser
|
# generate new .SRCINFO and put it to parser
|
||||||
srcinfo_source = Package._check_output("makepkg", "--printsrcinfo",
|
srcinfo_source = Package._check_output("makepkg", "--printsrcinfo",
|
||||||
exception=None, cwd=paths.cache_for(self.base), logger=self.logger)
|
cwd=paths.cache_for(self.base), logger=self.logger)
|
||||||
srcinfo, errors = parse_srcinfo(srcinfo_source)
|
srcinfo, errors = parse_srcinfo(srcinfo_source)
|
||||||
if errors:
|
if errors:
|
||||||
raise InvalidPackageInfo(errors)
|
raise PackageInfoError(errors)
|
||||||
|
|
||||||
return full_version(srcinfo.get("epoch"), srcinfo["pkgver"], srcinfo["pkgrel"])
|
return full_version(srcinfo.get("epoch"), srcinfo["pkgver"], srcinfo["pkgrel"])
|
||||||
except Exception:
|
except Exception:
|
||||||
@ -358,7 +358,7 @@ class Package(LazyLogging):
|
|||||||
|
|
||||||
return sorted(result)
|
return sorted(result)
|
||||||
|
|
||||||
def is_outdated(self, remote: Package, paths: RepositoryPaths, calculate_version: bool = True) -> bool:
|
def is_outdated(self, remote: Package, paths: RepositoryPaths, *, calculate_version: bool = True) -> bool:
|
||||||
"""
|
"""
|
||||||
check if package is out-of-dated
|
check if package is out-of-dated
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ from dataclasses import dataclass
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Set, Tuple, Type
|
from typing import Set, Tuple, Type
|
||||||
|
|
||||||
from ahriman.core.exceptions import InvalidPath
|
from ahriman.core.exceptions import PathError
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
@ -178,7 +178,7 @@ class RepositoryPaths:
|
|||||||
os.chown(current, root_uid, root_gid, follow_symlinks=False)
|
os.chown(current, root_uid, root_gid, follow_symlinks=False)
|
||||||
|
|
||||||
if self.root not in path.parents:
|
if self.root not in path.parents:
|
||||||
raise InvalidPath(path, self.root)
|
raise PathError(path, self.root)
|
||||||
root_uid, root_gid = self.root_owner
|
root_uid, root_gid = self.root_owner
|
||||||
while path != self.root:
|
while path != self.root:
|
||||||
set_owner(path)
|
set_owner(path)
|
||||||
|
@ -21,7 +21,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any, List, Optional, Iterable
|
from typing import Any, List, Optional, Iterable
|
||||||
|
|
||||||
from ahriman.core.exceptions import SuccessFailed
|
from ahriman.core.exceptions import UnprocessedPackageStatusError
|
||||||
from ahriman.models.package import Package
|
from ahriman.models.package import Package
|
||||||
|
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ class Result:
|
|||||||
self.add_failed(package)
|
self.add_failed(package)
|
||||||
for base, package in other._success.items():
|
for base, package in other._success.items():
|
||||||
if base in self._failed:
|
if base in self._failed:
|
||||||
raise SuccessFailed(base)
|
raise UnprocessedPackageStatusError(base)
|
||||||
self.add_success(package)
|
self.add_success(package)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#
|
#
|
||||||
from aiohttp.web import HTTPBadRequest, HTTPNoContent, HTTPNotFound, Response, json_response
|
from aiohttp.web import HTTPBadRequest, HTTPNoContent, HTTPNotFound, Response, json_response
|
||||||
|
|
||||||
from ahriman.core.exceptions import UnknownPackage
|
from ahriman.core.exceptions import UnknownPackageError
|
||||||
from ahriman.models.build_status import BuildStatusEnum
|
from ahriman.models.build_status import BuildStatusEnum
|
||||||
from ahriman.models.package import Package
|
from ahriman.models.package import Package
|
||||||
from ahriman.models.user_access import UserAccess
|
from ahriman.models.user_access import UserAccess
|
||||||
@ -54,7 +54,7 @@ class PackageView(BaseView):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
package, status = self.service.get(base)
|
package, status = self.service.get(base)
|
||||||
except UnknownPackage:
|
except UnknownPackageError:
|
||||||
raise HTTPNotFound()
|
raise HTTPNotFound()
|
||||||
|
|
||||||
response = [
|
response = [
|
||||||
@ -104,7 +104,7 @@ class PackageView(BaseView):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
self.service.update(base, status, package)
|
self.service.update(base, status, package)
|
||||||
except UnknownPackage:
|
except UnknownPackageError:
|
||||||
raise HTTPBadRequest(reason=f"Package {base} is unknown, but no package body set")
|
raise HTTPBadRequest(reason=f"Package {base} is unknown, but no package body set")
|
||||||
|
|
||||||
raise HTTPNoContent()
|
raise HTTPNoContent()
|
||||||
|
@ -26,7 +26,7 @@ from aiohttp import web
|
|||||||
from ahriman.core.auth import Auth
|
from ahriman.core.auth import Auth
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.database import SQLite
|
from ahriman.core.database import SQLite
|
||||||
from ahriman.core.exceptions import InitializeException
|
from ahriman.core.exceptions import InitializeError
|
||||||
from ahriman.core.spawn import Spawn
|
from ahriman.core.spawn import Spawn
|
||||||
from ahriman.core.status.watcher import Watcher
|
from ahriman.core.status.watcher import Watcher
|
||||||
from ahriman.web.middlewares.exception_handler import exception_handler
|
from ahriman.web.middlewares.exception_handler import exception_handler
|
||||||
@ -62,7 +62,7 @@ async def on_startup(application: web.Application) -> None:
|
|||||||
except Exception:
|
except Exception:
|
||||||
message = "could not load packages"
|
message = "could not load packages"
|
||||||
application.logger.exception(message)
|
application.logger.exception(message)
|
||||||
raise InitializeException(message)
|
raise InitializeError(message)
|
||||||
|
|
||||||
|
|
||||||
def run_server(application: web.Application) -> None:
|
def run_server(application: web.Application) -> None:
|
||||||
|
@ -24,7 +24,7 @@ def application_packages(configuration: Configuration, database: SQLite, mocker:
|
|||||||
"""
|
"""
|
||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
||||||
return ApplicationPackages("x86_64", configuration, no_report=True, unsafe=False)
|
return ApplicationPackages("x86_64", configuration, report=False, unsafe=False)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@ -43,7 +43,7 @@ def application_properties(configuration: Configuration, database: SQLite,
|
|||||||
"""
|
"""
|
||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
||||||
return ApplicationProperties("x86_64", configuration, no_report=True, unsafe=False)
|
return ApplicationProperties("x86_64", configuration, report=False, unsafe=False)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@ -62,4 +62,4 @@ def application_repository(configuration: Configuration, database: SQLite,
|
|||||||
"""
|
"""
|
||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
||||||
return ApplicationRepository("x86_64", configuration, no_report=True, unsafe=False)
|
return ApplicationRepository("x86_64", configuration, report=False, unsafe=False)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from pytest_mock import MockerFixture
|
from pytest_mock import MockerFixture
|
||||||
from unittest import mock
|
from unittest.mock import call as MockCall
|
||||||
|
|
||||||
from ahriman.application.application.application_repository import ApplicationRepository
|
from ahriman.application.application.application_repository import ApplicationRepository
|
||||||
from ahriman.core.tree import Leaf, Tree
|
from ahriman.core.tree import Leaf, Tree
|
||||||
@ -22,7 +22,7 @@ def test_clean_cache(application_repository: ApplicationRepository, mocker: Mock
|
|||||||
must clean cache directory
|
must clean cache directory
|
||||||
"""
|
"""
|
||||||
clear_mock = mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_cache")
|
clear_mock = mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_cache")
|
||||||
application_repository.clean(True, False, False, False)
|
application_repository.clean(cache=True, chroot=False, manual=False, packages=False, pacman=False)
|
||||||
clear_mock.assert_called_once_with()
|
clear_mock.assert_called_once_with()
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ def test_clean_chroot(application_repository: ApplicationRepository, mocker: Moc
|
|||||||
must clean chroot directory
|
must clean chroot directory
|
||||||
"""
|
"""
|
||||||
clear_mock = mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_chroot")
|
clear_mock = mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_chroot")
|
||||||
application_repository.clean(False, True, False, False)
|
application_repository.clean(cache=False, chroot=True, manual=False, packages=False, pacman=False)
|
||||||
clear_mock.assert_called_once_with()
|
clear_mock.assert_called_once_with()
|
||||||
|
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ def test_clean_manual(application_repository: ApplicationRepository, mocker: Moc
|
|||||||
must clean manual directory
|
must clean manual directory
|
||||||
"""
|
"""
|
||||||
clear_mock = mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_queue")
|
clear_mock = mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_queue")
|
||||||
application_repository.clean(False, False, True, False)
|
application_repository.clean(cache=False, chroot=False, manual=True, packages=False, pacman=False)
|
||||||
clear_mock.assert_called_once_with()
|
clear_mock.assert_called_once_with()
|
||||||
|
|
||||||
|
|
||||||
@ -49,7 +49,16 @@ def test_clean_packages(application_repository: ApplicationRepository, mocker: M
|
|||||||
must clean packages directory
|
must clean packages directory
|
||||||
"""
|
"""
|
||||||
clear_mock = mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_packages")
|
clear_mock = mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_packages")
|
||||||
application_repository.clean(False, False, False, True)
|
application_repository.clean(cache=False, chroot=False, manual=False, packages=True, pacman=False)
|
||||||
|
clear_mock.assert_called_once_with()
|
||||||
|
|
||||||
|
|
||||||
|
def test_clean_pacman(application_repository: ApplicationRepository, mocker: MockerFixture) -> None:
|
||||||
|
"""
|
||||||
|
must clean packages directory
|
||||||
|
"""
|
||||||
|
clear_mock = mocker.patch("ahriman.core.repository.cleaner.Cleaner.clear_pacman")
|
||||||
|
application_repository.clean(cache=False, chroot=False, manual=False, packages=False, pacman=True)
|
||||||
clear_mock.assert_called_once_with()
|
clear_mock.assert_called_once_with()
|
||||||
|
|
||||||
|
|
||||||
@ -68,8 +77,8 @@ def test_sign(application_repository: ApplicationRepository, package_ahriman: Pa
|
|||||||
|
|
||||||
application_repository.sign([])
|
application_repository.sign([])
|
||||||
copy_mock.assert_has_calls([
|
copy_mock.assert_has_calls([
|
||||||
mock.call(pytest.helpers.anyvar(int), pytest.helpers.anyvar(int)),
|
MockCall(pytest.helpers.anyvar(int), pytest.helpers.anyvar(int)),
|
||||||
mock.call(pytest.helpers.anyvar(int), pytest.helpers.anyvar(int))
|
MockCall(pytest.helpers.anyvar(int), pytest.helpers.anyvar(int))
|
||||||
])
|
])
|
||||||
update_mock.assert_called_once_with([])
|
update_mock.assert_called_once_with([])
|
||||||
sign_repository_mock.assert_called_once_with(application_repository.repository.repo.repo_path)
|
sign_repository_mock.assert_called_once_with(application_repository.repository.repo.repo_path)
|
||||||
@ -168,8 +177,8 @@ def test_update(application_repository: ApplicationRepository, package_ahriman:
|
|||||||
|
|
||||||
application_repository.update([package_ahriman])
|
application_repository.update([package_ahriman])
|
||||||
build_mock.assert_called_once_with([package_ahriman])
|
build_mock.assert_called_once_with([package_ahriman])
|
||||||
update_mock.assert_has_calls([mock.call(paths), mock.call(paths)])
|
update_mock.assert_has_calls([MockCall(paths), MockCall(paths)])
|
||||||
on_result_mock.assert_has_calls([mock.call(result), mock.call(result)])
|
on_result_mock.assert_has_calls([MockCall(result), MockCall(result)])
|
||||||
|
|
||||||
|
|
||||||
def test_update_empty(application_repository: ApplicationRepository, package_ahriman: Package,
|
def test_update_empty(application_repository: ApplicationRepository, package_ahriman: Package,
|
||||||
@ -199,8 +208,8 @@ def test_updates_all(application_repository: ApplicationRepository, package_ahri
|
|||||||
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
||||||
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
||||||
|
|
||||||
application_repository.updates([], no_aur=False, no_local=False, no_manual=False, no_vcs=False, log_fn=print)
|
application_repository.updates([], aur=True, local=True, manual=True, vcs=True, log_fn=print)
|
||||||
updates_aur_mock.assert_called_once_with([], False)
|
updates_aur_mock.assert_called_once_with([], vcs=True)
|
||||||
updates_local_mock.assert_called_once_with()
|
updates_local_mock.assert_called_once_with()
|
||||||
updates_manual_mock.assert_called_once_with()
|
updates_manual_mock.assert_called_once_with()
|
||||||
|
|
||||||
@ -214,7 +223,7 @@ def test_updates_disabled(application_repository: ApplicationRepository, mocker:
|
|||||||
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
||||||
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
||||||
|
|
||||||
application_repository.updates([], no_aur=True, no_local=True, no_manual=True, no_vcs=False, log_fn=print)
|
application_repository.updates([], aur=False, local=False, manual=False, vcs=True, log_fn=print)
|
||||||
updates_aur_mock.assert_not_called()
|
updates_aur_mock.assert_not_called()
|
||||||
updates_local_mock.assert_not_called()
|
updates_local_mock.assert_not_called()
|
||||||
updates_manual_mock.assert_not_called()
|
updates_manual_mock.assert_not_called()
|
||||||
@ -229,7 +238,7 @@ def test_updates_no_aur(application_repository: ApplicationRepository, mocker: M
|
|||||||
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
||||||
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
||||||
|
|
||||||
application_repository.updates([], no_aur=True, no_local=False, no_manual=False, no_vcs=False, log_fn=print)
|
application_repository.updates([], aur=False, local=True, manual=True, vcs=True, log_fn=print)
|
||||||
updates_aur_mock.assert_not_called()
|
updates_aur_mock.assert_not_called()
|
||||||
updates_local_mock.assert_called_once_with()
|
updates_local_mock.assert_called_once_with()
|
||||||
updates_manual_mock.assert_called_once_with()
|
updates_manual_mock.assert_called_once_with()
|
||||||
@ -244,8 +253,8 @@ def test_updates_no_local(application_repository: ApplicationRepository, mocker:
|
|||||||
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
||||||
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
||||||
|
|
||||||
application_repository.updates([], no_aur=False, no_local=True, no_manual=False, no_vcs=False, log_fn=print)
|
application_repository.updates([], aur=True, local=False, manual=True, vcs=True, log_fn=print)
|
||||||
updates_aur_mock.assert_called_once_with([], False)
|
updates_aur_mock.assert_called_once_with([], vcs=True)
|
||||||
updates_local_mock.assert_not_called()
|
updates_local_mock.assert_not_called()
|
||||||
updates_manual_mock.assert_called_once_with()
|
updates_manual_mock.assert_called_once_with()
|
||||||
|
|
||||||
@ -259,8 +268,8 @@ def test_updates_no_manual(application_repository: ApplicationRepository, mocker
|
|||||||
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
||||||
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
||||||
|
|
||||||
application_repository.updates([], no_aur=False, no_local=False, no_manual=True, no_vcs=False, log_fn=print)
|
application_repository.updates([], aur=True, local=True, manual=False, vcs=True, log_fn=print)
|
||||||
updates_aur_mock.assert_called_once_with([], False)
|
updates_aur_mock.assert_called_once_with([], vcs=True)
|
||||||
updates_local_mock.assert_called_once_with()
|
updates_local_mock.assert_called_once_with()
|
||||||
updates_manual_mock.assert_not_called()
|
updates_manual_mock.assert_not_called()
|
||||||
|
|
||||||
@ -274,8 +283,8 @@ def test_updates_no_vcs(application_repository: ApplicationRepository, mocker: M
|
|||||||
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
||||||
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
||||||
|
|
||||||
application_repository.updates([], no_aur=False, no_local=False, no_manual=False, no_vcs=True, log_fn=print)
|
application_repository.updates([], aur=True, local=True, manual=True, vcs=False, log_fn=print)
|
||||||
updates_aur_mock.assert_called_once_with([], True)
|
updates_aur_mock.assert_called_once_with([], vcs=False)
|
||||||
updates_local_mock.assert_called_once_with()
|
updates_local_mock.assert_called_once_with()
|
||||||
updates_manual_mock.assert_called_once_with()
|
updates_manual_mock.assert_called_once_with()
|
||||||
|
|
||||||
@ -289,8 +298,7 @@ def test_updates_with_filter(application_repository: ApplicationRepository, mock
|
|||||||
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
updates_local_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_local")
|
||||||
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
||||||
|
|
||||||
application_repository.updates(["filter"], no_aur=False, no_local=False, no_manual=False, no_vcs=False,
|
application_repository.updates(["filter"], aur=True, local=True, manual=True, vcs=True, log_fn=print)
|
||||||
log_fn=print)
|
updates_aur_mock.assert_called_once_with(["filter"], vcs=True)
|
||||||
updates_aur_mock.assert_called_once_with(["filter"], False)
|
|
||||||
updates_local_mock.assert_called_once_with()
|
updates_local_mock.assert_called_once_with()
|
||||||
updates_manual_mock.assert_called_once_with()
|
updates_manual_mock.assert_called_once_with()
|
||||||
|
@ -25,7 +25,7 @@ def application(configuration: Configuration, database: SQLite, mocker: MockerFi
|
|||||||
"""
|
"""
|
||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
||||||
return Application("x86_64", configuration, no_report=True, unsafe=False)
|
return Application("x86_64", configuration, report=False, unsafe=False)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@ -36,7 +36,7 @@ def args() -> argparse.Namespace:
|
|||||||
Returns:
|
Returns:
|
||||||
argparse.Namespace: command line arguments test instance
|
argparse.Namespace: command line arguments test instance
|
||||||
"""
|
"""
|
||||||
return argparse.Namespace(architecture=None, lock=None, force=False, unsafe=False, no_report=True)
|
return argparse.Namespace(architecture=None, lock=None, force=False, unsafe=False, report=False)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
@ -6,7 +6,7 @@ from pytest_mock import MockerFixture
|
|||||||
|
|
||||||
from ahriman.application.handlers import Handler
|
from ahriman.application.handlers import Handler
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.exceptions import ExitCode, MissingArchitecture, MultipleArchitectures
|
from ahriman.core.exceptions import ExitCode, MissingArchitectureError, MultipleArchitecturesError
|
||||||
|
|
||||||
|
|
||||||
def test_architectures_extract(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
|
def test_architectures_extract(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
|
||||||
@ -29,7 +29,7 @@ def test_architectures_extract_empty(args: argparse.Namespace, configuration: Co
|
|||||||
args.configuration = configuration.path
|
args.configuration = configuration.path
|
||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.known_architectures", return_value=set())
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.known_architectures", return_value=set())
|
||||||
|
|
||||||
with pytest.raises(MissingArchitecture):
|
with pytest.raises(MissingArchitectureError):
|
||||||
Handler.architectures_extract(args)
|
Handler.architectures_extract(args)
|
||||||
|
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ def test_architectures_extract_exception(args: argparse.Namespace, mocker: Mocke
|
|||||||
"""
|
"""
|
||||||
args.command = "config"
|
args.command = "config"
|
||||||
mocker.patch.object(Handler, "ALLOW_AUTO_ARCHITECTURE_RUN", False)
|
mocker.patch.object(Handler, "ALLOW_AUTO_ARCHITECTURE_RUN", False)
|
||||||
with pytest.raises(MissingArchitecture):
|
with pytest.raises(MissingArchitectureError):
|
||||||
Handler.architectures_extract(args)
|
Handler.architectures_extract(args)
|
||||||
|
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ def test_execute_multiple_not_supported(args: argparse.Namespace, mocker: Mocker
|
|||||||
args.command = "web"
|
args.command = "web"
|
||||||
mocker.patch.object(Handler, "ALLOW_MULTI_ARCHITECTURE_RUN", False)
|
mocker.patch.object(Handler, "ALLOW_MULTI_ARCHITECTURE_RUN", False)
|
||||||
|
|
||||||
with pytest.raises(MultipleArchitectures):
|
with pytest.raises(MultipleArchitecturesError):
|
||||||
Handler.execute(args)
|
Handler.execute(args)
|
||||||
|
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration) -> None:
|
|||||||
must raise NotImplemented for missing method
|
must raise NotImplemented for missing method
|
||||||
"""
|
"""
|
||||||
with pytest.raises(NotImplementedError):
|
with pytest.raises(NotImplementedError):
|
||||||
Handler.run(args, "x86_64", configuration, True, True)
|
Handler.run(args, "x86_64", configuration, report=True, unsafe=True)
|
||||||
|
|
||||||
|
|
||||||
def test_check_if_empty() -> None:
|
def test_check_if_empty() -> None:
|
||||||
|
@ -38,7 +38,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
application_mock = mocker.patch("ahriman.application.application.Application.add")
|
application_mock = mocker.patch("ahriman.application.application.Application.add")
|
||||||
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
||||||
|
|
||||||
Add.run(args, "x86_64", configuration, True, False)
|
Add.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_mock.assert_called_once_with(args.package, args.source, args.without_dependencies)
|
application_mock.assert_called_once_with(args.package, args.source, args.without_dependencies)
|
||||||
on_start_mock.assert_called_once_with()
|
on_start_mock.assert_called_once_with()
|
||||||
|
|
||||||
@ -58,8 +58,9 @@ def test_run_with_updates(args: argparse.Namespace, configuration: Configuration
|
|||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
updates_mock = mocker.patch("ahriman.application.application.Application.updates", return_value=[package_ahriman])
|
updates_mock = mocker.patch("ahriman.application.application.Application.updates", return_value=[package_ahriman])
|
||||||
|
|
||||||
Add.run(args, "x86_64", configuration, True, False)
|
Add.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
updates_mock.assert_called_once_with(args.package, True, True, False, True, pytest.helpers.anyvar(int))
|
updates_mock.assert_called_once_with(args.package, aur=False, local=False, manual=True, vcs=False,
|
||||||
|
log_fn=pytest.helpers.anyvar(int))
|
||||||
application_mock.assert_called_once_with([package_ahriman])
|
application_mock.assert_called_once_with([package_ahriman])
|
||||||
check_mock.assert_called_once_with(False, False)
|
check_mock.assert_called_once_with(False, False)
|
||||||
|
|
||||||
@ -77,5 +78,5 @@ def test_run_empty_exception(args: argparse.Namespace, configuration: Configurat
|
|||||||
mocker.patch("ahriman.application.application.Application.updates")
|
mocker.patch("ahriman.application.application.Application.updates")
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
Add.run(args, "x86_64", configuration, True, False)
|
Add.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
check_mock.assert_called_once_with(True, True)
|
check_mock.assert_called_once_with(True, True)
|
||||||
|
@ -33,7 +33,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
add_mock = tarfile.__enter__.return_value = MagicMock()
|
add_mock = tarfile.__enter__.return_value = MagicMock()
|
||||||
mocker.patch("tarfile.TarFile.__new__", return_value=tarfile)
|
mocker.patch("tarfile.TarFile.__new__", return_value=tarfile)
|
||||||
|
|
||||||
Backup.run(args, "x86_64", configuration, True, False)
|
Backup.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
add_mock.add.assert_called_once_with(Path("path"))
|
add_mock.add.assert_called_once_with(Path("path"))
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ def _default_args(args: argparse.Namespace) -> argparse.Namespace:
|
|||||||
args.chroot = False
|
args.chroot = False
|
||||||
args.manual = False
|
args.manual = False
|
||||||
args.packages = False
|
args.packages = False
|
||||||
|
args.pacman = False
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
|
||||||
@ -32,6 +33,6 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
application_mock = mocker.patch("ahriman.application.application.Application.clean")
|
application_mock = mocker.patch("ahriman.application.application.Application.clean")
|
||||||
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
||||||
|
|
||||||
Clean.run(args, "x86_64", configuration, True, False)
|
Clean.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_mock.assert_called_once_with(False, False, False, False)
|
application_mock.assert_called_once_with(cache=False, chroot=False, manual=False, packages=False, pacman=False)
|
||||||
on_start_mock.assert_called_once_with()
|
on_start_mock.assert_called_once_with()
|
||||||
|
@ -17,10 +17,10 @@ def _default_args(args: argparse.Namespace) -> argparse.Namespace:
|
|||||||
argparse.Namespace: generated arguments for these test cases
|
argparse.Namespace: generated arguments for these test cases
|
||||||
"""
|
"""
|
||||||
args.interval = 60 * 60 * 12
|
args.interval = 60 * 60 * 12
|
||||||
args.no_aur = False
|
args.aur = True
|
||||||
args.no_local = False
|
args.local = True
|
||||||
args.no_manual = False
|
args.manual = True
|
||||||
args.no_vcs = False
|
args.vcs = True
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
|
||||||
@ -33,8 +33,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
start_mock = mocker.patch("threading.Timer.start")
|
start_mock = mocker.patch("threading.Timer.start")
|
||||||
join_mock = mocker.patch("threading.Timer.join")
|
join_mock = mocker.patch("threading.Timer.join")
|
||||||
|
|
||||||
Daemon.run(args, "x86_64", configuration, True, False)
|
Daemon.run(args, "x86_64", configuration, report=True, unsafe=False)
|
||||||
Daemon._SHOULD_RUN = False
|
run_mock.assert_called_once_with(args, "x86_64", configuration, report=True, unsafe=False)
|
||||||
run_mock.assert_called_once_with(args, "x86_64", configuration, True, False)
|
|
||||||
start_mock.assert_called_once_with()
|
start_mock.assert_called_once_with()
|
||||||
join_mock.assert_called_once_with()
|
join_mock.assert_called_once_with()
|
||||||
|
@ -15,7 +15,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
application_mock = mocker.patch("ahriman.core.configuration.Configuration.dump",
|
application_mock = mocker.patch("ahriman.core.configuration.Configuration.dump",
|
||||||
return_value=configuration.dump())
|
return_value=configuration.dump())
|
||||||
|
|
||||||
Dump.run(args, "x86_64", configuration, True, False)
|
Dump.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_mock.assert_called_once_with()
|
application_mock.assert_called_once_with()
|
||||||
print_mock.assert_called()
|
print_mock.assert_called()
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
args = _default_args(args)
|
args = _default_args(args)
|
||||||
parse_mock = mocker.patch("argparse.ArgumentParser.parse_args")
|
parse_mock = mocker.patch("argparse.ArgumentParser.parse_args")
|
||||||
|
|
||||||
Help.run(args, "x86_64", configuration, True, False)
|
Help.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
parse_mock.assert_called_once_with(["--help"])
|
parse_mock.assert_called_once_with(["--help"])
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ def test_run_command(args: argparse.Namespace, configuration: Configuration, moc
|
|||||||
args.command = "aur-search"
|
args.command = "aur-search"
|
||||||
parse_mock = mocker.patch("argparse.ArgumentParser.parse_args")
|
parse_mock = mocker.patch("argparse.ArgumentParser.parse_args")
|
||||||
|
|
||||||
Help.run(args, "x86_64", configuration, True, False)
|
Help.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
parse_mock.assert_called_once_with(["aur-search", "--help"])
|
parse_mock.assert_called_once_with(["aur-search", "--help"])
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
application_mock = mocker.patch("ahriman.core.sign.gpg.GPG.key_import")
|
application_mock = mocker.patch("ahriman.core.sign.gpg.GPG.key_import")
|
||||||
|
|
||||||
KeyImport.run(args, "x86_64", configuration, True, False)
|
KeyImport.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_mock.assert_called_once_with(args.key_server, args.key)
|
application_mock.assert_called_once_with(args.key_server, args.key)
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
return_value=(args.package, PkgbuildPatch(None, "patch")))
|
return_value=(args.package, PkgbuildPatch(None, "patch")))
|
||||||
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_create")
|
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_create")
|
||||||
|
|
||||||
Patch.run(args, "x86_64", configuration, True, False)
|
Patch.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
patch_mock.assert_called_once_with(args.package, args.track)
|
patch_mock.assert_called_once_with(args.package, args.track)
|
||||||
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.package, PkgbuildPatch(None, "patch"))
|
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.package, PkgbuildPatch(None, "patch"))
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ def test_run_function(args: argparse.Namespace, configuration: Configuration, mo
|
|||||||
patch_mock = mocker.patch("ahriman.application.handlers.Patch.patch_create_from_function", return_value=patch)
|
patch_mock = mocker.patch("ahriman.application.handlers.Patch.patch_create_from_function", return_value=patch)
|
||||||
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_create")
|
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_create")
|
||||||
|
|
||||||
Patch.run(args, "x86_64", configuration, True, False)
|
Patch.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
patch_mock.assert_called_once_with(args.variable, args.patch)
|
patch_mock.assert_called_once_with(args.variable, args.patch)
|
||||||
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.package, patch)
|
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.package, patch)
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ def test_run_list(args: argparse.Namespace, configuration: Configuration, mocker
|
|||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_list")
|
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_list")
|
||||||
|
|
||||||
Patch.run(args, "x86_64", configuration, True, False)
|
Patch.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.package, ["version"], False)
|
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.package, ["version"], False)
|
||||||
|
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ def test_run_remove(args: argparse.Namespace, configuration: Configuration, mock
|
|||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_remove")
|
application_mock = mocker.patch("ahriman.application.handlers.Patch.patch_set_remove")
|
||||||
|
|
||||||
Patch.run(args, "x86_64", configuration, True, False)
|
Patch.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.package, ["version"])
|
application_mock.assert_called_once_with(pytest.helpers.anyvar(int), args.package, ["version"])
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import argparse
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from pytest_mock import MockerFixture
|
from pytest_mock import MockerFixture
|
||||||
from unittest import mock
|
from unittest.mock import call as MockCall
|
||||||
|
|
||||||
from ahriman.application.application import Application
|
from ahriman.application.application import Application
|
||||||
from ahriman.application.handlers import Rebuild
|
from ahriman.application.handlers import Rebuild
|
||||||
@ -43,10 +43,10 @@ def test_run(args: argparse.Namespace, package_ahriman: Package,
|
|||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
||||||
|
|
||||||
Rebuild.run(args, "x86_64", configuration, True, False)
|
Rebuild.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_packages_mock.assert_called_once_with(None)
|
application_packages_mock.assert_called_once_with(None)
|
||||||
application_mock.assert_called_once_with([package_ahriman])
|
application_mock.assert_called_once_with([package_ahriman])
|
||||||
check_mock.assert_has_calls([mock.call(False, False), mock.call(False, False)])
|
check_mock.assert_has_calls([MockCall(False, False), MockCall(False, False)])
|
||||||
on_start_mock.assert_called_once_with()
|
on_start_mock.assert_called_once_with()
|
||||||
|
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ def test_run_extract_packages(args: argparse.Namespace, configuration: Configura
|
|||||||
mocker.patch("ahriman.application.application.Application.add")
|
mocker.patch("ahriman.application.application.Application.add")
|
||||||
extract_mock = mocker.patch("ahriman.application.handlers.Rebuild.extract_packages", return_value=[])
|
extract_mock = mocker.patch("ahriman.application.handlers.Rebuild.extract_packages", return_value=[])
|
||||||
|
|
||||||
Rebuild.run(args, "x86_64", configuration, True, False)
|
Rebuild.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
extract_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
extract_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ def test_run_dry_run(args: argparse.Namespace, configuration: Configuration,
|
|||||||
application_mock = mocker.patch("ahriman.application.application.Application.update")
|
application_mock = mocker.patch("ahriman.application.application.Application.update")
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
Rebuild.run(args, "x86_64", configuration, True, False)
|
Rebuild.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_mock.assert_not_called()
|
application_mock.assert_not_called()
|
||||||
check_mock.assert_called_once_with(False, False)
|
check_mock.assert_called_once_with(False, False)
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ def test_run_filter(args: argparse.Namespace, configuration: Configuration, mock
|
|||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
application_packages_mock = mocker.patch("ahriman.core.repository.repository.Repository.packages_depend_on")
|
application_packages_mock = mocker.patch("ahriman.core.repository.repository.Repository.packages_depend_on")
|
||||||
|
|
||||||
Rebuild.run(args, "x86_64", configuration, True, False)
|
Rebuild.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_packages_mock.assert_called_once_with({"python-aur"})
|
application_packages_mock.assert_called_once_with({"python-aur"})
|
||||||
|
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ def test_run_without_filter(args: argparse.Namespace, configuration: Configurati
|
|||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
application_packages_mock = mocker.patch("ahriman.core.repository.repository.Repository.packages_depend_on")
|
application_packages_mock = mocker.patch("ahriman.core.repository.repository.Repository.packages_depend_on")
|
||||||
|
|
||||||
Rebuild.run(args, "x86_64", configuration, True, False)
|
Rebuild.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_packages_mock.assert_called_once_with(None)
|
application_packages_mock.assert_called_once_with(None)
|
||||||
|
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ def test_run_update_empty_exception(args: argparse.Namespace, configuration: Con
|
|||||||
mocker.patch("ahriman.core.repository.repository.Repository.packages_depend_on", return_value=[])
|
mocker.patch("ahriman.core.repository.repository.Repository.packages_depend_on", return_value=[])
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
Rebuild.run(args, "x86_64", configuration, True, False)
|
Rebuild.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
check_mock.assert_called_once_with(True, True)
|
check_mock.assert_called_once_with(True, True)
|
||||||
|
|
||||||
|
|
||||||
@ -137,8 +137,8 @@ def test_run_build_empty_exception(args: argparse.Namespace, configuration: Conf
|
|||||||
mocker.patch("ahriman.application.application.Application.update", return_value=Result())
|
mocker.patch("ahriman.application.application.Application.update", return_value=Result())
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
Rebuild.run(args, "x86_64", configuration, True, False)
|
Rebuild.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
check_mock.assert_has_calls([mock.call(True, False), mock.call(True, True)])
|
check_mock.assert_has_calls([MockCall(True, False), MockCall(True, True)])
|
||||||
|
|
||||||
|
|
||||||
def test_extract_packages(application: Application, mocker: MockerFixture) -> None:
|
def test_extract_packages(application: Application, mocker: MockerFixture) -> None:
|
||||||
|
@ -29,6 +29,6 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
application_mock = mocker.patch("ahriman.application.application.Application.remove")
|
application_mock = mocker.patch("ahriman.application.application.Application.remove")
|
||||||
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
||||||
|
|
||||||
Remove.run(args, "x86_64", configuration, True, False)
|
Remove.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_mock.assert_called_once_with([])
|
application_mock.assert_called_once_with([])
|
||||||
on_start_mock.assert_called_once_with()
|
on_start_mock.assert_called_once_with()
|
||||||
|
@ -18,7 +18,6 @@ def _default_args(args: argparse.Namespace) -> argparse.Namespace:
|
|||||||
argparse.Namespace: generated arguments for these test cases
|
argparse.Namespace: generated arguments for these test cases
|
||||||
"""
|
"""
|
||||||
args.dry_run = False
|
args.dry_run = False
|
||||||
args.info = False
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
|
||||||
@ -34,7 +33,7 @@ def test_run(args: argparse.Namespace, package_ahriman: Package,
|
|||||||
remove_mock = mocker.patch("ahriman.application.application.Application.remove")
|
remove_mock = mocker.patch("ahriman.application.application.Application.remove")
|
||||||
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
||||||
|
|
||||||
RemoveUnknown.run(args, "x86_64", configuration, True, False)
|
RemoveUnknown.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_mock.assert_called_once_with()
|
application_mock.assert_called_once_with()
|
||||||
remove_mock.assert_called_once_with([package_ahriman])
|
remove_mock.assert_called_once_with([package_ahriman])
|
||||||
on_start_mock.assert_called_once_with()
|
on_start_mock.assert_called_once_with()
|
||||||
@ -53,27 +52,7 @@ def test_run_dry_run(args: argparse.Namespace, configuration: Configuration, pac
|
|||||||
remove_mock = mocker.patch("ahriman.application.application.Application.remove")
|
remove_mock = mocker.patch("ahriman.application.application.Application.remove")
|
||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
|
|
||||||
RemoveUnknown.run(args, "x86_64", configuration, True, False)
|
RemoveUnknown.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_mock.assert_called_once_with()
|
application_mock.assert_called_once_with()
|
||||||
remove_mock.assert_not_called()
|
remove_mock.assert_not_called()
|
||||||
print_mock.assert_called_once_with(False)
|
print_mock.assert_called_once_with(False)
|
||||||
|
|
||||||
|
|
||||||
def test_run_dry_run_verbose(args: argparse.Namespace, configuration: Configuration, package_ahriman: Package,
|
|
||||||
mocker: MockerFixture) -> None:
|
|
||||||
"""
|
|
||||||
must run simplified command with increased verbosity
|
|
||||||
"""
|
|
||||||
args = _default_args(args)
|
|
||||||
args.dry_run = True
|
|
||||||
args.info = True
|
|
||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
|
||||||
application_mock = mocker.patch("ahriman.application.application.Application.unknown",
|
|
||||||
return_value=[package_ahriman])
|
|
||||||
remove_mock = mocker.patch("ahriman.application.application.Application.remove")
|
|
||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
|
||||||
|
|
||||||
RemoveUnknown.run(args, "x86_64", configuration, True, False)
|
|
||||||
application_mock.assert_called_once_with()
|
|
||||||
remove_mock.assert_not_called()
|
|
||||||
print_mock.assert_called_once_with(True)
|
|
||||||
|
@ -32,7 +32,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
extract_mock = tarfile.__enter__.return_value = MagicMock()
|
extract_mock = tarfile.__enter__.return_value = MagicMock()
|
||||||
mocker.patch("tarfile.TarFile.__new__", return_value=tarfile)
|
mocker.patch("tarfile.TarFile.__new__", return_value=tarfile)
|
||||||
|
|
||||||
Restore.run(args, "x86_64", configuration, True, False)
|
Restore.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
extract_mock.extractall.assert_called_once_with(path=args.output)
|
extract_mock.extractall.assert_called_once_with(path=args.output)
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@ import dataclasses
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from pytest_mock import MockerFixture
|
from pytest_mock import MockerFixture
|
||||||
from unittest import mock
|
from unittest.mock import call as MockCall
|
||||||
|
|
||||||
from ahriman.application.handlers import Search
|
from ahriman.application.handlers import Search
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.exceptions import InvalidOption
|
from ahriman.core.exceptions import OptionError
|
||||||
from ahriman.models.aur_package import AURPackage
|
from ahriman.models.aur_package import AURPackage
|
||||||
|
|
||||||
|
|
||||||
@ -41,11 +41,11 @@ def test_run(args: argparse.Namespace, configuration: Configuration, aur_package
|
|||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
|
|
||||||
Search.run(args, "x86_64", configuration, True, False)
|
Search.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
aur_search_mock.assert_called_once_with("ahriman", pacman=pytest.helpers.anyvar(int))
|
aur_search_mock.assert_called_once_with("ahriman", pacman=pytest.helpers.anyvar(int))
|
||||||
official_search_mock.assert_called_once_with("ahriman", pacman=pytest.helpers.anyvar(int))
|
official_search_mock.assert_called_once_with("ahriman", pacman=pytest.helpers.anyvar(int))
|
||||||
check_mock.assert_called_once_with(False, False)
|
check_mock.assert_called_once_with(False, False)
|
||||||
print_mock.assert_has_calls([mock.call(False), mock.call(False)])
|
print_mock.assert_has_calls([MockCall(False), MockCall(False)])
|
||||||
|
|
||||||
|
|
||||||
def test_run_empty_exception(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
|
def test_run_empty_exception(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
|
||||||
@ -60,7 +60,7 @@ def test_run_empty_exception(args: argparse.Namespace, configuration: Configurat
|
|||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
Search.run(args, "x86_64", configuration, True, False)
|
Search.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
check_mock.assert_called_once_with(True, True)
|
check_mock.assert_called_once_with(True, True)
|
||||||
|
|
||||||
|
|
||||||
@ -75,10 +75,10 @@ def test_run_sort(args: argparse.Namespace, configuration: Configuration, aur_pa
|
|||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
sort_mock = mocker.patch("ahriman.application.handlers.Search.sort")
|
sort_mock = mocker.patch("ahriman.application.handlers.Search.sort")
|
||||||
|
|
||||||
Search.run(args, "x86_64", configuration, True, False)
|
Search.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
sort_mock.assert_has_calls([
|
sort_mock.assert_has_calls([
|
||||||
mock.call([], "name"), mock.call().__iter__(),
|
MockCall([], "name"), MockCall().__iter__(),
|
||||||
mock.call([aur_package_ahriman], "name"), mock.call().__iter__()
|
MockCall([aur_package_ahriman], "name"), MockCall().__iter__()
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@ -94,10 +94,10 @@ def test_run_sort_by(args: argparse.Namespace, configuration: Configuration, aur
|
|||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
sort_mock = mocker.patch("ahriman.application.handlers.Search.sort")
|
sort_mock = mocker.patch("ahriman.application.handlers.Search.sort")
|
||||||
|
|
||||||
Search.run(args, "x86_64", configuration, True, False)
|
Search.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
sort_mock.assert_has_calls([
|
sort_mock.assert_has_calls([
|
||||||
mock.call([], "field"), mock.call().__iter__(),
|
MockCall([], "field"), MockCall().__iter__(),
|
||||||
mock.call([aur_package_ahriman], "field"), mock.call().__iter__()
|
MockCall([aur_package_ahriman], "field"), MockCall().__iter__()
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ def test_sort_exception(aur_package_ahriman: AURPackage) -> None:
|
|||||||
"""
|
"""
|
||||||
must raise an exception on unknown sorting field
|
must raise an exception on unknown sorting field
|
||||||
"""
|
"""
|
||||||
with pytest.raises(InvalidOption):
|
with pytest.raises(OptionError):
|
||||||
Search.sort([aur_package_ahriman], "random_field")
|
Search.sort([aur_package_ahriman], "random_field")
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import pytest
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from pytest_mock import MockerFixture
|
from pytest_mock import MockerFixture
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from unittest import mock
|
from unittest.mock import call as MockCall
|
||||||
|
|
||||||
from ahriman.application.handlers import Setup
|
from ahriman.application.handlers import Setup
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
@ -25,7 +25,7 @@ def _default_args(args: argparse.Namespace) -> argparse.Namespace:
|
|||||||
args.build_as_user = "ahriman"
|
args.build_as_user = "ahriman"
|
||||||
args.build_command = "ahriman"
|
args.build_command = "ahriman"
|
||||||
args.from_configuration = Path("/usr/share/devtools/pacman-extra.conf")
|
args.from_configuration = Path("/usr/share/devtools/pacman-extra.conf")
|
||||||
args.no_multilib = False
|
args.multilib = True
|
||||||
args.packager = "John Doe <john@doe.com>"
|
args.packager = "John Doe <john@doe.com>"
|
||||||
args.repository = "aur-clone"
|
args.repository = "aur-clone"
|
||||||
args.sign_key = "key"
|
args.sign_key = "key"
|
||||||
@ -48,11 +48,11 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository_
|
|||||||
executable_mock = mocker.patch("ahriman.application.handlers.Setup.executable_create")
|
executable_mock = mocker.patch("ahriman.application.handlers.Setup.executable_create")
|
||||||
init_mock = mocker.patch("ahriman.core.alpm.repo.Repo.init")
|
init_mock = mocker.patch("ahriman.core.alpm.repo.Repo.init")
|
||||||
|
|
||||||
Setup.run(args, "x86_64", configuration, True, False)
|
Setup.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
ahriman_configuration_mock.assert_called_once_with(
|
ahriman_configuration_mock.assert_called_once_with(
|
||||||
args, "x86_64", args.repository, configuration.include, repository_paths)
|
args, "x86_64", args.repository, configuration.include, repository_paths)
|
||||||
devtools_configuration_mock.assert_called_once_with(
|
devtools_configuration_mock.assert_called_once_with(
|
||||||
args.build_command, "x86_64", args.from_configuration, args.no_multilib, args.repository, repository_paths)
|
args.build_command, "x86_64", args.from_configuration, args.multilib, args.repository, repository_paths)
|
||||||
makepkg_configuration_mock.assert_called_once_with(args.packager, repository_paths)
|
makepkg_configuration_mock.assert_called_once_with(args.packager, repository_paths)
|
||||||
sudo_configuration_mock.assert_called_once_with(repository_paths, args.build_command, "x86_64")
|
sudo_configuration_mock.assert_called_once_with(repository_paths, args.build_command, "x86_64")
|
||||||
executable_mock.assert_called_once_with(repository_paths, args.build_command, "x86_64")
|
executable_mock.assert_called_once_with(repository_paths, args.build_command, "x86_64")
|
||||||
@ -84,13 +84,13 @@ def test_configuration_create_ahriman(args: argparse.Namespace, configuration: C
|
|||||||
|
|
||||||
Setup.configuration_create_ahriman(args, "x86_64", args.repository, configuration.include, repository_paths)
|
Setup.configuration_create_ahriman(args, "x86_64", args.repository, configuration.include, repository_paths)
|
||||||
set_option_mock.assert_has_calls([
|
set_option_mock.assert_has_calls([
|
||||||
mock.call(Configuration.section_name("build", "x86_64"), "build_command", str(command)),
|
MockCall(Configuration.section_name("build", "x86_64"), "build_command", str(command)),
|
||||||
mock.call("repository", "name", args.repository),
|
MockCall("repository", "name", args.repository),
|
||||||
mock.call(Configuration.section_name("build", "x86_64"), "makechrootpkg_flags", f"-U {args.build_as_user}"),
|
MockCall(Configuration.section_name("build", "x86_64"), "makechrootpkg_flags", f"-U {args.build_as_user}"),
|
||||||
mock.call(Configuration.section_name("sign", "x86_64"), "target",
|
MockCall(Configuration.section_name("sign", "x86_64"), "target",
|
||||||
" ".join([target.name.lower() for target in args.sign_target])),
|
" ".join([target.name.lower() for target in args.sign_target])),
|
||||||
mock.call(Configuration.section_name("sign", "x86_64"), "key", args.sign_key),
|
MockCall(Configuration.section_name("sign", "x86_64"), "key", args.sign_key),
|
||||||
mock.call(Configuration.section_name("web", "x86_64"), "port", str(args.web_port)),
|
MockCall(Configuration.section_name("web", "x86_64"), "port", str(args.web_port)),
|
||||||
])
|
])
|
||||||
write_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
write_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
@ -107,11 +107,8 @@ def test_configuration_create_devtools(args: argparse.Namespace, repository_path
|
|||||||
write_mock = mocker.patch("ahriman.core.configuration.Configuration.write")
|
write_mock = mocker.patch("ahriman.core.configuration.Configuration.write")
|
||||||
|
|
||||||
Setup.configuration_create_devtools(args.build_command, "x86_64", args.from_configuration,
|
Setup.configuration_create_devtools(args.build_command, "x86_64", args.from_configuration,
|
||||||
args.no_multilib, args.repository, repository_paths)
|
args.multilib, args.repository, repository_paths)
|
||||||
add_section_mock.assert_has_calls([
|
add_section_mock.assert_has_calls([MockCall("multilib"), MockCall(args.repository)])
|
||||||
mock.call("multilib"),
|
|
||||||
mock.call(args.repository)
|
|
||||||
])
|
|
||||||
write_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
write_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
|
|
||||||
@ -126,7 +123,7 @@ def test_configuration_create_devtools_no_multilib(args: argparse.Namespace, rep
|
|||||||
write_mock = mocker.patch("ahriman.core.configuration.Configuration.write")
|
write_mock = mocker.patch("ahriman.core.configuration.Configuration.write")
|
||||||
|
|
||||||
Setup.configuration_create_devtools(args.build_command, "x86_64", args.from_configuration,
|
Setup.configuration_create_devtools(args.build_command, "x86_64", args.from_configuration,
|
||||||
True, args.repository, repository_paths)
|
False, args.repository, repository_paths)
|
||||||
write_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
write_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ def _default_args(args: argparse.Namespace) -> argparse.Namespace:
|
|||||||
Returns:
|
Returns:
|
||||||
argparse.Namespace: generated arguments for these test cases
|
argparse.Namespace: generated arguments for these test cases
|
||||||
"""
|
"""
|
||||||
|
args.code = None
|
||||||
args.verbose = False
|
args.verbose = False
|
||||||
return args
|
return args
|
||||||
|
|
||||||
@ -29,10 +30,23 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
application_mock = mocker.patch("code.interact")
|
application_mock = mocker.patch("code.interact")
|
||||||
|
|
||||||
Shell.run(args, "x86_64", configuration, True, False)
|
Shell.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_mock.assert_called_once_with(local=pytest.helpers.anyvar(int))
|
application_mock.assert_called_once_with(local=pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
|
|
||||||
|
def test_run_eval(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
|
||||||
|
"""
|
||||||
|
must run command
|
||||||
|
"""
|
||||||
|
args = _default_args(args)
|
||||||
|
args.code = """print("hello world")"""
|
||||||
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
|
application_mock = mocker.patch("code.InteractiveConsole.runcode")
|
||||||
|
|
||||||
|
Shell.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
|
application_mock.assert_called_once_with(args.code)
|
||||||
|
|
||||||
|
|
||||||
def test_run_verbose(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
|
def test_run_verbose(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
|
||||||
"""
|
"""
|
||||||
must run command with verbose option
|
must run command with verbose option
|
||||||
@ -43,6 +57,6 @@ def test_run_verbose(args: argparse.Namespace, configuration: Configuration, moc
|
|||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
application_mock = mocker.patch("code.interact")
|
application_mock = mocker.patch("code.interact")
|
||||||
|
|
||||||
Shell.run(args, "x86_64", configuration, True, False)
|
Shell.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_mock.assert_called_once_with(local=pytest.helpers.anyvar(int))
|
application_mock.assert_called_once_with(local=pytest.helpers.anyvar(int))
|
||||||
print_mock.assert_called_once_with(verbose=False)
|
print_mock.assert_called_once_with(verbose=False)
|
||||||
|
@ -28,5 +28,5 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
application_mock = mocker.patch("ahriman.application.application.Application.sign")
|
application_mock = mocker.patch("ahriman.application.application.Application.sign")
|
||||||
|
|
||||||
Sign.run(args, "x86_64", configuration, True, False)
|
Sign.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_mock.assert_called_once_with([])
|
application_mock.assert_called_once_with([])
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from pytest_mock import MockerFixture
|
from pytest_mock import MockerFixture
|
||||||
from unittest import mock
|
from unittest.mock import call as MockCall
|
||||||
|
|
||||||
from ahriman.application.handlers import Status
|
from ahriman.application.handlers import Status
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
@ -41,11 +41,11 @@ def test_run(args: argparse.Namespace, configuration: Configuration, package_ahr
|
|||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
|
|
||||||
Status.run(args, "x86_64", configuration, True, False)
|
Status.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_mock.assert_called_once_with()
|
application_mock.assert_called_once_with()
|
||||||
packages_mock.assert_called_once_with(None)
|
packages_mock.assert_called_once_with(None)
|
||||||
check_mock.assert_called_once_with(False, False)
|
check_mock.assert_called_once_with(False, False)
|
||||||
print_mock.assert_has_calls([mock.call(False) for _ in range(3)])
|
print_mock.assert_has_calls([MockCall(False) for _ in range(3)])
|
||||||
|
|
||||||
|
|
||||||
def test_run_empty_exception(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
|
def test_run_empty_exception(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
|
||||||
@ -59,7 +59,7 @@ def test_run_empty_exception(args: argparse.Namespace, configuration: Configurat
|
|||||||
mocker.patch("ahriman.core.status.client.Client.get", return_value=[])
|
mocker.patch("ahriman.core.status.client.Client.get", return_value=[])
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
Status.run(args, "x86_64", configuration, True, False)
|
Status.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
check_mock.assert_called_once_with(True, True)
|
check_mock.assert_called_once_with(True, True)
|
||||||
|
|
||||||
|
|
||||||
@ -75,8 +75,8 @@ def test_run_verbose(args: argparse.Namespace, configuration: Configuration, pac
|
|||||||
return_value=[(package_ahriman, BuildStatus(BuildStatusEnum.Success))])
|
return_value=[(package_ahriman, BuildStatus(BuildStatusEnum.Success))])
|
||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
|
|
||||||
Status.run(args, "x86_64", configuration, True, False)
|
Status.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
print_mock.assert_has_calls([mock.call(True) for _ in range(2)])
|
print_mock.assert_has_calls([MockCall(True) for _ in range(2)])
|
||||||
|
|
||||||
|
|
||||||
def test_run_with_package_filter(args: argparse.Namespace, configuration: Configuration, package_ahriman: Package,
|
def test_run_with_package_filter(args: argparse.Namespace, configuration: Configuration, package_ahriman: Package,
|
||||||
@ -90,7 +90,7 @@ def test_run_with_package_filter(args: argparse.Namespace, configuration: Config
|
|||||||
packages_mock = mocker.patch("ahriman.core.status.client.Client.get",
|
packages_mock = mocker.patch("ahriman.core.status.client.Client.get",
|
||||||
return_value=[(package_ahriman, BuildStatus(BuildStatusEnum.Success))])
|
return_value=[(package_ahriman, BuildStatus(BuildStatusEnum.Success))])
|
||||||
|
|
||||||
Status.run(args, "x86_64", configuration, True, False)
|
Status.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
packages_mock.assert_called_once_with(package_ahriman.base)
|
packages_mock.assert_called_once_with(package_ahriman.base)
|
||||||
|
|
||||||
|
|
||||||
@ -107,8 +107,8 @@ def test_run_by_status(args: argparse.Namespace, configuration: Configuration, p
|
|||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
|
|
||||||
Status.run(args, "x86_64", configuration, True, False)
|
Status.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
print_mock.assert_has_calls([mock.call(False) for _ in range(2)])
|
print_mock.assert_has_calls([MockCall(False) for _ in range(2)])
|
||||||
|
|
||||||
|
|
||||||
def test_imply_with_report(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
|
def test_imply_with_report(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
|
||||||
@ -119,7 +119,7 @@ def test_imply_with_report(args: argparse.Namespace, configuration: Configuratio
|
|||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
load_mock = mocker.patch("ahriman.core.status.client.Client.load")
|
load_mock = mocker.patch("ahriman.core.status.client.Client.load")
|
||||||
|
|
||||||
Status.run(args, "x86_64", configuration, True, False)
|
Status.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
load_mock.assert_called_once_with(configuration)
|
load_mock.assert_called_once_with(configuration)
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
update_self_mock = mocker.patch("ahriman.core.status.client.Client.update_self")
|
update_self_mock = mocker.patch("ahriman.core.status.client.Client.update_self")
|
||||||
|
|
||||||
StatusUpdate.run(args, "x86_64", configuration, True, False)
|
StatusUpdate.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
update_self_mock.assert_called_once_with(args.status)
|
update_self_mock.assert_called_once_with(args.status)
|
||||||
|
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ def test_run_packages(args: argparse.Namespace, configuration: Configuration, pa
|
|||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
update_mock = mocker.patch("ahriman.core.status.client.Client.update")
|
update_mock = mocker.patch("ahriman.core.status.client.Client.update")
|
||||||
|
|
||||||
StatusUpdate.run(args, "x86_64", configuration, True, False)
|
StatusUpdate.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
update_mock.assert_called_once_with(package_ahriman.base, args.status)
|
update_mock.assert_called_once_with(package_ahriman.base, args.status)
|
||||||
|
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ def test_run_remove(args: argparse.Namespace, configuration: Configuration, pack
|
|||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
update_mock = mocker.patch("ahriman.core.status.client.Client.remove")
|
update_mock = mocker.patch("ahriman.core.status.client.Client.remove")
|
||||||
|
|
||||||
StatusUpdate.run(args, "x86_64", configuration, True, False)
|
StatusUpdate.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
update_mock.assert_called_once_with(package_ahriman.base)
|
update_mock.assert_called_once_with(package_ahriman.base)
|
||||||
|
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ def test_imply_with_report(args: argparse.Namespace, configuration: Configuratio
|
|||||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||||
load_mock = mocker.patch("ahriman.core.status.client.Client.load")
|
load_mock = mocker.patch("ahriman.core.status.client.Client.load")
|
||||||
|
|
||||||
StatusUpdate.run(args, "x86_64", configuration, True, False)
|
StatusUpdate.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
load_mock.assert_called_once_with(configuration)
|
load_mock.assert_called_once_with(configuration)
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
application_mock = mocker.patch("ahriman.application.application.Application.on_result")
|
application_mock = mocker.patch("ahriman.application.application.Application.on_result")
|
||||||
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
||||||
|
|
||||||
Triggers.run(args, "x86_64", configuration, True, False)
|
Triggers.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_mock.assert_called_once_with(Result())
|
application_mock.assert_called_once_with(Result())
|
||||||
on_start_mock.assert_called_once_with()
|
on_start_mock.assert_called_once_with()
|
||||||
|
|
||||||
@ -48,6 +48,6 @@ def test_run_trigger(args: argparse.Namespace, configuration: Configuration, pac
|
|||||||
report_mock = mocker.patch("ahriman.core.report.ReportTrigger.on_result")
|
report_mock = mocker.patch("ahriman.core.report.ReportTrigger.on_result")
|
||||||
upload_mock = mocker.patch("ahriman.core.upload.UploadTrigger.on_result")
|
upload_mock = mocker.patch("ahriman.core.upload.UploadTrigger.on_result")
|
||||||
|
|
||||||
Triggers.run(args, "x86_64", configuration, True, False)
|
Triggers.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
report_mock.assert_called_once_with(Result(), [package_ahriman])
|
report_mock.assert_called_once_with(Result(), [package_ahriman])
|
||||||
upload_mock.assert_not_called()
|
upload_mock.assert_not_called()
|
||||||
|
@ -32,7 +32,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
return_value=["command"])
|
return_value=["command"])
|
||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
|
|
||||||
UnsafeCommands.run(args, "x86_64", configuration, True, False)
|
UnsafeCommands.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
commands_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
commands_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
||||||
print_mock.assert_called_once_with(verbose=True)
|
print_mock.assert_called_once_with(verbose=True)
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ def test_run_check(args: argparse.Namespace, configuration: Configuration, mocke
|
|||||||
return_value=["command"])
|
return_value=["command"])
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.UnsafeCommands.check_unsafe")
|
check_mock = mocker.patch("ahriman.application.handlers.UnsafeCommands.check_unsafe")
|
||||||
|
|
||||||
UnsafeCommands.run(args, "x86_64", configuration, True, False)
|
UnsafeCommands.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
commands_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
commands_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
||||||
check_mock.assert_called_once_with("clean", ["command"], pytest.helpers.anyvar(int))
|
check_mock.assert_called_once_with("clean", ["command"], pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import argparse
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from pytest_mock import MockerFixture
|
from pytest_mock import MockerFixture
|
||||||
from unittest import mock
|
from unittest.mock import call as MockCall
|
||||||
|
|
||||||
from ahriman.application.application import Application
|
from ahriman.application.application import Application
|
||||||
from ahriman.application.handlers import Update
|
from ahriman.application.handlers import Update
|
||||||
@ -24,10 +24,10 @@ def _default_args(args: argparse.Namespace) -> argparse.Namespace:
|
|||||||
args.package = []
|
args.package = []
|
||||||
args.dry_run = False
|
args.dry_run = False
|
||||||
args.exit_code = False
|
args.exit_code = False
|
||||||
args.no_aur = False
|
args.aur = True
|
||||||
args.no_local = False
|
args.local = True
|
||||||
args.no_manual = False
|
args.manual = True
|
||||||
args.no_vcs = False
|
args.vcs = True
|
||||||
args.refresh = 0
|
args.refresh = 0
|
||||||
return args
|
return args
|
||||||
|
|
||||||
@ -46,11 +46,11 @@ def test_run(args: argparse.Namespace, package_ahriman: Package,
|
|||||||
updates_mock = mocker.patch("ahriman.application.application.Application.updates", return_value=[package_ahriman])
|
updates_mock = mocker.patch("ahriman.application.application.Application.updates", return_value=[package_ahriman])
|
||||||
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
on_start_mock = mocker.patch("ahriman.application.application.Application.on_start")
|
||||||
|
|
||||||
Update.run(args, "x86_64", configuration, True, False)
|
Update.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_mock.assert_called_once_with([package_ahriman])
|
application_mock.assert_called_once_with([package_ahriman])
|
||||||
updates_mock.assert_called_once_with(args.package, args.no_aur, args.no_local, args.no_manual, args.no_vcs,
|
updates_mock.assert_called_once_with(args.package, aur=args.aur, local=args.local, manual=args.manual, vcs=args.vcs,
|
||||||
pytest.helpers.anyvar(int))
|
log_fn=pytest.helpers.anyvar(int))
|
||||||
check_mock.assert_has_calls([mock.call(False, False), mock.call(False, False)])
|
check_mock.assert_has_calls([MockCall(False, False), MockCall(False, False)])
|
||||||
on_start_mock.assert_called_once_with()
|
on_start_mock.assert_called_once_with()
|
||||||
|
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ def test_run_empty_exception(args: argparse.Namespace, configuration: Configurat
|
|||||||
mocker.patch("ahriman.application.application.Application.updates", return_value=[])
|
mocker.patch("ahriman.application.application.Application.updates", return_value=[])
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
Update.run(args, "x86_64", configuration, True, False)
|
Update.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
check_mock.assert_called_once_with(True, True)
|
check_mock.assert_called_once_with(True, True)
|
||||||
|
|
||||||
|
|
||||||
@ -81,8 +81,8 @@ def test_run_update_empty_exception(args: argparse.Namespace, package_ahriman: P
|
|||||||
mocker.patch("ahriman.application.application.Application.updates", return_value=[package_ahriman])
|
mocker.patch("ahriman.application.application.Application.updates", return_value=[package_ahriman])
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
Update.run(args, "x86_64", configuration, True, False)
|
Update.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
check_mock.assert_has_calls([mock.call(True, False), mock.call(True, True)])
|
check_mock.assert_has_calls([MockCall(True, False), MockCall(True, True)])
|
||||||
|
|
||||||
|
|
||||||
def test_run_dry_run(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
|
def test_run_dry_run(args: argparse.Namespace, configuration: Configuration, mocker: MockerFixture) -> None:
|
||||||
@ -96,9 +96,9 @@ def test_run_dry_run(args: argparse.Namespace, configuration: Configuration, moc
|
|||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
updates_mock = mocker.patch("ahriman.application.application.Application.updates")
|
updates_mock = mocker.patch("ahriman.application.application.Application.updates")
|
||||||
|
|
||||||
Update.run(args, "x86_64", configuration, True, False)
|
Update.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
updates_mock.assert_called_once_with(args.package, args.no_aur, args.no_local, args.no_manual, args.no_vcs,
|
updates_mock.assert_called_once_with(args.package, aur=args.aur, local=args.local, manual=args.manual, vcs=args.vcs,
|
||||||
pytest.helpers.anyvar(int))
|
log_fn=pytest.helpers.anyvar(int))
|
||||||
application_mock.assert_not_called()
|
application_mock.assert_not_called()
|
||||||
check_mock.assert_called_once_with(False, pytest.helpers.anyvar(int))
|
check_mock.assert_called_once_with(False, pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
@ -109,4 +109,4 @@ def test_log_fn(application: Application, mocker: MockerFixture) -> None:
|
|||||||
"""
|
"""
|
||||||
logger_mock = mocker.patch("logging.Logger.info")
|
logger_mock = mocker.patch("logging.Logger.info")
|
||||||
Update.log_fn(application, False)("hello")
|
Update.log_fn(application, False)("hello")
|
||||||
logger_mock.assert_has_calls([mock.call("hello")])
|
logger_mock.assert_has_calls([MockCall("hello")])
|
||||||
|
@ -7,7 +7,7 @@ from pytest_mock import MockerFixture
|
|||||||
from ahriman.application.handlers import Users
|
from ahriman.application.handlers import Users
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.database import SQLite
|
from ahriman.core.database import SQLite
|
||||||
from ahriman.core.exceptions import InitializeException
|
from ahriman.core.exceptions import InitializeError
|
||||||
from ahriman.models.action import Action
|
from ahriman.models.action import Action
|
||||||
from ahriman.models.user import User
|
from ahriman.models.user import User
|
||||||
from ahriman.models.user_access import UserAccess
|
from ahriman.models.user_access import UserAccess
|
||||||
@ -47,7 +47,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, database: S
|
|||||||
get_salt_mock = mocker.patch("ahriman.application.handlers.Users.get_salt", return_value="salt")
|
get_salt_mock = mocker.patch("ahriman.application.handlers.Users.get_salt", return_value="salt")
|
||||||
update_mock = mocker.patch("ahriman.core.database.SQLite.user_update")
|
update_mock = mocker.patch("ahriman.core.database.SQLite.user_update")
|
||||||
|
|
||||||
Users.run(args, "x86_64", configuration, True, False)
|
Users.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
get_auth_configuration_mock.assert_called_once_with(configuration.include)
|
get_auth_configuration_mock.assert_called_once_with(configuration.include)
|
||||||
create_configuration_mock.assert_called_once_with(pytest.helpers.anyvar(int), pytest.helpers.anyvar(int),
|
create_configuration_mock.assert_called_once_with(pytest.helpers.anyvar(int), pytest.helpers.anyvar(int),
|
||||||
pytest.helpers.anyvar(int), args.as_service, args.secure)
|
pytest.helpers.anyvar(int), args.as_service, args.secure)
|
||||||
@ -67,7 +67,7 @@ def test_run_list(args: argparse.Namespace, configuration: Configuration, databa
|
|||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
list_mock = mocker.patch("ahriman.core.database.SQLite.user_list", return_value=[user])
|
list_mock = mocker.patch("ahriman.core.database.SQLite.user_list", return_value=[user])
|
||||||
|
|
||||||
Users.run(args, "x86_64", configuration, True, False)
|
Users.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
list_mock.assert_called_once_with("user", args.role)
|
list_mock.assert_called_once_with("user", args.role)
|
||||||
check_mock.assert_called_once_with(False, False)
|
check_mock.assert_called_once_with(False, False)
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ def test_run_empty_exception(args: argparse.Namespace, configuration: Configurat
|
|||||||
mocker.patch("ahriman.core.database.SQLite.user_list", return_value=[])
|
mocker.patch("ahriman.core.database.SQLite.user_list", return_value=[])
|
||||||
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
check_mock = mocker.patch("ahriman.application.handlers.Handler.check_if_empty")
|
||||||
|
|
||||||
Users.run(args, "x86_64", configuration, True, False)
|
Users.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
check_mock.assert_called_once_with(True, True)
|
check_mock.assert_called_once_with(True, True)
|
||||||
|
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ def test_run_remove(args: argparse.Namespace, configuration: Configuration, data
|
|||||||
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
||||||
remove_mock = mocker.patch("ahriman.core.database.SQLite.user_remove")
|
remove_mock = mocker.patch("ahriman.core.database.SQLite.user_remove")
|
||||||
|
|
||||||
Users.run(args, "x86_64", configuration, True, False)
|
Users.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
remove_mock.assert_called_once_with(args.username)
|
remove_mock.assert_called_once_with(args.username)
|
||||||
|
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ def test_configuration_write_not_loaded(configuration: Configuration, mocker: Mo
|
|||||||
configuration.path = None
|
configuration.path = None
|
||||||
mocker.patch("pathlib.Path.open")
|
mocker.patch("pathlib.Path.open")
|
||||||
|
|
||||||
with pytest.raises(InitializeException):
|
with pytest.raises(InitializeError):
|
||||||
Users.configuration_write(configuration, secure=True)
|
Users.configuration_write(configuration, secure=True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from pytest_mock import MockerFixture
|
from pytest_mock import MockerFixture
|
||||||
from unittest import mock
|
from unittest.mock import call as MockCall
|
||||||
|
|
||||||
from ahriman.application.handlers import Versions
|
from ahriman.application.handlers import Versions
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
@ -14,9 +14,9 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
application_mock = mocker.patch("ahriman.application.handlers.Versions.package_dependencies")
|
application_mock = mocker.patch("ahriman.application.handlers.Versions.package_dependencies")
|
||||||
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
print_mock = mocker.patch("ahriman.core.formatters.Printer.print")
|
||||||
|
|
||||||
Versions.run(args, "x86_64", configuration, True, False)
|
Versions.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
application_mock.assert_called_once_with("ahriman", ("pacman", "s3", "web"))
|
application_mock.assert_called_once_with("ahriman", ("pacman", "s3", "web"))
|
||||||
print_mock.assert_has_calls([mock.call(verbose=False, separator=" "), mock.call(verbose=False, separator=" ")])
|
print_mock.assert_has_calls([MockCall(verbose=False, separator=" "), MockCall(verbose=False, separator=" ")])
|
||||||
|
|
||||||
|
|
||||||
def test_package_dependencies() -> None:
|
def test_package_dependencies() -> None:
|
||||||
|
@ -31,7 +31,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
|
|||||||
setup_mock = mocker.patch("ahriman.web.web.setup_service")
|
setup_mock = mocker.patch("ahriman.web.web.setup_service")
|
||||||
run_mock = mocker.patch("ahriman.web.web.run_server")
|
run_mock = mocker.patch("ahriman.web.web.run_server")
|
||||||
|
|
||||||
Web.run(args, "x86_64", configuration, True, False)
|
Web.run(args, "x86_64", configuration, report=False, unsafe=False)
|
||||||
setup_mock.assert_called_once_with("x86_64", configuration, pytest.helpers.anyvar(int))
|
setup_mock.assert_called_once_with("x86_64", configuration, pytest.helpers.anyvar(int))
|
||||||
run_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
run_mock.assert_called_once_with(pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
|
@ -47,12 +47,12 @@ def test_multiple_architectures(parser: argparse.ArgumentParser) -> None:
|
|||||||
|
|
||||||
def test_subparsers_aur_search(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_aur_search(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
aur-search command must imply architecture list, lock, no-report, quiet and unsafe
|
aur-search command must imply architecture list, lock, report, quiet and unsafe
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["aur-search", "ahriman"])
|
args = parser.parse_args(["aur-search", "ahriman"])
|
||||||
assert args.architecture == [""]
|
assert args.architecture == [""]
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
assert args.quiet
|
assert args.quiet
|
||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
@ -99,12 +99,12 @@ def test_subparsers_daemon_option_interval(parser: argparse.ArgumentParser) -> N
|
|||||||
|
|
||||||
def test_subparsers_help(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_help(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
help command must imply architecture list, lock, no-report, quiet, unsafe and parser
|
help command must imply architecture list, lock, report, quiet, unsafe and parser
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["help"])
|
args = parser.parse_args(["help"])
|
||||||
assert args.architecture == [""]
|
assert args.architecture == [""]
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
assert args.quiet
|
assert args.quiet
|
||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
assert args.parser is not None and args.parser()
|
assert args.parser is not None and args.parser()
|
||||||
@ -120,12 +120,12 @@ def test_subparsers_help_architecture(parser: argparse.ArgumentParser) -> None:
|
|||||||
|
|
||||||
def test_subparsers_help_commands_unsafe(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_help_commands_unsafe(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
help-commands-unsafe command must imply architecture list, lock, no-report, quiet, unsafe and parser
|
help-commands-unsafe command must imply architecture list, lock, report, quiet, unsafe and parser
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["help-commands-unsafe"])
|
args = parser.parse_args(["help-commands-unsafe"])
|
||||||
assert args.architecture == [""]
|
assert args.architecture == [""]
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
assert args.quiet
|
assert args.quiet
|
||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
assert args.parser is not None and args.parser()
|
assert args.parser is not None and args.parser()
|
||||||
@ -141,12 +141,12 @@ def test_subparsers_help_commands_unsafe_architecture(parser: argparse.ArgumentP
|
|||||||
|
|
||||||
def test_subparsers_key_import(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_key_import(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
key-import command must imply architecture list, lock and no-report
|
key-import command must imply architecture list, lock and report
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["key-import", "key"])
|
args = parser.parse_args(["key-import", "key"])
|
||||||
assert args.architecture == [""]
|
assert args.architecture == [""]
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_key_import_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_key_import_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
@ -191,38 +191,38 @@ def test_subparsers_package_remove_architecture(parser: argparse.ArgumentParser)
|
|||||||
|
|
||||||
def test_subparsers_package_status(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_package_status(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
package-status command must imply lock, no-report, quiet and unsafe
|
package-status command must imply lock, report, quiet and unsafe
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["-a", "x86_64", "package-status"])
|
args = parser.parse_args(["-a", "x86_64", "package-status"])
|
||||||
assert args.architecture == ["x86_64"]
|
assert args.architecture == ["x86_64"]
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
assert args.quiet
|
assert args.quiet
|
||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_package_status_remove(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_package_status_remove(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
package-status-remove command must imply action, lock, no-report, quiet and unsafe
|
package-status-remove command must imply action, lock, report, quiet and unsafe
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["-a", "x86_64", "package-status-remove", "ahriman"])
|
args = parser.parse_args(["-a", "x86_64", "package-status-remove", "ahriman"])
|
||||||
assert args.architecture == ["x86_64"]
|
assert args.architecture == ["x86_64"]
|
||||||
assert args.action == Action.Remove
|
assert args.action == Action.Remove
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
assert args.quiet
|
assert args.quiet
|
||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_package_status_update(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_package_status_update(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
package-status-update command must imply action, lock, no-report, quiet and unsafe
|
package-status-update command must imply action, lock, report, quiet and unsafe
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["-a", "x86_64", "package-status-update"])
|
args = parser.parse_args(["-a", "x86_64", "package-status-update"])
|
||||||
assert args.architecture == ["x86_64"]
|
assert args.architecture == ["x86_64"]
|
||||||
assert args.action == Action.Update
|
assert args.action == Action.Update
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
assert args.quiet
|
assert args.quiet
|
||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
@ -239,13 +239,13 @@ def test_subparsers_package_status_update_option_status(parser: argparse.Argumen
|
|||||||
|
|
||||||
def test_subparsers_patch_add(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_patch_add(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
patch-add command must imply action, architecture list, lock and no-report
|
patch-add command must imply action, architecture list, lock and report
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["patch-add", "ahriman", "version"])
|
args = parser.parse_args(["patch-add", "ahriman", "version"])
|
||||||
assert args.action == Action.Update
|
assert args.action == Action.Update
|
||||||
assert args.architecture == [""]
|
assert args.architecture == [""]
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_patch_add_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_patch_add_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
@ -258,13 +258,13 @@ def test_subparsers_patch_add_architecture(parser: argparse.ArgumentParser) -> N
|
|||||||
|
|
||||||
def test_subparsers_patch_list(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_patch_list(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
patch-list command must imply action, architecture list, lock and no-report
|
patch-list command must imply action, architecture list, lock and report
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["patch-list", "ahriman"])
|
args = parser.parse_args(["patch-list", "ahriman"])
|
||||||
assert args.action == Action.List
|
assert args.action == Action.List
|
||||||
assert args.architecture == [""]
|
assert args.architecture == [""]
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_patch_list_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_patch_list_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
@ -277,13 +277,13 @@ def test_subparsers_patch_list_architecture(parser: argparse.ArgumentParser) ->
|
|||||||
|
|
||||||
def test_subparsers_patch_remove(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_patch_remove(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
patch-remove command must imply action, architecture list, lock and no-report
|
patch-remove command must imply action, architecture list, lock and report
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["patch-remove", "ahriman"])
|
args = parser.parse_args(["patch-remove", "ahriman"])
|
||||||
assert args.action == Action.Remove
|
assert args.action == Action.Remove
|
||||||
assert args.architecture == [""]
|
assert args.architecture == [""]
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_patch_remove_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_patch_remove_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
@ -296,13 +296,13 @@ def test_subparsers_patch_remove_architecture(parser: argparse.ArgumentParser) -
|
|||||||
|
|
||||||
def test_subparsers_patch_set_add(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_patch_set_add(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
patch-set-add command must imply action, architecture list, lock, no-report and variable
|
patch-set-add command must imply action, architecture list, lock, report and variable
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["patch-set-add", "ahriman"])
|
args = parser.parse_args(["patch-set-add", "ahriman"])
|
||||||
assert args.action == Action.Update
|
assert args.action == Action.Update
|
||||||
assert args.architecture == [""]
|
assert args.architecture == [""]
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
assert args.variable is None
|
assert args.variable is None
|
||||||
|
|
||||||
|
|
||||||
@ -332,12 +332,12 @@ def test_subparsers_patch_set_add_option_track(parser: argparse.ArgumentParser)
|
|||||||
|
|
||||||
def test_subparsers_repo_backup(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_backup(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-backup command must imply architecture list, lock, no-report and unsafe
|
repo-backup command must imply architecture list, lock, report and unsafe
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["repo-backup", "output.zip"])
|
args = parser.parse_args(["repo-backup", "output.zip"])
|
||||||
assert args.architecture == [""]
|
assert args.architecture == [""]
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
|
|
||||||
@ -351,12 +351,12 @@ def test_subparsers_repo_backup_architecture(parser: argparse.ArgumentParser) ->
|
|||||||
|
|
||||||
def test_subparsers_repo_check(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_check(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-check command must imply dry-run, no-aur and no-manual
|
repo-check command must imply dry-run, aur and manual
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["repo-check"])
|
args = parser.parse_args(["repo-check"])
|
||||||
assert args.dry_run
|
assert args.dry_run
|
||||||
assert not args.no_aur
|
assert args.aur
|
||||||
assert args.no_manual
|
assert not args.manual
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_repo_check_architecture(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_check_architecture(parser: argparse.ArgumentParser) -> None:
|
||||||
@ -402,12 +402,12 @@ def test_subparsers_repo_clean_architecture(parser: argparse.ArgumentParser) ->
|
|||||||
|
|
||||||
def test_subparsers_repo_config(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_config(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-config command must imply lock, no-report, quiet and unsafe
|
repo-config command must imply lock, report, quiet and unsafe
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["-a", "x86_64", "repo-config"])
|
args = parser.parse_args(["-a", "x86_64", "repo-config"])
|
||||||
assert args.architecture == ["x86_64"]
|
assert args.architecture == ["x86_64"]
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
assert args.quiet
|
assert args.quiet
|
||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
@ -452,12 +452,12 @@ def test_subparsers_repo_report_architecture(parser: argparse.ArgumentParser) ->
|
|||||||
|
|
||||||
def test_subparsers_repo_restore(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_restore(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-restore command must imply architecture list, lock, no-report and unsafe
|
repo-restore command must imply architecture list, lock, report and unsafe
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["repo-restore", "output.zip"])
|
args = parser.parse_args(["repo-restore", "output.zip"])
|
||||||
assert args.architecture == [""]
|
assert args.architecture == [""]
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
|
|
||||||
@ -471,13 +471,13 @@ def test_subparsers_repo_restore_architecture(parser: argparse.ArgumentParser) -
|
|||||||
|
|
||||||
def test_subparsers_repo_setup(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_setup(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
repo-setup command must imply lock, no-report, quiet and unsafe
|
repo-setup command must imply lock, report, quiet and unsafe
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["-a", "x86_64", "repo-setup", "--packager", "John Doe <john@doe.com>",
|
args = parser.parse_args(["-a", "x86_64", "repo-setup", "--packager", "John Doe <john@doe.com>",
|
||||||
"--repository", "aur-clone"])
|
"--repository", "aur-clone"])
|
||||||
assert args.architecture == ["x86_64"]
|
assert args.architecture == ["x86_64"]
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
assert args.quiet
|
assert args.quiet
|
||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
@ -516,13 +516,13 @@ def test_subparsers_repo_sign_architecture(parser: argparse.ArgumentParser) -> N
|
|||||||
|
|
||||||
def test_subparsers_repo_status_update(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_repo_status_update(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
re[p-status-update command must imply action, lock, no-report, package, quiet and unsafe
|
re[p-status-update command must imply action, lock, report, package, quiet and unsafe
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["-a", "x86_64", "package-status-update"])
|
args = parser.parse_args(["-a", "x86_64", "package-status-update"])
|
||||||
assert args.architecture == ["x86_64"]
|
assert args.architecture == ["x86_64"]
|
||||||
assert args.action == Action.Update
|
assert args.action == Action.Update
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
assert not args.package
|
assert not args.package
|
||||||
assert args.quiet
|
assert args.quiet
|
||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
@ -590,22 +590,22 @@ def test_subparsers_repo_update_option_refresh(parser: argparse.ArgumentParser)
|
|||||||
|
|
||||||
def test_subparsers_shell(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_shell(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
shell command must imply lock and no-report
|
shell command must imply lock and report
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["shell"])
|
args = parser.parse_args(["shell"])
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
|
|
||||||
|
|
||||||
def test_subparsers_user_add(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_user_add(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
user-add command must imply action, architecture, lock, no-report, quiet and unsafe
|
user-add command must imply action, architecture, lock, report, quiet and unsafe
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["user-add", "username"])
|
args = parser.parse_args(["user-add", "username"])
|
||||||
assert args.action == Action.Update
|
assert args.action == Action.Update
|
||||||
assert args.architecture == [""]
|
assert args.architecture == [""]
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
assert args.quiet
|
assert args.quiet
|
||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
@ -630,13 +630,13 @@ def test_subparsers_user_add_option_role(parser: argparse.ArgumentParser) -> Non
|
|||||||
|
|
||||||
def test_subparsers_user_list(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_user_list(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
user-list command must imply action, architecture, lock, no-report, password, quiet and unsafe
|
user-list command must imply action, architecture, lock, report, password, quiet and unsafe
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["user-list"])
|
args = parser.parse_args(["user-list"])
|
||||||
assert args.action == Action.List
|
assert args.action == Action.List
|
||||||
assert args.architecture == [""]
|
assert args.architecture == [""]
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
assert args.password is not None
|
assert args.password is not None
|
||||||
assert args.quiet
|
assert args.quiet
|
||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
@ -660,13 +660,13 @@ def test_subparsers_user_list_option_role(parser: argparse.ArgumentParser) -> No
|
|||||||
|
|
||||||
def test_subparsers_user_remove(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_user_remove(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
user-remove command must imply action, architecture, lock, no-report, password, quiet, role and unsafe
|
user-remove command must imply action, architecture, lock, report, password, quiet, role and unsafe
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["user-remove", "username"])
|
args = parser.parse_args(["user-remove", "username"])
|
||||||
assert args.action == Action.Remove
|
assert args.action == Action.Remove
|
||||||
assert args.architecture == [""]
|
assert args.architecture == [""]
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
assert args.password is not None
|
assert args.password is not None
|
||||||
assert args.quiet
|
assert args.quiet
|
||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
@ -682,12 +682,12 @@ def test_subparsers_user_remove_architecture(parser: argparse.ArgumentParser) ->
|
|||||||
|
|
||||||
def test_subparsers_version(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_version(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
version command must imply architecture, lock, no-report, quiet and unsafe
|
version command must imply architecture, lock, report, quiet and unsafe
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["version"])
|
args = parser.parse_args(["version"])
|
||||||
assert args.architecture == [""]
|
assert args.architecture == [""]
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
assert args.quiet
|
assert args.quiet
|
||||||
assert args.unsafe
|
assert args.unsafe
|
||||||
|
|
||||||
@ -702,12 +702,12 @@ def test_subparsers_version_architecture(parser: argparse.ArgumentParser) -> Non
|
|||||||
|
|
||||||
def test_subparsers_web(parser: argparse.ArgumentParser) -> None:
|
def test_subparsers_web(parser: argparse.ArgumentParser) -> None:
|
||||||
"""
|
"""
|
||||||
web command must imply lock, no_report and parser
|
web command must imply lock, report and parser
|
||||||
"""
|
"""
|
||||||
args = parser.parse_args(["-a", "x86_64", "web"])
|
args = parser.parse_args(["-a", "x86_64", "web"])
|
||||||
assert args.architecture == ["x86_64"]
|
assert args.architecture == ["x86_64"]
|
||||||
assert args.lock is None
|
assert args.lock is None
|
||||||
assert args.no_report
|
assert not args.report
|
||||||
assert args.parser is not None and args.parser()
|
assert args.parser is not None and args.parser()
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@ import tempfile
|
|||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from pytest_mock import MockerFixture
|
from pytest_mock import MockerFixture
|
||||||
from unittest import mock
|
from unittest.mock import call as MockCall
|
||||||
|
|
||||||
from ahriman import version
|
from ahriman import version
|
||||||
from ahriman.application.lock import Lock
|
from ahriman.application.lock import Lock
|
||||||
from ahriman.core.exceptions import DuplicateRun, UnsafeRun
|
from ahriman.core.exceptions import DuplicateRunError, UnsafeRunError
|
||||||
from ahriman.models.build_status import BuildStatus, BuildStatusEnum
|
from ahriman.models.build_status import BuildStatus, BuildStatusEnum
|
||||||
from ahriman.models.internal_status import InternalStatus
|
from ahriman.models.internal_status import InternalStatus
|
||||||
|
|
||||||
@ -28,10 +28,7 @@ def test_enter(lock: Lock, mocker: MockerFixture) -> None:
|
|||||||
clear_mock.assert_called_once_with()
|
clear_mock.assert_called_once_with()
|
||||||
create_mock.assert_called_once_with()
|
create_mock.assert_called_once_with()
|
||||||
check_version_mock.assert_called_once_with()
|
check_version_mock.assert_called_once_with()
|
||||||
update_status_mock.assert_has_calls([
|
update_status_mock.assert_has_calls([MockCall(BuildStatusEnum.Building), MockCall(BuildStatusEnum.Success)])
|
||||||
mock.call(BuildStatusEnum.Building),
|
|
||||||
mock.call(BuildStatusEnum.Success)
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
def test_exit_with_exception(lock: Lock, mocker: MockerFixture) -> None:
|
def test_exit_with_exception(lock: Lock, mocker: MockerFixture) -> None:
|
||||||
@ -46,10 +43,7 @@ def test_exit_with_exception(lock: Lock, mocker: MockerFixture) -> None:
|
|||||||
with pytest.raises(Exception):
|
with pytest.raises(Exception):
|
||||||
with lock:
|
with lock:
|
||||||
raise Exception()
|
raise Exception()
|
||||||
update_status_mock.assert_has_calls([
|
update_status_mock.assert_has_calls([MockCall(BuildStatusEnum.Building), MockCall(BuildStatusEnum.Failed)])
|
||||||
mock.call(BuildStatusEnum.Building),
|
|
||||||
mock.call(BuildStatusEnum.Failed)
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
def test_check_version(lock: Lock, mocker: MockerFixture) -> None:
|
def test_check_version(lock: Lock, mocker: MockerFixture) -> None:
|
||||||
@ -82,15 +76,15 @@ def test_check_user(lock: Lock, mocker: MockerFixture) -> None:
|
|||||||
"""
|
"""
|
||||||
check_user_patch = mocker.patch("ahriman.application.lock.check_user")
|
check_user_patch = mocker.patch("ahriman.application.lock.check_user")
|
||||||
lock.check_user()
|
lock.check_user()
|
||||||
check_user_patch.assert_called_once_with(lock.paths, False)
|
check_user_patch.assert_called_once_with(lock.paths, unsafe=False)
|
||||||
|
|
||||||
|
|
||||||
def test_check_user_exception(lock: Lock, mocker: MockerFixture) -> None:
|
def test_check_user_exception(lock: Lock, mocker: MockerFixture) -> None:
|
||||||
"""
|
"""
|
||||||
must raise exception if user differs
|
must raise exception if user differs
|
||||||
"""
|
"""
|
||||||
mocker.patch("ahriman.application.lock.check_user", side_effect=UnsafeRun(0, 1))
|
mocker.patch("ahriman.application.lock.check_user", side_effect=UnsafeRunError(0, 1))
|
||||||
with pytest.raises(UnsafeRun):
|
with pytest.raises(UnsafeRunError):
|
||||||
lock.check_user()
|
lock.check_user()
|
||||||
|
|
||||||
|
|
||||||
@ -148,7 +142,7 @@ def test_create_exception(lock: Lock) -> None:
|
|||||||
lock.path = Path(tempfile.mktemp()) # nosec
|
lock.path = Path(tempfile.mktemp()) # nosec
|
||||||
lock.path.touch()
|
lock.path.touch()
|
||||||
|
|
||||||
with pytest.raises(DuplicateRun):
|
with pytest.raises(DuplicateRunError):
|
||||||
lock.create()
|
lock.create()
|
||||||
lock.path.unlink()
|
lock.path.unlink()
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ from unittest.mock import MagicMock
|
|||||||
|
|
||||||
from ahriman.core.alpm.pacman import Pacman
|
from ahriman.core.alpm.pacman import Pacman
|
||||||
from ahriman.core.alpm.remote import AUR
|
from ahriman.core.alpm.remote import AUR
|
||||||
from ahriman.core.exceptions import InvalidPackageInfo
|
from ahriman.core.exceptions import PackageInfoError, UnknownPackageError
|
||||||
from ahriman.models.aur_package import AURPackage
|
from ahriman.models.aur_package import AURPackage
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ def test_parse_response_error(resource_path_root: Path) -> None:
|
|||||||
must raise exception on invalid response
|
must raise exception on invalid response
|
||||||
"""
|
"""
|
||||||
response = (resource_path_root / "models" / "aur_error").read_text()
|
response = (resource_path_root / "models" / "aur_error").read_text()
|
||||||
with pytest.raises(InvalidPackageInfo, match="Incorrect request type specified."):
|
with pytest.raises(PackageInfoError, match="Incorrect request type specified."):
|
||||||
AUR.parse_response(json.loads(response))
|
AUR.parse_response(json.loads(response))
|
||||||
|
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ def test_parse_response_unknown_error() -> None:
|
|||||||
"""
|
"""
|
||||||
must raise exception on invalid response with empty error message
|
must raise exception on invalid response with empty error message
|
||||||
"""
|
"""
|
||||||
with pytest.raises(InvalidPackageInfo, match="Unknown API error"):
|
with pytest.raises(PackageInfoError, match="Unknown API error"):
|
||||||
AUR.parse_response({"type": "error"})
|
AUR.parse_response({"type": "error"})
|
||||||
|
|
||||||
|
|
||||||
@ -142,6 +142,16 @@ def test_package_info(aur: AUR, aur_package_ahriman: AURPackage, pacman: Pacman,
|
|||||||
request_mock.assert_called_once_with("info", aur_package_ahriman.name)
|
request_mock.assert_called_once_with("info", aur_package_ahriman.name)
|
||||||
|
|
||||||
|
|
||||||
|
def test_package_info_not_found(aur: AUR, aur_package_ahriman: AURPackage, pacman: Pacman,
|
||||||
|
mocker: MockerFixture) -> None:
|
||||||
|
"""
|
||||||
|
must raise UnknownPackage exception in case if no package was found
|
||||||
|
"""
|
||||||
|
mocker.patch("ahriman.core.alpm.remote.AUR.make_request", return_value=[])
|
||||||
|
with pytest.raises(UnknownPackageError, match=aur_package_ahriman.name):
|
||||||
|
assert aur.package_info(aur_package_ahriman.name, pacman=pacman)
|
||||||
|
|
||||||
|
|
||||||
def test_package_search(aur: AUR, aur_package_ahriman: AURPackage, pacman: Pacman, mocker: MockerFixture) -> None:
|
def test_package_search(aur: AUR, aur_package_ahriman: AURPackage, pacman: Pacman, mocker: MockerFixture) -> None:
|
||||||
"""
|
"""
|
||||||
must make request for search
|
must make request for search
|
||||||
|
@ -8,7 +8,7 @@ from unittest.mock import MagicMock
|
|||||||
|
|
||||||
from ahriman.core.alpm.pacman import Pacman
|
from ahriman.core.alpm.pacman import Pacman
|
||||||
from ahriman.core.alpm.remote import Official
|
from ahriman.core.alpm.remote import Official
|
||||||
from ahriman.core.exceptions import InvalidPackageInfo
|
from ahriman.core.exceptions import PackageInfoError, UnknownPackageError
|
||||||
from ahriman.models.aur_package import AURPackage
|
from ahriman.models.aur_package import AURPackage
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ def test_parse_response_unknown_error(resource_path_root: Path) -> None:
|
|||||||
must raise exception on invalid response with empty error message
|
must raise exception on invalid response with empty error message
|
||||||
"""
|
"""
|
||||||
response = (resource_path_root / "models" / "official_error").read_text()
|
response = (resource_path_root / "models" / "official_error").read_text()
|
||||||
with pytest.raises(InvalidPackageInfo, match="API validation error"):
|
with pytest.raises(PackageInfoError, match="API validation error"):
|
||||||
Official.parse_response(json.loads(response))
|
Official.parse_response(json.loads(response))
|
||||||
|
|
||||||
|
|
||||||
@ -119,6 +119,16 @@ def test_package_info(official: Official, aur_package_akonadi: AURPackage, pacma
|
|||||||
request_mock.assert_called_once_with(aur_package_akonadi.name, by="name")
|
request_mock.assert_called_once_with(aur_package_akonadi.name, by="name")
|
||||||
|
|
||||||
|
|
||||||
|
def test_package_info_not_found(official: Official, aur_package_ahriman: AURPackage, pacman: Pacman,
|
||||||
|
mocker: MockerFixture) -> None:
|
||||||
|
"""
|
||||||
|
must raise UnknownPackage exception in case if no package was found
|
||||||
|
"""
|
||||||
|
mocker.patch("ahriman.core.alpm.remote.Official.make_request", return_value=[])
|
||||||
|
with pytest.raises(UnknownPackageError, match=aur_package_ahriman.name):
|
||||||
|
assert official.package_info(aur_package_ahriman.name, pacman=pacman)
|
||||||
|
|
||||||
|
|
||||||
def test_package_search(official: Official, aur_package_akonadi: AURPackage, pacman: Pacman,
|
def test_package_search(official: Official, aur_package_akonadi: AURPackage, pacman: Pacman,
|
||||||
mocker: MockerFixture) -> None:
|
mocker: MockerFixture) -> None:
|
||||||
"""
|
"""
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
|
import pytest
|
||||||
|
|
||||||
from pytest_mock import MockerFixture
|
from pytest_mock import MockerFixture
|
||||||
|
|
||||||
from ahriman.core.alpm.pacman import Pacman
|
from ahriman.core.alpm.pacman import Pacman
|
||||||
from ahriman.core.alpm.remote import OfficialSyncdb
|
from ahriman.core.alpm.remote import OfficialSyncdb
|
||||||
|
from ahriman.core.exceptions import UnknownPackageError
|
||||||
from ahriman.models.aur_package import AURPackage
|
from ahriman.models.aur_package import AURPackage
|
||||||
|
|
||||||
|
|
||||||
def test_package_info(official_syncdb: OfficialSyncdb, aur_package_akonadi: AURPackage,
|
def test_package_info(official_syncdb: OfficialSyncdb, aur_package_akonadi: AURPackage, pacman: Pacman,
|
||||||
pacman: Pacman, mocker: MockerFixture) -> None:
|
mocker: MockerFixture) -> None:
|
||||||
"""
|
"""
|
||||||
must return package info from the database
|
must return package info from the database
|
||||||
"""
|
"""
|
||||||
@ -16,3 +19,13 @@ def test_package_info(official_syncdb: OfficialSyncdb, aur_package_akonadi: AURP
|
|||||||
package = official_syncdb.package_info(aur_package_akonadi.name, pacman=pacman)
|
package = official_syncdb.package_info(aur_package_akonadi.name, pacman=pacman)
|
||||||
get_mock.assert_called_once_with(aur_package_akonadi.name)
|
get_mock.assert_called_once_with(aur_package_akonadi.name)
|
||||||
assert package == aur_package_akonadi
|
assert package == aur_package_akonadi
|
||||||
|
|
||||||
|
|
||||||
|
def test_package_info_not_found(official_syncdb: OfficialSyncdb, aur_package_akonadi: AURPackage, pacman: Pacman,
|
||||||
|
mocker: MockerFixture) -> None:
|
||||||
|
"""
|
||||||
|
must raise UnknownPackage exception in case if no package was found
|
||||||
|
"""
|
||||||
|
mocker.patch("ahriman.core.alpm.pacman.Pacman.package_get", return_value=[])
|
||||||
|
with pytest.raises(UnknownPackageError, match=aur_package_akonadi.name):
|
||||||
|
assert official_syncdb.package_info(aur_package_akonadi.name, pacman=pacman)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from pytest_mock import MockerFixture
|
from pytest_mock import MockerFixture
|
||||||
from unittest import mock
|
from unittest.mock import call as MockCall
|
||||||
|
|
||||||
from ahriman.core.alpm.pacman import Pacman
|
from ahriman.core.alpm.pacman import Pacman
|
||||||
from ahriman.core.alpm.remote import Remote
|
from ahriman.core.alpm.remote import Remote
|
||||||
@ -25,7 +25,7 @@ def test_multisearch(aur_package_ahriman: AURPackage, pacman: Pacman, mocker: Mo
|
|||||||
search_mock = mocker.patch("ahriman.core.alpm.remote.Remote.search", return_value=[aur_package_ahriman])
|
search_mock = mocker.patch("ahriman.core.alpm.remote.Remote.search", return_value=[aur_package_ahriman])
|
||||||
|
|
||||||
assert Remote.multisearch(*terms, pacman=pacman) == [aur_package_ahriman]
|
assert Remote.multisearch(*terms, pacman=pacman) == [aur_package_ahriman]
|
||||||
search_mock.assert_has_calls([mock.call("ahriman", pacman=pacman), mock.call("cool", pacman=pacman)])
|
search_mock.assert_has_calls([MockCall("ahriman", pacman=pacman), MockCall("cool", pacman=pacman)])
|
||||||
|
|
||||||
|
|
||||||
def test_multisearch_empty(pacman: Pacman, mocker: MockerFixture) -> None:
|
def test_multisearch_empty(pacman: Pacman, mocker: MockerFixture) -> None:
|
||||||
|
@ -4,7 +4,7 @@ import pytest
|
|||||||
from pytest_mock import MockerFixture
|
from pytest_mock import MockerFixture
|
||||||
|
|
||||||
from ahriman.core.auth import OAuth
|
from ahriman.core.auth import OAuth
|
||||||
from ahriman.core.exceptions import InvalidOption
|
from ahriman.core.exceptions import OptionError
|
||||||
|
|
||||||
|
|
||||||
def test_auth_control(oauth: OAuth) -> None:
|
def test_auth_control(oauth: OAuth) -> None:
|
||||||
@ -28,7 +28,7 @@ def test_get_provider_not_a_type() -> None:
|
|||||||
"""
|
"""
|
||||||
must raise an exception if attribute is not a type
|
must raise an exception if attribute is not a type
|
||||||
"""
|
"""
|
||||||
with pytest.raises(InvalidOption):
|
with pytest.raises(OptionError):
|
||||||
OAuth.get_provider("__version__")
|
OAuth.get_provider("__version__")
|
||||||
|
|
||||||
|
|
||||||
@ -36,9 +36,9 @@ def test_get_provider_invalid_type() -> None:
|
|||||||
"""
|
"""
|
||||||
must raise an exception if attribute is not an OAuth2 client
|
must raise an exception if attribute is not an OAuth2 client
|
||||||
"""
|
"""
|
||||||
with pytest.raises(InvalidOption):
|
with pytest.raises(OptionError):
|
||||||
OAuth.get_provider("User")
|
OAuth.get_provider("User")
|
||||||
with pytest.raises(InvalidOption):
|
with pytest.raises(OptionError):
|
||||||
OAuth.get_provider("OAuth1Client")
|
OAuth.get_provider("OAuth1Client")
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import pytest
|
|||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from pytest_mock import MockerFixture
|
from pytest_mock import MockerFixture
|
||||||
from unittest import mock
|
from unittest.mock import call as MockCall
|
||||||
|
|
||||||
from ahriman.core.build_tools.sources import Sources
|
from ahriman.core.build_tools.sources import Sources
|
||||||
from ahriman.models.package import Package
|
from ahriman.models.package import Package
|
||||||
@ -55,12 +55,10 @@ def test_fetch_existing(remote_source: RemoteSource, mocker: MockerFixture) -> N
|
|||||||
local = Path("local")
|
local = Path("local")
|
||||||
Sources.fetch(local, remote_source)
|
Sources.fetch(local, remote_source)
|
||||||
check_output_mock.assert_has_calls([
|
check_output_mock.assert_has_calls([
|
||||||
mock.call("git", "fetch", "origin", remote_source.branch,
|
MockCall("git", "fetch", "origin", remote_source.branch, cwd=local, logger=pytest.helpers.anyvar(int)),
|
||||||
exception=None, cwd=local, logger=pytest.helpers.anyvar(int)),
|
MockCall("git", "checkout", "--force", remote_source.branch, cwd=local, logger=pytest.helpers.anyvar(int)),
|
||||||
mock.call("git", "checkout", "--force", remote_source.branch,
|
MockCall("git", "reset", "--hard", f"origin/{remote_source.branch}",
|
||||||
exception=None, cwd=local, logger=pytest.helpers.anyvar(int)),
|
cwd=local, logger=pytest.helpers.anyvar(int)),
|
||||||
mock.call("git", "reset", "--hard", f"origin/{remote_source.branch}",
|
|
||||||
exception=None, cwd=local, logger=pytest.helpers.anyvar(int))
|
|
||||||
])
|
])
|
||||||
move_mock.assert_called_once_with(local.resolve(), local)
|
move_mock.assert_called_once_with(local.resolve(), local)
|
||||||
|
|
||||||
@ -76,12 +74,11 @@ def test_fetch_new(remote_source: RemoteSource, mocker: MockerFixture) -> None:
|
|||||||
local = Path("local")
|
local = Path("local")
|
||||||
Sources.fetch(local, remote_source)
|
Sources.fetch(local, remote_source)
|
||||||
check_output_mock.assert_has_calls([
|
check_output_mock.assert_has_calls([
|
||||||
mock.call("git", "clone", "--branch", remote_source.branch, "--single-branch",
|
MockCall("git", "clone", "--branch", remote_source.branch, "--single-branch",
|
||||||
remote_source.git_url, str(local), exception=None, cwd=local, logger=pytest.helpers.anyvar(int)),
|
remote_source.git_url, str(local), cwd=local, logger=pytest.helpers.anyvar(int)),
|
||||||
mock.call("git", "checkout", "--force", remote_source.branch,
|
MockCall("git", "checkout", "--force", remote_source.branch, cwd=local, logger=pytest.helpers.anyvar(int)),
|
||||||
exception=None, cwd=local, logger=pytest.helpers.anyvar(int)),
|
MockCall("git", "reset", "--hard", f"origin/{remote_source.branch}",
|
||||||
mock.call("git", "reset", "--hard", f"origin/{remote_source.branch}",
|
cwd=local, logger=pytest.helpers.anyvar(int))
|
||||||
exception=None, cwd=local, logger=pytest.helpers.anyvar(int))
|
|
||||||
])
|
])
|
||||||
move_mock.assert_called_once_with(local.resolve(), local)
|
move_mock.assert_called_once_with(local.resolve(), local)
|
||||||
|
|
||||||
@ -97,10 +94,9 @@ def test_fetch_new_without_remote(mocker: MockerFixture) -> None:
|
|||||||
local = Path("local")
|
local = Path("local")
|
||||||
Sources.fetch(local, None)
|
Sources.fetch(local, None)
|
||||||
check_output_mock.assert_has_calls([
|
check_output_mock.assert_has_calls([
|
||||||
mock.call("git", "checkout", "--force", Sources.DEFAULT_BRANCH,
|
MockCall("git", "checkout", "--force", Sources.DEFAULT_BRANCH, cwd=local, logger=pytest.helpers.anyvar(int)),
|
||||||
exception=None, cwd=local, logger=pytest.helpers.anyvar(int)),
|
MockCall("git", "reset", "--hard", f"origin/{Sources.DEFAULT_BRANCH}",
|
||||||
mock.call("git", "reset", "--hard", f"origin/{Sources.DEFAULT_BRANCH}",
|
cwd=local, logger=pytest.helpers.anyvar(int))
|
||||||
exception=None, cwd=local, logger=pytest.helpers.anyvar(int))
|
|
||||||
])
|
])
|
||||||
move_mock.assert_called_once_with(local.resolve(), local)
|
move_mock.assert_called_once_with(local.resolve(), local)
|
||||||
|
|
||||||
@ -124,8 +120,7 @@ def test_has_remotes(mocker: MockerFixture) -> None:
|
|||||||
|
|
||||||
local = Path("local")
|
local = Path("local")
|
||||||
assert Sources.has_remotes(local)
|
assert Sources.has_remotes(local)
|
||||||
check_output_mock.assert_called_once_with(
|
check_output_mock.assert_called_once_with("git", "remote", cwd=local, logger=pytest.helpers.anyvar(int))
|
||||||
"git", "remote", exception=None, cwd=local, logger=pytest.helpers.anyvar(int))
|
|
||||||
|
|
||||||
|
|
||||||
def test_has_remotes_empty(mocker: MockerFixture) -> None:
|
def test_has_remotes_empty(mocker: MockerFixture) -> None:
|
||||||
@ -145,7 +140,7 @@ def test_init(mocker: MockerFixture) -> None:
|
|||||||
local = Path("local")
|
local = Path("local")
|
||||||
Sources.init(local)
|
Sources.init(local)
|
||||||
check_output_mock.assert_called_once_with("git", "init", "--initial-branch", Sources.DEFAULT_BRANCH,
|
check_output_mock.assert_called_once_with("git", "init", "--initial-branch", Sources.DEFAULT_BRANCH,
|
||||||
exception=None, cwd=local, logger=pytest.helpers.anyvar(int))
|
cwd=local, logger=pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
|
|
||||||
def test_load(package_ahriman: Package, repository_paths: RepositoryPaths, mocker: MockerFixture) -> None:
|
def test_load(package_ahriman: Package, repository_paths: RepositoryPaths, mocker: MockerFixture) -> None:
|
||||||
@ -225,7 +220,7 @@ def test_push(package_ahriman: Package, mocker: MockerFixture) -> None:
|
|||||||
commit_mock.assert_called_once_with(local)
|
commit_mock.assert_called_once_with(local)
|
||||||
check_output_mock.assert_called_once_with(
|
check_output_mock.assert_called_once_with(
|
||||||
"git", "push", package_ahriman.remote.git_url, package_ahriman.remote.branch,
|
"git", "push", package_ahriman.remote.git_url, package_ahriman.remote.branch,
|
||||||
exception=None, cwd=local, logger=pytest.helpers.anyvar(int))
|
cwd=local, logger=pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
|
|
||||||
def test_add(sources: Sources, mocker: MockerFixture) -> None:
|
def test_add(sources: Sources, mocker: MockerFixture) -> None:
|
||||||
@ -237,10 +232,10 @@ def test_add(sources: Sources, mocker: MockerFixture) -> None:
|
|||||||
|
|
||||||
local = Path("local")
|
local = Path("local")
|
||||||
sources.add(local, "pattern1", "pattern2")
|
sources.add(local, "pattern1", "pattern2")
|
||||||
glob_mock.assert_has_calls([mock.call("pattern1"), mock.call("pattern2")])
|
glob_mock.assert_has_calls([MockCall("pattern1"), MockCall("pattern2")])
|
||||||
check_output_mock.assert_called_once_with(
|
check_output_mock.assert_called_once_with(
|
||||||
"git", "add", "--intent-to-add", "1", "2", "1", "2",
|
"git", "add", "--intent-to-add", "1", "2", "1", "2", cwd=local, logger=pytest.helpers.anyvar(int)
|
||||||
exception=None, cwd=local, logger=pytest.helpers.anyvar(int))
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_add_skip(sources: Sources, mocker: MockerFixture) -> None:
|
def test_add_skip(sources: Sources, mocker: MockerFixture) -> None:
|
||||||
@ -264,8 +259,7 @@ def test_commit(sources: Sources, mocker: MockerFixture) -> None:
|
|||||||
commit_message = "Commit message"
|
commit_message = "Commit message"
|
||||||
sources.commit(local, commit_message=commit_message)
|
sources.commit(local, commit_message=commit_message)
|
||||||
check_output_mock.assert_called_once_with(
|
check_output_mock.assert_called_once_with(
|
||||||
"git", "commit", "--allow-empty", "--message", commit_message,
|
"git", "commit", "--allow-empty", "--message", commit_message, cwd=local, logger=pytest.helpers.anyvar(int)
|
||||||
exception=None, cwd=local, logger=pytest.helpers.anyvar(int)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -279,7 +273,7 @@ def test_commit_autogenerated(sources: Sources, mocker: MockerFixture) -> None:
|
|||||||
sources.commit(Path("local"))
|
sources.commit(Path("local"))
|
||||||
check_output_mock.assert_called_once_with(
|
check_output_mock.assert_called_once_with(
|
||||||
"git", "commit", "--allow-empty", "--message", pytest.helpers.anyvar(str, strict=True),
|
"git", "commit", "--allow-empty", "--message", pytest.helpers.anyvar(str, strict=True),
|
||||||
exception=None, cwd=local, logger=pytest.helpers.anyvar(int)
|
cwd=local, logger=pytest.helpers.anyvar(int)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -291,8 +285,7 @@ def test_diff(sources: Sources, mocker: MockerFixture) -> None:
|
|||||||
|
|
||||||
local = Path("local")
|
local = Path("local")
|
||||||
assert sources.diff(local)
|
assert sources.diff(local)
|
||||||
check_output_mock.assert_called_once_with(
|
check_output_mock.assert_called_once_with("git", "diff", cwd=local, logger=pytest.helpers.anyvar(int))
|
||||||
"git", "diff", exception=None, cwd=local, logger=pytest.helpers.anyvar(int))
|
|
||||||
|
|
||||||
|
|
||||||
def test_move(sources: Sources, mocker: MockerFixture) -> None:
|
def test_move(sources: Sources, mocker: MockerFixture) -> None:
|
||||||
@ -326,7 +319,7 @@ def test_patch_apply(sources: Sources, mocker: MockerFixture) -> None:
|
|||||||
sources.patch_apply(local, patch)
|
sources.patch_apply(local, patch)
|
||||||
check_output_mock.assert_called_once_with(
|
check_output_mock.assert_called_once_with(
|
||||||
"git", "apply", "--ignore-space-change", "--ignore-whitespace",
|
"git", "apply", "--ignore-space-change", "--ignore-whitespace",
|
||||||
exception=None, cwd=local, input_data=patch.value, logger=pytest.helpers.anyvar(int)
|
cwd=local, input_data=patch.value, logger=pytest.helpers.anyvar(int)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import pytest
|
|||||||
|
|
||||||
from pytest_mock import MockerFixture
|
from pytest_mock import MockerFixture
|
||||||
from sqlite3 import Connection
|
from sqlite3 import Connection
|
||||||
from unittest import mock
|
from unittest.mock import call as MockCall
|
||||||
|
|
||||||
from ahriman.core.database.data import migrate_package_statuses
|
from ahriman.core.database.data import migrate_package_statuses
|
||||||
from ahriman.models.package import Package
|
from ahriman.models.package import Package
|
||||||
@ -22,11 +22,11 @@ def test_migrate_package_statuses(connection: Connection, package_ahriman: Packa
|
|||||||
|
|
||||||
migrate_package_statuses(connection, repository_paths)
|
migrate_package_statuses(connection, repository_paths)
|
||||||
connection.execute.assert_has_calls([
|
connection.execute.assert_has_calls([
|
||||||
mock.call(pytest.helpers.anyvar(str, strict=True), pytest.helpers.anyvar(int)),
|
MockCall(pytest.helpers.anyvar(str, strict=True), pytest.helpers.anyvar(int)),
|
||||||
mock.call(pytest.helpers.anyvar(str, strict=True), pytest.helpers.anyvar(int)),
|
MockCall(pytest.helpers.anyvar(str, strict=True), pytest.helpers.anyvar(int)),
|
||||||
])
|
])
|
||||||
connection.executemany.assert_has_calls([
|
connection.executemany.assert_has_calls([
|
||||||
mock.call(pytest.helpers.anyvar(str, strict=True), pytest.helpers.anyvar(int)),
|
MockCall(pytest.helpers.anyvar(str, strict=True), pytest.helpers.anyvar(int)),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from sqlite3 import Connection
|
from sqlite3 import Connection
|
||||||
from unittest import mock
|
from unittest.mock import call as MockCall
|
||||||
|
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.database.data import migrate_users_data
|
from ahriman.core.database.data import migrate_users_data
|
||||||
@ -16,6 +16,6 @@ def test_migrate_users_data(connection: Connection, configuration: Configuration
|
|||||||
|
|
||||||
migrate_users_data(connection, configuration)
|
migrate_users_data(connection, configuration)
|
||||||
connection.execute.assert_has_calls([
|
connection.execute.assert_has_calls([
|
||||||
mock.call(pytest.helpers.anyvar(str, strict=True), pytest.helpers.anyvar(int)),
|
MockCall(pytest.helpers.anyvar(str, strict=True), pytest.helpers.anyvar(int)),
|
||||||
mock.call(pytest.helpers.anyvar(str, strict=True), pytest.helpers.anyvar(int)),
|
MockCall(pytest.helpers.anyvar(str, strict=True), pytest.helpers.anyvar(int)),
|
||||||
])
|
])
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user