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

* Re: [gnap-dev] [PATCH] Custom GNAP TEMPDIR in gnap_make
  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
  0 siblings, 1 reply; 4+ messages in thread
From: josé Alberto Suárez López @ 2007-06-21 12:02 UTC (permalink / raw
  To: gnap-dev

nice idea :)

El jue, 21-06-2007 a las 14:48 +0300, Philipp Riegger escribió:
> 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:
> 


--
gnap-dev@gentoo.org mailing list



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

* Re: [gnap-dev] [PATCH] Custom GNAP TEMPDIR in gnap_make
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Philipp Riegger @ 2007-06-21 12:40 UTC (permalink / raw
  To: gnap-dev

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


On 21.06.2007, at 15:02, josé Alberto Suárez López wrote:

> nice idea :)
>
> El jue, 21-06-2007 a las 14:48 +0300, Philipp Riegger escribió:
>> 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:

I'd like to discuss 2 points i'm not quite sure about.

1) keeptemp: Should this be an extra option (-K) or should this be  
triggered by my introduces custom tempdir option (-T)?

2) My option is quite strange since "usually" you give a tempdir  
like /var/tmp and the tool uses a subdir of that e.g. /var/tmp/gnap- 
lsdfnsdf. My approach uses the given dir directly, this is kind of  
not straight forward. Furthermore, if somebody uses a environment  
variable TEMPDIR and -T is not used, the alternative execution path  
is also used.

Some possibilities what to do:

To fix the environment thing, TEMPDIR can be set to '' before parsing  
command line arguments. As an alternative we could use the GNAP*  
namespace and rename it to GNAPTEMP or GNAPTEMPDIR. This would be  
easier than setting all sensitive variables to '' and if somebody  
messes with that namespace, it's not our fault.

To fix 2) we could use TEMPDIR/gnap or TEMPDIR/gnap-VERSIONSTAMP in  
the -T case. anything against this?

Thoughts about 1): If no overlays are used, the tempdir is quite  
small. If overlays are used, then it is bigger, but the data created  
during the snapshot creation is simply the portage snapshot and the  
overlays on top and can be found in the catalyst tempdir. So... the  
big data is never really needed and it is available at another place  
and the small data is the important one and does not hurt much.

Still: Should we introduce a new command like option or create some  
logic when to delete what and when not? I would prefer 2.

Philipp

[-- 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

* Re: [gnap-dev] [PATCH] Custom GNAP TEMPDIR in gnap_make
  2007-06-21 12:40   ` Philipp Riegger
@ 2007-06-21 13:41     ` josé Alberto Suárez López
  0 siblings, 0 replies; 4+ messages in thread
From: josé Alberto Suárez López @ 2007-06-21 13:41 UTC (permalink / raw
  To: gnap-dev

El jue, 21-06-2007 a las 15:40 +0300, Philipp Riegger escribió:
> On 21.06.2007, at 15:02, josé Alberto Suárez López wrote:
> 
> > nice idea :)
> >
> > El jue, 21-06-2007 a las 14:48 +0300, Philipp Riegger escribió:
> >> 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:
> 
> I'd like to discuss 2 points i'm not quite sure about.
> 
> 1) keeptemp: Should this be an extra option (-K) or should this be  
> triggered by my introduces custom tempdir option (-T)?

i prefer an extra option, so maybe is better to keep this kind of
"advanced" options in commons.conf

> 2) My option is quite strange since "usually" you give a tempdir  
> like /var/tmp and the tool uses a subdir of that e.g. /var/tmp/gnap- 
> lsdfnsdf. My approach uses the given dir directly, this is kind of  
> not straight forward. Furthermore, if somebody uses a environment  
> variable TEMPDIR and -T is not used, the alternative execution path  
> is also used.
> 
> Some possibilities what to do:
> 
> To fix the environment thing, TEMPDIR can be set to '' before parsing  
> command line arguments. As an alternative we could use the GNAP*  
> namespace and rename it to GNAPTEMP or GNAPTEMPDIR. This would be  
> easier than setting all sensitive variables to '' and if somebody  
> messes with that namespace, it's not our fault.

We must use the GNAP namespace.

> To fix 2) we could use TEMPDIR/gnap or TEMPDIR/gnap-VERSIONSTAMP in  
> the -T case. anything against this?

VERSIONSTAMP must be used ever.

> 
> Thoughts about 1): If no overlays are used, the tempdir is quite  
> small. If overlays are used, then it is bigger, but the data created  
> during the snapshot creation is simply the portage snapshot and the  
> overlays on top and can be found in the catalyst tempdir. So... the  
> big data is never really needed and it is available at another place  
> and the small data is the important one and does not hurt much.
> 
> Still: Should we introduce a new command like option or create some  
> logic when to delete what and when not? I would prefer 2.

i prefer 2 too, so maybe we can guide this logic in cmmons.conf

> 
> Philipp

--
gnap-dev@gentoo.org mailing list



^ 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