diff --git a/doc/man/ade-sysroot.1 b/doc/man/ade-sysroot.1 index 14145151b21f18ffff6be38e62d6b5f6b824d487..eff5cc146c4173d9da6eb9b478c06e3ce3de43b7 100644 --- a/doc/man/ade-sysroot.1 +++ b/doc/man/ade-sysroot.1 @@ -12,7 +12,7 @@ ade-sysroot \- Manage set of installed Apertis sysroots .SH SYNOPSIS .sp .nf -\fIade sysroot\fR [--path=<path>] +\fIade sysroot\fR [--config=<config>] [--path=<path>] \fIade sysroot list\fR \fIade sysroot latest\fR \fIade sysroot latest\fR --distro=<distro> --release=<release> [--arch=<arch>] @@ -55,10 +55,31 @@ get the sysroot information from that file\&. .SH OPTIONS .sp .PP -\fI--path\fR +\fI\-\-config\fR .RS 4 -Specify the installation path for sysroots\&. By default, the path is retrieved -from the sysroot configuration file or, if not existing, is /opt/sysroot\&. +Specify the sysroot configuration file to use\&. By default, the XDG Base +Directory specification is respected and \fBsysroot.conf\fR is searched for +inside the XDG configuration directories\&. The \fBgeneral\fR section contains +values applied for all sysroots, distribution-specific sections can override +these values\&. +.sp +Possible keys are: +.sp +.RS 4 +\fIpath\fR Sysroots installation path\&. +.sp +\fIurl\fR Remote URL to retrieve sysroot version file\&. +.RE +.sp +The following variables can be used in the file: \fB%(distro)\fR, +\fB%(release)\fR and \fB%(arch)\fR\&. +.sp +.RE +.PP +\fI\-\-path\fR +.RS 4 +Specify the installation path for sysroots\&. By default, the path is +/opt/sysroot\&. .sp .SH COMMANDS .sp diff --git a/tools/ade b/tools/ade index b04936bf6393eb3415b119013b7b07064d1903cf..a5b467cf746b0a87bf7a92f10a8f36c30390671c 100755 --- a/tools/ade +++ b/tools/ade @@ -343,9 +343,9 @@ class Ade: def validate_install_path(self): if not self.path: try: - config = configparser.ConfigParser() - config.read('/etc/sysroot.conf') - self.path = config['general']['path'] + parser = configparser.ConfigParser() + parser.read(self.config) + self.path = parser['general']['path'] except: self.path = '/opt/sysroot/' @@ -354,23 +354,23 @@ class Ade: # XXX Allow project-specific config file to specify these info if not self.distro: - print("* No distribution specified, defaulting to host distribution") + self.info("* No distribution specified, defaulting to host distribution") self.distro, release = self.get_host_distro() if not self.release: - print("* No release version specified, defaulting to host release version") + self.info("* No release version specified, defaulting to host release version") distro, self.release = self.get_host_distro() if distro != self.distro: self.die("Mismatch between host distro and specified distro") if not self.arch: - print("* No architecture specified, defaulting to 'armhf'") + self.info("* No architecture specified, defaulting to 'armhf'") self.arch = 'armhf' def parse_version_file(self, content): try: mod_content = "[sysroot]\n" + content - config = configparser.ConfigParser() - config.read_string(mod_content) - return SysrootVersion(config['sysroot']['version'], config['sysroot']['url']) + parser = configparser.ConfigParser() + parser.read_string(mod_content) + return SysrootVersion(parser['sysroot']['version'], parser['sysroot']['url']) except configparser.ParsingError: self.die("Invalid syntax for sysroot version file") except KeyError as e: @@ -666,6 +666,7 @@ if __name__ == '__main__': # Sysroot parser sysroot_parser = subparsers.add_parser('sysroot', help='Sysroot related commands') + sysroot_parser.add_argument('--config', help="Sysroot configuration file") sysroot_parser.add_argument('--path', help="Sysroot installation directory") sysroot_subparsers = sysroot_parser.add_subparsers(dest='subcommand') sysroot_subparsers.required = True