Fix slackpkg update ChangeLog.txt

This commit is contained in:
Dimitris Zlatanidis 2015-09-04 05:29:12 +03:00
parent 97c8b83646
commit e795bf72a9
5 changed files with 12 additions and 69 deletions

View file

@ -1,26 +0,0 @@
# Slackware ChangeLog mirror.
#
# http://www.slackware.com/changelog/
#
# The latest happenings in Slackware development can be seen by looking
# at the ChangeLogs in the various distribution trees. For your bleeding
# edge enjoyment, we are providing the ChangeLogs for the -current
# development tree as well as the latest stable release on the web site.
# The latest ChangeLogs can always be found on ftp://ftp.slackware.com We
# are updating this page every two hours, so they will remain fairly
# current. But the truly bleeding edge will want to leave an ftp session
# open to ftp://ftp.slackware.com and less the ChangeLog every 5 minutes.
#
# Uncomment ONLY ONE mirror each time
#
# ----------------------------------------------------------------------------
# For Slackware -stable and -current:
# ----------------------------------------------------------------------------
http://ftp.osuosl.org/pub/slackware/
# ftp://ftp.osuosl.org/pub/slackware/
#
# ----------------------------------------------------------------------------
# For Slackware ARM -stable and -current:
# ----------------------------------------------------------------------------
# http://ftp.arm.slackware.com/slackwarearm/
# ftp://ftp.arm.slackware.com/slackwarearm/

View file

@ -8,8 +8,7 @@ config() {
fi
}
CONFIGS="slpkg.conf repositories.conf blacklist slackware-mirrors custom-repositories \
slackware-changelogs-mirror"
CONFIGS="slpkg.conf repositories.conf blacklist slackware-mirrors custom-repositories"
for file in $CONFIGS; do
config etc/slpkg/${file}.new
done

View file

@ -86,8 +86,7 @@ find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | gr
mkdir -p $PKG/etc/slpkg
# install configurations files
CONFIGS="slpkg.conf repositories.conf blacklist slackware-mirrors custom-repositories \
slackware-changelogs-mirror"
CONFIGS="slpkg.conf repositories.conf blacklist slackware-mirrors custom-repositories"
for file in $CONFIGS; do
install -D -m0644 conf/$file $PKG/etc/slpkg/${file}.new
done

View file

@ -232,9 +232,6 @@ class MetaData(object):
# slackpkg lib path
slackpkg_lib_path = "/var/lib/slackpkg/"
# slackpkg conf path
slackpkg_conf = "/etc/slackpkg/"
# computer architecture
arch = os.uname()[4]

View file

@ -225,42 +225,16 @@ class Patches(object):
break
def slackpkg_update(self):
"""
This replace slackpkg ChangeLog.txt file with new
"""This replace slackpkg ChangeLog.txt file with new
from Slackware official mirrors after update distribution.
"""
log_mirror, arch = "", ""
ChangeLog_txt = "ChangeLog.txt"
ChangeLog_old = ChangeLog_txt + ".old"
arch = ("64" if self.meta.arch == "x86_64" else
"arm" if self.meta.arch.startswith("arm") else "")
slackware_mirror = self.utils.read_config(self.utils.read_file(
self.meta.conf_path + "slackware-changelogs-mirror"))
slackpkg_mirror = self.utils.read_config(
self.utils.read_file("{0}{1}".format(self.meta.slackpkg_conf,
"mirrors")))
if slackpkg_mirror:
if arch.startswith("arm") and "current" == self.meta.slack_rel:
log_mirror = "{0}slackware{1}-{2}/{3}".format(
slackware_mirror, arch, self.meta.slack_rel, ChangeLog_txt)
elif arch.startswith("arm"):
log_mirror = "{0}slackware{1}-{2}/{3}".format(
slackware_mirror, arch, slack_ver()[1], ChangeLog_txt)
elif "current" == self.meta.slack_rel:
log_mirror = "{0}slackware{1}-{2}/{3}".format(
slackware_mirror, arch, self.meta.slack_rel, ChangeLog_txt)
elif slackpkg_mirror:
log_mirror = "{0}slackware{1}-{2}/{3}".format(
slackware_mirror, arch, slack_ver(), ChangeLog_txt)
slackware_log = URL(log_mirror).reading()
if os.path.isfile(self.meta.slackpkg_lib_path + ChangeLog_txt):
if os.path.isfile(self.meta.slackpkg_lib_path + ChangeLog_old):
os.remove(self.meta.slackpkg_lib_path + ChangeLog_old)
shutil.copy2(self.meta.slackpkg_lib_path + ChangeLog_txt,
self.meta.slackpkg_lib_path + ChangeLog_old)
if os.path.isfile(self.meta.slackpkg_lib_path + ChangeLog_txt):
os.remove(self.meta.slackpkg_lib_path + ChangeLog_txt)
with open(self.meta.slackpkg_lib_path + ChangeLog_txt,
"w") as log:
log.write(slackware_log)
NEW_ChangeLog_txt = URL(mirrors("ChangeLog.txt", "")).reading()
if os.path.isfile(self.meta.slackpkg_lib_path + "ChangeLog.txt.old"):
os.remove(self.meta.slackpkg_lib_path + "ChangeLog.txt.old")
if os.path.isfile(self.meta.slackpkg_lib_path + "ChangeLog.txt"):
shutil.copy2(self.meta.slackpkg_lib_path + "ChangeLog.txt",
self.meta.slackpkg_lib_path + "ChangeLog.txt.old")
os.remove(self.meta.slackpkg_lib_path + "ChangeLog.txt")
with open(self.meta.slackpkg_lib_path + "ChangeLog.txt", "w") as log:
log.write(NEW_ChangeLog_txt)
log.close()