diff --git a/Makefile b/Makefile index 6edc233a434318eaed62e34098c5bdde1203231e..3a6d1d2ae1506fbe0123329ff82234bb5e61685c 100644 --- a/Makefile +++ b/Makefile @@ -58,6 +58,10 @@ docs: pandoc -s -t man docs/index.md -o man/pacman-mirrors.8 gzip man/pacman-mirrors.8 -fq +man-page: + pandoc -s -t man docs/index.md -o man/pacman-mirrors.8 + man man/pacman-mirrors.8 + release: clean python setup.py sdist upload python setup.py bdist_wheel upload diff --git a/conf/pacman-mirrors.conf b/conf/pacman-mirrors.conf index 17492077c85718c339674cba52bd4304714d33eb..bcee8f4416cf911470f92cb4e6924245b3b9ae49 100644 --- a/conf/pacman-mirrors.conf +++ b/conf/pacman-mirrors.conf @@ -25,12 +25,6 @@ ## Empty means all # OnlyCountry = -## Mirrors directory -# MirrorlistsDir = /var/lib/pacman-mirrors - -## Output file -# OutputMirrorlist = /etc/pacman.d/mirrorlist - ## When set to False - all certificates are accepted. ## Use only if you fully trust all ssl-enabled mirrors. # SSLVerify = True diff --git a/docs/index.md b/docs/index.md index 3e8ffcd22d8e188381a7a9e38eb6a4a609b3890a..1a4ff7bba832930fa0c81842f26f84ca1ec30870 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,24 +8,59 @@ pacman-mirrors - generate pacman mirrorlist for Manjaro Linux # SYNOPSIS -pacman-mirrors [OPTION] ... +pacman-mirrors [-f*NUMBER*|[[-i[-d]][-c*COUNTRY*,[*...*]|--geoip]][-m*METHOD*]] +[-a[-p*PREFIX*][-G|-S*BRANCH*]-P*PROTO*,[*...*]] [-b*BRANCH*] [-t*SECONDS*] +[-q] [-v] [-n|-y] + # DESCRIPTION Generate mirrorlist for Manjaro Linux. Default is to rank all mirrors by reponse time. If no arguments are given pacman-mirrors lists available options. +Pacman-mirrors requires access to files which are read-only +so it must be run with su or sudo. To create a mirrorlist using all default use, - sudo pacman-mirrors -g + pacman-mirrors --generate -The mirrorlist generation process can be refined through options -and arguments which takes input, for example, +The mirrorlist generation process can be refined through arguments +and arguments with options, for example, - sudo pacman-mirrors --country Denmark --timeout 5 + pacman-mirrors --country Denmark --timeout 5 # OPTIONS +Some options are mutual exclusive and they will throw an arguments error, + +* **\--no-mirrorlist** and **\--sync** +* **--branch**, **--get-branch** and **--set-branch** +* **--sync** and **--no-mirrorlist** +* **--country** and **--geoip** + +Others can be used together but they have precedence. +If the fasttrack arg is used with interactive, country or geoip +the fasttrack arg will have precendence and the other is ignored. +Also, if the branch arg is used with set-branch the set-branch arg has precedence. +Some arguments requires other argument to have effect for example, + + pacman-mirrors -b unstable --default + +the --default argument has no effect, +it should have been in conjunction with --interactive. + +The same goes for the API specific arguments. +For those to have effect the --api argument must be present also. + + pacman-mirrors --api -Sunstable + +The arguments can appear in any order except for arguments which takes +additional options in which case the options must follow +immediately after the argument, for example + + pacman-mirrors -ayidS unstable + +## METHODS -g, \--generate : Generate a new default mirrorlist using defaults @@ -33,82 +68,79 @@ and arguments which takes input, for example, : Generates a mirrorlist with a number mirrors ranked by responsiveness, the mirrors are selected from <http://repo.manjaro.org/status.json> --m, \--method *METHOD* -: Default method is *rank* but *random* can be selected - -i, \--interactive [--default] : Launches a tool for selectively picking mirrors and protocols, **--default** forces pacman-mirrors to load the default mirror file and ignore any preset custom-mirrors file, thus allowing for reselecting mirrors for a new custom mirror file +-m, \--method *METHOD* +: Default method is *rank* but *random* can be selected + +## BRANCH + -b, \--branch *BRANCH* : Temporarily use another branch, use *stable*, *testing* or *unstable*, the branch is reset with next run of pacman-mirrors --c, \--country *COUNTRY* [*COUNTRY* ...] -: Specifiy a country or a list of countries, excludes **\--geoip** +## COUNTRY +-c, \--country *COUNTRY* [*COUNTRY*] ... +: Specifiy a country or a list of countries \--geoip -: Use geolocation if possible, if not uses all mirrors, - excludes **-c**, **\--country** +: Use geolocation if possible, if not uses all mirrors --l, \--country-list +-l, \--list, \--country-list : Lists available mirror countries --d, \--mirror_dir *NEW_DIR* -: *(DEPRECATED)* Choose a temporary directory where mirrors file is located - --o, \--output *NEW_FILE* -: *(DEPRECATED)* Choose a temporary file for your mirrorlist - --q, \--quiet -: Make pacman-mirrors silent - --t, \--timeout *SECONDS* -: Change the number of seconds waiting for a server response, - SSL enabled mirrors has this value doubled to compensate, - for the time spent on exchanging encryption keys - --n, \--no-mirrorlist -: Skip mirrorlist generation, excludes **-y**, **\--sync** - --y, \--sync -: Instruct pacman-mirrors to syncronize the pacman database, - excludes **-n**, **\--no-mirrorlist** - ## API --a, \--api -: Instructs pacman-mirrors to activate these optional arguments +-a, \--api [-p *PREFIX*] [-G|-S *BRANCH*] [-P *PROTO* [*PROTO*] ...] +: Instructs pacman-mirrors to activate processing of API arguments --a -p, \--prefix *PREFIX* -: Add a path prefix to pacman-mirrors file-handling +-p, \--prefix *PREFIX* +: Add a path prefix to pacman-mirrors file-handling eg. */mnt/install* or *$mnt* --a -G, \--get-branch +-G, \--get-branch : Returns branch from configuration optionally with a prefix. --a -S, \--set-branch *BRANCH* -: Writes the branch to configuration optionally with a prefix, +-S, \--set-branch *BRANCH* +: Writes the branch to configuration optionally with a prefix, use *stable*, *testing* or *unstable* --a -P, \--proto, \--protocols *PROTO* [*PROTO* ...] -: Write the protocols to configuration optionally with a prefix, +-P, \--proto, \--protocols *PROTO* [*...*] +: Write the protocols to configuration optionally with a prefix, use *all* or *http*, *https*, *ftp* and *ftps*. -## GENERIC +## MISC -h, \--help : Show the help message +-n, \--no-mirrorlist +: Skip mirrorlist generation + +-q, \--quiet +: Make pacman-mirrors silent + +-t, \--timeout *SECONDS* +: Change the number of seconds waiting for a server response, + SSL enabled mirrors has this value doubled to compensate, + for the time spent on exchanging encryption keys + -v, \--version : Show the version of pacman-mirrors +-y, \--sync +: Instruct pacman-mirrors to syncronize the pacman database + ## Exit status: -0 if OK -1 if problem with argument +0: OK +1: Problem with argument +2: Problem accessing systemfiles +3: Missing mirror file BRANCH from config # EXAMPLES @@ -118,61 +150,61 @@ The API functions is mainly designed to help packagers and iso-builders. However it can be of use for everyone because it takes the hazzle out of editing your pacman-mirrors configuration. -Which countries has mirrors? +* Which countries has mirrors? - sudo pacman-mirrors -l + ```sudo pacman-mirrors -l``` -I want to temporary change branch to unstable, +* I want to temporary change branch to unstable, use geolocation and syncronize pacman, - sudo pacman-mirrors -yb unstable --geoip + ```sudo pacman-mirrors -yb unstable --geoip``` -I want to permanently change branch to unstable, +* I want to permanently change branch to unstable, use mirrors from Germany and France, use only https and http protocol in that order and syncronize pacman - sudo pacman-mirrors -yac Germany,France -S unstable -P https http + ```sudo pacman-mirrors -yac Germany,France -S unstable -P https http``` -Create a mirrorlist with German mirrors and syncronize pacman +* Create a mirrorlist with German mirrors and syncronize pacman - sudo pacman-mirrors -yc Germany + ```sudo pacman-mirrors -yc Germany``` -If you want more countries in your mirrorlist add them +* If you want more countries in your mirrorlist add them - sudo pacman-mirrors -yc Germany France Denmark + ```sudo pacman-mirrors -yc Germany France Denmark``` -Create a mirrorlist with 5 mirrors with current packages and syncronize pacman +* Create a mirrorlist with 5 mirrors with current packages and syncronize pacman - sudo pacman-mirrors -yf 5 + ```sudo pacman-mirrors -yf 5``` -I want to choose my mirrors +* I want to choose my mirrors - sudo pacman-mirrors -i + ```sudo pacman-mirrors -i``` -I have a custom mirror list and I want to create a new custom mirror list? +* I have a custom mirror list and I want to create a new custom mirror list? - sudo pacman-mirrors -i --default + ```sudo pacman-mirrors -i --default``` -I have a custom mirror list - can I reset it? +* I have a custom mirror list - can I reset it? - sudo pacman-mirrors -c all + ```sudo pacman-mirrors -c all``` -What branch am I on +* What branch am I on - sudo pacman-mirrors -a -G* + ```sudo pacman-mirrors -a -G``` -Change system branch and dont change the mirrorlist +* Change system branch and dont change the mirrorlist - sudo pacman-mirrors -naS unstable + ```sudo pacman-mirrors -naS unstable``` -Change protocols you will accept but dont touch the mirrorlist +* Change protocols you will accept but dont touch the mirrorlist - sudo pacman-mirrors -naP https http + ```sudo pacman-mirrors -naP https http``` -A packager can write the directly to a mounted systems +* A packager can write the directly to a mounted systems datafiles using either a path or an environment variable - sudo pacman-mirrors -ap $mnt -S unstable -P https + ```sudo pacman-mirrors -ap $mnt -S unstable -P https``` # REPORTING BUGS <https://github.com/manjaro/pacman-mirrors/issues> diff --git a/locale/pacman_mirrors.pot b/locale/pacman_mirrors.pot index 8340d693e35e1934ad98fe3648a07fac8f205885..74d51b47666d8c353acc31f4576bec724551b372 100644 --- a/locale/pacman_mirrors.pot +++ b/locale/pacman_mirrors.pot @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: pacman-mirrors 4.2.0.dev0\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2017-05-16 16:33+0200\n" +"POT-Creation-Date: 2017-05-19 11:02+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -55,63 +55,63 @@ msgid "NUMBER" msgstr "" #: pacman_mirrors/txt.py:43 -msgid "Branch name" +msgid "Return branch from configuration" msgstr "" #: pacman_mirrors/txt.py:44 -msgid "Comma separated list of countries, from which mirrors will be used" +msgid "Set prefix to" +msgstr "" + +#: pacman_mirrors/txt.py:45 +msgid "Write protocols to configuration" msgstr "" #: pacman_mirrors/txt.py:46 -msgid "Load default mirror file" +msgid "Write branch to configuration" msgstr "" #: pacman_mirrors/txt.py:47 -msgid "Output file" +msgid "Branch name" msgstr "" #: pacman_mirrors/txt.py:48 -msgid "Generate mirrorlist with defaults" -msgstr "" - -#: pacman_mirrors/txt.py:49 -msgid "Get current country using geolocation. Ignored if" +msgid "Comma separated list of countries, from which mirrors will be used" msgstr "" #: pacman_mirrors/txt.py:50 -msgid "is supplied" +msgid "Load default mirror file" msgstr "" #: pacman_mirrors/txt.py:51 -msgid "Generate custom mirrorlist" +msgid "Generate mirrorlist with a number of up-to-date mirrors" msgstr "" #: pacman_mirrors/txt.py:52 -msgid "Generation method" +msgid "Generate mirrorlist with defaults" msgstr "" #: pacman_mirrors/txt.py:53 -msgid "Mirrors list path" +msgid "Get current country using geolocation" msgstr "" #: pacman_mirrors/txt.py:54 -msgid "Quiet mode - less verbose output" +msgid "List all available countries" msgstr "" #: pacman_mirrors/txt.py:55 -msgid "Maximum waiting time for server response" +msgid "Generate custom mirrorlist" msgstr "" #: pacman_mirrors/txt.py:56 -msgid "Print the pacman-mirrors version" +msgid "Generation method" msgstr "" #: pacman_mirrors/txt.py:57 -msgid "Generate mirrorlist with a number of up-to-date mirrors. Overrides" +msgid "Use to skip generation of mirrorlist" msgstr "" #: pacman_mirrors/txt.py:58 -msgid "List all available countries" +msgid "Quiet mode - less verbose output" msgstr "" #: pacman_mirrors/txt.py:59 @@ -119,190 +119,178 @@ msgid "Syncronize pacman databases" msgstr "" #: pacman_mirrors/txt.py:60 -msgid "Set prefix to" +msgid "Maximum waiting time for server response" msgstr "" #: pacman_mirrors/txt.py:61 -msgid "Set accepted protocols" -msgstr "" - -#: pacman_mirrors/txt.py:62 -msgid "Return branch from configuration" +msgid "Print the pacman-mirrors version" msgstr "" #: pacman_mirrors/txt.py:63 -msgid "Write new branch to configuration" -msgstr "" - -#: pacman_mirrors/txt.py:65 msgid "Available countries are" msgstr "" -#: pacman_mirrors/txt.py:66 +#: pacman_mirrors/txt.py:64 msgid "Could not download from" msgstr "" -#: pacman_mirrors/txt.py:67 +#: pacman_mirrors/txt.py:65 msgid "Cannot read file" msgstr "" -#: pacman_mirrors/txt.py:68 +#: pacman_mirrors/txt.py:66 msgid "Cannot write file" msgstr "" -#: pacman_mirrors/txt.py:69 +#: pacman_mirrors/txt.py:67 msgid "Converting custom mirror file to new format" msgstr "" -#: pacman_mirrors/txt.py:70 +#: pacman_mirrors/txt.py:68 msgid "Custom mirror file" msgstr "" -#: pacman_mirrors/txt.py:71 +#: pacman_mirrors/txt.py:69 msgid "Custom mirror file saved" msgstr "" -#: pacman_mirrors/txt.py:72 +#: pacman_mirrors/txt.py:70 msgid "User generated mirror list" msgstr "" -#: pacman_mirrors/txt.py:73 +#: pacman_mirrors/txt.py:71 msgid "doesn't exist." msgstr "" -#: pacman_mirrors/txt.py:74 +#: pacman_mirrors/txt.py:72 msgid "Downloading mirrors from" msgstr "" -#: pacman_mirrors/txt.py:75 +#: pacman_mirrors/txt.py:73 msgid "Falling back to" msgstr "" -#: pacman_mirrors/txt.py:76 +#: pacman_mirrors/txt.py:74 msgid "is missing" msgstr "" -#: pacman_mirrors/txt.py:77 +#: pacman_mirrors/txt.py:75 msgid "The mirror file" msgstr "" -#: pacman_mirrors/txt.py:78 +#: pacman_mirrors/txt.py:76 msgid "Mirrorlist generated and saved to" msgstr "" -#: pacman_mirrors/txt.py:79 +#: pacman_mirrors/txt.py:77 msgid "Mirror ranking is not available" msgstr "" -#: pacman_mirrors/txt.py:80 +#: pacman_mirrors/txt.py:78 msgid "Must have root privileges" msgstr "" -#: pacman_mirrors/txt.py:81 +#: pacman_mirrors/txt.py:79 msgid "Internet connection appears to be down" msgstr "" -#: pacman_mirrors/txt.py:82 -msgid "Internet access is required to proceed" -msgstr "" - -#: pacman_mirrors/txt.py:83 -msgid "Pacman needs a mirrorlist. Use -m random to create one without network" +#: pacman_mirrors/txt.py:80 +msgid "Mirrorlist is generated using random method" msgstr "" -#: pacman_mirrors/txt.py:85 +#: pacman_mirrors/txt.py:81 msgid "The mirror list is not changed" msgstr "" -#: pacman_mirrors/txt.py:86 +#: pacman_mirrors/txt.py:82 msgid "No mirrors in selection" msgstr "" -#: pacman_mirrors/txt.py:87 +#: pacman_mirrors/txt.py:83 msgid "Option" msgstr "" -#: pacman_mirrors/txt.py:88 +#: pacman_mirrors/txt.py:84 msgid "Writing mirror list" msgstr "" -#: pacman_mirrors/txt.py:89 +#: pacman_mirrors/txt.py:85 msgid "Querying mirrors" msgstr "" -#: pacman_mirrors/txt.py:90 +#: pacman_mirrors/txt.py:86 msgid "Randomizing mirror list" msgstr "" -#: pacman_mirrors/txt.py:91 +#: pacman_mirrors/txt.py:87 msgid "To reset custom config run " msgstr "" -#: pacman_mirrors/txt.py:92 +#: pacman_mirrors/txt.py:88 msgid "This may take some time" msgstr "" -#: pacman_mirrors/txt.py:93 +#: pacman_mirrors/txt.py:89 msgid "unknown country" msgstr "" -#: pacman_mirrors/txt.py:94 +#: pacman_mirrors/txt.py:90 msgid "Using all mirrors" msgstr "" -#: pacman_mirrors/txt.py:95 +#: pacman_mirrors/txt.py:91 msgid "Using custom mirror file" msgstr "" -#: pacman_mirrors/txt.py:96 +#: pacman_mirrors/txt.py:92 msgid "Using default mirror file" msgstr "" -#: pacman_mirrors/txt.py:98 +#: pacman_mirrors/txt.py:94 msgid "Manjaro mirrors by response time" msgstr "" -#: pacman_mirrors/txt.py:99 +#: pacman_mirrors/txt.py:95 msgid "Manjaro mirrors in random order" msgstr "" -#: pacman_mirrors/txt.py:100 +#: pacman_mirrors/txt.py:96 msgid "Check mirrors for your personal list" msgstr "" -#: pacman_mirrors/txt.py:101 +#: pacman_mirrors/txt.py:97 msgid "Use" msgstr "" -#: pacman_mirrors/txt.py:102 +#: pacman_mirrors/txt.py:98 msgid "Country" msgstr "" -#: pacman_mirrors/txt.py:103 +#: pacman_mirrors/txt.py:99 msgid "Resp" msgstr "" -#: pacman_mirrors/txt.py:104 +#: pacman_mirrors/txt.py:100 msgid "Sync" msgstr "" -#: pacman_mirrors/txt.py:105 +#: pacman_mirrors/txt.py:101 msgid "URL" msgstr "" -#: pacman_mirrors/txt.py:106 +#: pacman_mirrors/txt.py:102 msgid "Cancel" msgstr "" -#: pacman_mirrors/txt.py:107 +#: pacman_mirrors/txt.py:103 msgid "OK" msgstr "" -#: pacman_mirrors/txt.py:108 +#: pacman_mirrors/txt.py:104 msgid "Confirm selections" msgstr "" -#: pacman_mirrors/txt.py:109 +#: pacman_mirrors/txt.py:105 msgid "I want to use these mirrors" msgstr "" diff --git a/man/pacman-mirrors.8.gz b/man/pacman-mirrors.8.gz index 00165218e1c4267afbd60c13be5f8b3ab3b71054..a344f5e9c3d78c50fa3d8a558223805b4b05ec9e 100644 Binary files a/man/pacman-mirrors.8.gz and b/man/pacman-mirrors.8.gz differ diff --git a/pacman_mirrors/colors.py b/pacman_mirrors/colors.py new file mode 100644 index 0000000000000000000000000000000000000000..0c27fde121229b0a65f963cd0d371eec64f9ab14 --- /dev/null +++ b/pacman_mirrors/colors.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +"""Useful constants""" + +GREEN = "\033[1;32m" +RED = "\033[1;31m::" +YELLOW = "\033[1;33m" +BLUE = "\033[1;34m" +WHITE = "\033[1;37m" +ENDCOLOR = "\033[1;m" +DBG_CLR = "\033[1;46m.: {}\033[1;m".format("DEBUG") diff --git a/pacman_mirrors/configfn.py b/pacman_mirrors/configfn.py index bd84af25dc3e2e00e3f945252ee6ab3f1bba0d1e..502462ffebc1f5d97d4d776bf792520c73daa162 100644 --- a/pacman_mirrors/configfn.py +++ b/pacman_mirrors/configfn.py @@ -54,7 +54,7 @@ def api_write_branch(branch, filename): txt.CANNOT_READ_FILE, err.filename, err.strerror)) - sys.exit(1) + sys.exit(2) def api_write_only_country(filename, selection, custom=False): @@ -91,7 +91,7 @@ def api_write_only_country(filename, selection, custom=False): except OSError as err: print(".: {} {}: {}: {}".format(txt.ERR_CLR, txt.CANNOT_READ_FILE, err.filename, err.strerror)) - sys.exit(1) + sys.exit(2) def api_write_protocols(protocols, filename): @@ -121,7 +121,7 @@ def api_write_protocols(protocols, filename): txt.CANNOT_READ_FILE, err.filename, err.strerror)) - sys.exit(1) + sys.exit(2) def build_config(): @@ -173,25 +173,20 @@ def build_config(): config["only_country"] = value.split(",") else: config["only_country"] = value.split(" ") - elif key == "MirrorlistsDir": - config["work_dir"] = value - elif key == "OutputMirrorlist": - config["mirror_list"] = value - elif key == "NoUpdate": - config["no_update"] = value - elif key == "SSLVerify": - if value == "False": - config["ssl_verify"] = False elif key == "Protocols": if "," in value: config["protocols"] = value.split(",") else: config["protocols"] = value.split(" ") + elif key == "SSLVerify": + if value == "False": + config["ssl_verify"] = False except (PermissionError, OSError) as err: print(".: {} {}: {}: {}".format(txt.ERR_CLR, txt.CANNOT_READ_FILE, err.filename, err.strerror)) + sys.exit(2) return config, custom diff --git a/pacman_mirrors/filefn.py b/pacman_mirrors/filefn.py index 2a8e82c3556c8dc7ce8bd1bbf978814393ccaf30..1667419ece6616d871e58c2a273bead870aefb89 100644 --- a/pacman_mirrors/filefn.py +++ b/pacman_mirrors/filefn.py @@ -27,6 +27,7 @@ import sys from . import jsonfn from . import miscfn from . import txt +from . import colors as color def check_file(filename): @@ -57,10 +58,10 @@ def return_mirror_filename(config): elif check_file(config["mirror_file"]): filename = config["mirror_file"] if not filename: - print("\n{}.:! {}{}\n".format(txt.RS, + print("\n{}.:! {}{}\n".format(color.RED, txt.HOUSTON, - txt.CE)) - sys.exit(1) + color.ENDCOLOR)) + sys.exit(3) return filename, status @@ -70,7 +71,7 @@ def output_mirror_list(config, servers, custom=False, quiet=False, interactive=F :param servers: list of servers to write :param custom: :param quiet: - :param interactive: + :param interactive: """ try: with open(config["mirror_list"], "w") as outfile: @@ -119,7 +120,7 @@ def output_mirror_list(config, servers, custom=False, quiet=False, interactive=F txt.CANNOT_WRITE_FILE, err.filename, err.strerror)) - sys.exit(1) + sys.exit(2) def read_mirror_file(filename): diff --git a/pacman_mirrors/miscfn.py b/pacman_mirrors/miscfn.py index 93af257aacfe00a16403e2aba8c974ac5794c828..f7d7234ad554e6f3b7d7fb2f16249160b942853e 100644 --- a/pacman_mirrors/miscfn.py +++ b/pacman_mirrors/miscfn.py @@ -25,33 +25,32 @@ from . import txt def debug(where, what, value): """Helper for printing debug messages""" - print("{} In function {} -> '{} = {}'".format(txt.DBG_CLR, where, what, value)) + print("{} {} >>>> '{} = {}'".format(DBG_CLR, where, what, value)) -def blue(where, what, value): +def blue(message): """Helper for printing blue messages""" - print("{}In function{} >>{} \n\n{} = {}".format(txt.BS, where, txt.CE, what, value)) + print("{}{}{}".format(BLUE, message, ENDCOLOR)) -def green(where, what, value): +def green(message): """Helper for printing green messages""" - print("{}In function {} >>{} \n\n{} = {}".format(txt.GS, where, txt.CE, what, value)) + print("{}{}{}".format(GREEN, message, ENDCOLOR)) -def red(where, what, value): +def red(message): """Helper for printing yellow messages""" - print("{}In function {} >>{} \n\n{} = {}".format(txt.RS, where, txt.CE, what, value)) + print("{}{}{}".format(RED, message, ENDCOLOR)) -def yellow(where, what, value): +def yellow(message): """Helper for printing yellow messages""" - print("{}In function {} >>{} \n\n{} = {}".format(txt.YS, where, txt.CE, what, value)) + print("{}{}{}".format(YELLOW, message, ENDCOLOR)) def internet_message(): """Message when internet connection is down""" print(".: {} {}".format(txt.WRN_CLR, txt.INTERNET_DOWN)) - print(".: {} {}".format(txt.INF_CLR, txt.INTERNET_REQUIRED)) print(".: {} {}".format(txt.INF_CLR, txt.MIRROR_RANKING_NA)) print(".: {} {}".format(txt.INF_CLR, txt.INTERNET_ALTERNATIVE)) diff --git a/pacman_mirrors/pacman_mirrors.py b/pacman_mirrors/pacman_mirrors.py index ca899a7838e40feb8902fa444ddddc6163eb7459..dcd92b129b74844e3c8ff2eabdd257cce28d216a 100644 --- a/pacman_mirrors/pacman_mirrors.py +++ b/pacman_mirrors/pacman_mirrors.py @@ -35,6 +35,7 @@ from pacman_mirrors import __version__ from .custom_help_formatter import CustomHelpFormatter from .mirror import Mirror from . import mirrorfn +from . import colors as color from . import configuration as conf from . import configfn from . import filefn @@ -80,98 +81,89 @@ class PacmanMirrors: def command_line_parse(self): """Read the arguments of the command line""" parser = argparse.ArgumentParser(formatter_class=CustomHelpFormatter) - parser.add_argument("-v", "--version", - action="store_true", - help=txt.HLP_ARG_VERSION) - country = parser.add_argument_group("COUNTRY") - country.add_argument("-c", "--country", - type=str, - nargs="+", - help=txt.HLP_ARG_COUNTRY) - country.add_argument("--geoip", - action="store_true", - help="{} {} {}".format(txt.HLP_ARG_GEOIP_P1, - txt.OPT_COUNTRY, - txt.HLP_ARG_GEOIP_P2)) + # Method arguments methods = parser.add_argument_group("METHODS") + methods.add_argument("-g", "--generate", + action="store_true", + help=txt.HLP_ARG_GENERATE) methods.add_argument("-f", "--fasttrack", type=int, metavar=txt.NUMBER, help="{} {}".format(txt.HLP_ARG_FASTTRACK, txt.OVERRIDE_OPT)) - methods.add_argument("-g", "--generate", - action="store_true", - help=txt.HLP_ARG_GENERATE) methods.add_argument("-i", "--interactive", action="store_true", help=txt.HLP_ARG_INTERACTIVE) + methods.add_argument("-d", "--default", + action="store_true", + help="Interactive: " + txt.HLP_ARG_DEFAULT) methods.add_argument("-m", "--method", type=str, choices=["rank", "random"], help=txt.HLP_ARG_METHOD) - misc = parser.add_argument_group("MISC") - misc.add_argument("-b", "--branch", - type=str, - choices=["stable", "testing", "unstable"], - help=txt.HLP_ARG_BRANCH) - misc.add_argument("-d", "--mirror_dir", - type=str, - metavar=txt.PATH, - help=txt.HLP_ARG_PATH) - misc.add_argument("-l", "--country-list", "--list", - action="store_true", - help=txt.HLP_ARG_LIST) - misc.add_argument("-o", "--output", - type=str, - metavar=txt.FILE, - help=txt.HLP_ARG_FILE) - misc.add_argument("-q", "--quiet", - action="store_true", - help=txt.HLP_ARG_QUIET) - misc.add_argument("-t", "--timeout", - type=int, - metavar=txt.SECONDS, - help=txt.HLP_ARG_TIMEOUT) - misc.add_argument("--default", - action="store_true", - help="Interactive: " + txt.HLP_ARG_DEFAULT) - # Update arguments - update = parser.add_argument_group("SYNC") - sync = update.add_mutually_exclusive_group() - sync.add_argument("-n", "--no-mirrorlist", - action="store_true", - help="Skip mirrorlist") - sync.add_argument("-y", "--sync", - action="store_true", - help=txt.HLP_ARG_SYNC) + country = parser.add_argument_group("COUNTRY") + country.add_argument("-c", "--country", + type=str, + nargs="+", + help=txt.HLP_ARG_COUNTRY) + country.add_argument("--geoip", + action="store_true", + help=txt.HLP_ARG_GEOIP) + country.add_argument("-l", "--country-list", "--list", + action="store_true", + help=txt.HLP_ARG_LIST) # Api arguments api = parser.add_argument_group("API") api.add_argument("-a", "--api", action="store_true", - help="[--prefix] [--set-branch|--get-branch] [--proto] [--no-mirrorlist]") + help="[-p PREFIX][-S|-G BRANCH][-P PROTO [PROTO ...]]") api.add_argument("-p", "--prefix", type=str, - help="API: " + txt.HLP_ARG_API_PREFIX + txt.PREFIX_TIP) + help=txt.HLP_ARG_API_PREFIX + txt.PREFIX_TIP) api.add_argument("-P", "--proto", "--protocols", choices=["all", "http", "https", "ftp", "ftps"], type=str, nargs="+", - help="API: " + txt.HLP_ARG_API_PROTOCOLS) + help=txt.HLP_ARG_API_PROTOCOLS) branch = api.add_mutually_exclusive_group() + branch.add_argument("-b", "--branch", + type=str, + choices=["stable", "testing", "unstable"], + help=txt.HLP_ARG_BRANCH) branch.add_argument("-G", "--get-branch", action="store_true", - help="API: " + txt.HLP_ARG_API_GET_BRANCH) + help=txt.HLP_ARG_API_GET_BRANCH) branch.add_argument("-S", "--set-branch", choices=["stable", "testing", "unstable"], - help="API: " + txt.HLP_ARG_API_SET_BRANCH) + help=txt.HLP_ARG_API_SET_BRANCH) + # Misc arguments + misc = parser.add_argument_group("MISC") + misc.add_argument("-q", "--quiet", + action="store_true", + help=txt.HLP_ARG_QUIET) + misc.add_argument("-t", "--timeout", + type=int, + metavar=txt.SECONDS, + help=txt.HLP_ARG_TIMEOUT) + misc.add_argument("-v", "--version", + action="store_true", + help=txt.HLP_ARG_VERSION) + sync = misc.add_mutually_exclusive_group() + sync.add_argument("-n", "--no-mirrorlist", + action="store_true", + help=txt.HLP_ARG_NO_MIRRORLIST) + sync.add_argument("-y", "--sync", + action="store_true", + help=txt.HLP_ARG_SYNC) args = parser.parse_args() if len(sys.argv) == 1: + print("pacman-mirrors version " + __version__) parser.print_help() sys.exit(0) if args.version: - print("{}pacman-mirrors {}{}".format(txt.GS, __version__, txt.CE)) + print("{}pacman-mirrors {}{}".format(color.GREEN, __version__, color.ENDCOLOR)) sys.exit(0) if args.country_list: @@ -196,15 +188,6 @@ class PacmanMirrors: if args.sync: self.sync = True - if args.mirror_dir: - self.config["work_dir"] = args.mirror_dir - - if args.output: - if args.output[0] == "/": - self.config["mirror_list"] = args.output - else: - self.config["mirror_list"] = os.getcwd() + "/" + args.output - if args.interactive: self.interactive = True if not os.environ.get("DISPLAY") or not GTK_AVAILABLE: @@ -331,7 +314,7 @@ class PacmanMirrors: print("\r") else: if not self.quiet: - print("\r {:<5}{}{} ".format(txt.GS, resp_time, txt.CE)) + print("\r {:<5}{}{} ".format(color.GREEN, resp_time, color.ENDCOLOR)) worklist.append(mirror) counter += 1 if counter == number: @@ -526,7 +509,7 @@ class PacmanMirrors: print("\r") else: if not self.quiet: - print("\r {:<5}{}{} ".format(txt.GS, resp_time, txt.CE)) + print("\r {:<5}{}{} ".format(color.GREEN, resp_time, color.ENDCOLOR)) return worklist def run(self): @@ -543,6 +526,7 @@ class PacmanMirrors: self.config["method"] = "random" # use random instead of rank self.fasttrack = False # using fasttrack is not possible if self.no_mirrorlist: + print(".: {} {}".format(txt.INF_CLR, txt.NO_CHANGE)) sys.exit(0) self.load_all_mirrors() if self.country_list: diff --git a/pacman_mirrors/txt.py b/pacman_mirrors/txt.py index ca6c439551efd5fc6803ff8e84270454ded562d3..116e77ceb0bfead1ed5fd5c6bd117d600a032f41 100644 --- a/pacman_mirrors/txt.py +++ b/pacman_mirrors/txt.py @@ -40,27 +40,25 @@ FILE = _("FILE") SECONDS = _("SECONDS") NUMBER = _("NUMBER") # help messages +HLP_ARG_API_GET_BRANCH = _("Return branch from configuration") +HLP_ARG_API_PREFIX = _("Set prefix to") +HLP_ARG_API_PROTOCOLS = _("Write protocols to configuration") +HLP_ARG_API_SET_BRANCH = _("Write branch to configuration") HLP_ARG_BRANCH = _("Branch name") HLP_ARG_COUNTRY = _( "Comma separated list of countries, from which mirrors will be used") HLP_ARG_DEFAULT = _("Load default mirror file") -HLP_ARG_FILE = _("Output file") +HLP_ARG_FASTTRACK = _("Generate mirrorlist with a number of up-to-date mirrors") HLP_ARG_GENERATE = _("Generate mirrorlist with defaults") -HLP_ARG_GEOIP_P1 = _("Get current country using geolocation. Ignored if") -HLP_ARG_GEOIP_P2 = _("is supplied") +HLP_ARG_GEOIP = _("Get current country using geolocation") +HLP_ARG_LIST = _("List all available countries") HLP_ARG_INTERACTIVE = _("Generate custom mirrorlist") HLP_ARG_METHOD = _("Generation method") -HLP_ARG_PATH = _("Mirrors list path") +HLP_ARG_NO_MIRRORLIST = _("Use to skip generation of mirrorlist") HLP_ARG_QUIET = _("Quiet mode - less verbose output") +HLP_ARG_SYNC = _("Syncronize pacman databases") HLP_ARG_TIMEOUT = _("Maximum waiting time for server response") HLP_ARG_VERSION = _("Print the pacman-mirrors version") -HLP_ARG_FASTTRACK = _("Generate mirrorlist with a number of up-to-date mirrors. Overrides") -HLP_ARG_LIST = _("List all available countries") -HLP_ARG_SYNC = _("Syncronize pacman databases") -HLP_ARG_API_PREFIX = _("Set prefix to") -HLP_ARG_API_PROTOCOLS = _("Set accepted protocols") -HLP_ARG_API_GET_BRANCH = _("Return branch from configuration") -HLP_ARG_API_SET_BRANCH = _("Write new branch to configuration") # messages AVAILABLE_COUNTRIES = _("Available countries are") CANNOT_DOWNLOAD_FILE = _("Could not download from") @@ -79,9 +77,7 @@ MIRROR_LIST_SAVED = _("Mirrorlist generated and saved to") MIRROR_RANKING_NA = _("Mirror ranking is not available") MUST_BE_ROOT = _("Must have root privileges") INTERNET_DOWN = _("Internet connection appears to be down") -INTERNET_REQUIRED = _("Internet access is required to proceed") -INTERNET_ALTERNATIVE = _( - "Pacman needs a mirrorlist. Use -m random to create one without network") +INTERNET_ALTERNATIVE = _("Mirrorlist is generated using random method") NO_CHANGE = _("The mirror list is not changed") NO_SELECTION = _("No mirrors in selection") OPTION = _("Option") @@ -107,29 +103,20 @@ I_CANCEL = _("Cancel") I_CONFIRM = _("OK") I_CONFIRM_SELECTION = _("Confirm selections") I_USE_THESE_MIRRORS = _("I want to use these mirrors") - # NON TRANSLATABLE STRINGS HOUSTON = "Houston?! We have a problem." OVERRIDE_OPT = "--country --interactive --method --geoip" REPO_SERVER = "repo.manjaro.org" RESET_TIP = "pacman-mirrors -c all" -PREFIX_TIP = ": $mnt | /dir" +PREFIX_TIP = ": $mnt | /mnt/install" +# options +OPT_RANDOM = " '-m/--method random " # mirror status constants LASTSYNC_OK = "24:00" # last syncronize in the past 24 hours LASTSYNC_NA = "9800:00" # last syncronization not available SERVER_BAD = "9999:99" # default last syncronization status SERVER_RES = "99.99" # default response status -# options -OPT_COUNTRY = " '-c/--country' " -OPT_RANDOM = " '-m/--method random " # colors -DBG_CLR = "\033[1;46m.: {} >>> \033[1;m".format("DEBUG") ERR_CLR = "\033[1;31m{}\033[1;m".format(ERROR) INF_CLR = "\033[1;37m{}\033[1;m".format(INFO) WRN_CLR = "\033[1;33m{}\033[1;m".format(WARN) -CE = "\033[1;m" -GS = "\033[1;32m" -RS = "\033[1;31m::" -YS = "\033[1;33m" -BS = "\033[1;34m" -WS = "\033[1;37m" diff --git a/site/index.html b/site/index.html index 5c95084941bea218a2592ed3e71d74bb3bcee203..1417a880cd70ca397e86202888f3f0adefe6a2fb 100644 --- a/site/index.html +++ b/site/index.html @@ -89,8 +89,11 @@ <li class="main "><a href="#synopsis">SYNOPSIS</a></li> <li class="main "><a href="#description">DESCRIPTION</a></li> <li class="main "><a href="#options">OPTIONS</a></li> + <li><a href="#methods">METHODS</a></li> + <li><a href="#branch">BRANCH</a></li> + <li><a href="#country">COUNTRY</a></li> <li><a href="#api">API</a></li> - <li><a href="#generic">GENERIC</a></li> + <li><a href="#misc">MISC</a></li> <li><a href="#exit-status">Exit status:</a></li> <li class="main "><a href="#examples">EXAMPLES</a></li> <li class="main "><a href="#reporting-bugs">REPORTING BUGS</a></li> @@ -106,127 +109,170 @@ <h1 id="name">NAME</h1> <p>pacman-mirrors - generate pacman mirrorlist for Manjaro Linux</p> <h1 id="synopsis">SYNOPSIS</h1> -<p>pacman-mirrors [OPTION] ...</p> +<p>pacman-mirrors [-f<em>NUMBER</em>|[[-i[-d]][-c<em>COUNTRY</em>,[<em>...</em>]|--geoip]][-m<em>METHOD</em>]] +[-a[-p<em>PREFIX</em>][-G|-S<em>BRANCH</em>]-P<em>PROTO</em>,[<em>...</em>]] [-b<em>BRANCH</em>] [-t<em>SECONDS</em>] +[-q] [-v] [-n|-y] </p> <h1 id="description">DESCRIPTION</h1> <p>Generate mirrorlist for Manjaro Linux. Default is to rank all mirrors by reponse time. If no arguments are given pacman-mirrors lists available options. +Pacman-mirrors requires access to files which are read-only +so it must be run with su or sudo. To create a mirrorlist using all default use,</p> -<pre><code>sudo pacman-mirrors -g +<pre><code>pacman-mirrors --generate </code></pre> -<p>The mirrorlist generation process can be refined through options -and arguments which takes input, for example,</p> -<pre><code>sudo pacman-mirrors --country Denmark --timeout 5 +<p>The mirrorlist generation process can be refined through arguments +and arguments with options, for example,</p> +<pre><code>pacman-mirrors --country Denmark --timeout 5 </code></pre> <h1 id="options">OPTIONS</h1> +<p>Some options are mutual exclusive and they will throw an arguments error, </p> +<ul> +<li><strong>--no-mirrorlist</strong> and <strong>--sync</strong></li> +<li><strong>--branch</strong>, <strong>--get-branch</strong> and <strong>--set-branch</strong></li> +<li><strong>--sync</strong> and <strong>--no-mirrorlist</strong></li> +<li><strong>--country</strong> and <strong>--geoip</strong></li> +</ul> +<p>Others can be used together but they have precedence. +If the fasttrack arg is used with interactive, country or geoip +the fasttrack arg will have precendence and the other is ignored. +Also, if the branch arg is used with set-branch the set-branch arg has precedence. +Some arguments requires other argument to have effect for example,</p> +<pre><code>pacman-mirrors -b unstable --default +</code></pre> +<p>the --default argument has no effect, +it should have been in conjunction with --interactive.</p> +<p>The same goes for the API specific arguments. +For those to have effect the --api argument must be present also.</p> +<pre><code>pacman-mirrors --api -Sunstable +</code></pre> +<p>The arguments can appear in any order except for arguments which takes +additional options in which case the options must follow +immediately after the argument, for example</p> +<pre><code>pacman-mirrors -ayidS unstable +</code></pre> +<h2 id="methods">METHODS</h2> <p>-g, --generate : Generate a new default mirrorlist using defaults</p> <p>-f, --fasttrack NUMBER : Generates a mirrorlist with a number mirrors ranked by responsiveness, the mirrors are selected from <a href="http://repo.manjaro.org/status.json">http://repo.manjaro.org/status.json</a></p> -<p>-m, --method <em>METHOD</em> -: Default method is <em>rank</em> but <em>random</em> can be selected </p> <p>-i, --interactive [--default] : Launches a tool for selectively picking mirrors and protocols, <strong>--default</strong> forces pacman-mirrors to load the default mirror file and ignore any preset custom-mirrors file, thus allowing for reselecting mirrors for a new custom mirror file</p> +<p>-m, --method <em>METHOD</em> +: Default method is <em>rank</em> but <em>random</em> can be selected </p> +<h2 id="branch">BRANCH</h2> <p>-b, --branch <em>BRANCH</em> : Temporarily use another branch, use <em>stable</em>, <em>testing</em> or <em>unstable</em>, the branch is reset with next run of pacman-mirrors</p> -<p>-c, --country <em>COUNTRY</em> [<em>COUNTRY</em> ...] -: Specifiy a country or a list of countries, excludes <strong>--geoip</strong></p> +<h2 id="country">COUNTRY</h2> +<p>-c, --country <em>COUNTRY</em> [<em>COUNTRY</em>] ... +: Specifiy a country or a list of countries</p> <p>--geoip -: Use geolocation if possible, if not uses all mirrors, - excludes <strong>-c</strong>, <strong>--country</strong></p> -<p>-l, --country-list +: Use geolocation if possible, if not uses all mirrors</p> +<p>-l, --list, --country-list : Lists available mirror countries</p> -<p>-d, --mirror_dir <em>NEW_DIR</em> -: <em>(DEPRECATED)</em> Choose a temporary directory where mirrors file is located</p> -<p>-o, --output <em>NEW_FILE</em> -: <em>(DEPRECATED)</em> Choose a temporary file for your mirrorlist</p> -<p>-q, --quiet -: Make pacman-mirrors silent</p> -<p>-t, --timeout <em>SECONDS</em> -: Change the number of seconds waiting for a server response, - SSL enabled mirrors has this value doubled to compensate, - for the time spent on exchanging encryption keys</p> -<p>-n, --no-mirrorlist -: Skip mirrorlist generation, excludes <strong>-y</strong>, <strong>--sync</strong></p> -<p>-y, --sync -: Instruct pacman-mirrors to syncronize the pacman database, - excludes <strong>-n</strong>, <strong>--no-mirrorlist</strong></p> <h2 id="api">API</h2> -<p>-a, --api -: Instructs pacman-mirrors to activate these optional arguments</p> -<p>-a -p, --prefix <em>PREFIX</em> -: Add a path prefix to pacman-mirrors file-handling<br /> +<p>-a, --api [-p <em>PREFIX</em>] [-G|-S <em>BRANCH</em>] [-P <em>PROTO</em> [<em>PROTO</em>] ...] +: Instructs pacman-mirrors to activate processing of API arguments</p> +<p>-p, --prefix <em>PREFIX</em> +: Add a path prefix to pacman-mirrors file-handling eg. <em>/mnt/install</em> or <em>$mnt</em></p> -<p>-a -G, --get-branch +<p>-G, --get-branch : Returns branch from configuration optionally with a prefix.</p> -<p>-a -S, --set-branch <em>BRANCH</em> -: Writes the branch to configuration optionally with a prefix, <br /> +<p>-S, --set-branch <em>BRANCH</em> +: Writes the branch to configuration optionally with a prefix, use <em>stable</em>, <em>testing</em> or <em>unstable</em></p> -<p>-a -P, --proto, --protocols <em>PROTO</em> [<em>PROTO</em> ...] -: Write the protocols to configuration optionally with a prefix,<br /> +<p>-P, --proto, --protocols <em>PROTO</em> [<em>...</em>] +: Write the protocols to configuration optionally with a prefix, use <em>all</em> or <em>http</em>, <em>https</em>, <em>ftp</em> and <em>ftps</em>.</p> -<h2 id="generic">GENERIC</h2> +<h2 id="misc">MISC</h2> <p>-h, --help : Show the help message</p> +<p>-n, --no-mirrorlist +: Skip mirrorlist generation</p> +<p>-q, --quiet +: Make pacman-mirrors silent</p> +<p>-t, --timeout <em>SECONDS</em> +: Change the number of seconds waiting for a server response, + SSL enabled mirrors has this value doubled to compensate, + for the time spent on exchanging encryption keys</p> <p>-v, --version : Show the version of pacman-mirrors</p> +<p>-y, --sync +: Instruct pacman-mirrors to syncronize the pacman database</p> <h2 id="exit-status">Exit status:</h2> -<p>0 if OK<br /> -1 if problem with argument<br /> +<p>0: OK<br /> +1: Problem with argument +2: Problem accessing systemfiles +3: Missing mirror file BRANCH from config </p> <h1 id="examples">EXAMPLES</h1> <p>Most optional arguments are self explaining others require explanation. The API functions is mainly designed to help packagers and iso-builders. However it can be of use for everyone because it takes the hazzle out of editing your pacman-mirrors configuration.</p> +<ul> +<li> <p>Which countries has mirrors?</p> -<pre><code>sudo pacman-mirrors -l -</code></pre> +<p><code>sudo pacman-mirrors -l</code></p> +</li> +<li> <p>I want to temporary change branch to unstable, use geolocation and syncronize pacman,</p> -<pre><code>sudo pacman-mirrors -yb unstable --geoip -</code></pre> +<p><code>sudo pacman-mirrors -yb unstable --geoip</code></p> +</li> +<li> <p>I want to permanently change branch to unstable, use mirrors from Germany and France, use only https and http protocol in that order and syncronize pacman</p> -<pre><code>sudo pacman-mirrors -yac Germany,France -S unstable -P https http -</code></pre> +<p><code>sudo pacman-mirrors -yac Germany,France -S unstable -P https http</code></p> +</li> +<li> <p>Create a mirrorlist with German mirrors and syncronize pacman</p> -<pre><code>sudo pacman-mirrors -yc Germany -</code></pre> +<p><code>sudo pacman-mirrors -yc Germany</code></p> +</li> +<li> <p>If you want more countries in your mirrorlist add them</p> -<pre><code>sudo pacman-mirrors -yc Germany France Denmark -</code></pre> +<p><code>sudo pacman-mirrors -yc Germany France Denmark</code></p> +</li> +<li> <p>Create a mirrorlist with 5 mirrors with current packages and syncronize pacman</p> -<pre><code>sudo pacman-mirrors -yf 5 -</code></pre> +<p><code>sudo pacman-mirrors -yf 5</code></p> +</li> +<li> <p>I want to choose my mirrors</p> -<pre><code>sudo pacman-mirrors -i -</code></pre> +<p><code>sudo pacman-mirrors -i</code></p> +</li> +<li> <p>I have a custom mirror list and I want to create a new custom mirror list?</p> -<pre><code>sudo pacman-mirrors -i --default -</code></pre> +<p><code>sudo pacman-mirrors -i --default</code></p> +</li> +<li> <p>I have a custom mirror list - can I reset it?</p> -<pre><code>sudo pacman-mirrors -c all -</code></pre> +<p><code>sudo pacman-mirrors -c all</code></p> +</li> +<li> <p>What branch am I on</p> -<pre><code>sudo pacman-mirrors -a -G* -</code></pre> +<p><code>sudo pacman-mirrors -a -G</code></p> +</li> +<li> <p>Change system branch and dont change the mirrorlist</p> -<pre><code>sudo pacman-mirrors -naS unstable -</code></pre> +<p><code>sudo pacman-mirrors -naS unstable</code></p> +</li> +<li> <p>Change protocols you will accept but dont touch the mirrorlist</p> -<pre><code>sudo pacman-mirrors -naP https http -</code></pre> +<p><code>sudo pacman-mirrors -naP https http</code></p> +</li> +<li> <p>A packager can write the directly to a mounted systems datafiles using either a path or an environment variable</p> -<pre><code>sudo pacman-mirrors -ap $mnt -S unstable -P https -</code></pre> +<p><code>sudo pacman-mirrors -ap $mnt -S unstable -P https</code></p> +</li> +</ul> <h1 id="reporting-bugs">REPORTING BUGS</h1> <p><a href="https://github.com/manjaro/pacman-mirrors/issues">https://github.com/manjaro/pacman-mirrors/issues</a></p> <h1 id="see-also">SEE ALSO</h1> @@ -276,5 +322,5 @@ Frede Hundewadt <a href="mailto:fr <!-- MkDocs version : 0.16.3 -Build Date UTC : 2017-05-18 18:30:42 +Build Date UTC : 2017-05-19 09:01:46 --> diff --git a/site/mkdocs/search_index.json b/site/mkdocs/search_index.json index f9a142604572bee3b57a5d6d029944ca2ca2b566..949c1ed2a4d5ba5eeedfb48dd1b3f0618bbb27d4 100644 --- a/site/mkdocs/search_index.json +++ b/site/mkdocs/search_index.json @@ -2,7 +2,7 @@ "docs": [ { "location": "/", - "text": "% pacman-mirrors(8) Pacman-Mirrors User Manual\n\n% \n\n% May 18, 2017 \n\n\nNAME\n\n\npacman-mirrors - generate pacman mirrorlist for Manjaro Linux\n\n\nSYNOPSIS\n\n\npacman-mirrors [OPTION] ...\n\n\nDESCRIPTION\n\n\nGenerate mirrorlist for Manjaro Linux.\nDefault is to rank all mirrors by reponse time.\nIf no arguments are given pacman-mirrors lists available options.\nTo create a mirrorlist using all default use,\n\n\nsudo pacman-mirrors -g\n\n\n\nThe mirrorlist generation process can be refined through options \nand arguments which takes input, for example,\n\n\nsudo pacman-mirrors --country Denmark --timeout 5\n\n\n\nOPTIONS\n\n\n-g, --generate\n: Generate a new default mirrorlist using defaults\n\n\n-f, --fasttrack NUMBER\n: Generates a mirrorlist with a number mirrors ranked by responsiveness,\n the mirrors are selected from \nhttp://repo.manjaro.org/status.json\n\n\n-m, --method \nMETHOD\n\n: Default method is \nrank\n but \nrandom\n can be selected \n\n\n-i, --interactive [--default]\n: Launches a tool for selectively picking mirrors and protocols,\n \n--default\n forces pacman-mirrors to load the default mirror\n file and ignore any preset custom-mirrors file, thus allowing for \n reselecting mirrors for a new custom mirror file\n\n\n-b, --branch \nBRANCH\n\n: Temporarily use another branch, use \nstable\n, \ntesting\n or \nunstable\n, \n the branch is reset with next run of pacman-mirrors\n\n\n-c, --country \nCOUNTRY\n [\nCOUNTRY\n ...]\n: Specifiy a country or a list of countries, excludes \n--geoip\n\n\n--geoip\n: Use geolocation if possible, if not uses all mirrors, \n excludes \n-c\n, \n--country\n\n\n-l, --country-list\n: Lists available mirror countries\n\n\n-d, --mirror_dir \nNEW_DIR\n\n: \n(DEPRECATED)\n Choose a temporary directory where mirrors file is located\n\n\n-o, --output \nNEW_FILE\n\n: \n(DEPRECATED)\n Choose a temporary file for your mirrorlist\n\n\n-q, --quiet\n: Make pacman-mirrors silent\n\n\n-t, --timeout \nSECONDS\n\n: Change the number of seconds waiting for a server response, \n SSL enabled mirrors has this value doubled to compensate, \n for the time spent on exchanging encryption keys\n\n\n-n, --no-mirrorlist\n: Skip mirrorlist generation, excludes \n-y\n, \n--sync\n\n\n-y, --sync\n: Instruct pacman-mirrors to syncronize the pacman database, \n excludes \n-n\n, \n--no-mirrorlist\n\n\nAPI\n\n\n-a, --api\n: Instructs pacman-mirrors to activate these optional arguments\n\n\n-a -p, --prefix \nPREFIX\n\n: Add a path prefix to pacman-mirrors file-handling\n\n eg. \n/mnt/install\n or \n$mnt\n\n\n-a -G, --get-branch\n: Returns branch from configuration optionally with a prefix.\n\n\n-a -S, --set-branch \nBRANCH\n\n: Writes the branch to configuration optionally with a prefix, \n\n use \nstable\n, \ntesting\n or \nunstable\n\n\n-a -P, --proto, --protocols \nPROTO\n [\nPROTO\n ...]\n: Write the protocols to configuration optionally with a prefix,\n\n use \nall\n or \nhttp\n, \nhttps\n, \nftp\n and \nftps\n.\n\n\nGENERIC\n\n\n-h, --help\n: Show the help message\n\n\n-v, --version\n: Show the version of pacman-mirrors\n\n\nExit status:\n\n\n0 if OK\n\n1 if problem with argument\n\nBRANCH from config \n\n\nEXAMPLES\n\n\nMost optional arguments are self explaining others require explanation. \nThe API functions is mainly designed to help packagers and iso-builders. \nHowever it can be of use for everyone because it takes the hazzle out \nof editing your pacman-mirrors configuration.\n\n\nWhich countries has mirrors?\n\n\nsudo pacman-mirrors -l\n\n\n\nI want to temporary change branch to unstable, \nuse geolocation and syncronize pacman,\n\n\nsudo pacman-mirrors -yb unstable --geoip\n\n\n\nI want to permanently change branch to unstable, \nuse mirrors from Germany and France, \nuse only https and http protocol in that order and syncronize pacman\n\n\nsudo pacman-mirrors -yac Germany,France -S unstable -P https http\n\n\n\nCreate a mirrorlist with German mirrors and syncronize pacman\n\n\nsudo pacman-mirrors -yc Germany\n\n\n\nIf you want more countries in your mirrorlist add them\n\n\nsudo pacman-mirrors -yc Germany France Denmark\n\n\n\nCreate a mirrorlist with 5 mirrors with current packages and syncronize pacman\n\n\nsudo pacman-mirrors -yf 5\n\n\n\nI want to choose my mirrors\n\n\nsudo pacman-mirrors -i\n\n\n\nI have a custom mirror list and I want to create a new custom mirror list?\n\n\nsudo pacman-mirrors -i --default\n\n\n\nI have a custom mirror list - can I reset it?\n\n\nsudo pacman-mirrors -c all\n\n\n\nWhat branch am I on\n\n\nsudo pacman-mirrors -a -G*\n\n\n\nChange system branch and dont change the mirrorlist\n\n\nsudo pacman-mirrors -naS unstable\n\n\n\nChange protocols you will accept but dont touch the mirrorlist\n\n\nsudo pacman-mirrors -naP https http\n\n\n\nA packager can write the directly to a mounted systems \ndatafiles using either a path or an environment variable\n\n\nsudo pacman-mirrors -ap $mnt -S unstable -P https\n\n\n\nREPORTING BUGS\n\n\nhttps://github.com/manjaro/pacman-mirrors/issues\n\n\nSEE ALSO\n\n\nThe pacman-mirrors source code and all documentation \nmay be downloaded from \nhttps://github.com/manjaro/pacman-mirrors/archive/master.zip\n\n\nAUTHORS\n\n\nEsclapion \nesclapion@manjaro.org\n\nphilm \nphilm@manjaro.org\n\nRamon Buld\u00f3 \nrbuldo@gmail.com\n\nHugo Posnic \nhuluti@manjaro.org\n\nFrede Hundewadt \nfrede@hundewadt.dk", + "text": "% pacman-mirrors(8) Pacman-Mirrors User Manual\n\n% \n\n% May 18, 2017 \n\n\nNAME\n\n\npacman-mirrors - generate pacman mirrorlist for Manjaro Linux\n\n\nSYNOPSIS\n\n\npacman-mirrors [-f\nNUMBER\n|[[-i[-d]][-c\nCOUNTRY\n,[\n...\n]|--geoip]][-m\nMETHOD\n]] \n[-a[-p\nPREFIX\n][-G|-S\nBRANCH\n]-P\nPROTO\n,[\n...\n]] [-b\nBRANCH\n] [-t\nSECONDS\n]\n[-q] [-v] [-n|-y] \n\n\nDESCRIPTION\n\n\nGenerate mirrorlist for Manjaro Linux.\nDefault is to rank all mirrors by reponse time.\nIf no arguments are given pacman-mirrors lists available options.\nPacman-mirrors requires access to files which are read-only \nso it must be run with su or sudo.\nTo create a mirrorlist using all default use,\n\n\npacman-mirrors --generate\n\n\n\nThe mirrorlist generation process can be refined through arguments \nand arguments with options, for example,\n\n\npacman-mirrors --country Denmark --timeout 5\n\n\n\nOPTIONS\n\n\nSome options are mutual exclusive and they will throw an arguments error, \n\n\n\n\n--no-mirrorlist\n and \n--sync\n\n\n--branch\n, \n--get-branch\n and \n--set-branch\n\n\n--sync\n and \n--no-mirrorlist\n\n\n--country\n and \n--geoip\n\n\n\n\nOthers can be used together but they have precedence.\nIf the fasttrack arg is used with interactive, country or geoip\nthe fasttrack arg will have precendence and the other is ignored.\nAlso, if the branch arg is used with set-branch the set-branch arg has precedence. \nSome arguments requires other argument to have effect for example,\n\n\npacman-mirrors -b unstable --default\n\n\n\nthe --default argument has no effect,\nit should have been in conjunction with --interactive.\n\n\nThe same goes for the API specific arguments. \nFor those to have effect the --api argument must be present also.\n\n\npacman-mirrors --api -Sunstable\n\n\n\nThe arguments can appear in any order except for arguments which takes \nadditional options in which case the options must follow \nimmediately after the argument, for example\n\n\npacman-mirrors -ayidS unstable\n\n\n\nMETHODS\n\n\n-g, --generate\n: Generate a new default mirrorlist using defaults\n\n\n-f, --fasttrack NUMBER\n: Generates a mirrorlist with a number mirrors ranked by responsiveness,\n the mirrors are selected from \nhttp://repo.manjaro.org/status.json\n\n\n-i, --interactive [--default]\n: Launches a tool for selectively picking mirrors and protocols,\n \n--default\n forces pacman-mirrors to load the default mirror\n file and ignore any preset custom-mirrors file, thus allowing for \n reselecting mirrors for a new custom mirror file\n\n\n-m, --method \nMETHOD\n\n: Default method is \nrank\n but \nrandom\n can be selected \n\n\nBRANCH\n\n\n-b, --branch \nBRANCH\n\n: Temporarily use another branch, use \nstable\n, \ntesting\n or \nunstable\n, \n the branch is reset with next run of pacman-mirrors\n\n\nCOUNTRY\n\n\n-c, --country \nCOUNTRY\n [\nCOUNTRY\n] ...\n: Specifiy a country or a list of countries\n\n\n--geoip\n: Use geolocation if possible, if not uses all mirrors\n\n\n-l, --list, --country-list\n: Lists available mirror countries\n\n\nAPI\n\n\n-a, --api [-p \nPREFIX\n] [-G|-S \nBRANCH\n] [-P \nPROTO\n [\nPROTO\n] ...]\n: Instructs pacman-mirrors to activate processing of API arguments\n\n\n-p, --prefix \nPREFIX\n\n: Add a path prefix to pacman-mirrors file-handling\n eg. \n/mnt/install\n or \n$mnt\n\n\n-G, --get-branch\n: Returns branch from configuration optionally with a prefix.\n\n\n-S, --set-branch \nBRANCH\n\n: Writes the branch to configuration optionally with a prefix,\n use \nstable\n, \ntesting\n or \nunstable\n\n\n-P, --proto, --protocols \nPROTO\n [\n...\n]\n: Write the protocols to configuration optionally with a prefix,\n use \nall\n or \nhttp\n, \nhttps\n, \nftp\n and \nftps\n.\n\n\nMISC\n\n\n-h, --help\n: Show the help message\n\n\n-n, --no-mirrorlist\n: Skip mirrorlist generation\n\n\n-q, --quiet\n: Make pacman-mirrors silent\n\n\n-t, --timeout \nSECONDS\n\n: Change the number of seconds waiting for a server response, \n SSL enabled mirrors has this value doubled to compensate, \n for the time spent on exchanging encryption keys\n\n\n-v, --version\n: Show the version of pacman-mirrors\n\n\n-y, --sync\n: Instruct pacman-mirrors to syncronize the pacman database\n\n\nExit status:\n\n\n0: OK\n\n1: Problem with argument\n2: Problem accessing systemfiles\n3: Missing mirror file\nBRANCH from config \n\n\nEXAMPLES\n\n\nMost optional arguments are self explaining others require explanation. \nThe API functions is mainly designed to help packagers and iso-builders. \nHowever it can be of use for everyone because it takes the hazzle out \nof editing your pacman-mirrors configuration.\n\n\n\n\n\n\nWhich countries has mirrors?\n\n\nsudo pacman-mirrors -l\n\n\n\n\n\n\nI want to temporary change branch to unstable, \nuse geolocation and syncronize pacman,\n\n\nsudo pacman-mirrors -yb unstable --geoip\n\n\n\n\n\n\nI want to permanently change branch to unstable, \nuse mirrors from Germany and France, \nuse only https and http protocol in that order and syncronize pacman\n\n\nsudo pacman-mirrors -yac Germany,France -S unstable -P https http\n\n\n\n\n\n\nCreate a mirrorlist with German mirrors and syncronize pacman\n\n\nsudo pacman-mirrors -yc Germany\n\n\n\n\n\n\nIf you want more countries in your mirrorlist add them\n\n\nsudo pacman-mirrors -yc Germany France Denmark\n\n\n\n\n\n\nCreate a mirrorlist with 5 mirrors with current packages and syncronize pacman\n\n\nsudo pacman-mirrors -yf 5\n\n\n\n\n\n\nI want to choose my mirrors\n\n\nsudo pacman-mirrors -i\n\n\n\n\n\n\nI have a custom mirror list and I want to create a new custom mirror list?\n\n\nsudo pacman-mirrors -i --default\n\n\n\n\n\n\nI have a custom mirror list - can I reset it?\n\n\nsudo pacman-mirrors -c all\n\n\n\n\n\n\nWhat branch am I on\n\n\nsudo pacman-mirrors -a -G\n\n\n\n\n\n\nChange system branch and dont change the mirrorlist\n\n\nsudo pacman-mirrors -naS unstable\n\n\n\n\n\n\nChange protocols you will accept but dont touch the mirrorlist\n\n\nsudo pacman-mirrors -naP https http\n\n\n\n\n\n\nA packager can write the directly to a mounted systems \ndatafiles using either a path or an environment variable\n\n\nsudo pacman-mirrors -ap $mnt -S unstable -P https\n\n\n\n\n\n\nREPORTING BUGS\n\n\nhttps://github.com/manjaro/pacman-mirrors/issues\n\n\nSEE ALSO\n\n\nThe pacman-mirrors source code and all documentation \nmay be downloaded from \nhttps://github.com/manjaro/pacman-mirrors/archive/master.zip\n\n\nAUTHORS\n\n\nEsclapion \nesclapion@manjaro.org\n\nphilm \nphilm@manjaro.org\n\nRamon Buld\u00f3 \nrbuldo@gmail.com\n\nHugo Posnic \nhuluti@manjaro.org\n\nFrede Hundewadt \nfrede@hundewadt.dk", "title": "Home" }, { @@ -12,37 +12,52 @@ }, { "location": "/#synopsis", - "text": "pacman-mirrors [OPTION] ...", + "text": "pacman-mirrors [-f NUMBER |[[-i[-d]][-c COUNTRY ,[ ... ]|--geoip]][-m METHOD ]] \n[-a[-p PREFIX ][-G|-S BRANCH ]-P PROTO ,[ ... ]] [-b BRANCH ] [-t SECONDS ]\n[-q] [-v] [-n|-y]", "title": "SYNOPSIS" }, { "location": "/#description", - "text": "Generate mirrorlist for Manjaro Linux.\nDefault is to rank all mirrors by reponse time.\nIf no arguments are given pacman-mirrors lists available options.\nTo create a mirrorlist using all default use, sudo pacman-mirrors -g The mirrorlist generation process can be refined through options \nand arguments which takes input, for example, sudo pacman-mirrors --country Denmark --timeout 5", + "text": "Generate mirrorlist for Manjaro Linux.\nDefault is to rank all mirrors by reponse time.\nIf no arguments are given pacman-mirrors lists available options.\nPacman-mirrors requires access to files which are read-only \nso it must be run with su or sudo.\nTo create a mirrorlist using all default use, pacman-mirrors --generate The mirrorlist generation process can be refined through arguments \nand arguments with options, for example, pacman-mirrors --country Denmark --timeout 5", "title": "DESCRIPTION" }, { "location": "/#options", - "text": "-g, --generate\n: Generate a new default mirrorlist using defaults -f, --fasttrack NUMBER\n: Generates a mirrorlist with a number mirrors ranked by responsiveness,\n the mirrors are selected from http://repo.manjaro.org/status.json -m, --method METHOD \n: Default method is rank but random can be selected -i, --interactive [--default]\n: Launches a tool for selectively picking mirrors and protocols,\n --default forces pacman-mirrors to load the default mirror\n file and ignore any preset custom-mirrors file, thus allowing for \n reselecting mirrors for a new custom mirror file -b, --branch BRANCH \n: Temporarily use another branch, use stable , testing or unstable , \n the branch is reset with next run of pacman-mirrors -c, --country COUNTRY [ COUNTRY ...]\n: Specifiy a country or a list of countries, excludes --geoip --geoip\n: Use geolocation if possible, if not uses all mirrors, \n excludes -c , --country -l, --country-list\n: Lists available mirror countries -d, --mirror_dir NEW_DIR \n: (DEPRECATED) Choose a temporary directory where mirrors file is located -o, --output NEW_FILE \n: (DEPRECATED) Choose a temporary file for your mirrorlist -q, --quiet\n: Make pacman-mirrors silent -t, --timeout SECONDS \n: Change the number of seconds waiting for a server response, \n SSL enabled mirrors has this value doubled to compensate, \n for the time spent on exchanging encryption keys -n, --no-mirrorlist\n: Skip mirrorlist generation, excludes -y , --sync -y, --sync\n: Instruct pacman-mirrors to syncronize the pacman database, \n excludes -n , --no-mirrorlist", + "text": "Some options are mutual exclusive and they will throw an arguments error, --no-mirrorlist and --sync --branch , --get-branch and --set-branch --sync and --no-mirrorlist --country and --geoip Others can be used together but they have precedence.\nIf the fasttrack arg is used with interactive, country or geoip\nthe fasttrack arg will have precendence and the other is ignored.\nAlso, if the branch arg is used with set-branch the set-branch arg has precedence. \nSome arguments requires other argument to have effect for example, pacman-mirrors -b unstable --default the --default argument has no effect,\nit should have been in conjunction with --interactive. The same goes for the API specific arguments. \nFor those to have effect the --api argument must be present also. pacman-mirrors --api -Sunstable The arguments can appear in any order except for arguments which takes \nadditional options in which case the options must follow \nimmediately after the argument, for example pacman-mirrors -ayidS unstable", "title": "OPTIONS" }, + { + "location": "/#methods", + "text": "-g, --generate\n: Generate a new default mirrorlist using defaults -f, --fasttrack NUMBER\n: Generates a mirrorlist with a number mirrors ranked by responsiveness,\n the mirrors are selected from http://repo.manjaro.org/status.json -i, --interactive [--default]\n: Launches a tool for selectively picking mirrors and protocols,\n --default forces pacman-mirrors to load the default mirror\n file and ignore any preset custom-mirrors file, thus allowing for \n reselecting mirrors for a new custom mirror file -m, --method METHOD \n: Default method is rank but random can be selected", + "title": "METHODS" + }, + { + "location": "/#branch", + "text": "-b, --branch BRANCH \n: Temporarily use another branch, use stable , testing or unstable , \n the branch is reset with next run of pacman-mirrors", + "title": "BRANCH" + }, + { + "location": "/#country", + "text": "-c, --country COUNTRY [ COUNTRY ] ...\n: Specifiy a country or a list of countries --geoip\n: Use geolocation if possible, if not uses all mirrors -l, --list, --country-list\n: Lists available mirror countries", + "title": "COUNTRY" + }, { "location": "/#api", - "text": "-a, --api\n: Instructs pacman-mirrors to activate these optional arguments -a -p, --prefix PREFIX \n: Add a path prefix to pacman-mirrors file-handling \n eg. /mnt/install or $mnt -a -G, --get-branch\n: Returns branch from configuration optionally with a prefix. -a -S, --set-branch BRANCH \n: Writes the branch to configuration optionally with a prefix, \n use stable , testing or unstable -a -P, --proto, --protocols PROTO [ PROTO ...]\n: Write the protocols to configuration optionally with a prefix, \n use all or http , https , ftp and ftps .", + "text": "-a, --api [-p PREFIX ] [-G|-S BRANCH ] [-P PROTO [ PROTO ] ...]\n: Instructs pacman-mirrors to activate processing of API arguments -p, --prefix PREFIX \n: Add a path prefix to pacman-mirrors file-handling\n eg. /mnt/install or $mnt -G, --get-branch\n: Returns branch from configuration optionally with a prefix. -S, --set-branch BRANCH \n: Writes the branch to configuration optionally with a prefix,\n use stable , testing or unstable -P, --proto, --protocols PROTO [ ... ]\n: Write the protocols to configuration optionally with a prefix,\n use all or http , https , ftp and ftps .", "title": "API" }, { - "location": "/#generic", - "text": "-h, --help\n: Show the help message -v, --version\n: Show the version of pacman-mirrors", - "title": "GENERIC" + "location": "/#misc", + "text": "-h, --help\n: Show the help message -n, --no-mirrorlist\n: Skip mirrorlist generation -q, --quiet\n: Make pacman-mirrors silent -t, --timeout SECONDS \n: Change the number of seconds waiting for a server response, \n SSL enabled mirrors has this value doubled to compensate, \n for the time spent on exchanging encryption keys -v, --version\n: Show the version of pacman-mirrors -y, --sync\n: Instruct pacman-mirrors to syncronize the pacman database", + "title": "MISC" }, { "location": "/#exit-status", - "text": "0 if OK \n1 if problem with argument \nBRANCH from config", + "text": "0: OK \n1: Problem with argument\n2: Problem accessing systemfiles\n3: Missing mirror file\nBRANCH from config", "title": "Exit status:" }, { "location": "/#examples", - "text": "Most optional arguments are self explaining others require explanation. \nThe API functions is mainly designed to help packagers and iso-builders. \nHowever it can be of use for everyone because it takes the hazzle out \nof editing your pacman-mirrors configuration. Which countries has mirrors? sudo pacman-mirrors -l I want to temporary change branch to unstable, \nuse geolocation and syncronize pacman, sudo pacman-mirrors -yb unstable --geoip I want to permanently change branch to unstable, \nuse mirrors from Germany and France, \nuse only https and http protocol in that order and syncronize pacman sudo pacman-mirrors -yac Germany,France -S unstable -P https http Create a mirrorlist with German mirrors and syncronize pacman sudo pacman-mirrors -yc Germany If you want more countries in your mirrorlist add them sudo pacman-mirrors -yc Germany France Denmark Create a mirrorlist with 5 mirrors with current packages and syncronize pacman sudo pacman-mirrors -yf 5 I want to choose my mirrors sudo pacman-mirrors -i I have a custom mirror list and I want to create a new custom mirror list? sudo pacman-mirrors -i --default I have a custom mirror list - can I reset it? sudo pacman-mirrors -c all What branch am I on sudo pacman-mirrors -a -G* Change system branch and dont change the mirrorlist sudo pacman-mirrors -naS unstable Change protocols you will accept but dont touch the mirrorlist sudo pacman-mirrors -naP https http A packager can write the directly to a mounted systems \ndatafiles using either a path or an environment variable sudo pacman-mirrors -ap $mnt -S unstable -P https", + "text": "Most optional arguments are self explaining others require explanation. \nThe API functions is mainly designed to help packagers and iso-builders. \nHowever it can be of use for everyone because it takes the hazzle out \nof editing your pacman-mirrors configuration. Which countries has mirrors? sudo pacman-mirrors -l I want to temporary change branch to unstable, \nuse geolocation and syncronize pacman, sudo pacman-mirrors -yb unstable --geoip I want to permanently change branch to unstable, \nuse mirrors from Germany and France, \nuse only https and http protocol in that order and syncronize pacman sudo pacman-mirrors -yac Germany,France -S unstable -P https http Create a mirrorlist with German mirrors and syncronize pacman sudo pacman-mirrors -yc Germany If you want more countries in your mirrorlist add them sudo pacman-mirrors -yc Germany France Denmark Create a mirrorlist with 5 mirrors with current packages and syncronize pacman sudo pacman-mirrors -yf 5 I want to choose my mirrors sudo pacman-mirrors -i I have a custom mirror list and I want to create a new custom mirror list? sudo pacman-mirrors -i --default I have a custom mirror list - can I reset it? sudo pacman-mirrors -c all What branch am I on sudo pacman-mirrors -a -G Change system branch and dont change the mirrorlist sudo pacman-mirrors -naS unstable Change protocols you will accept but dont touch the mirrorlist sudo pacman-mirrors -naP https http A packager can write the directly to a mounted systems \ndatafiles using either a path or an environment variable sudo pacman-mirrors -ap $mnt -S unstable -P https", "title": "EXAMPLES" }, { diff --git a/site/sitemap.xml b/site/sitemap.xml index 2bbb58a6403080de32f20a1ea3c973becddca12f..fdb218e572c8300ba34ea231b2053afe4e2d1063 100644 --- a/site/sitemap.xml +++ b/site/sitemap.xml @@ -4,7 +4,7 @@ <url> <loc>/</loc> - <lastmod>2017-05-18</lastmod> + <lastmod>2017-05-19</lastmod> <changefreq>daily</changefreq> </url> @@ -12,7 +12,7 @@ <url> <loc>/installation/</loc> - <lastmod>2017-05-18</lastmod> + <lastmod>2017-05-19</lastmod> <changefreq>daily</changefreq> </url> @@ -20,7 +20,7 @@ <url> <loc>/usage/</loc> - <lastmod>2017-05-18</lastmod> + <lastmod>2017-05-19</lastmod> <changefreq>daily</changefreq> </url> diff --git a/tests/test_command_line_parse.py b/tests/test_command_line_parse.py index 1c2bbc4f2455642a1fbf05516f7ea3345bdbceb3..0b68195d9af39772292a4a21036e9160bf33b330 100644 --- a/tests/test_command_line_parse.py +++ b/tests/test_command_line_parse.py @@ -86,36 +86,6 @@ class TestCommandLineParse(unittest.TestCase): app.command_line_parse() assert app.config["method"] == "random" - @patch("os.getuid") - @patch.object(configfn, "build_config") - def test_arg_mirrordir(self, mock_build_config, mock_os_getuid): - """TEST: CLI config[mirror_dir] from ARG '-d /another/dir'""" - mock_os_getuid.return_value = 0 - mock_build_config.return_value = test_conf - with unittest.mock.patch("sys.argv", - ["pacman-mirrors", - "-d", "/another/dir/"]): - app = PacmanMirrors() - app.config["config_file"] = conf.CONFIG_FILE - app.config = configfn.build_config() - app.command_line_parse() - assert app.config["work_dir"] == "/another/dir/" - - @patch("os.getuid") - @patch.object(configfn, "build_config") - def test_arg_mirrorlist(self, mock_build_config, mock_os_getuid): - """TEST: CLI config[mirror_list] from ARG '-o /another/list'""" - mock_os_getuid.return_value = 0 - mock_build_config.return_value = test_conf - with unittest.mock.patch("sys.argv", - ["pacman-mirrors", - "-o", "/another/list"]): - app = PacmanMirrors() - app.config["config_file"] = conf.CONFIG_FILE - app.config = configfn.build_config() - app.command_line_parse() - assert app.config["mirror_list"] == "/another/list" - @patch("os.getuid") @patch.object(configfn, "build_config") def test_arg_onlycountry(self, mock_build_config, mock_os_getuid): diff --git a/tests/test_inital_values.py b/tests/test_inital_values.py index 553620042a6a959db8dde673bbc8d350d0ec6c80..753a5ee656fda730feeeeb53d64f105f7532d4ec 100644 --- a/tests/test_inital_values.py +++ b/tests/test_inital_values.py @@ -109,6 +109,26 @@ class TestInitialValues(unittest.TestCase): app = PacmanMirrors() assert app.selected_countries == [] + @patch("os.getuid") + def test_initial_selected_countries(self, mock_os_getuid): + """TEST: self.no_mirrorlist = False""" + mock_os_getuid.return_value = 0 + with unittest.mock.patch("sys.argv", + ["pacman-mirrors", + "-g"]): + app = PacmanMirrors() + assert app.no_mirrorlist is False + + @patch("os.getuid") + def test_initial_selected_countries(self, mock_os_getuid): + """TEST: self.sync = False""" + mock_os_getuid.return_value = 0 + with unittest.mock.patch("sys.argv", + ["pacman-mirrors", + "-g"]): + app = PacmanMirrors() + assert app.sync is False + def tearDown(self): """Tear down""" pass