mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-11-17 07:48:18 +01:00
fix slack init
This commit is contained in:
parent
8f1b9cf359
commit
78d00f845e
9 changed files with 153 additions and 60 deletions
|
@ -1,6 +1,4 @@
|
|||
#
|
||||
# slpkg.conf - Configuration for slpkg
|
||||
#
|
||||
# Configuration file for slpkg
|
||||
|
||||
# slpkg.conf file is part of slpkg.
|
||||
|
||||
|
@ -22,16 +20,29 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Slackware version 'stable' or 'current'
|
||||
# Slackware version 'stable' or 'current'.
|
||||
VERSION=stable
|
||||
|
||||
# Build directory for repository slackbuilds.org. In this directory downloaded sources
|
||||
# and scripts for building.
|
||||
# Build directory for repository slackbuilds.org. In this directory
|
||||
# downloaded sources and scripts for building.
|
||||
BUILD=/tmp/slpkg/build/
|
||||
|
||||
# Download directory for others repositories that use binaries files for installation.
|
||||
# If SBO_CHECK_MD5 is 'on' the system will check all downloaded
|
||||
# sources from SBo repository.
|
||||
SBO_CHECK_MD5=on
|
||||
|
||||
# Download directory for others repositories that use binaries files
|
||||
# for installation.
|
||||
PACKAGES=/tmp/slpkg/packages/
|
||||
|
||||
# Download directory for Slackware patches file.
|
||||
PATCHES=/tmp/slpkg/patches/
|
||||
|
||||
# Delete all downloaded files if DEL_ALL is 'on'.
|
||||
DEL_ALL=on
|
||||
|
||||
# Delete build directory after each process if DEL_BUILD is 'on'.
|
||||
DEL_BUILD=off
|
||||
|
||||
# Keep build log file if SBO_BUILD_LOG is 'on'.
|
||||
SBO_BUILD_LOG=on
|
||||
|
|
76
man/slpkg.8
76
man/slpkg.8
|
@ -15,14 +15,17 @@
|
|||
.SH NAME
|
||||
slpkg - Utility for easy management packages in Slackware
|
||||
.SH SYNOPSIS
|
||||
\fBUsage: slpkg [-h] [-v] [-a script [sources...]]
|
||||
\fBUsage: slpkg [-h] [-v] [-a script.tar.gz [sources...]]
|
||||
[-b --list, --add, --remove [...]]
|
||||
[-q --list, [...] --add, --remove]
|
||||
[-q --build, --install, --build-install]
|
||||
[-l all, sbo, slack, noarch]
|
||||
[-c <repository> --upgrade --current]
|
||||
[-s <repository> <package> --current]
|
||||
[-f] [-t] [-n] [-i [...]] [-u [...]]
|
||||
[ --build, --install, --build-install]
|
||||
[-l <repository>, all, noarch]
|
||||
[-c <repository> --upgrade]
|
||||
[-s <repository> <package>]
|
||||
[-t <repository> <package>]
|
||||
[-p <repository> <package> --color=]
|
||||
[ red, green, yellow, cyan, grey]
|
||||
[-f] [-n] [-i [...]] [-u [...]]
|
||||
[-o [...]] [-r [...]] [-d [...]]\fp
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
@ -35,15 +38,17 @@ It's a quick and easy way to manage your packages in slackware to a command.
|
|||
Optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-v, --version print version and exit
|
||||
-a, script [source...] auto build packages
|
||||
-a, script.tar.gz [source...] auto build SBo packages
|
||||
-b, --list, [package...] --add, --remove add, remove packages in blacklist
|
||||
-q, --list, [package...] --add, --remove add, remove packages in queue
|
||||
--build, --install, --build-install build or install from queue
|
||||
-l, <repository>, all, noarch list of installed packages
|
||||
-c, <repository> --upgrade --current check for updated packages
|
||||
-s, <repository> <package> --current download, build & install
|
||||
-c, <repository> --upgrade check for updated packages
|
||||
-s, <repository> <package> download, build & install
|
||||
-t, <repository> <package> tracking dependencies
|
||||
-p, <repository> <package> --color= view package description
|
||||
red, green, yellow, cyan, grey colors support
|
||||
-f, <package> find installed packages
|
||||
-t, <package> tracking dependencies from SBo
|
||||
-n, <package> view packages from SBo
|
||||
-i, [package...] install binary packages
|
||||
-u, [package...] upgrade binary packages
|
||||
|
@ -54,8 +59,8 @@ Optional arguments:
|
|||
Note: '-q' options is working only for SBo repository
|
||||
|
||||
Repositories:
|
||||
Slackware = slack '--current'
|
||||
Alien = alien '--current'
|
||||
Slackware = slack
|
||||
Alien = alien
|
||||
SlackBuilds = sbo
|
||||
Slacky = slacky
|
||||
Robby's = rlw\fP
|
||||
|
@ -91,25 +96,28 @@ Build or install or build and install packages are queued.
|
|||
Four display options list, sbo, slack, noarch and all packages
|
||||
items that are installed on the system.
|
||||
.SS -c , <repository> check if your packages is up to date
|
||||
\fBslpkg\fP \fB-c\fP <\fIrepository\fP> \fI--upgrade\fP \fB--current\fP
|
||||
\fBslpkg\fP \fB-c\fP <\fIrepository\fP> \fI--upgrade\f
|
||||
.PP
|
||||
Check your packages from Slackware official mirrors or from
|
||||
slackbuilds.org is up to date. Use '--current' to switch in current repository.
|
||||
Check your packages is up to date.
|
||||
.SS -s , <repository> download, build and install package with all dependencies
|
||||
\fBslpkg\fP \fB-s\fP <\fIrepository\fP> <\fIname of package\fP> \fB--current\fP
|
||||
\fBslpkg\fP \fB-s\fP <\fIrepository\fP> <\fIname of package\fP>
|
||||
.PP
|
||||
Installs or upgrade packages from the repository slackbuilds.org automatically resolving all
|
||||
Installs or upgrade packages from the repositories with automatically resolving all
|
||||
dependencies of the package. Also installs the official distribution Slackware
|
||||
packages. Use '--current' to install packages from Slackware current repository.
|
||||
packages.
|
||||
.SS -t , tracking dependencies
|
||||
\fBslpkg\fP \fB-t\fP <\fIrepository\fP> <\fIname of package\fP>
|
||||
.PP
|
||||
Tracking all dependencies of that package.
|
||||
The sequence shown is that you must follow to correctly install package.
|
||||
.SS -p , print packages description
|
||||
\fBslpkg\fP \fB-p\fP <\fIrepository\fP> <\fIname of package\fP>
|
||||
.PP
|
||||
Print package description
|
||||
.SS -f find packages
|
||||
\fBslpkg\fP \fB-f\fP <\fIname of package\fP>
|
||||
.PP
|
||||
Find installed packages with view total file size.
|
||||
.SS -t , tracking dependencies
|
||||
\fBslpkg\fP \fB-t\fP <\fIname of package\fP>
|
||||
.PP
|
||||
Tracking all dependencies of that package.
|
||||
The sequence shown is that you must follow to correctly install package.
|
||||
.SS -n , find packages from SBo repositority
|
||||
\fBslpkg\fP \fB-n\fP <\fIname of package\fP>
|
||||
.PP
|
||||
|
@ -155,6 +163,25 @@ command.
|
|||
.br
|
||||
For example:
|
||||
\fBslpkg \-\-help\fP - display help for slpkg
|
||||
|
||||
.SH FILES
|
||||
|
||||
/etc/slpkg/slpkg.conf
|
||||
General configuration of slpkg
|
||||
|
||||
/etc/slpkg/blacklist
|
||||
List of packages to skip
|
||||
|
||||
/var/log/slpkg
|
||||
ChangeLog.txt repositories files
|
||||
SlackBuilds logs and dependencies files
|
||||
|
||||
/var/lib/slpkg
|
||||
PACKAGES.TXT files and SLACKBUILDS.TXT file
|
||||
|
||||
/tmp/slpkg
|
||||
Slpkg temponary donwloaded files and build packages
|
||||
|
||||
.SH AUTHOR
|
||||
Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
||||
.SH HOMEPAGE
|
||||
|
@ -163,4 +190,5 @@ https://github.com/dslackw/slpkg
|
|||
Copyright \(co 2014 Dimitris Zlatanidis
|
||||
|
||||
.SH SEE ALSO
|
||||
installpkg(8), upgradepkg(8), removepkg(8), pkgtool(8), slackpkg(8)
|
||||
installpkg(8), upgradepkg(8), removepkg(8), pkgtool(8), slackpkg(8), explodepkg(8),
|
||||
makepkg(8).
|
||||
|
|
10
setup.py
10
setup.py
|
@ -81,13 +81,15 @@ if "install" in sys.argv:
|
|||
os.chmod(man_path, int("444", 8))
|
||||
|
||||
conf_path = "/etc/slpkg/"
|
||||
conf_file = "conf/slpkg.conf"
|
||||
black_file = "conf/blacklist"
|
||||
if not os.path.exists(conf_path):
|
||||
os.system("mkdir -p {0}".format(conf_path))
|
||||
# slpkg.conf file
|
||||
# slpkg.conf file
|
||||
if not os.isfile(conf_path + conf_file):
|
||||
print("Installing slpkg configuration file")
|
||||
conf_file = "conf/slpkg.conf"
|
||||
shutil.copy2(conf_file, conf_path)
|
||||
# blacklist file
|
||||
# blacklist file
|
||||
if not os.isfile(conf_path + black_file):
|
||||
print("Installing blacklist configuration file")
|
||||
black_file = "conf/blacklist"
|
||||
shutil.copy2(black_file, conf_path)
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
config() {
|
||||
NEW="$1"
|
||||
OLD="$(dirname $NEW)/$(basename $NEW .new)"
|
||||
if [ ! -r $OLD ]; then
|
||||
mv $NEW $OLD
|
||||
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
|
||||
rm $NEW
|
||||
fi
|
||||
}
|
||||
|
||||
config /etc/slpkg/slpkg.conf.new
|
||||
|
||||
if [ -x /usr/bin/update-desktop-database ]; then
|
||||
/usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
|
||||
fi
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
PRGNAM=slpkg
|
||||
VERSION=${VERSION:-2.0.4}
|
||||
VERSION=${VERSION:-2.0.5}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_dsw}
|
||||
|
||||
|
@ -69,7 +69,7 @@ find -L . \
|
|||
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
||||
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
||||
|
||||
# avoid install man page and blacklist over setup.py
|
||||
# avoid install man page and slpkg.conf, blacklist over setup.py
|
||||
sed -i 's/if "install"/if ""/' setup.py
|
||||
|
||||
python setup.py install --root=$PKG
|
||||
|
@ -77,12 +77,16 @@ python setup.py install --root=$PKG
|
|||
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
|
||||
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
||||
|
||||
mkdir -p $PKG/etc/slpkg
|
||||
# check if blacklist file if already exist in /etc/slpkg
|
||||
if [ ! -f "/etc/$PRGNAM/blacklist" ]; then
|
||||
mkdir -p $PKG/etc/$PRGNAM
|
||||
install -D -m0644 conf/blacklist $PKG/etc/$PRGNAM/blacklist
|
||||
fi
|
||||
|
||||
# install configuration file
|
||||
mv $PKG/etc/slpkg/slpkg.conf $PKG/etc/slpkg/slpkg.conf.new
|
||||
|
||||
# install man page
|
||||
mkdir -p $PKG/usr/man/man8
|
||||
gzip -9 man/$PRGNAM.8
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
PRGNAM="slpkg"
|
||||
VERSION="2.0.4"
|
||||
VERSION="2.0.5"
|
||||
HOMEPAGE="https://github.com/dslackw/slpkg"
|
||||
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v2.0.4.tar.gz"
|
||||
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v2.0.5.tar.gz"
|
||||
MD5SUM=""
|
||||
DOWNLOAD_x86_64=""
|
||||
MD5SUM_x86_64=""
|
||||
|
|
|
@ -63,22 +63,29 @@ slpkg_conf = [
|
|||
"# Slackware version 'stable' or 'current'.\n",
|
||||
"VERSION=stable\n",
|
||||
"\n",
|
||||
"# Build directory for repository slackbuilds.org. In this directory\n"
|
||||
"# Build directory for repository slackbuilds.org. In this directory\n",
|
||||
"# downloaded sources and scripts for building.\n",
|
||||
"BUILD=/tmp/slpkg/build/\n",
|
||||
"\n",
|
||||
"# Download directory for others repositories that use binaries files\n"
|
||||
"# If SBO_CHECK_MD5 is 'on' the system will check all downloaded\n",
|
||||
"# sources from SBo repository.\n",
|
||||
"SBO_CHECK_MD5=on\n",
|
||||
"\n",
|
||||
"# Download directory for others repositories that use binaries files\n",
|
||||
"# for installation.\n",
|
||||
"PACKAGES=/tmp/slpkg/packages/\n",
|
||||
"\n",
|
||||
"# Download directory for Slackware patches file.\n",
|
||||
"PATCHES=/tmp/slpkg/patches/\n"
|
||||
"PATCHES=/tmp/slpkg/patches/\n",
|
||||
"\n",
|
||||
"# Delete all downloaded files if DEL_ALL is 'on'.\n",
|
||||
"DEL_ALL=on\n"
|
||||
"DEL_ALL=on\n",
|
||||
"\n",
|
||||
"# Delete build directory after each process if DEL_BUILD is 'on'.\n",
|
||||
"DEL_BUILD=off\n"
|
||||
"DEL_BUILD=off\n",
|
||||
"\n",
|
||||
"# Keep build log file if SBO_BUILD_LOG is 'on'.\n",
|
||||
"SBO_BUILD_LOG=on\n"
|
||||
]
|
||||
|
||||
if not os.path.isfile("/etc/slpkg/slpkg.conf"):
|
||||
|
@ -91,6 +98,16 @@ f = open("/etc/slpkg/slpkg.conf", "r")
|
|||
conf = f.read()
|
||||
f.close()
|
||||
|
||||
# Default configuration values
|
||||
slack_rel = "stable"
|
||||
build_path = "/tmp/slpkg/build/"
|
||||
slpkg_tmp_packages = tmp + "slpkg/packages/"
|
||||
slpkg_tmp_patches = tmp + "slpkg/patches/"
|
||||
del_all = "on"
|
||||
sbo_check_md5 = "on"
|
||||
del_build = "off"
|
||||
sbo_build_log = "on"
|
||||
|
||||
for line in conf.splitlines():
|
||||
line = line.lstrip()
|
||||
if line.startswith("VERSION"):
|
||||
|
@ -105,6 +122,10 @@ for line in conf.splitlines():
|
|||
del_all = line[8:].strip()
|
||||
if line.startswith("DEL_BUILD"):
|
||||
del_build = line[10:].strip()
|
||||
if line.startswith("SBO_CHECK_MD5"):
|
||||
sbo_check_md5 = line[14:].strip()
|
||||
if line.startswith("SBO_BUILD_LOG"):
|
||||
sbo_build_log = line[14:].strip()
|
||||
|
||||
if not slack_rel or slack_rel not in ['stable', 'current']:
|
||||
slack_rel = "stable"
|
||||
|
@ -130,6 +151,12 @@ if not del_all or del_all not in ['on', 'off']:
|
|||
if not del_build or del_build not in ['on', 'off']:
|
||||
del_build = "off"
|
||||
|
||||
if not sbo_check_md5 or sbo_check_md5 not in ['on', 'off']:
|
||||
sbo_check_md5 = "on"
|
||||
|
||||
if not sbo_build_log or sbo_build_log not in ['on', 'off']:
|
||||
sbo_build_log = "on"
|
||||
|
||||
# repositories
|
||||
repositories = [
|
||||
"sbo",
|
||||
|
|
|
@ -43,6 +43,8 @@ class Initialization(object):
|
|||
os.mkdir(log_path)
|
||||
if not os.path.exists(lib_path):
|
||||
os.mkdir(lib_path)
|
||||
if not os.path.exists("/tmp/slpkg/"):
|
||||
os.mkdir("/tmp/slpkg/")
|
||||
if not os.path.exists(build_path):
|
||||
os.mkdir(build_path)
|
||||
if not os.path.exists(slpkg_tmp_packages):
|
||||
|
@ -70,7 +72,7 @@ class Initialization(object):
|
|||
changelog_txt = mirrors(log_file, "", version)
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
self.remote(log, log_file, changelog_txt, lib, lib_file, packages)
|
||||
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt)
|
||||
|
||||
def sbo(self):
|
||||
'''
|
||||
|
@ -181,6 +183,7 @@ class Initialization(object):
|
|||
If the two files differ in size delete and replaced with new.
|
||||
We take the size of ChangeLog.txt from the server and locally
|
||||
'''
|
||||
PACKAGES_TXT = ""
|
||||
server = FileSize(args[2]).server()
|
||||
local = FileSize(args[0] + args[1]).local()
|
||||
if server != local:
|
||||
|
@ -190,7 +193,8 @@ class Initialization(object):
|
|||
print("slpkg ...initialization")
|
||||
sys.stdout.write("Files re-created ...")
|
||||
sys.stdout.flush()
|
||||
PACKAGES_TXT = URL(args[5]).reading()
|
||||
for fu in args[5].split():
|
||||
PACKAGES_TXT += URL(fu).reading()
|
||||
CHANGELOG_TXT = URL(args[2]).reading()
|
||||
with open("{0}{1}".format(args[3], args[4]), "w") as f:
|
||||
f.write(PACKAGES_TXT)
|
||||
|
|
|
@ -30,9 +30,9 @@ import tarfile
|
|||
import subprocess
|
||||
|
||||
from checksum import md5sum
|
||||
from __metadata__ import log_path
|
||||
from colors import RED, GREEN, ENDC
|
||||
from messages import pkg_not_found, template
|
||||
from __metadata__ import log_path, sbo_check_md5, sbo_build_log
|
||||
|
||||
from sbo.greps import SBoGrep
|
||||
|
||||
|
@ -55,8 +55,6 @@ class BuildPackage(object):
|
|||
os.mkdir(self.sbo_logs)
|
||||
if not os.path.exists(self.build_logs):
|
||||
os.mkdir(self.build_logs)
|
||||
if os.path.isfile(self.build_logs + self.log_file):
|
||||
os.remove(self.build_logs + self.log_file)
|
||||
|
||||
def build(self):
|
||||
'''
|
||||
|
@ -72,23 +70,30 @@ class BuildPackage(object):
|
|||
for src, sbo_md5 in zip(self.sources, sbo_md5_list):
|
||||
# fix build sources with spaces
|
||||
src = src.replace("%20", " ")
|
||||
check_md5(sbo_md5, src)
|
||||
if sbo_check_md5 == "on":
|
||||
check_md5(sbo_md5, src)
|
||||
shutil.copy2(src, self.prgnam)
|
||||
os.chdir(self.path + self.prgnam)
|
||||
# change permissions
|
||||
subprocess.call("chmod +x {0}.SlackBuild".format(self.prgnam),
|
||||
shell=True)
|
||||
# start log write
|
||||
log_head(self.build_logs, self.log_file, self.start_log_time)
|
||||
subprocess.Popen("./{0}.SlackBuild 2>&1 | tee -a {1}{2}".format(
|
||||
self.prgnam, self.build_logs, self.log_file), shell=True,
|
||||
stdout=sys.stdout).communicate()
|
||||
sum_time = build_time(self.start_time)
|
||||
# write end in log file
|
||||
log_end(self.build_logs, self.log_file, sum_time)
|
||||
if sbo_build_log == "on":
|
||||
if os.path.isfile(self.build_logs + self.log_file):
|
||||
os.remove(self.build_logs + self.log_file)
|
||||
# start log write
|
||||
log_head(self.build_logs, self.log_file, self.start_log_time)
|
||||
subprocess.Popen("./{0}.SlackBuild 2>&1 | tee -a {1}{2}".format(
|
||||
self.prgnam, self.build_logs, self.log_file), shell=True,
|
||||
stdout=sys.stdout).communicate()
|
||||
sum_time = build_time(self.start_time)
|
||||
# write end in log file
|
||||
log_end(self.build_logs, self.log_file, sum_time)
|
||||
print("Total build time for package {0} : {1}\n".format(
|
||||
self.prgnam, sum_time))
|
||||
else:
|
||||
subprocess.call("./{0}.SlackBuild".format(self.prgnam,
|
||||
shell=True))
|
||||
os.chdir(self.path)
|
||||
print("Total build time for package {0} : {1}\n".format(self.prgnam,
|
||||
sum_time))
|
||||
except (OSError, IOError):
|
||||
pkg_not_found("\n", self.prgnam, "Wrong file", "\n")
|
||||
except KeyboardInterrupt:
|
||||
|
|
Loading…
Reference in a new issue