mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-30 20:34:38 +01:00
Added command clean
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
f023925dd1
commit
8ab15075a4
5 changed files with 71 additions and 1 deletions
|
@ -5,6 +5,8 @@ Updated:
|
||||||
- Merge sbo/remove.py in the slpkg/remove.py file
|
- Merge sbo/remove.py in the slpkg/remove.py file
|
||||||
Fixed:
|
Fixed:
|
||||||
- Bugfix: update slpkg itself from gitlab repository
|
- Bugfix: update slpkg itself from gitlab repository
|
||||||
|
Added:
|
||||||
|
- Command clean to remove the packages and the sources from /tmp/slpkg/ directory
|
||||||
|
|
||||||
3.3.9 - 14/01/2019
|
3.3.9 - 14/01/2019
|
||||||
Updated:
|
Updated:
|
||||||
|
|
|
@ -29,6 +29,7 @@ Usage: slpkg [COMMANDS|OPTIONS] {repository|package...}
|
||||||
[health, --silent]
|
[health, --silent]
|
||||||
[deps-status, --tree, --graph=[type]]
|
[deps-status, --tree, --graph=[type]]
|
||||||
[new-config]
|
[new-config]
|
||||||
|
[clean]
|
||||||
|
|
||||||
Optional arguments:
|
Optional arguments:
|
||||||
[-h] [-v]
|
[-h] [-v]
|
||||||
|
@ -152,6 +153,11 @@ Additional options:
|
||||||
This command searches for .new configuration files in /etc/ path and ask the user what todo with those
|
This command searches for .new configuration files in /etc/ path and ask the user what todo with those
|
||||||
files.
|
files.
|
||||||
|
|
||||||
|
.SS clean, the tmp/ directory
|
||||||
|
\fBslpkg\fP \fBclean\fP
|
||||||
|
.PP
|
||||||
|
Clean the /tmp/slpkg/ directory from downloaded packages and sources.
|
||||||
|
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.PP
|
.PP
|
||||||
The following arguments are available.
|
The following arguments are available.
|
||||||
|
|
|
@ -78,6 +78,8 @@ Commands:
|
||||||
|
|
||||||
new-config Manage .new configuration files.
|
new-config Manage .new configuration files.
|
||||||
|
|
||||||
|
clean Clean the tmp/ directory from
|
||||||
|
downloaded packages and sources.
|
||||||
Optional arguments:
|
Optional arguments:
|
||||||
-h | --help Print this help message and exit.
|
-h | --help Print this help message and exit.
|
||||||
|
|
||||||
|
@ -184,6 +186,7 @@ def usage(repo):
|
||||||
[health, --silent]
|
[health, --silent]
|
||||||
[deps-status, --tree, --graph=[type]]
|
[deps-status, --tree, --graph=[type]]
|
||||||
[new-config]
|
[new-config]
|
||||||
|
[clean]
|
||||||
|
|
||||||
Optional arguments:
|
Optional arguments:
|
||||||
[-h] [-v]
|
[-h] [-v]
|
||||||
|
|
49
slpkg/clean.py
Normal file
49
slpkg/clean.py
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# clean.py file is part of slpkg.
|
||||||
|
|
||||||
|
# Copyright 2014-2019 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
||||||
|
# All rights reserved.
|
||||||
|
|
||||||
|
# Slpkg is a user-friendly package manager for Slackware installations
|
||||||
|
|
||||||
|
# https://gitlab.com/dslackw/slpkg
|
||||||
|
|
||||||
|
# Slpkg is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
|
def clean_tmp():
|
||||||
|
"""Delete packages and sources from tmp/ directory
|
||||||
|
"""
|
||||||
|
tmps = [_meta_.tmp_path, # /tmp/slpkg/
|
||||||
|
_meta_.build_path, # /tmp/slpkg/build/
|
||||||
|
_meta_.slpkg_tmp_packages, # /tmp/slpkg/packages/
|
||||||
|
_meta_.slpkg_tmp_patches # /tmp/slpkg/patches/
|
||||||
|
]
|
||||||
|
# Delete a whole slpkg folder from the tmp directory
|
||||||
|
if os.path.exists(tmps[0]):
|
||||||
|
shutil.rmtree(tmps[0])
|
||||||
|
print("All packages and sources were deleted from: {0}".format(
|
||||||
|
tmps[0]))
|
||||||
|
# Recreate the paths again
|
||||||
|
if not os.path.exists(tmps[0]):
|
||||||
|
for tmp in tmps:
|
||||||
|
print("Create directory: {0}".format(tmp))
|
||||||
|
os.mkdir(tmp)
|
||||||
|
print("Done!")
|
|
@ -25,6 +25,7 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from slpkg.clean import clean_tmp
|
||||||
from slpkg.load import Regex
|
from slpkg.load import Regex
|
||||||
from slpkg.desc import PkgDesc
|
from slpkg.desc import PkgDesc
|
||||||
from slpkg.messages import Msg
|
from slpkg.messages import Msg
|
||||||
|
@ -82,7 +83,8 @@ class ArgParse(object):
|
||||||
"update-slpkg",
|
"update-slpkg",
|
||||||
"health",
|
"health",
|
||||||
"deps-status",
|
"deps-status",
|
||||||
"new-config"
|
"new-config",
|
||||||
|
"clean"
|
||||||
]
|
]
|
||||||
|
|
||||||
# checking if repositories exists
|
# checking if repositories exists
|
||||||
|
@ -239,6 +241,13 @@ class ArgParse(object):
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
|
||||||
|
def command_clean(self):
|
||||||
|
"""Clean all downloaded packages and sources"""
|
||||||
|
if len(self.args) == 1 and self.args[0] == "clean":
|
||||||
|
clean_tmp()
|
||||||
|
else:
|
||||||
|
usage("")
|
||||||
|
|
||||||
def auto_build(self):
|
def auto_build(self):
|
||||||
"""Auto built tool
|
"""Auto built tool
|
||||||
"""
|
"""
|
||||||
|
@ -806,6 +815,7 @@ def main():
|
||||||
"health": argparse.command_health,
|
"health": argparse.command_health,
|
||||||
"deps-status": argparse.command_deps_status,
|
"deps-status": argparse.command_deps_status,
|
||||||
"new-config": argparse.command_new_config,
|
"new-config": argparse.command_new_config,
|
||||||
|
"clean": argparse.command_clean,
|
||||||
"-a": argparse.auto_build,
|
"-a": argparse.auto_build,
|
||||||
"--autobuild": argparse.auto_build,
|
"--autobuild": argparse.auto_build,
|
||||||
"-l": argparse.pkg_list,
|
"-l": argparse.pkg_list,
|
||||||
|
|
Loading…
Add table
Reference in a new issue