* [gentoo-catalyst] [PATCH 0/4] Some general cleanup, remove some hardcoding of paths.
@ 2013-02-28 1:46 Brian Dolbec
2013-02-28 1:46 ` [gentoo-catalyst] [PATCH 1/4] Whitespace cleanup Brian Dolbec
` (4 more replies)
0 siblings, 5 replies; 11+ messages in thread
From: Brian Dolbec @ 2013-02-28 1:46 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Brian Dolbec
These 4 patches were made before I started restructing the python code layout.
They have been rebased on master and should apply cleanly.
Matt has already stated that they should probably be applied to master.
While I've done testing on my rewrites. I have done some extensive rebasing on all
the commits. While I endeavored to incorporate all fixes to changes back into the initial commit
The third patch should be tested a little more thouroughly once applied just in case some of the
changes are missing in that patch. During the rebasing I encountered numerous rebasing errors.
I believe I got them all.
There are several more bugfixes I feel shuld be applied to master if you intend on releasing a
bug fix version bump. They will have to be applied manually since the file names and locations
have changed in the rewrite.
Brian Dolbec (4):
Whitespace cleanup.
Add more configured defaults
Remove self.mounts and self.mountmap's use of paths for keys and
paths.
cleanup long lines, improve useage() output formatting slightly
ChangeLog | 44 ++++++------
arch/alpha.py | 2 +-
arch/arm.py | 4 +-
arch/mips.py | 2 +-
arch/x86.py | 2 +-
catalyst | 135 ++++++++++++++++++++---------------
examples/generic_stage_template.spec | 4 +-
examples/grp_template.spec | 2 +-
examples/livecd-stage2_template.spec | 6 +-
examples/stage4_template.spec | 8 +--
examples/tinderbox_template.spec | 2 +-
files/catalyst.conf | 2 +-
livecd/files/minimal.motd.txt | 2 +-
modules/generic_stage_target.py | 86 +++++++++++-----------
modules/snapshot_target.py | 14 ++--
modules/tinderbox_target.py | 4 +-
targets/stage1/build.py | 2 +-
17 files changed, 174 insertions(+), 147 deletions(-)
--
1.8.1.4
^ permalink raw reply [flat|nested] 11+ messages in thread
* [gentoo-catalyst] [PATCH 1/4] Whitespace cleanup.
2013-02-28 1:46 [gentoo-catalyst] [PATCH 0/4] Some general cleanup, remove some hardcoding of paths Brian Dolbec
@ 2013-02-28 1:46 ` Brian Dolbec
2013-02-28 11:46 ` W. Trevor King
2013-03-09 2:36 ` Matt Turner
2013-02-28 1:46 ` [gentoo-catalyst] [PATCH 2/4] Add more configured defaults Brian Dolbec
` (3 subsequent siblings)
4 siblings, 2 replies; 11+ messages in thread
From: Brian Dolbec @ 2013-02-28 1:46 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Brian Dolbec
Run the following command to cleanup whitespace.
for FILE in $(git ls-tree -r --name-only HEAD | grep -v 'bz2$'); do
sed -i 's/[[:space:]]*$//' "$FILE"
done
Signed-off-by: Brian Dolbec <dolsen@gentoo.org>
---
ChangeLog | 44 ++++++++++++++++++------------------
arch/alpha.py | 2 +-
arch/arm.py | 4 ++--
arch/mips.py | 2 +-
arch/x86.py | 2 +-
catalyst | 36 ++++++++++++++---------------
examples/generic_stage_template.spec | 4 ++--
examples/grp_template.spec | 2 +-
examples/livecd-stage2_template.spec | 6 ++---
examples/stage4_template.spec | 8 +++----
examples/tinderbox_template.spec | 2 +-
files/catalyst.conf | 2 +-
livecd/files/minimal.motd.txt | 2 +-
targets/stage1/build.py | 2 +-
14 files changed, 59 insertions(+), 59 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 893cfec..12b41f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1798,7 +1798,7 @@
Removed famd from the default runlevel for gentoo-release-livecd. It really
shouldn't cause a problem, but I prefer it stay a bit clean.
- 11 Jul 2006; Chris Gianelloni <wolf31o2@gentoo.org>
+ 11 Jul 2006; Chris Gianelloni <wolf31o2@gentoo.org>
modules/generic_stage_target.py, targets/support/bootloader-setup.sh,
targets/support/create-iso.sh, targets/support/kmerge.sh,
targets/support/livecdfs-update.sh, targets/support/mips-arcload_conf.sh:
@@ -2432,7 +2432,7 @@
10 Jan 2006; Eric Edgar <rocket@gentoo.org>
modules/generic_stage_target.py, targets/support/kmerge.sh:
filter kname - and . for kmerge.sh
-
+
10 Jan 2006; Chris Gianelloni <wolf31o2@gentoo.org>
targets/support/create-iso.sh:
Added sparc64 to sparc lines for create-iso.sh to fix ISO creation on sparc64.
@@ -3437,7 +3437,7 @@
06 Jul 2005; Eric Edgar <rocket@gentoo.org> targets/support/create-iso.sh:
Fix iso creation script. Case statement out of place
-
+
05 Jul 2005; Chris Gianelloni <wolf31o2@gentoo.org> arch/alpha.py,
arch/amd64.py, arch/hppa.py, arch/ia64.py, arch/mips.py, arch/ppc.py,
arch/ppc64.py, arch/s390.py, arch/sparc.py, arch/sparc64.py, arch/x86.py,
@@ -4762,10 +4762,10 @@
fixes for bugs #55192 and #54137
added a new key for all specfiles, portage_confdir.
this should point to a directory similar in functionality to /etc/portage.
-
+
cleaned up the module code a bit so that unnecessary modules
are not imported.
-
+
more work on resuming. it is getting there, but it still needs a ton of work,
so please test, and report bugs.
@@ -4790,7 +4790,7 @@
of me doing this is that SIGINT (ctrl-c) makes catalyst die nice and proper
now. Additionally, catalyst will stop when there is an error with an ebuild
... it didn't do this before, it just plowed along and packed things up.
-
+
Much thanks to <carpaski@gentoo.org> for (writing) pointing me to the spawn()
code in portage.py and then answering my noob questions.
@@ -4974,7 +4974,7 @@
05 Apr 2004; John Davis <zhen@gentoo.org> modules/targets.py:
bugfix for #46861
- 04 Apr 2004; Benjamin Judas <beejay@gentoo.org>
+ 04 Apr 2004; Benjamin Judas <beejay@gentoo.org>
livecd/kconfig/config-2004.1-gentoo-dev-sources-2.6.3-r1,
livecd/kconfig/config-2004.1-xfs-sources-2.4.24-r3:
Added the two kernel-configs for 2004.1 x86
@@ -5052,8 +5052,8 @@
examples/livecd/runscript/alpha-archscript.sh, files/catalyst.conf:
fixes for bugs 43676, 43701. Alpha support added as well.
- 25 Feb 2004; Pieter Van den Abeele <pvdabeel@gentoo.org>:
- added powerpc livecd support, preparing for 2004.0 release. Preliminary
+ 25 Feb 2004; Pieter Van den Abeele <pvdabeel@gentoo.org>:
+ added powerpc livecd support, preparing for 2004.0 release. Preliminary
kde/gnome cd specs added.
18 Feb 2004; John Davis <zhen@gentoo.org> files/catalyst.conf:
@@ -5070,7 +5070,7 @@
point to a file to use in place of /etc/catalyst.conf. By setting this
variable in your shell, catalyst can easily be used by multiple people on the
same machine. Also, ccache support now works for genkernel.
-
+
11 Feb 2004; Daniel Robbins <drobbins@gentoo.org>:
removed file for livecd-stage2 target, as this is handled by the runscript
now. Added support for "/boot/kernel/foo/use", "/boot/kernel/foo/packages,"
@@ -5097,34 +5097,34 @@
29 Nov 2003; Daniel Robbins <drobbins@gentoo.org>:
Tinderbox target added. See tinderbox examples in examples/ dir.
-
+
08 Nov 2003; Daniel Robbins <drobbins@gentoo.org>:
spec file support integrated into catalyst. Use "-f/--file specfile" as
argument; see examples dir for examples.
"grp" target now functional. See examples/x86-grp-20031102.spec for an
example of how to use it.
-
+
08 Nov 2003; Daniel Robbins <drobbins@gentoo.org>:
support functions for spec file parsing and reading added. Will get added to
the code soon.
-
+
05 Nov 2003; Daniel Robbins <drobbins@gentoo.org>:
Many bug fixes later, things seem to be working well for stage1/2/3 so I've
added a README.
-
+
28 Oct 2003; Daniel Robbins <drobbins@gentoo.org>:
Significant rework of code structure. Everything is falling nicely into place.
-
+
28 Oct 2003; Daniel Robbins <drobbins@gentoo.org>:
Exception handling fully-integrated into current prototype code.
-
+
27 Oct 2003; Daniel Robbins <drobbins@gentoo.org>:
beginning of exception handling integration, got some of the target code
nicely fleshed out.
-
+
24 Oct 2003; Daniel Robbins <drobbins@gentoo.org>:
major code rework in progress on the python parts.
-
+
17 Oct 2003; John Davis <zhen@gentoo.org> files/grp/x86/x86.conf,
files/grp/x86/x86.pkg.cd1, files/grp/x86/x86.pkg.cd2, files/grp/x86/x86.src,
files/livecd/x86-basic/base.pkg, files/livecd/x86-basic/kern.pkg:
@@ -5146,7 +5146,7 @@
12 Oct 2003; Daniel Robbins <drobins@gentoo.org>:
subarch test outsourced to python catalyst-subarches function.
-
+
12 Oct 2003; John Davis <zhen@gentoo.org> include/build_functions.sh:
fixed the entry in include/build_functions.sh for location of bootstrap.sh
@@ -5159,7 +5159,7 @@
12 Oct 2003; Robin H. Johnson <robbat2@gentoo.org> catalyst:
Fix valid subarch test.
- 12 Oct 2003; John Davis <zhen@gentoo.org> catalyst,
+ 12 Oct 2003; John Davis <zhen@gentoo.org> catalyst,
include/build_functions.sh, include/functions.sh:
thanks to robbat2, the cmdline argument handling is now fixed. I moved
start_build to build_functions.sh cleaning up the main catalyst script some
@@ -5183,7 +5183,7 @@
08 Oct 2003; John Davis <zhen@gentoo.org> catalyst:
I changed the is_special handling so that it is cleaner and faster
- 08 Oct 2003; John Davis <zhen@gentoo.org> catalyst, include/functions.sh,
+ 08 Oct 2003; John Davis <zhen@gentoo.org> catalyst, include/functions.sh,
livecd/foundations/x86-basic/base.pkg, livecd/foundations/x86-basic/kern.pkg,
livecd/foundations/x86-basic/post-clean.sh,
livecd/foundations/x86-basic/pre-clean.sh,
@@ -5231,7 +5231,7 @@
stage*-arch-etdyn-ssp.* re method's request. This will not be the first time
I change naming conventions, as catalyst will be eventually extended to
do selinux-* stages also.
-
+
Additionally, I updated README.catalyst to include profile information.
10 Sep 2003; John Davis <zhen@gentoo.org> README.catalyst, README.stager,
diff --git a/arch/alpha.py b/arch/alpha.py
index 3fd9b3d..f0fc95a 100644
--- a/arch/alpha.py
+++ b/arch/alpha.py
@@ -71,5 +71,5 @@ def register():
"Inform main catalyst program of the contents of this plugin."
return ({ "alpha":arch_alpha, "ev4":arch_ev4, "ev45":arch_ev45,
"ev5":arch_ev5, "ev56":arch_ev56, "pca56":arch_pca56,
- "ev6":arch_ev6, "ev67":arch_ev67 },
+ "ev6":arch_ev6, "ev67":arch_ev67 },
("alpha", ))
diff --git a/arch/arm.py b/arch/arm.py
index 4ba5a83..2de3942 100644
--- a/arch/arm.py
+++ b/arch/arm.py
@@ -8,7 +8,7 @@ class generic_arm(builder.generic):
builder.generic.__init__(self,myspec)
self.settings["CHROOT"]="chroot"
self.settings["CFLAGS"]="-O2 -pipe"
-
+
class generic_armeb(builder.generic):
"Abstract base class for all arm (big endian) builders"
def __init__(self,myspec):
@@ -129,5 +129,5 @@ def register():
"armv7a_hardfp" : arch_armv7a_hardfp,
"armeb" : arch_armeb,
"armv5teb" : arch_armv5teb
- }, ("arm", "armv4l", "armv4tl", "armv5tl", "armv5tel", "armv5tejl", "armv6l",
+ }, ("arm", "armv4l", "armv4tl", "armv5tl", "armv5tel", "armv5tejl", "armv6l",
"armv7l", "armeb", "armv5teb") )
diff --git a/arch/mips.py b/arch/mips.py
index 9ea2d0e..b3730fa 100644
--- a/arch/mips.py
+++ b/arch/mips.py
@@ -398,7 +398,7 @@ class arch_cobalt_n32(generic_mips64el):
def register():
"Inform main catalyst program of the contents of this plugin."
- return ({
+ return ({
"cobalt" : arch_cobalt,
"cobalt_n32" : arch_cobalt_n32,
"mips" : arch_mips1,
diff --git a/arch/x86.py b/arch/x86.py
index 9d1acb3..0391b79 100644
--- a/arch/x86.py
+++ b/arch/x86.py
@@ -55,7 +55,7 @@ class arch_pentium_mmx(generic_x86):
generic_x86.__init__(self,myspec)
self.settings["CFLAGS"]="-O2 -march=pentium-mmx -pipe"
self.settings["HOSTUSE"]=["mmx"]
-
+
class arch_pentium2(generic_x86):
"Intel Pentium 2 CPU with MMX support"
def __init__(self,myspec):
diff --git a/catalyst b/catalyst
index 9f8dd30..c29c814 100755
--- a/catalyst
+++ b/catalyst
@@ -66,7 +66,7 @@ def parse_config(myconfig):
"portdir":"/usr/portage","options":"",\
"snapshot_cache":"/var/tmp/catalyst/snapshot_cache",\
"hash_function":"crc32"}
-
+
# first, try the one passed (presumably from the cmdline)
if myconfig:
if os.path.exists(myconfig):
@@ -77,12 +77,12 @@ def parse_config(myconfig):
print "!!! catalyst: Could not use specified configuration file "+\
myconfig
sys.exit(1)
-
+
# next, try the default location
elif os.path.exists("/etc/catalyst/catalyst.conf"):
print "Using default Catalyst configuration file, /etc/catalyst/catalyst.conf"
config_file="/etc/catalyst/catalyst.conf"
-
+
# can't find a config file (we are screwed), so bail out
else:
print "!!! catalyst: Could not find a suitable configuration file"
@@ -93,11 +93,11 @@ def parse_config(myconfig):
# execfile(config_file, myconf, myconf)
myconfig = catalyst.config.ConfigParser(config_file)
myconf.update(myconfig.get_values())
-
+
except:
print "!!! catalyst: Unable to parse configuration file, "+myconfig
sys.exit(1)
-
+
# now, load up the values into conf_values so that we can use them
for x in confdefaults.keys():
if x in myconf:
@@ -216,9 +216,9 @@ def build_target(addlargs, targetmap):
try:
if addlargs["target"] not in targetmap:
raise CatalystError,"Target \""+addlargs["target"]+"\" not available."
-
+
mytarget=targetmap[addlargs["target"]](conf_values, addlargs)
-
+
mytarget.run()
except:
@@ -228,7 +228,7 @@ def build_target(addlargs, targetmap):
if __name__ == "__main__":
targetmap={}
-
+
version()
if os.getuid() != 0:
# catalyst cannot be run as a normal user due to chroots, mounts, etc
@@ -244,11 +244,11 @@ if __name__ == "__main__":
try:
opts,args = getopt.getopt(sys.argv[1:], "apPThvdc:C:f:FVs:", ["purge", "purgeonly", "purgetmponly", "help", "version", "debug",\
"clear-autoresume", "config=", "cli=", "file=", "fetch", "verbose","snapshot="])
-
+
except getopt.GetoptError:
usage()
sys.exit(2)
-
+
# defaults for commandline opts
debug=False
verbose=False
@@ -269,7 +269,7 @@ if __name__ == "__main__":
if o in ("-h", "--help"):
usage()
sys.exit(1)
-
+
if o in ("-V", "--version"):
print "Catalyst version "+__version__
sys.exit(1)
@@ -287,14 +287,14 @@ if __name__ == "__main__":
while x < len(sys.argv):
mycmdline.append(sys.argv[x])
x=x+1
-
+
if o in ("-f", "--file"):
run = True
myspecfile=a
if o in ("-F", "--fetchonly"):
conf_values["FETCH"]="1"
-
+
if o in ("-v", "--verbose"):
conf_values["VERBOSE"]="1"
@@ -307,7 +307,7 @@ if __name__ == "__main__":
run = True
mycmdline.append("target=snapshot")
mycmdline.append("version_stamp="+a)
-
+
if o in ("-p", "--purge"):
conf_values["PURGE"] = "1"
@@ -329,7 +329,7 @@ if __name__ == "__main__":
parse_config(myconfig)
sys.path.append(conf_values["sharedir"]+"/modules")
from catalyst_support import *
-
+
# Start checking that digests are valid now that the hash_map was imported
# from catalyst_support
if "digests" in conf_values:
@@ -373,11 +373,11 @@ if __name__ == "__main__":
targetmap=import_modules()
addlargs={}
-
+
if myspecfile:
spec = catalyst.config.SpecParser(myspecfile)
addlargs.update(spec.get_values())
-
+
if mycmdline:
try:
cmdline = catalyst.config.ConfigParser()
@@ -393,7 +393,7 @@ if __name__ == "__main__":
# everything is setup, so the build is a go
try:
build_target(addlargs, targetmap)
-
+
except CatalystError:
print
print "Catalyst aborting...."
diff --git a/examples/generic_stage_template.spec b/examples/generic_stage_template.spec
index b386c7c..45268ca 100644
--- a/examples/generic_stage_template.spec
+++ b/examples/generic_stage_template.spec
@@ -12,7 +12,7 @@ subarch:
# it to be, but it is usually a date.
# example:
# version_stamp: 2006.1
-version_stamp:
+version_stamp:
# The target specifies what target we want catalyst to do. For stages, the
# supported targets are: stage1 stage2 stage3
@@ -45,7 +45,7 @@ snapshot:
# default/stage3-x86-2006.1
source_subpath:
-# These are the hosts used as distcc slaves when distcc is enabled in your
+# These are the hosts used as distcc slaves when distcc is enabled in your
# catalyst.conf. It follows the same syntax as distcc-config --set-hosts and
# is entirely optional.
# example:
diff --git a/examples/grp_template.spec b/examples/grp_template.spec
index 97e49dc..8cf9e27 100644
--- a/examples/grp_template.spec
+++ b/examples/grp_template.spec
@@ -17,7 +17,7 @@ version_stamp:
# supported targets are: grp
# example:
# target: grp
-target: grp
+target: grp
# The rel_type defines what kind of build we are doing. This is merely another
# identifier, but it useful for allowing multiple concurrent builds. Usually,
diff --git a/examples/livecd-stage2_template.spec b/examples/livecd-stage2_template.spec
index 18a06a4..1e27918 100644
--- a/examples/livecd-stage2_template.spec
+++ b/examples/livecd-stage2_template.spec
@@ -110,7 +110,7 @@ livecd/cdtar:
livecd/iso:
# A fsscript is simply a shell script that is copied into the chroot of the CD
-# after the kernel(s) and any external modules have been compiled and is
+# after the kernel(s) and any external modules have been compiled and is
# executed within the chroot. It can contain any commands that are available
# via the packages installed by our stages or by the packages installed during
# the livecd-stage1 build. We do not use one for the official release media, so
@@ -204,7 +204,7 @@ livecd/rcdel:
# This overlay is dropped onto the CD filesystem and is outside any loop which
# has been configured. This is typically used for adding the documentation,
-# distfiles, snapshots, and stages to the official media. These files will not
+# distfiles, snapshots, and stages to the official media. These files will not
# be available if docache is enabled, as they are outside the loop.
# example:
# livecd/overlay: /tmp/overlay-minimal
@@ -323,7 +323,7 @@ boot/kernel/gentoo/machine_type:
# This is only supported on ppc64 currently. This entry sets up the console=
# boot parameters required for sending the output to the appropriate console.
# example:
-# boot/kernel/gentoo/console: hvsi0
+# boot/kernel/gentoo/console: hvsi0
# boot/kernel/gentoo/console: hvc0
# boot/kernel/gentoo/console: tty0 ttyS0
boot/kernel/gentoo/console:
diff --git a/examples/stage4_template.spec b/examples/stage4_template.spec
index 9da5e5e..33fc0e6 100644
--- a/examples/stage4_template.spec
+++ b/examples/stage4_template.spec
@@ -66,7 +66,7 @@ portage_overlay:
# catalyst. Mainly used as a way for different spec files to access the same
# cache directory. Default behavior is for this location to be autogenerated
# by catalyst based on the spec file.
-# example:
+# example:
# pkgcache_path: /tmp/packages
pkgcache_path:
@@ -80,7 +80,7 @@ kerncache_path:
# The stage4 target is where you will build packages for basically updated
# stage3. These packages can be built with customized USE settings. The
-# settings here are additive to the default USE configured by the profile.
+# settings here are additive to the default USE configured by the profile.
# Leaving this blank will default to the system use flags
# example:
# stage4/use: ipv6 socks5 fbcon ncurses readline ssl
@@ -95,7 +95,7 @@ stage4/use:
stage4/packages:
# A fsscript is simply a shell script that is copied into the chroot of the stage4
-# after the kernel(s) and any external modules have been compiled and is
+# after the kernel(s) and any external modules have been compiled and is
# executed within the chroot. It can contain any commands that are available
# via the packages installed by our stages or by the packages installed during
# the stage4-stage1 build. We do not use one for the official release media, so
@@ -126,7 +126,7 @@ stage4/gk_mainargs:
# stage4/linuxrc:
stage4/linuxrc:
-# This is for the message of the day. It is not required
+# This is for the message of the day. It is not required
# release media, as catalyst builds a default motd when the stage4/type is set
# to one of the gentoo-* options. This setting overrides the default motd even
# on official media. Since we do not use this for the official releases, it is
diff --git a/examples/tinderbox_template.spec b/examples/tinderbox_template.spec
index 65ccbe3..09cc20f 100644
--- a/examples/tinderbox_template.spec
+++ b/examples/tinderbox_template.spec
@@ -15,7 +15,7 @@ version_stamp:
# The target specifies what target we want catalyst to do.
# example:
# target: tinderbox
-target: tinderbox
+target: tinderbox
# The rel_type defines what kind of build we are doing. This is merely another
# identifier, but it useful for allowing multiple concurrent builds. Usually,
diff --git a/files/catalyst.conf b/files/catalyst.conf
index f88f105..b74c546 100644
--- a/files/catalyst.conf
+++ b/files/catalyst.conf
@@ -34,7 +34,7 @@ distdir="/usr/portage/distfiles"
# export FOO="bar"
envscript="/etc/catalyst/catalystrc"
-# Internal hash function catalyst should use for things like autoresume,
+# Internal hash function catalyst should use for things like autoresume,
# seedcache, etc. The default and fastest is crc32. You should not ever need
# to change this unless your OS does not support it.
# Supported hashes:
diff --git a/livecd/files/minimal.motd.txt b/livecd/files/minimal.motd.txt
index 1f702fc..55f6158 100644
--- a/livecd/files/minimal.motd.txt
+++ b/livecd/files/minimal.motd.txt
@@ -2,7 +2,7 @@ The latest version of the Handbook is always available from the Gentoo web
site by typing "links http://www.gentoo.org/doc/en/handbook/handbook.xml".
To start an ssh server on this system, type "/etc/init.d/sshd start". If you
-need to log in remotely as root, type "passwd root" to reset root's password
+need to log in remotely as root, type "passwd root" to reset root's password
to a known value.
Please report any bugs you find to http://bugs.gentoo.org. Be sure to include
diff --git a/targets/stage1/build.py b/targets/stage1/build.py
index 539c4c7..bf20bcf 100644
--- a/targets/stage1/build.py
+++ b/targets/stage1/build.py
@@ -12,7 +12,7 @@ def scan_profile(file):
else:
if "grab_multiple" in dir(portage):
return portage.stack_lists( portage.grab_multiple(file, portage.settings.profiles, portage.grabfile), incremental=1);
- else:
+ else:
return portage.stack_lists( [portage.grabfile_package(os.path.join(x, file)) for x in portage.settings.profiles], incremental=1);
# loaded the stacked packages / packages.build files
--
1.8.1.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-catalyst] [PATCH 2/4] Add more configured defaults
2013-02-28 1:46 [gentoo-catalyst] [PATCH 0/4] Some general cleanup, remove some hardcoding of paths Brian Dolbec
2013-02-28 1:46 ` [gentoo-catalyst] [PATCH 1/4] Whitespace cleanup Brian Dolbec
@ 2013-02-28 1:46 ` Brian Dolbec
2013-02-28 11:51 ` W. Trevor King
2013-02-28 1:47 ` [gentoo-catalyst] [PATCH 3/4] Remove self.mounts and self.mountmap's use of paths for keys and paths Brian Dolbec
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Brian Dolbec @ 2013-02-28 1:46 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Brian Dolbec
Use the new configured snapshot_name and portdir settings
Use the portdir setting rather than hard-coded path
Signed-off-by: Brian Dolbec <dolsen@gentoo.org>
---
catalyst | 18 +++++++++++++-----
modules/generic_stage_target.py | 6 ++++--
modules/snapshot_target.py | 14 +++++++++-----
modules/tinderbox_target.py | 4 ++--
4 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/catalyst b/catalyst
index c29c814..0878ce4 100755
--- a/catalyst
+++ b/catalyst
@@ -61,11 +61,19 @@ def parse_config(myconfig):
myconf={}
config_file=""
- confdefaults={ "storedir":"/var/tmp/catalyst",\
- "sharedir":"/usr/share/catalyst","distdir":"/usr/portage/distfiles",\
- "portdir":"/usr/portage","options":"",\
- "snapshot_cache":"/var/tmp/catalyst/snapshot_cache",\
- "hash_function":"crc32"}
+ confdefaults={
+ "storedir": "/var/tmp/catalyst",
+ "sharedir": "/usr/lib/catalyst",
+ "distdir": "/usr/portage/distfiles",
+ "repo_name": "portage",
+ "portdir": "/usr/portage",
+ "packagedir": "/usr/portage/packages",
+ "port_tmpdir": "/var/tmp/portage",
+ "options": "",
+ "snapshot_name": "portage-",
+ "snapshot_cache": "/var/tmp/catalyst/snapshot_cache",
+ "hash_function": "crc32",
+ }
# first, try the one passed (presumably from the cmdline)
if myconfig:
diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py
index 31cb025..c79f8ae 100644
--- a/modules/generic_stage_target.py
+++ b/modules/generic_stage_target.py
@@ -410,7 +410,8 @@ class generic_stage_target(generic_target):
def set_snapshot_path(self):
self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
- "/snapshots/portage-"+self.settings["snapshot"]+".tar.xz")
+ "/snapshots/" + self.settings["snapshot_name"] +
+ self.settings["snapshot"]+".tar.xz")
if os.path.exists(self.settings["snapshot_path"]):
self.settings["snapshot_path_hash"]=\
@@ -418,7 +419,8 @@ class generic_stage_target(generic_target):
hash_function=self.settings["hash_function"],verbose=False)
else:
self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
- "/snapshots/portage-"+self.settings["snapshot"]+".tar.bz2")
+ "/snapshots/" + self.settings["snapshot_name"] +
+ self.settings["snapshot"]+".tar.bz2")
if os.path.exists(self.settings["snapshot_path"]):
self.settings["snapshot_path_hash"]=\
diff --git a/modules/snapshot_target.py b/modules/snapshot_target.py
index e93a86a..79c1f03 100644
--- a/modules/snapshot_target.py
+++ b/modules/snapshot_target.py
@@ -18,8 +18,9 @@ class snapshot_target(generic_stage_target):
self.settings=myspec
self.settings["target_subpath"]="portage"
st=self.settings["storedir"]
- self.settings["snapshot_path"]=normpath(st+"/snapshots/portage-"+self.settings["version_stamp"]\
- +".tar.bz2")
+ self.settings["snapshot_path"]=normpath(st + "/snapshots/"
+ + self.settings["snapshot_name"]
+ + self.settings["version_stamp"] + ".tar.bz2")
self.settings["tmp_path"]=normpath(st+"/tmp/"+self.settings["target_subpath"])
def setup(self):
@@ -46,11 +47,14 @@ class snapshot_target(generic_stage_target):
if not os.path.exists(mytmp):
os.makedirs(mytmp)
- cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ --exclude /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-* "+\
- self.settings["portdir"]+"/ "+mytmp+"/portage/","Snapshot failure",env=self.env)
+ cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ " + \
+ "--exclude /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-* "+\
+ self.settings["portdir"] + "/ " + mytmp + "/%s/" % self.settings["repo_name"],
+ "Snapshot failure",env=self.env)
print "Compressing Portage snapshot tarball..."
- cmd("tar -I lbzip2 -cf "+self.settings["snapshot_path"]+" -C "+mytmp+" portage",\
+ cmd("tar -I lbzip2 -cf " + self.settings["snapshot_path"] + " -C " +
+ mytmp + " %s" % self.settings["repo_name"],
"Snapshot creation failure",env=self.env)
self.gen_contents_file(self.settings["snapshot_path"])
diff --git a/modules/tinderbox_target.py b/modules/tinderbox_target.py
index 46fe082..d6d3ea3 100644
--- a/modules/tinderbox_target.py
+++ b/modules/tinderbox_target.py
@@ -29,8 +29,8 @@ class tinderbox_target(generic_stage_target):
raise CatalystError,"Tinderbox aborting due to error."
def set_cleanables(self):
- self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/root/*",\
- "/usr/portage"]
+ self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/root/*",
+ self.settings['portdir']]
def set_action_sequence(self):
#Default action sequence for run method
--
1.8.1.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-catalyst] [PATCH 3/4] Remove self.mounts and self.mountmap's use of paths for keys and paths.
2013-02-28 1:46 [gentoo-catalyst] [PATCH 0/4] Some general cleanup, remove some hardcoding of paths Brian Dolbec
2013-02-28 1:46 ` [gentoo-catalyst] [PATCH 1/4] Whitespace cleanup Brian Dolbec
2013-02-28 1:46 ` [gentoo-catalyst] [PATCH 2/4] Add more configured defaults Brian Dolbec
@ 2013-02-28 1:47 ` Brian Dolbec
2013-02-28 3:01 ` Brian Dolbec
2013-02-28 1:47 ` [gentoo-catalyst] [PATCH 4/4] cleanup long lines, improve useage() output formatting slightly Brian Dolbec
2013-02-28 13:17 ` [gentoo-catalyst] [PATCH 0/4] Some general cleanup, remove some hardcoding of paths W. Trevor King
4 siblings, 1 reply; 11+ messages in thread
From: Brian Dolbec @ 2013-02-28 1:47 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Brian Dolbec
Migrate more hardcoded paths to use settings variables instead.
Signed-off-by: Brian Dolbec <dolsen@gentoo.org>
---
modules/generic_stage_target.py | 80 ++++++++++++++++++++---------------------
1 file changed, 40 insertions(+), 40 deletions(-)
diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py
index c79f8ae..927b4c3 100644
--- a/modules/generic_stage_target.py
+++ b/modules/generic_stage_target.py
@@ -179,11 +179,11 @@ class generic_stage_target(generic_target):
"/usr/portage":self.settings["snapshot_cache_path"]+"/portage",\
"/usr/portage/distfiles":self.settings["distdir"],"/var/tmp/portage":"tmpfs"}
else:
- self.mounts=["/proc","/dev","/usr/portage/distfiles","/var/tmp/portage"]
- self.mountmap={"/proc":"/proc","/dev":"/dev","/dev/pts":"/dev/pts",\
- "/usr/portage/distfiles":self.settings["distdir"],"/var/tmp/portage":"tmpfs"}
+ self.mounts=["proc","dev", "distdir", "port_tmpdir"]
+ self.mountmap={"proc":"/proc", "dev":"/dev", "pts":"/dev/pts",
+ "distdir":self.settings["distdir"], "port_tmpdir":"tmpfs"}
if os.uname()[0] == "Linux":
- self.mounts.append("/dev/pts")
+ self.mounts.append("pts")
self.set_mounts()
@@ -195,16 +195,15 @@ class generic_stage_target(generic_target):
self.set_pkgcache_path()
print "Location of the package cache is "+\
self.settings["pkgcache_path"]
- self.mounts.append("/usr/portage/packages")
- self.mountmap["/usr/portage/packages"]=\
- self.settings["pkgcache_path"]
+ self.mounts.append("packagedir")
+ self.mountmap["packagedir"] = self.settings["pkgcache_path"]
if "KERNCACHE" in self.settings:
self.set_kerncache_path()
print "Location of the kerncache is "+\
self.settings["kerncache_path"]
- self.mounts.append("/tmp/kerncache")
- self.mountmap["/tmp/kerncache"]=self.settings["kerncache_path"]
+ self.mounts.append("kerncache")
+ self.mountmap["kerncache"]=self.settings["kerncache_path"]
if "CCACHE" in self.settings:
if "CCACHE_DIR" in os.environ:
@@ -216,8 +215,8 @@ class generic_stage_target(generic_target):
raise CatalystError,\
"Compiler cache support can't be enabled (can't find "+\
ccdir+")"
- self.mounts.append("/var/tmp/ccache")
- self.mountmap["/var/tmp/ccache"]=ccdir
+ self.mounts.append("ccache")
+ self.mountmap["ccache"]=ccdir
""" for the chroot: """
self.env["CCACHE_DIR"]="/var/tmp/ccache"
@@ -406,7 +405,7 @@ class generic_stage_target(generic_target):
def set_cleanables(self):
self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/tmp/*",\
- "/root/*","/usr/portage"]
+ "/root/*", self.settings["portdir"]]
def set_snapshot_path(self):
self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
@@ -615,21 +614,21 @@ class generic_stage_target(generic_target):
return
for x in self.mounts:
- if not os.path.exists(mypath+x):
+ if not os.path.exists(mypath + self.mountmap[x]):
continue
- if ismount(mypath+x):
+ if ismount(mypath +self.mountmap[x]):
""" Something is still mounted "" """
try:
- print x+" is still mounted; performing auto-bind-umount...",
+ print self.mountmap[x] + " is still mounted; performing auto-bind-umount...",
""" Try to umount stuff ourselves """
self.unbind()
- if ismount(mypath+x):
- raise CatalystError, "Auto-unbind failed for "+x
+ if ismount(mypath + self.mountmap[x]):
+ raise CatalystError, "Auto-unbind failed for " + self.mountmap[x]
else:
print "Auto-unbind successful..."
except CatalystError:
- raise CatalystError, "Unable to auto-unbind "+x
+ raise CatalystError, "Unable to auto-unbind " + self.mountmap[x]
def unpack(self):
unpack=True
@@ -787,7 +786,7 @@ class generic_stage_target(generic_target):
print "Valid snapshot cache, skipping unpack of portage tree..."
unpack=False
else:
- destdir=normpath(self.settings["chroot_path"]+"/usr/portage")
+ destdir=normpath(self.settings["chroot_path"] + self.settings["portdir"])
cleanup_errmsg="Error removing existing snapshot directory."
cleanup_msg=\
"Cleaning up existing portage tree (This can take a long time)..."
@@ -801,7 +800,7 @@ class generic_stage_target(generic_target):
if "AUTORESUME" in self.settings \
and os.path.exists(self.settings["chroot_path"]+\
- "/usr/portage/") \
+ self.settings["portdir"]) \
and os.path.exists(self.settings["autoresume_path"]\
+"unpack_portage") \
and self.settings["snapshot_path_hash"] == snapshot_hash:
@@ -848,7 +847,7 @@ class generic_stage_target(generic_target):
cmd("rm -f "+self.settings["chroot_path"]+"/etc/portage/make.profile",\
"Error zapping profile link",env=self.env)
cmd("mkdir -p "+self.settings["chroot_path"]+"/etc/portage/")
- cmd("ln -sf ../../usr/portage/profiles/"+\
+ cmd("ln -sf ../.." + self.settings["portdir"] + "/profiles/"+\
self.settings["target_profile"]+" "+\
self.settings["chroot_path"]+"/etc/portage/make.profile",\
"Error creating profile link",env=self.env)
@@ -874,10 +873,10 @@ class generic_stage_target(generic_target):
if os.path.exists(x):
print "Copying overlay dir " +x
cmd("mkdir -p "+self.settings["chroot_path"]+\
- "/usr/local/portage",\
+ self.settings["local_overlay"],\
"Could not make portage_overlay dir",env=self.env)
cmd("cp -R "+x+"/* "+self.settings["chroot_path"]+\
- "/usr/local/portage",\
+ self.settings["local_overlay"],\
"Could not copy portage_overlay",env=self.env)
def root_overlay(self):
@@ -897,7 +896,7 @@ class generic_stage_target(generic_target):
def bind(self):
for x in self.mounts:
- if not os.path.exists(self.settings["chroot_path"]+x):
+ if not os.path.exists(self.settings["chroot_path"] + self.mountmap[x]):
os.makedirs(self.settings["chroot_path"]+x,0755)
if not os.path.exists(self.mountmap[x]):
@@ -909,11 +908,11 @@ class generic_stage_target(generic_target):
self.snapshot_lock_object.read_lock()
if os.uname()[0] == "FreeBSD":
if src == "/dev":
- retval=os.system("mount -t devfs none "+\
- self.settings["chroot_path"]+x)
+ retval=os.system("mount -t devfs none " +
+ self.settings["chroot_path"] + src)
else:
- retval=os.system("mount_nullfs "+src+" "+\
- self.settings["chroot_path"]+x)
+ retval=os.system("mount_nullfs " + src + " " +
+ self.settings["chroot_path"] + src)
else:
if src == "tmpfs":
if "var_tmpfs_portage" in self.settings:
@@ -921,11 +920,11 @@ class generic_stage_target(generic_target):
self.settings["var_tmpfs_portage"]+"G "+src+" "+\
self.settings["chroot_path"]+x)
else:
- retval=os.system("mount --bind "+src+" "+\
- self.settings["chroot_path"]+x)
+ retval=os.system("mount --bind " + src + " " +
+ self.settings["chroot_path"] + src)
if retval!=0:
self.unbind()
- raise CatalystError,"Couldn't bind mount "+src
+ raise CatalystError,"Couldn't bind mount " + src
def unbind(self):
ouch=0
@@ -934,25 +933,26 @@ class generic_stage_target(generic_target):
myrevmounts.reverse()
""" Unmount in reverse order for nested bind-mounts """
for x in myrevmounts:
- if not os.path.exists(mypath+x):
+ if not os.path.exists(mypath + self.mountmap[x]):
continue
- if not ismount(mypath+x):
+ if not ismount(mypath + self.mountmap[x]):
continue
retval=os.system("umount "+\
- os.path.join(mypath,x.lstrip(os.path.sep)))
+ os.path.join(mypath, self.mountmap[x].lstrip(os.path.sep)))
if retval!=0:
- warn("First attempt to unmount: "+mypath+x+" failed.")
+ warn("First attempt to unmount: " + mypath +
+ self.mountmap[x] +" failed.")
warn("Killing any pids still running in the chroot")
self.kill_chroot_pids()
- retval2=os.system("umount "+mypath+x)
+ retval2=os.system("umount " + mypath + self.mountmap[x])
if retval2!=0:
ouch=1
- warn("Couldn't umount bind mount: "+mypath+x)
+ warn("Couldn't umount bind mount: " + mypath + self.mountmap[x])
if "SNAPCACHE" in self.settings and x == "/usr/portage":
try:
@@ -1114,9 +1114,9 @@ class generic_stage_target(generic_target):
"Could not replace /etc/hosts",env=self.env)
""" Remove our overlay """
- if os.path.exists(self.settings["chroot_path"]+"/usr/local/portage"):
- cmd("rm -rf "+self.settings["chroot_path"]+"/usr/local/portage",\
- "Could not remove /usr/local/portage",env=self.env)
+ if os.path.exists(self.settings["chroot_path"] + self.settings["local_overlay"]):
+ cmd("rm -rf " + self.settings["chroot_path"] + self.settings["local_overlay"],
+ "Could not remove " + self.settings["local_overlay"], env=self.env)
cmd("sed -i '/^PORTDIR_OVERLAY/d' "+self.settings["chroot_path"]+\
"/etc/portage/make.conf",\
"Could not remove PORTDIR_OVERLAY from make.conf",env=self.env)
--
1.8.1.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-catalyst] [PATCH 4/4] cleanup long lines, improve useage() output formatting slightly
2013-02-28 1:46 [gentoo-catalyst] [PATCH 0/4] Some general cleanup, remove some hardcoding of paths Brian Dolbec
` (2 preceding siblings ...)
2013-02-28 1:47 ` [gentoo-catalyst] [PATCH 3/4] Remove self.mounts and self.mountmap's use of paths for keys and paths Brian Dolbec
@ 2013-02-28 1:47 ` Brian Dolbec
2013-02-28 13:17 ` [gentoo-catalyst] [PATCH 0/4] Some general cleanup, remove some hardcoding of paths W. Trevor King
4 siblings, 0 replies; 11+ messages in thread
From: Brian Dolbec @ 2013-02-28 1:47 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Brian Dolbec
Signed-off-by: Brian Dolbec <dolsen@gentoo.org>
---
catalyst | 81 +++++++++++++++++++++++++++++++++++++---------------------------
1 file changed, 47 insertions(+), 34 deletions(-)
diff --git a/catalyst b/catalyst
index 0878ce4..2a9b75c 100755
--- a/catalyst
+++ b/catalyst
@@ -24,31 +24,33 @@ __version__="2.0.12.2"
conf_values={}
def usage():
- print "Usage catalyst [options] [-C variable=value...] [ -s identifier]"
- print " -a --clear-autoresume clear autoresume flags"
- print " -c --config use specified configuration file"
- print " -C --cli catalyst commandline (MUST BE LAST OPTION)"
- print " -d --debug enable debugging"
- print " -f --file read specfile"
- print " -F --fetchonly fetch files only"
- print " -h --help print this help message"
- print " -p --purge clear tmp dirs,package cache and autoresume flags"
- print " -P --purgeonly clear tmp dirs,package cache and autoresume flags and exit"
- print " -T --purgetmponly clear tmp dirs and autoresume flags and exit"
- print " -s --snapshot generate a release snapshot"
- print " -V --version display version information"
- print " -v --verbose verbose output"
- print
- print "Usage examples:"
- print
- print "Using the commandline option (-C, --cli) to build a Portage snapshot:"
- print "catalyst -C target=snapshot version_stamp=my_date"
- print
- print "Using the snapshot option (-s, --snapshot) to build a release snapshot:"
- print "catalyst -s 20071121"
- print
- print "Using the specfile option (-f, --file) to build a stage target:"
- print "catalyst -f stage1-specfile.spec"
+ print """Usage catalyst [options] [-C variable=value...] [ -s identifier]
+ -a --clear-autoresume clear autoresume flags
+ -c --config use specified configuration file
+ -C --cli catalyst commandline (MUST BE LAST OPTION)
+ -d --debug enable debugging
+ -f --file read specfile
+ -F --fetchonly fetch files only
+ -h --help print this help message
+ -p --purge clear tmp dirs,package cache, autoresume flags
+ -P --purgeonly clear tmp dirs,package cache, autoresume flags and exit
+ -T --purgetmponly clear tmp dirs and autoresume flags and exit
+ -s --snapshot generate a release snapshot
+ -V --version display version information
+ -v --verbose verbose output
+
+Usage examples:
+
+Using the commandline option (-C, --cli) to build a Portage snapshot:
+catalyst -C target=snapshot version_stamp=my_date
+
+Using the snapshot option (-s, --snapshot) to build a release snapshot:
+catalyst -s 20071121"
+
+Using the specfile option (-f, --file) to build a stage target:
+catalyst -f stage1-specfile.spec
+"""
+
def version():
print "Catalyst, version "+__version__
@@ -78,7 +80,8 @@ def parse_config(myconfig):
# first, try the one passed (presumably from the cmdline)
if myconfig:
if os.path.exists(myconfig):
- print "Using command line specified Catalyst configuration file, "+myconfig
+ print "Using command line specified Catalyst configuration file, "+\
+ myconfig
config_file=myconfig
else:
@@ -88,7 +91,8 @@ def parse_config(myconfig):
# next, try the default location
elif os.path.exists("/etc/catalyst/catalyst.conf"):
- print "Using default Catalyst configuration file, /etc/catalyst/catalyst.conf"
+ print "Using default Catalyst configuration file," + \
+ " /etc/catalyst/catalyst.conf"
config_file="/etc/catalyst/catalyst.conf"
# can't find a config file (we are screwed), so bail out
@@ -188,14 +192,16 @@ def parse_config(myconfig):
conf_values["port_logdir"]=myconf["port_logdir"];
def import_modules():
- # import catalyst's own modules (i.e. catalyst_support and the arch modules)
+ # import catalyst's own modules
+ # (i.e. catalyst_support and the arch modules)
targetmap={}
try:
for x in required_build_targets:
try:
fh=open(conf_values["sharedir"]+"/modules/"+x+".py")
- module=imp.load_module(x,fh,"modules/"+x+".py",(".py","r",imp.PY_SOURCE))
+ module=imp.load_module(x,fh,"modules/"+x+".py",
+ (".py","r",imp.PY_SOURCE))
fh.close()
except IOError:
@@ -205,7 +211,8 @@ def import_modules():
for x in valid_build_targets:
try:
fh=open(conf_values["sharedir"]+"/modules/"+x+".py")
- module=imp.load_module(x,fh,"modules/"+x+".py",(".py","r",imp.PY_SOURCE))
+ module=imp.load_module(x,fh,"modules/"+x+".py",
+ (".py","r",imp.PY_SOURCE))
module.register(targetmap)
fh.close()
@@ -223,7 +230,8 @@ def import_modules():
def build_target(addlargs, targetmap):
try:
if addlargs["target"] not in targetmap:
- raise CatalystError,"Target \""+addlargs["target"]+"\" not available."
+ raise CatalystError, \
+ "Target \"%s\" not available." % addlargs["target"]
mytarget=targetmap[addlargs["target"]](conf_values, addlargs)
@@ -231,7 +239,8 @@ def build_target(addlargs, targetmap):
except:
catalyst.util.print_traceback()
- print "!!! catalyst: Error encountered during run of target " + addlargs["target"]
+ print "!!! catalyst: Error encountered during run of target " + \
+ addlargs["target"]
sys.exit(1)
if __name__ == "__main__":
@@ -250,8 +259,12 @@ if __name__ == "__main__":
# parse out the command line arguments
try:
- opts,args = getopt.getopt(sys.argv[1:], "apPThvdc:C:f:FVs:", ["purge", "purgeonly", "purgetmponly", "help", "version", "debug",\
- "clear-autoresume", "config=", "cli=", "file=", "fetch", "verbose","snapshot="])
+ opts,args = getopt.getopt(sys.argv[1:], "apPThvdc:C:f:FVs:",
+ ["purge", "purgeonly", "purgetmponly", "help", "version", "debug",
+ "clear-autoresume", "config=", "cli=", "file=", "fetch",
+ "verbose","snapshot="
+ ]
+ )
except getopt.GetoptError:
usage()
--
1.8.1.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [gentoo-catalyst] [PATCH 3/4] Remove self.mounts and self.mountmap's use of paths for keys and paths.
2013-02-28 1:47 ` [gentoo-catalyst] [PATCH 3/4] Remove self.mounts and self.mountmap's use of paths for keys and paths Brian Dolbec
@ 2013-02-28 3:01 ` Brian Dolbec
0 siblings, 0 replies; 11+ messages in thread
From: Brian Dolbec @ 2013-02-28 3:01 UTC (permalink / raw
To: gentoo-catalyst
I just saw there are number of more fixes for this in a commit much
later after the restructure. So this one is not complete.
On Wed, 2013-02-27 at 17:47 -0800, Brian Dolbec wrote:
> Migrate more hardcoded paths to use settings variables instead.
>
> Signed-off-by: Brian Dolbec <dolsen@gentoo.org>
> ---
> modules/generic_stage_target.py | 80 ++++++++++++++++++++---------------------
> 1 file changed, 40 insertions(+), 40 deletions(-)
>
> diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py
> index c79f8ae..927b4c3 100644
> --- a/modules/generic_stage_target.py
> +++ b/modules/generic_stage_target.py
> @@ -179,11 +179,11 @@ class generic_stage_target(generic_target):
> "/usr/portage":self.settings["snapshot_cache_path"]+"/portage",\
> "/usr/portage/distfiles":self.settings["distdir"],"/var/tmp/portage":"tmpfs"}
> else:
> - self.mounts=["/proc","/dev","/usr/portage/distfiles","/var/tmp/portage"]
> - self.mountmap={"/proc":"/proc","/dev":"/dev","/dev/pts":"/dev/pts",\
> - "/usr/portage/distfiles":self.settings["distdir"],"/var/tmp/portage":"tmpfs"}
> + self.mounts=["proc","dev", "distdir", "port_tmpdir"]
> + self.mountmap={"proc":"/proc", "dev":"/dev", "pts":"/dev/pts",
> + "distdir":self.settings["distdir"], "port_tmpdir":"tmpfs"}
> if os.uname()[0] == "Linux":
> - self.mounts.append("/dev/pts")
> + self.mounts.append("pts")
>
> self.set_mounts()
>
> @@ -195,16 +195,15 @@ class generic_stage_target(generic_target):
> self.set_pkgcache_path()
> print "Location of the package cache is "+\
> self.settings["pkgcache_path"]
> - self.mounts.append("/usr/portage/packages")
> - self.mountmap["/usr/portage/packages"]=\
> - self.settings["pkgcache_path"]
> + self.mounts.append("packagedir")
> + self.mountmap["packagedir"] = self.settings["pkgcache_path"]
>
> if "KERNCACHE" in self.settings:
> self.set_kerncache_path()
> print "Location of the kerncache is "+\
> self.settings["kerncache_path"]
> - self.mounts.append("/tmp/kerncache")
> - self.mountmap["/tmp/kerncache"]=self.settings["kerncache_path"]
> + self.mounts.append("kerncache")
> + self.mountmap["kerncache"]=self.settings["kerncache_path"]
>
> if "CCACHE" in self.settings:
> if "CCACHE_DIR" in os.environ:
> @@ -216,8 +215,8 @@ class generic_stage_target(generic_target):
> raise CatalystError,\
> "Compiler cache support can't be enabled (can't find "+\
> ccdir+")"
> - self.mounts.append("/var/tmp/ccache")
> - self.mountmap["/var/tmp/ccache"]=ccdir
> + self.mounts.append("ccache")
> + self.mountmap["ccache"]=ccdir
> """ for the chroot: """
> self.env["CCACHE_DIR"]="/var/tmp/ccache"
>
> @@ -406,7 +405,7 @@ class generic_stage_target(generic_target):
>
> def set_cleanables(self):
> self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/tmp/*",\
> - "/root/*","/usr/portage"]
> + "/root/*", self.settings["portdir"]]
>
> def set_snapshot_path(self):
> self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
> @@ -615,21 +614,21 @@ class generic_stage_target(generic_target):
> return
>
> for x in self.mounts:
> - if not os.path.exists(mypath+x):
> + if not os.path.exists(mypath + self.mountmap[x]):
> continue
>
> - if ismount(mypath+x):
> + if ismount(mypath +self.mountmap[x]):
> """ Something is still mounted "" """
> try:
> - print x+" is still mounted; performing auto-bind-umount...",
> + print self.mountmap[x] + " is still mounted; performing auto-bind-umount...",
> """ Try to umount stuff ourselves """
> self.unbind()
> - if ismount(mypath+x):
> - raise CatalystError, "Auto-unbind failed for "+x
> + if ismount(mypath + self.mountmap[x]):
> + raise CatalystError, "Auto-unbind failed for " + self.mountmap[x]
> else:
> print "Auto-unbind successful..."
> except CatalystError:
> - raise CatalystError, "Unable to auto-unbind "+x
> + raise CatalystError, "Unable to auto-unbind " + self.mountmap[x]
>
> def unpack(self):
> unpack=True
> @@ -787,7 +786,7 @@ class generic_stage_target(generic_target):
> print "Valid snapshot cache, skipping unpack of portage tree..."
> unpack=False
> else:
> - destdir=normpath(self.settings["chroot_path"]+"/usr/portage")
> + destdir=normpath(self.settings["chroot_path"] + self.settings["portdir"])
> cleanup_errmsg="Error removing existing snapshot directory."
> cleanup_msg=\
> "Cleaning up existing portage tree (This can take a long time)..."
> @@ -801,7 +800,7 @@ class generic_stage_target(generic_target):
>
> if "AUTORESUME" in self.settings \
> and os.path.exists(self.settings["chroot_path"]+\
> - "/usr/portage/") \
> + self.settings["portdir"]) \
> and os.path.exists(self.settings["autoresume_path"]\
> +"unpack_portage") \
> and self.settings["snapshot_path_hash"] == snapshot_hash:
> @@ -848,7 +847,7 @@ class generic_stage_target(generic_target):
> cmd("rm -f "+self.settings["chroot_path"]+"/etc/portage/make.profile",\
> "Error zapping profile link",env=self.env)
> cmd("mkdir -p "+self.settings["chroot_path"]+"/etc/portage/")
> - cmd("ln -sf ../../usr/portage/profiles/"+\
> + cmd("ln -sf ../.." + self.settings["portdir"] + "/profiles/"+\
> self.settings["target_profile"]+" "+\
> self.settings["chroot_path"]+"/etc/portage/make.profile",\
> "Error creating profile link",env=self.env)
> @@ -874,10 +873,10 @@ class generic_stage_target(generic_target):
> if os.path.exists(x):
> print "Copying overlay dir " +x
> cmd("mkdir -p "+self.settings["chroot_path"]+\
> - "/usr/local/portage",\
> + self.settings["local_overlay"],\
> "Could not make portage_overlay dir",env=self.env)
> cmd("cp -R "+x+"/* "+self.settings["chroot_path"]+\
> - "/usr/local/portage",\
> + self.settings["local_overlay"],\
> "Could not copy portage_overlay",env=self.env)
>
> def root_overlay(self):
> @@ -897,7 +896,7 @@ class generic_stage_target(generic_target):
>
> def bind(self):
> for x in self.mounts:
> - if not os.path.exists(self.settings["chroot_path"]+x):
> + if not os.path.exists(self.settings["chroot_path"] + self.mountmap[x]):
> os.makedirs(self.settings["chroot_path"]+x,0755)
>
> if not os.path.exists(self.mountmap[x]):
> @@ -909,11 +908,11 @@ class generic_stage_target(generic_target):
> self.snapshot_lock_object.read_lock()
> if os.uname()[0] == "FreeBSD":
> if src == "/dev":
> - retval=os.system("mount -t devfs none "+\
> - self.settings["chroot_path"]+x)
> + retval=os.system("mount -t devfs none " +
> + self.settings["chroot_path"] + src)
> else:
> - retval=os.system("mount_nullfs "+src+" "+\
> - self.settings["chroot_path"]+x)
> + retval=os.system("mount_nullfs " + src + " " +
> + self.settings["chroot_path"] + src)
> else:
> if src == "tmpfs":
> if "var_tmpfs_portage" in self.settings:
> @@ -921,11 +920,11 @@ class generic_stage_target(generic_target):
> self.settings["var_tmpfs_portage"]+"G "+src+" "+\
> self.settings["chroot_path"]+x)
> else:
> - retval=os.system("mount --bind "+src+" "+\
> - self.settings["chroot_path"]+x)
> + retval=os.system("mount --bind " + src + " " +
> + self.settings["chroot_path"] + src)
> if retval!=0:
> self.unbind()
> - raise CatalystError,"Couldn't bind mount "+src
> + raise CatalystError,"Couldn't bind mount " + src
>
> def unbind(self):
> ouch=0
> @@ -934,25 +933,26 @@ class generic_stage_target(generic_target):
> myrevmounts.reverse()
> """ Unmount in reverse order for nested bind-mounts """
> for x in myrevmounts:
> - if not os.path.exists(mypath+x):
> + if not os.path.exists(mypath + self.mountmap[x]):
> continue
>
> - if not ismount(mypath+x):
> + if not ismount(mypath + self.mountmap[x]):
> continue
>
> retval=os.system("umount "+\
> - os.path.join(mypath,x.lstrip(os.path.sep)))
> + os.path.join(mypath, self.mountmap[x].lstrip(os.path.sep)))
>
> if retval!=0:
> - warn("First attempt to unmount: "+mypath+x+" failed.")
> + warn("First attempt to unmount: " + mypath +
> + self.mountmap[x] +" failed.")
> warn("Killing any pids still running in the chroot")
>
> self.kill_chroot_pids()
>
> - retval2=os.system("umount "+mypath+x)
> + retval2=os.system("umount " + mypath + self.mountmap[x])
> if retval2!=0:
> ouch=1
> - warn("Couldn't umount bind mount: "+mypath+x)
> + warn("Couldn't umount bind mount: " + mypath + self.mountmap[x])
>
> if "SNAPCACHE" in self.settings and x == "/usr/portage":
> try:
> @@ -1114,9 +1114,9 @@ class generic_stage_target(generic_target):
> "Could not replace /etc/hosts",env=self.env)
>
> """ Remove our overlay """
> - if os.path.exists(self.settings["chroot_path"]+"/usr/local/portage"):
> - cmd("rm -rf "+self.settings["chroot_path"]+"/usr/local/portage",\
> - "Could not remove /usr/local/portage",env=self.env)
> + if os.path.exists(self.settings["chroot_path"] + self.settings["local_overlay"]):
> + cmd("rm -rf " + self.settings["chroot_path"] + self.settings["local_overlay"],
> + "Could not remove " + self.settings["local_overlay"], env=self.env)
> cmd("sed -i '/^PORTDIR_OVERLAY/d' "+self.settings["chroot_path"]+\
> "/etc/portage/make.conf",\
> "Could not remove PORTDIR_OVERLAY from make.conf",env=self.env)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-catalyst] [PATCH 1/4] Whitespace cleanup.
2013-02-28 1:46 ` [gentoo-catalyst] [PATCH 1/4] Whitespace cleanup Brian Dolbec
@ 2013-02-28 11:46 ` W. Trevor King
2013-02-28 23:44 ` Matt Turner
2013-03-09 2:36 ` Matt Turner
1 sibling, 1 reply; 11+ messages in thread
From: W. Trevor King @ 2013-02-28 11:46 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Brian Dolbec
[-- Attachment #1: Type: text/plain, Size: 1004 bytes --]
On Wed, Feb 27, 2013 at 05:46:58PM -0800, Brian Dolbec wrote:
> Run the following command to cleanup whitespace.
> for FILE in $(git ls-tree -r --name-only HEAD | grep -v 'bz2$'); do
> sed -i 's/[[:space:]]*$//' "$FILE"
> done
Since you dropped the changes to COPYING, you should probably add
COPYING to the grep (grep -v 'bz2$\|COPYING') or add `git checkout
COPYING` after the for loop.
> Signed-off-by: Brian Dolbec <dolsen@gentoo.org>
I don't thing this is appropriate for catalyst, since we never
document its meaning for this project. If we *do* want to add
Linux/Git-style sign-offs, I've got the docs all pulled out into their
own GPLv2 project [1], which could be merged into catalyst. In this
case, I imagine it's not worth the trouble ;).
Cheers,
Trevor
[1]: https://github.com/wking/signed-off-by/
--
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-catalyst] [PATCH 2/4] Add more configured defaults
2013-02-28 1:46 ` [gentoo-catalyst] [PATCH 2/4] Add more configured defaults Brian Dolbec
@ 2013-02-28 11:51 ` W. Trevor King
0 siblings, 0 replies; 11+ messages in thread
From: W. Trevor King @ 2013-02-28 11:51 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Brian Dolbec
[-- Attachment #1: Type: text/plain, Size: 476 bytes --]
On Wed, Feb 27, 2013 at 05:46:59PM -0800, Brian Dolbec wrote:
> Use the new configured snapshot_name and portdir settings
> Use the portdir setting rather than hard-coded path
You add other settings that you don't use yet ('packagedir',
'port_tmpdir'). I'd postpone their addition until you actually use
them.
--
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-catalyst] [PATCH 0/4] Some general cleanup, remove some hardcoding of paths.
2013-02-28 1:46 [gentoo-catalyst] [PATCH 0/4] Some general cleanup, remove some hardcoding of paths Brian Dolbec
` (3 preceding siblings ...)
2013-02-28 1:47 ` [gentoo-catalyst] [PATCH 4/4] cleanup long lines, improve useage() output formatting slightly Brian Dolbec
@ 2013-02-28 13:17 ` W. Trevor King
4 siblings, 0 replies; 11+ messages in thread
From: W. Trevor King @ 2013-02-28 13:17 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Brian Dolbec
[-- Attachment #1: Type: text/plain, Size: 1572 bytes --]
On Wed, Feb 27, 2013 at 05:46:57PM -0800, Brian Dolbec wrote:
> There are several more bugfixes I feel shuld be applied to master if
> you intend on releasing a bug fix version bump. They will have to
> be applied manually since the file names and locations have changed
> in the rewrite.
Git records abbreviated blob SHAs in the diff:
diff --git a/ChangeLog b/ChangeLog
index 893cfec..12b41f2 100644
--- a/ChangeLog
+++ b/ChangeLog
which it can use to apply patches to files, even if the patched blobs
have been renamed in a separate commit. You have to use the `--3way`
option with `git am` to turn this functionality on, though. For
example:
$ mkdir test-repo
$ cd test-repo
$ git init
$ echo 'hello world' > README
$ git add README
$ git commit -m 'README: create with dummy content'
$ git mv README{,-b}
$ git commit -am 'README-b: moved from README'
$ echo 'goodbye world' >> README-b
$ git commit -am 'README: edited'
$ git format-patch HEAD^
$ git reset --hard HEAD^^
$ git am -3 *patch
Works (even though we reset to before the rename), as we can see with:
$ git --no-pager log --oneline
c587719 README: edited
ee5ec97 README: create with dummy content
$ cat README
hello world
goodbye world
However, the fact that Git *can* apply patches like this doesn't mean
that it's a good idea ;).
Cheers,
Trevor
--
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-catalyst] [PATCH 1/4] Whitespace cleanup.
2013-02-28 11:46 ` W. Trevor King
@ 2013-02-28 23:44 ` Matt Turner
0 siblings, 0 replies; 11+ messages in thread
From: Matt Turner @ 2013-02-28 23:44 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Brian Dolbec
On Thu, Feb 28, 2013 at 3:46 AM, W. Trevor King <wking@tremily.us> wrote:
> On Wed, Feb 27, 2013 at 05:46:58PM -0800, Brian Dolbec wrote:
>> Run the following command to cleanup whitespace.
>> for FILE in $(git ls-tree -r --name-only HEAD | grep -v 'bz2$'); do
>> sed -i 's/[[:space:]]*$//' "$FILE"
>> done
>
> Since you dropped the changes to COPYING, you should probably add
> COPYING to the grep (grep -v 'bz2$\|COPYING') or add `git checkout
> COPYING` after the for loop.
>
>> Signed-off-by: Brian Dolbec <dolsen@gentoo.org>
>
> I don't thing this is appropriate for catalyst, since we never
> document its meaning for this project. If we *do* want to add
> Linux/Git-style sign-offs, I've got the docs all pulled out into their
> own GPLv2 project [1], which could be merged into catalyst. In this
> case, I imagine it's not worth the trouble ;).
Yeah, I don't think S-o-B adds anything. I've stopped using them for
everything but the X server and kernel.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-catalyst] [PATCH 1/4] Whitespace cleanup.
2013-02-28 1:46 ` [gentoo-catalyst] [PATCH 1/4] Whitespace cleanup Brian Dolbec
2013-02-28 11:46 ` W. Trevor King
@ 2013-03-09 2:36 ` Matt Turner
1 sibling, 0 replies; 11+ messages in thread
From: Matt Turner @ 2013-03-09 2:36 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Brian Dolbec
On Wed, Feb 27, 2013 at 5:46 PM, Brian Dolbec <dolsen@gentoo.org> wrote:
> Run the following command to cleanup whitespace.
> for FILE in $(git ls-tree -r --name-only HEAD | grep -v 'bz2$'); do
> sed -i 's/[[:space:]]*$//' "$FILE"
> done
>
> Signed-off-by: Brian Dolbec <dolsen@gentoo.org>
> ---
Committed with Trevor's suggestions in the commit message.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-03-09 2:36 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-28 1:46 [gentoo-catalyst] [PATCH 0/4] Some general cleanup, remove some hardcoding of paths Brian Dolbec
2013-02-28 1:46 ` [gentoo-catalyst] [PATCH 1/4] Whitespace cleanup Brian Dolbec
2013-02-28 11:46 ` W. Trevor King
2013-02-28 23:44 ` Matt Turner
2013-03-09 2:36 ` Matt Turner
2013-02-28 1:46 ` [gentoo-catalyst] [PATCH 2/4] Add more configured defaults Brian Dolbec
2013-02-28 11:51 ` W. Trevor King
2013-02-28 1:47 ` [gentoo-catalyst] [PATCH 3/4] Remove self.mounts and self.mountmap's use of paths for keys and paths Brian Dolbec
2013-02-28 3:01 ` Brian Dolbec
2013-02-28 1:47 ` [gentoo-catalyst] [PATCH 4/4] cleanup long lines, improve useage() output formatting slightly Brian Dolbec
2013-02-28 13:17 ` [gentoo-catalyst] [PATCH 0/4] Some general cleanup, remove some hardcoding of paths W. Trevor King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox