From cecc59430af517f7d00edca30743616fe4b93380 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 12 Nov 2015 06:01:20 +0200 Subject: [PATCH] Added directory prefix option --- README.rst | 2 +- man/slpkg.8 | 3 +++ slpkg/arguments.py | 3 ++- slpkg/binary/install.py | 5 +++++ slpkg/main.py | 4 ++++ slpkg/sbo/slackbuild.py | 5 +++++ 6 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index c6de1efb..3ead023e 100644 --- a/README.rst +++ b/README.rst @@ -443,7 +443,7 @@ Command Line Tool Usage --checklist dependencies. -s, --sync, [repository] [package...], Sync packages. Install packages --resolve-off, --download-only, directly from remote repositories - --case-ins with all dependencies. + --directory-prefix=[dir], --case-ins with all dependencies. -t, --tracking, [repository] [package], Tracking package dependencies and --check-deps, --graph=[type], print package dependencies tree with --case-ins highlight if packages is installed. diff --git a/man/slpkg.8 b/man/slpkg.8 index af19767d..98c5eefc 100644 --- a/man/slpkg.8 +++ b/man/slpkg.8 @@ -41,6 +41,7 @@ Usage: slpkg Commands: [-s [repository] [package...], --resolve-off, --download-only, --case-ins] [-t [repository] [package], --check-deps, --graph=[type], + --directory-prefix=[dir], --case-ins] [-p [repository] [package], --color=[]] [-n [SBo package], --checklist, --case-ins] @@ -222,6 +223,8 @@ Additional options: .PP \fB--download-only\fP : Download packages without install. .PP +\fB--directory-prefix=[path/to/dir/]\fP : Download packages in specific directory. +.PP \fB--case-ins\fP : Search package name in repository with case insensitive. .SS -t, --tracking, tracking dependencies diff --git a/slpkg/arguments.py b/slpkg/arguments.py index 97006ade..84a220a2 100644 --- a/slpkg/arguments.py +++ b/slpkg/arguments.py @@ -93,7 +93,7 @@ Optional arguments: --checklist dependencies. -s, --sync, [repository] [package...], Sync packages. Install packages --resolve-off, --download-only, directly from remote repositories - --case-ins with all dependencies. + --directory-prefix=[dir], --case-ins with all dependencies. -t, --tracking, [repository] [package], Tracking package dependencies and --check-deps, --graph=[type], print package dependencies tree with --case-ins highlight if packages is installed. @@ -160,6 +160,7 @@ def usage(repo): [-c [repository], --upgrade, --skip=[...], --resolve-off, --checklist] [-s [repository] [package...], --resolve-off, --download-only, + --directory-prefix=[dir], --case-ins] [-t [repository] [package], --check-deps, --graph=[type], --case-ins] diff --git a/slpkg/binary/install.py b/slpkg/binary/install.py index c132a745..86b4ff86 100644 --- a/slpkg/binary/install.py +++ b/slpkg/binary/install.py @@ -58,6 +58,11 @@ class BinaryInstall(object): self.msg = Msg() self.version = self.meta.slack_rel self.tmp_path = self.meta.slpkg_tmp_packages + for fl in self.flag: + if fl.startswith("--directory-prefix="): + self.tmp_path = fl.split("=")[1] + if not self.tmp_path.endswith("/"): + self.tmp_path += "/" self.dwn, self.dep_dwn = [], [] self.install, self.dep_install = [], [] self.comp_sum, self.dep_comp_sum = [], [] diff --git a/slpkg/main.py b/slpkg/main.py index 275f0b8f..4189f19f 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -327,9 +327,13 @@ class ArgParse(object): additional_options = [ "--resolve-off", "--download-only", + "--directory-prefix=", "--case-ins" ] for arg in self.args: + if arg.startswith(additional_options[2]): + flag.append(arg) + arg = "" if arg in additional_options: flag.append(arg) if len(self.args) >= 3 and self.args[0] in options: diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py index 49e81c06..2574674a 100644 --- a/slpkg/sbo/slackbuild.py +++ b/slpkg/sbo/slackbuild.py @@ -56,6 +56,11 @@ class SBoInstall(object): self.msg = Msg() self.arch = SBoArch().get() self.build_folder = self.meta.build_path + for fl in self.flag: + if fl.startswith("--directory-prefix="): + self.build_folder = fl.split("=")[1] + if not self.build_folder.endswith("/"): + self.build_folder += "/" self.unst = ["UNSUPPORTED", "UNTESTED"] self.master_packages = [] self.deps = []