public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/catalyst:master commit in: doc/, catalyst/base/, catalyst/
@ 2020-04-17 19:52 Matt Turner
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Turner @ 2020-04-17 19:52 UTC (permalink / raw
  To: gentoo-commits

commit:     bb21b8615e64cb31fa9aa9d533ef328dc1374e45
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 17 18:03:02 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Fri Apr 17 19:51:32 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=bb21b861

catalyst: gzip the .CONTENTS file

Other algorithms give better compression ratios, but the difference is
not meaningful for a 2MiB text file. In my testing bzip2 gave a better
compression ratio of 15:1 vs gzip's 11:1, but that ends up being only a
size difference of 50KiB (136 vs 187) which is only an additional 2.5%
savings from the uncompressed input.

Choose gzip because transparent decompression is widely supported by web
servers and clients.

Closes: https://bugs.gentoo.org/630284
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/genbase.py | 5 +++--
 catalyst/support.py      | 2 +-
 doc/HOWTO.txt            | 6 +++---
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/catalyst/base/genbase.py b/catalyst/base/genbase.py
index eb09a4e0..3db20f84 100644
--- a/catalyst/base/genbase.py
+++ b/catalyst/base/genbase.py
@@ -2,6 +2,7 @@
 import hashlib
 import io
 import os
+import gzip
 
 class GenBase():
     """
@@ -28,7 +29,7 @@ class GenBase():
     def gen_contents_file(self, path):
         c = self.settings['contents_map']
 
-        with io.open(path + '.CONTENTS', 'w', encoding='utf-8') as file:
+        with gzip.open(path + '.CONTENTS.gz', 'w', encoding='utf-8') as file:
             file.write(c.contents(path, '', verbose=self.settings['VERBOSE']))
 
     def gen_digest_file(self, path):
@@ -36,6 +37,6 @@ class GenBase():
             return
 
         with io.open(path + '.DIGESTS', 'w', encoding='utf-8') as file:
-            for f in [path, path + '.CONTENTS']:
+            for f in [path, path + '.CONTENTS.gz']:
                 for i in self.settings['digests']:
                     file.write(self.generate_hash(f, name=i))

diff --git a/catalyst/support.py b/catalyst/support.py
index 654b23aa..988a81f5 100644
--- a/catalyst/support.py
+++ b/catalyst/support.py
@@ -65,7 +65,7 @@ def file_check(filepath, extensions=None, strict=True):
     files = glob.glob("%s.*" % filepath)
     # remove any false positive files
     files = [x for x in files if not x.endswith(
-        ".CONTENTS") and not x.endswith(".DIGESTS")]
+        ".CONTENTS") and not x.endswith(".CONTENTS.gz") and not x.endswith(".DIGESTS")]
     if len(files) == 1:
         return files[0]
     if len(files) > 1 and strict:

diff --git a/doc/HOWTO.txt b/doc/HOWTO.txt
index 960b5761..7b759121 100644
--- a/doc/HOWTO.txt
+++ b/doc/HOWTO.txt
@@ -22,7 +22,7 @@ Create a snapshot of your current Portage tree (you may want to
     # catalyst --snapshot 20130131
     # ls /var/tmp/catalyst/snapshots/
     portage-20130131.tar.bz2
-    portage-20130131.tar.bz2.CONTENTS
+    portage-20130131.tar.bz2.CONTENTS.gz
     portage-20130131.tar.bz2.DIGESTS
 
 where the storage location is relative to the default
@@ -44,7 +44,7 @@ For example,
 Grab the tarball and put it where catalyst will find it:
 
     # wget http://…/stage3-amd64-20121213.tar.bz2
-    # wget http://…/stage3-amd64-20121213.tar.bz2.CONTENTS
+    # wget http://…/stage3-amd64-20121213.tar.bz2.CONTENTS.gz
     # wget http://…/stage3-amd64-20121213.tar.bz2.DIGESTS.asc
     # sha512sum -c stage3-amd64-20121213.tar.bz2.DIGESTS.asc
     # gpg --verify stage3-amd64-20121213.tar.bz2.DIGESTS.asc
@@ -89,7 +89,7 @@ which will build the target and install something like:
 
     # ls /var/tmp/catalyst/builds/default/stage1-amd64-2013.1.*
     /var/tmp/catalyst/builds/default/stage1-amd64-2013.1.tar.bz2
-    /var/tmp/catalyst/builds/default/stage1-amd64-2013.1.tar.bz2.CONTENTS
+    /var/tmp/catalyst/builds/default/stage1-amd64-2013.1.tar.bz2.CONTENTS.gz
     /var/tmp/catalyst/builds/default/stage1-amd64-2013.1.tar.bz2.DIGESTS
 
 The name is an expansion of


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/catalyst:master commit in: doc/, catalyst/base/, catalyst/
  2021-01-28  1:54 [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/base/, doc/, catalyst/ Matt Turner
@ 2021-01-23 16:22 ` Matt Turner
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Turner @ 2021-01-23 16:22 UTC (permalink / raw
  To: gentoo-commits

commit:     87b0588ab4f77e413c250a4a3e357624ec41c374
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 18 16:52:20 2021 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Sat Jan 23 16:22:22 2021 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=87b0588a

catalyst: Add option to enter the chroot before building

With --enter-chroot, after the mounts and environment are set up,
catalyst will drop you into a shell inside the chroot. Useful for
hacking or debugging.

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py | 16 +++++++++++++++-
 catalyst/main.py           |  4 ++++
 doc/catalyst.1.txt         |  3 +++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 40b60af3..676206ff 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -20,7 +20,7 @@ from catalyst import log
 from catalyst.context import namespace
 from catalyst.defaults import (confdefaults, MOUNT_DEFAULTS, PORT_LOGDIR_CLEAN)
 from catalyst.support import (CatalystError, file_locate, normpath,
-                              cmd, read_makeconf, get_repo_name, ismount,
+                              cmd, command, read_makeconf, get_repo_name,
                               file_check, sanitize_name)
 from catalyst.base.targetbase import TargetBase
 from catalyst.base.clearbase import ClearBase
@@ -95,6 +95,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
             self.chroot_setup,
             self.setup_environment,
         ]
+        if 'enter-chroot' in self.settings['options']:
+            self.build_sequence.append(self.enter_chroot)
+
         self.finish_sequence = []
 
         self.set_valid_build_kernel_vars(addlargs)
@@ -1326,6 +1329,17 @@ class StageBase(TargetBase, ClearBase, GenBase):
 
         log.debug('setup_environment(); env = %r', self.env)
 
+    def enter_chroot(self):
+        chroot = command('chroot')
+        bash = command('bash')
+
+        log.notice("Entering chroot")
+        try:
+            cmd([chroot, self.settings['chroot_path'], bash, '-l'],
+                env=self.env)
+        except CatalystError:
+            pass
+
     def run(self):
         self.chroot_lock.write_lock()
 

diff --git a/catalyst/main.py b/catalyst/main.py
index 48daf004..b0d9015f 100644
--- a/catalyst/main.py
+++ b/catalyst/main.py
@@ -120,6 +120,8 @@ def get_parser():
     parser.add_argument('-V', '--version',
                         action='version', version=get_version(),
                         help='display version information')
+    parser.add_argument('--enter-chroot', default=False, action='store_true',
+                        help='Enter chroot before starting the build')
 
     group = parser.add_argument_group('Program output options')
     group.add_argument('-d', '--debug',
@@ -293,6 +295,8 @@ def _main(parser, opts):
         options.append('purgetmponly')
     if opts.clear_autoresume:
         options.append('clear-autoresume')
+    if opts.enter_chroot:
+        options.append('enter-chroot')
 
     # Make sure we have some work before moving further.
     if not myspecfile and not mycmdline:

diff --git a/doc/catalyst.1.txt b/doc/catalyst.1.txt
index 90d5a24b..217fc86a 100644
--- a/doc/catalyst.1.txt
+++ b/doc/catalyst.1.txt
@@ -39,6 +39,9 @@ configuration file is installed at '/etc/catalyst/catalyst.conf'.
 *-d*::
 Enable debugging mode
 
+*--enter-chroot*::
+Enter the chroot before starting the build.
+
 *--fetchonly*::
 *-F*::
 This tells *catalyst* to only fetch distfiles for the given packages without


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-23 16:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-17 19:52 [gentoo-commits] proj/catalyst:master commit in: doc/, catalyst/base/, catalyst/ Matt Turner
  -- strict thread matches above, loose matches on Subject: below --
2021-01-28  1:54 [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/base/, doc/, catalyst/ Matt Turner
2021-01-23 16:22 ` [gentoo-commits] proj/catalyst:master commit in: doc/, catalyst/base/, catalyst/ Matt Turner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox