Merge branch 'develop'

This commit is contained in:
Dimitris Zlatanidis 2019-05-19 18:26:08 +02:00
commit 86a218e067
7 changed files with 63 additions and 7 deletions

View file

@ -1,3 +1,10 @@
3.4.3 - 19/05/2019
Updated:
- Update gen_repos_files.sh to version 1.94
Fixed:
- Downloader to recognise the char +
- Build from sources with char + in name
3.4.2 - 23/01/2019 3.4.2 - 23/01/2019
Fixed: Fixed:
- Bugfixed delete build folder in network option - Bugfixed delete build folder in network option

View file

@ -1,4 +1,4 @@
# slpkg 3.4.2 # slpkg 3.4.3
Slpkg is a powerful software package manager that installs, updates, and removes packages on Slpkg is a powerful software package manager that installs, updates, and removes packages on
[Slackware](http://www.slackware.com/) based systems. It automatically computes dependencies and [Slackware](http://www.slackware.com/) based systems. It automatically computes dependencies and

View file

@ -78,7 +78,7 @@ class MetaData(object):
__all__ = "slpkg" __all__ = "slpkg"
__author__ = "dslackw" __author__ = "dslackw"
__version_info__ = (3, 4, 2) __version_info__ = (3, 4, 3)
__version__ = "{0}.{1}.{2}".format(*__version_info__) __version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)" __license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com" __email__ = "d.zlatanidis@gmail.com"

View file

@ -26,6 +26,7 @@ import os
import tarfile import tarfile
import subprocess import subprocess
from slpkg.utils import Utils
from slpkg.messages import Msg from slpkg.messages import Msg
from slpkg.slack.slack_version import slack_ver from slpkg.slack.slack_version import slack_ver
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
@ -53,8 +54,7 @@ class Download(object):
dwn_count = 1 dwn_count = 1
self._directory_prefix() self._directory_prefix()
for dwn in self.url: for dwn in self.url:
# get file name from url and fix passing char '+' self.file_name = Utils().fix_file_name(dwn.split("/")[-1])
self.file_name = dwn.split("/")[-1].replace("%2B", "+")
if dwn.startswith("file:///"): if dwn.startswith("file:///"):
source_dir = dwn[7:-7].replace(slack_ver(), "") source_dir = dwn[7:-7].replace(slack_ver(), "")

View file

@ -31,6 +31,7 @@ import tarfile
import subprocess import subprocess
import multiprocessing import multiprocessing
from slpkg.utils import Utils
from slpkg.messages import Msg from slpkg.messages import Msg
from slpkg.checksum import check_md5 from slpkg.checksum import check_md5
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
@ -44,6 +45,7 @@ class BuildPackage(object):
def __init__(self, script, sources, path, auto): def __init__(self, script, sources, path, auto):
self.script = script self.script = script
self.sources = sources self.sources = sources
self._check_sources()
self.path = path self.path = path
self.auto = auto self.auto = auto
self.meta = _meta_ self.meta = _meta_
@ -89,7 +91,7 @@ class BuildPackage(object):
src = src.replace("%20", " ") src = src.replace("%20", " ")
check_md5(self.sbo_md5[src], src) check_md5(self.sbo_md5[src], src)
# copy source and fix passing char '+' from file name # copy source and fix passing char '+' from file name
shutil.copy2(src.replace("%2B", "+"), self.path + self.prgnam) shutil.copy2(src, self.path + self.prgnam)
os.chdir(self.path + self.prgnam) os.chdir(self.path + self.prgnam)
# change permissions # change permissions
subprocess.call("chmod +x {0}.SlackBuild".format(self.prgnam), subprocess.call("chmod +x {0}.SlackBuild".format(self.prgnam),
@ -117,6 +119,14 @@ class BuildPackage(object):
except KeyboardInterrupt: # (OSError, IOError): except KeyboardInterrupt: # (OSError, IOError):
self.msg.pkg_not_found("\n", self.prgnam, "Wrong file", "\n") self.msg.pkg_not_found("\n", self.prgnam, "Wrong file", "\n")
def _check_sources(self):
"""Fix filenames with char +
"""
new_sources = []
for src in self.sources:
new_sources.append(Utils().fix_file_name(src))
self.sources = new_sources
def _create_md5_dict(self): def _create_md5_dict(self):
"""Create md5 dictionary per source """Create md5 dictionary per source
""" """

View file

@ -92,6 +92,16 @@ class Utils(object):
if line and not line.startswith("#"): if line and not line.startswith("#"):
return line return line
def fix_file_name(self, file_name):
"""Get file name from url and fix passing char '+'
"""
if "%2b" in file_name:
return file_name.replace("%2b", "+", 5)
elif "%2B" in file_name:
return file_name.replace("%2B", "+", 5)
else:
return file_name
def debug(self, test): def debug(self, test):
"""Function used for print some stuff for debugging """Function used for print some stuff for debugging
""" """

View file

@ -28,7 +28,7 @@
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
cat <<"EOT" cat <<"EOT"
# -------------------------------------------------------------------# # -------------------------------------------------------------------#
# $Id: gen_repos_files.sh,v 1.92 2014/07/31 20:27:53 root Exp root $ # # $Id: gen_repos_files.sh,v 1.94 2018/05/03 15:02:39 root Exp root $ #
# -------------------------------------------------------------------# # -------------------------------------------------------------------#
EOT EOT
@ -36,7 +36,7 @@ EOT
BASENAME=$( basename $0 ) BASENAME=$( basename $0 )
# The script'""s revision number will be displayed in the RSS feed: # The script'""s revision number will be displayed in the RSS feed:
REV=$( echo "$Revision: 1.92 $" | cut -d' ' -f2 ) REV=$( echo "$Revision: 1.94 $" | cut -d' ' -f2 )
# The repository owner's defaults file; # The repository owner's defaults file;
# you can override any of the default values in this file: # you can override any of the default values in this file:
@ -276,6 +276,7 @@ function addpkg {
if [ "$FORCEPKG" == "yes" -o ! -f $LOCATION/$TXTFILE ]; then if [ "$FORCEPKG" == "yes" -o ! -f $LOCATION/$TXTFILE ]; then
# This is a courtesy service: # This is a courtesy service:
echo "--> Generating .txt file for $NAME" echo "--> Generating .txt file for $NAME"
rm -f $LOCATION/$TXTFILE
$COMPEXE -cd $PKG | tar xOf - install/slack-desc | sed -n '/^#/d;/:/p' > $LOCATION/$TXTFILE $COMPEXE -cd $PKG | tar xOf - install/slack-desc | sed -n '/^#/d;/:/p' > $LOCATION/$TXTFILE
[ "$TOUCHUP" == "yes" ] && touch -r $PKG $LOCATION/$TXTFILE || touch -d "$UPDATEDATE" $LOCATION/$TXTFILE [ "$TOUCHUP" == "yes" ] && touch -r $PKG $LOCATION/$TXTFILE || touch -d "$UPDATEDATE" $LOCATION/$TXTFILE
fi fi
@ -303,6 +304,7 @@ function addpkg {
SUGGESTS=$($COMPEXE -cd $PKG | tar xOf - install/slack-suggests 2>/dev/null|xargs -r ) SUGGESTS=$($COMPEXE -cd $PKG | tar xOf - install/slack-suggests 2>/dev/null|xargs -r )
fi fi
rm -f $LOCATION/$METAFILE
echo "PACKAGE NAME: $NAME" > $LOCATION/$METAFILE echo "PACKAGE NAME: $NAME" > $LOCATION/$METAFILE
if [ -n "$DL_URL" ]; then if [ -n "$DL_URL" ]; then
echo "PACKAGE MIRROR: $DL_URL" >> $LOCATION/$METAFILE echo "PACKAGE MIRROR: $DL_URL" >> $LOCATION/$METAFILE
@ -360,6 +362,7 @@ function addman {
# Determine the compression tool used for this package: # Determine the compression tool used for this package:
COMPEXE=$( pkgcomp $PKG ) COMPEXE=$( pkgcomp $PKG )
rm -f $LOCATION/$LSTFILE
cat << EOF > $LOCATION/$LSTFILE cat << EOF > $LOCATION/$LSTFILE
++======================================== ++========================================
|| ||
@ -402,6 +405,7 @@ function genmd5 {
if [ "$FORCEMD5" == "yes" -o ! -f $LOCATION/$MD5FILE ]; then if [ "$FORCEMD5" == "yes" -o ! -f $LOCATION/$MD5FILE ]; then
echo "--> Generating .md5 file for $NAME" echo "--> Generating .md5 file for $NAME"
(cd $LOCATION (cd $LOCATION
rm -f $MD5FILE
md5sum $NAME > $MD5FILE md5sum $NAME > $MD5FILE
) )
[ "$TOUCHUP" == "yes" ] && touch -r $PKG $LOCATION/$MD5FILE || touch -d "$UPDATEDATE" $LOCATION/$MD5FILE [ "$TOUCHUP" == "yes" ] && touch -r $PKG $LOCATION/$MD5FILE || touch -d "$UPDATEDATE" $LOCATION/$MD5FILE
@ -455,6 +459,7 @@ function gen_filelist {
LISTFILE=${2:-FILELIST.TXT} LISTFILE=${2:-FILELIST.TXT}
( cd ${DIR} ( cd ${DIR}
rm -f ${LISTFILE}
cat <<EOT > ${LISTFILE} cat <<EOT > ${LISTFILE}
$UPDATEDATE $UPDATEDATE
@ -605,6 +610,7 @@ function rss_changelog {
# "+--------------------------+" then we just skip that. # "+--------------------------+" then we just skip that.
[ "$cline" == "+--------------------------+" ] && read cline [ "$cline" == "+--------------------------+" ] && read cline
PUBDATE=$(LC_ALL=C TZ=GMT date +"%a, %e %b %Y %H:%M:%S GMT" -d "$cline") PUBDATE=$(LC_ALL=C TZ=GMT date +"%a, %e %b %Y %H:%M:%S GMT" -d "$cline")
rm -f ${RSSFILE}
cat <<-_EOT_ > ${RSSFILE} cat <<-_EOT_ > ${RSSFILE}
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0"> <rss version="2.0">
@ -734,6 +740,7 @@ run_repo() {
done done
# Make the changes visible: # Make the changes visible:
rm -f PACKAGES.TXT
echo "PACKAGES.TXT; $UPDATEDATE" > PACKAGES.TXT echo "PACKAGES.TXT; $UPDATEDATE" > PACKAGES.TXT
echo "" >> PACKAGES.TXT echo "" >> PACKAGES.TXT
if [ -n "$DL_URL" ]; then if [ -n "$DL_URL" ]; then
@ -742,12 +749,15 @@ run_repo() {
cat .PACKAGES.TXT | grep -v "PACKAGE MIRROR: " >> PACKAGES.TXT cat .PACKAGES.TXT | grep -v "PACKAGE MIRROR: " >> PACKAGES.TXT
fi fi
rm -f .PACKAGES.TXT rm -f .PACKAGES.TXT
rm -f MANIFEST
cat .MANIFEST > MANIFEST cat .MANIFEST > MANIFEST
rm -f .MANIFEST rm -f .MANIFEST
rm -f PACKAGES.TXT.gz MANIFEST.bz2
bzip2 -9f MANIFEST bzip2 -9f MANIFEST
gzip -9cf PACKAGES.TXT > PACKAGES.TXT.gz gzip -9cf PACKAGES.TXT > PACKAGES.TXT.gz
if [ "${CHANGELOG}" == "yes" -a -f ChangeLog.txt ]; then if [ "${CHANGELOG}" == "yes" -a -f ChangeLog.txt ]; then
rm -f ChangeLog.txt.gz
gzip -9cf ChangeLog.txt > ChangeLog.txt.gz gzip -9cf ChangeLog.txt > ChangeLog.txt.gz
fi fi
@ -789,6 +799,7 @@ EOF
else else
find . -type f -print $PRUNES | grep -v CHECKSUMS | sort | xargs md5sum $1 2>/dev/null >> .CHECKSUMS.md5 find . -type f -print $PRUNES | grep -v CHECKSUMS | sort | xargs md5sum $1 2>/dev/null >> .CHECKSUMS.md5
fi fi
rm -f CHECKSUMS.md5 CHECKSUMS.md5.gz
cat .CHECKSUMS.md5 > CHECKSUMS.md5 cat .CHECKSUMS.md5 > CHECKSUMS.md5
gzip -9cf CHECKSUMS.md5 > CHECKSUMS.md5.gz gzip -9cf CHECKSUMS.md5 > CHECKSUMS.md5.gz
@ -871,19 +882,37 @@ else
rm -f $TESTTMP rm -f $TESTTMP
exit 1 exit 1
else else
# Use the key fingerprint to determine whether GPG-KEY is outdated:
GPG_FPR=$($GPGBIN --with-colon --with-fingerprint --list-keys "$REPOSOWNERGPG" |grep ^fpr |cut -d: -f10)
if [ -r ${REPOSROOT}/GPG-KEY ]; then
# If the GPG-KEY file is outdated (user may have a new key),
# then we delete this file and re-generate it in the next step:
if ! grep -q $GPG_FPR ${REPOSROOT}/GPG-KEY ; then
rm -f ${REPOSROOT}/GPG-KEY
fi
fi
if [ ! -r ${REPOSROOT}/GPG-KEY ]; then if [ ! -r ${REPOSROOT}/GPG-KEY ]; then
echo "Generating a "GPG-KEY" file in '$REPOSROOT'," echo "Generating a "GPG-KEY" file in '$REPOSROOT',"
echo " containing the public key information for '$REPOSOWNERGPG'..." echo " containing the public key information for '$REPOSOWNERGPG'..."
$GPGBIN --list-keys "$REPOSOWNERGPG" > ${REPOSROOT}/GPG-KEY $GPGBIN --list-keys "$REPOSOWNERGPG" > ${REPOSROOT}/GPG-KEY
echo "Key fingerprint: $GPG_FPR" >> ${REPOSROOT}/GPG-KEY
$GPGBIN -a --export "$REPOSOWNERGPG" >> ${REPOSROOT}/GPG-KEY $GPGBIN -a --export "$REPOSOWNERGPG" >> ${REPOSROOT}/GPG-KEY
chmod 444 ${REPOSROOT}/GPG-KEY chmod 444 ${REPOSROOT}/GPG-KEY
fi fi
if [ -n "$REPO_SUBDIRS" ]; then if [ -n "$REPO_SUBDIRS" ]; then
for SUBDIR in $REPO_SUBDIRS ; do for SUBDIR in $REPO_SUBDIRS ; do
if [ -r ${REPOSROOT}}/${SUBDIR}/GPG-KEY ]; then
# If the GPG-KEY file is outdated (user may have a new key),
# then we delete this file and re-generate it in the next step:
if ! grep -q $GPG_FPR ${REPOSROOT}}/${SUBDIR}/GPG-KEY ; then
rm -f ${REPOSROOT}}/${SUBDIR}/GPG-KEY
fi
fi
if [ ! -r ${REPOSROOT}/${SUBDIR}/GPG-KEY ]; then if [ ! -r ${REPOSROOT}/${SUBDIR}/GPG-KEY ]; then
echo "Generating a "GPG-KEY" file in '$REPOSROOT/$SUBDIR'," echo "Generating a "GPG-KEY" file in '$REPOSROOT/$SUBDIR',"
echo " containing the public key information for '$REPOSOWNERGPG'." echo " containing the public key information for '$REPOSOWNERGPG'."
$GPGBIN --list-keys "$REPOSOWNERGPG" > $REPOSROOT/$SUBDIR/GPG-KEY $GPGBIN --list-keys "$REPOSOWNERGPG" > $REPOSROOT/$SUBDIR/GPG-KEY
echo "Key fingerprint: $GPG_FPR" >> $REPOSROOT/$SUBDIR/GPG-KEY
$GPGBIN -a --export "$REPOSOWNERGPG" >> $REPOSROOT/$SUBDIR/GPG-KEY $GPGBIN -a --export "$REPOSOWNERGPG" >> $REPOSROOT/$SUBDIR/GPG-KEY
chmod 444 ${REPOSROOT}/${SUBDIR}/GPG-KEY chmod 444 ${REPOSROOT}/${SUBDIR}/GPG-KEY
fi fi