[gentoo-commits] proj/catalyst:master commit in: catalyst/, targets/stage1/, targets/support/

2020-04-17 Thread Matt Turner
commit: 80ec0abb4c0f801df3f604aea5fa3b51e9a9db54
Author: Matt Turner  gentoo  org>
AuthorDate: Wed Apr 15 23:43:42 2020 +
Commit: Matt Turner  gentoo  org>
CommitDate: Wed Apr 15 23:43:42 2020 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=80ec0abb

catalyst: Remove GNU sed detection

Was added in commit f3d246e24b5b (detect and use a configured sed
command for Gentoo/FreeBSD # 363577) for FreeBSD, but BSD support is now
gone.

Signed-off-by: Matt Turner  gentoo.org>

 catalyst/defaults.py|  1 -
 catalyst/main.py|  6 --
 targets/stage1/chroot.sh| 10 +-
 targets/support/chroot-functions.sh | 10 +-
 targets/support/kmerge.sh   |  8 
 targets/support/livecdfs-update.sh  | 32 
 6 files changed, 30 insertions(+), 37 deletions(-)

diff --git a/catalyst/defaults.py b/catalyst/defaults.py
index 4f67878c..8e276500 100644
--- a/catalyst/defaults.py
+++ b/catalyst/defaults.py
@@ -52,7 +52,6 @@ confdefaults = {
 "PythonDir": "./catalyst",
 "repo_basedir": REPODIR[:],
 "repo_name": MAINREPO[:],
-"sed": "sed",
 "sharedir": "/usr/share/catalyst",
 "shdir": "/usr/share/catalyst/targets/",
 "snapshot_cache": "/var/tmp/catalyst/snapshot_cache",

diff --git a/catalyst/main.py b/catalyst/main.py
index 8603012d..0fb8a682 100644
--- a/catalyst/main.py
+++ b/catalyst/main.py
@@ -404,12 +404,6 @@ def _main(parser, opts):
 hash_map.hash_map[conf_values['hash_function']].cmd,
 conf_values['hash_function'])
 
-# detect GNU sed
-for sed in ('/usr/bin/gsed', '/bin/sed', '/usr/bin/sed'):
-if os.path.exists(sed):
-conf_values["sed"] = sed
-break
-
 addlargs = {}
 
 if myspecfile:

diff --git a/targets/stage1/chroot.sh b/targets/stage1/chroot.sh
index 6e20027a..ac9d68ea 100755
--- a/targets/stage1/chroot.sh
+++ b/targets/stage1/chroot.sh
@@ -48,14 +48,14 @@ else
 fi
 
 # Clear USE
-[ -e ${clst_make_conf} ] && ${clst_sed} -i -e "/^USE=\"${BINDIST} ${USE}\"/d" 
${clst_make_conf}
+[ -e ${clst_make_conf} ] && sed -i -e "/^USE=\"${BINDIST} ${USE}\"/d" 
${clst_make_conf}
 make_destpath "${clst_root_path}"
 
 ## START BUILD
 # First, we drop in a known-good baselayout
 [ -e ${clst_make_conf} ] && echo "USE=\"${USE} -build\"" >> ${clst_make_conf}
 run_merge "--oneshot --nodeps sys-apps/baselayout"
-${clst_sed} -i "/USE=\"${USE} -build\"/d" ${clst_make_conf}
+sed -i "/USE=\"${USE} -build\"/d" ${clst_make_conf}
 
 echo "$locales" > /etc/locale.gen
 for etc in /etc "${clst_root_path}"/etc; do
@@ -87,10 +87,10 @@ locale-gen --destdir "${clst_root_path}"/ || die 
"locale-gen failed"
 # Why are we removing these? Don't we need them for final make.conf?
 for useexpand in ${clst_HOSTUSEEXPAND}; do
x="clst_${useexpand}"
-   ${clst_sed} -i "/${useexpand}=\"${!x}\"/d" \
+   sed -i "/${useexpand}=\"${!x}\"/d" \
${clst_make_conf}
 done
 
 # Clear USE
-[ -e ${clst_make_conf} ] && ${clst_sed} -i -e "/^CATALYST_USE/d" 
${clst_make_conf}
-[ -e ${clst_make_conf} ] && ${clst_sed} -i -e "/^USE=\"/s/\${CATALYST_USE} 
${USE} ${BOOTSTRAP_USE}//" ${clst_make_conf}
+[ -e ${clst_make_conf} ] && sed -i -e "/^CATALYST_USE/d" ${clst_make_conf}
+[ -e ${clst_make_conf} ] && sed -i -e "/^USE=\"/s/\${CATALYST_USE} ${USE} 
${BOOTSTRAP_USE}//" ${clst_make_conf}

diff --git a/targets/support/chroot-functions.sh 
b/targets/support/chroot-functions.sh
index 2c256f06..2fe5ac00 100755
--- a/targets/support/chroot-functions.sh
+++ b/targets/support/chroot-functions.sh
@@ -102,7 +102,7 @@ setup_myfeatures(){
else
clst_root_path=/ run_merge --oneshot --noreplace 
sys-devel/distcc || exit 1
fi
-   ${clst_sed} -i '/USE="${USE} -avahi -gtk -gnome"/d' 
${clst_make_conf}
+   sed -i '/USE="${USE} -avahi -gtk -gnome"/d' ${clst_make_conf}
mkdir -p /etc/distcc
echo "${clst_distcc_hosts}" > /etc/distcc/hosts
 
@@ -191,7 +191,7 @@ setup_pkgmgr(){
echo "Adding USE=\"\${USE} $1\" to make.conf for portage build"
[ -e "${clst_make_conf}" ] && echo "USE=\"\${USE} $1\"" >> 
"${clst_make_conf}"
run_merge --oneshot --update --newuse sys-apps/portage
-   ${clst_sed} -i "/USE=\"\${USE} $1\"/d" "${clst_make_conf}"
+   sed -i "/USE=\"\${USE} $1\"/d" "${clst_make_conf}"
else
run_merge --oneshot --update --newuse sys-apps/portage
fi
@@ -245,8 +245,8 @@ cleanup_stages() {
esac
 
# Remove bindist from use
-   ${clst_sed} -i "/USE=\"\${USE} bindist\"/d" "${clst_make_conf}"
-   ${clst_sed} -i "/USE=\"bindist\"/d" "${clst_make_conf}"
+   sed -i "/USE=\"\${USE} bindist\"/d" "${clst_make_conf}"
+   sed -i "/USE=\"bindist\"/d" "${clst_make_conf}"
 
rm -f /var/log/emerge.log 

[gentoo-commits] proj/catalyst:master commit in: catalyst/, targets/stage1/

2015-10-06 Thread Mike Frysinger
commit: 7445a15662512bf034a7e3f8144c9d07d1e9d8c6
Author: Mike Frysinger  gentoo  org>
AuthorDate: Tue Oct  6 13:51:29 2015 +
Commit: Mike Frysinger  gentoo  org>
CommitDate: Tue Oct  6 13:51:29 2015 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=7445a156

lint: unwrap multiple statements

It's hard to read code that packs multiple statements in one line, so
unwrap the few places in the codebase where we do that.

 catalyst/config.py  | 3 ++-
 targets/stage1/build.py | 6 --
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/catalyst/config.py b/catalyst/config.py
index 48d9c12..ffad9b3 100644
--- a/catalyst/config.py
+++ b/catalyst/config.py
@@ -53,7 +53,8 @@ class ParserBase(object):
myline = trailing_comment.sub("", myline)
 
# Skip any blank lines
-   if not myline: continue
+   if not myline:
+   continue
 
if self.key_value_separator in myline:
# Split on the first occurence of the separator 
creating two strings in the array mobjs

diff --git a/targets/stage1/build.py b/targets/stage1/build.py
index 6495ee3..be1bc4d 100755
--- a/targets/stage1/build.py
+++ b/targets/stage1/build.py
@@ -33,6 +33,8 @@ for idx in range(0, len(pkgs)):
buildpkgs[bidx] = pkgs[idx]
if buildpkgs[bidx][0:1] == "*":
buildpkgs[bidx] = buildpkgs[bidx][1:]
-   except: pass
+   except:
+   pass
 
-for b in buildpkgs: sys.stdout.write(b+" ")
+for b in buildpkgs:
+   sys.stdout.write(b + " ")



[gentoo-commits] proj/catalyst:master commit in: catalyst/, targets/stage1/, catalyst/base/

2015-10-06 Thread Mike Frysinger
commit: 3a0aff0ef565404c78ca07bdfd01d42e9632912a
Author: Mike Frysinger  gentoo  org>
AuthorDate: Tue Oct  6 04:21:29 2015 +
Commit: Mike Frysinger  gentoo  org>
CommitDate: Tue Oct  6 04:21:29 2015 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=3a0aff0e

lint: avoid redefining builtins

It can be confusing to try and use builtins like str() when code is
also declaring variables named "str".  Avoid doing that everywhere.

 catalyst/base/genbase.py | 34 ++
 catalyst/support.py  | 10 +-
 targets/stage1/build.py  |  8 
 3 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/catalyst/base/genbase.py b/catalyst/base/genbase.py
index c05b36d..a163638 100644
--- a/catalyst/base/genbase.py
+++ b/catalyst/base/genbase.py
@@ -11,48 +11,50 @@ class GenBase(object):
self.settings = myspec
 
 
-   def gen_contents_file(self,file):
-   if os.path.exists(file+".CONTENTS"):
-   os.remove(file+".CONTENTS")
+   def gen_contents_file(self, path):
+   contents = path + ".CONTENTS"
+   if os.path.exists(contents):
+   os.remove(contents)
if "contents" in self.settings:
contents_map = self.settings["contents_map"]
-   if os.path.exists(file):
-   myf=open(file+".CONTENTS","w")
+   if os.path.exists(path):
+   myf = open(contents, "w")
keys={}
for i in self.settings["contents"].split():
keys[i]=1
array=keys.keys()
array.sort()
for j in array:
-   contents = contents_map.contents(file, 
j,
+   contents = contents_map.contents(path, 
j,
verbose="VERBOSE" in 
self.settings)
if contents:
myf.write(contents)
myf.close()
 
-   def gen_digest_file(self,file):
-   if os.path.exists(file+".DIGESTS"):
-   os.remove(file+".DIGESTS")
+   def gen_digest_file(self, path):
+   digests = path + ".DIGESTS"
+   if os.path.exists(digests):
+   os.remove(digests)
if "digests" in self.settings:
hash_map = self.settings["hash_map"]
-   if os.path.exists(file):
-   myf=open(file+".DIGESTS","w")
+   if os.path.exists(path):
+   myf=open(digests, "w")
keys={}
for i in self.settings["digests"].split():
keys[i]=1
array=keys.keys()
array.sort()
-   for f in [file, file+'.CONTENTS']:
+   for f in [path, path + '.CONTENTS']:
if os.path.exists(f):
if "all" in array:
for k in 
list(hash_map.hash_map):
-   hash = 
hash_map.generate_hash(f,hash_=k,
+   digest = 
hash_map.generate_hash(f,hash_=k,
verbose 
= "VERBOSE" in self.settings)
-   myf.write(hash)
+   
myf.write(digest)
else:
for j in array:
-   hash = 
hash_map.generate_hash(f,hash_=j,
+   digest = 
hash_map.generate_hash(f,hash_=j,
verbose 
= "VERBOSE" in self.settings)
-   myf.write(hash)
+   
myf.write(digest)
myf.close()
 

diff --git a/catalyst/support.py b/catalyst/support.py
index 1e3eeef..90c59eb 100644
--- a/catalyst/support.py
+++ b/catalyst/support.py
@@ -34,23 +34,23 @@ spawned_pids = []
 
 # a function to turn a string of non-printable characters
 # into a string of hex