public inbox for gnap-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gnap-dev] [PATCH] Custom GNAP TEMPDIR in gnap_make
@ 2007-06-21 11:48 Philipp Riegger
  2007-06-21 12:02 ` josé Alberto Suárez López
  0 siblings, 1 reply; 4+ messages in thread
From: Philipp Riegger @ 2007-06-21 11:48 UTC (permalink / raw
  To: gnap-dev

[-- Attachment #1: Type: text/plain, Size: 3100 bytes --]

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  
numbers.

Feedback and comments are welcome,
     Philipp

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
         echo "Please man ${GNAPNAME} for more details."
}
@@ -29,7 +30,7 @@
# Read options
NOTARGET=1
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  
unknown!';;
         esac
done
@@ -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'
+else
+       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}"
+fi
# Prepare specs dir and check common.conf file
SPECDIR="${TEMPDIR}/specs"


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]

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

end of thread, other threads:[~2007-06-21 13:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-21 11:48 [gnap-dev] [PATCH] Custom GNAP TEMPDIR in gnap_make Philipp Riegger
2007-06-21 12:02 ` josé Alberto Suárez López
2007-06-21 12:40   ` Philipp Riegger
2007-06-21 13:41     ` josé Alberto Suárez López

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