Gentoo Archives: gnap-dev

From: Philipp Riegger <lists@××××××××××××.de>
To: gnap-dev@l.g.o
Subject: [gnap-dev] [PATCH] Custom GNAP TEMPDIR in gnap_make
Date: Thu, 21 Jun 2007 11:49:03
Good day.

I though it might be nice to be able to tell gnap_make which tempdir  
to use. I can think of 2 scenarios where this will make sense:

   - /tmp does not have that much space and the portage snapshot/the  
overlays are big. At the moment overlays are rsynced (or something  
like that) over the portage snapshot, therefore the snapshot is  
unpacked into /tmp and this might be very very big. My patch enables  
the user to use /var/tmp or whatever instead.

   - For debugging and development purposes, it might be interesting  
to use catalyst directly. A reason for that might be that more  
advanced festures are wanted and gnap_make does not support them yet.

In future versions of gnap i'd also like to have better support for  
resume (possibly reuse of the TEMPDIR) and something like a no- 
cleanup flag (since the tempdir is deleted after gnap_make). I'll  
look into that, soon.

This patch was made after a not that small change in the generl  
structure of gnap_make, i will try to send those patches today. If  
this patch does not apply, it is due to a big difference in line  

Feedback and comments are welcome,

Index: gnap_make
--- gnap_make   (revision 44)
+++ gnap_make   (working copy)
@@ -15,6 +15,7 @@
         echo '    -l logfile           Use specific log file prefix'
         echo '    -c catalyst.conf     Use specific catalyst.conf file'
         echo '    -e specs             Specs directory or tar.bz2 file'
+       echo '    -T gnap_tempdir      Use specific temp dir'
         echo "Please man ${GNAPNAME} for more details."
@@ -29,7 +30,7 @@
# Read options
STAMP=$(date +%Y%m%d)
-while getopts ':hs:p:m:o:v:t:fl:c:e:' options; do
+while getopts ':hs:p:m:o:v:t:fl:c:e:T:' options; do
         case ${options} in
                 h ) usage
                         exit 0;;
@@ -60,6 +61,7 @@
                 l ) GNAPLOGPREFIX="${OPTARG}";;
                 c ) CATALYST_CONF="${OPTARG}";;
                 e ) SPECS="${OPTARG}";;
+               T ) TEMPDIR="${OPTARG}";;
                 * ) gtest 1 'Specified options are incomplete or  
@@ -69,8 +71,18 @@
gtest continued $? "You need to be root to run ${GNAPNAME}"
# Setting up temporary directory
-TEMPDIR=$(mktemp -d -t gnap_make.XXXXXX)
-gtest continued $? 'Failed to create temporary directory'
+if [[ "${TEMPDIR}" = "" ]]; then
+       TEMPDIR=$(mktemp -d -t gnap_make.XXXXXX)
+       gtest continued $? 'Failed to create temporary directory'
+       test -d "${TEMPDIR}" && \
+               gconfirm "${TEMPDIR} already exists. If this  
directory is used " \
+                       "there might be side effects due to existing  
files and the " \
+                       "directory will be deleted when the program  
terminates. " \
+                       "Continue?"
+       mkdir -p "${TEMPDIR}"
+       gtest continued $? "Failed to create ${TEMPDIR}"
# Prepare specs dir and check common.conf file


File name MIME type
PGP.sig application/pgp-signature


Subject Author
Re: [gnap-dev] [PATCH] Custom GNAP TEMPDIR in gnap_make "josé Alberto Suárez López" <bass@g.o>