List Info

Thread: jhalfs - delete old package dirs upon restart




jhalfs - delete old package dirs upon restart
user name
2006-05-31 21:54:22
Manuel,

   I am trying out the following pieces of code before
committing them. 
They address the request for 'delete before unpack' that
is necessary 
when restarting the makefile.  Other than the addition of
these two 
functions I insert calls to these routines from within
wrt_unpack, 
wrt_unpack2 and wrt_unpack3.

   This may not be the cleanest method but it seems to do
the job. The 
only issue I see is if we *WANT* to keep the directories (
binutils? ) 
then this method will fail. The books do not keep any
directories 
hanging around between passes or phases do they?

Examnple:::

#----------------------------------#
wrt_unpack() {                     # Unpack and set 'ROOT'
var
#----------------------------------#
   local FILE=$1

   wrt_remove_existing_dirs "$FILE" 
<<<<<< NEW CALL
(
cat << EOF
	\$(call unpack,$FILE)
	ROOT=\`head -n1 /tmp/unpacked | sed 's^./;s/.*'\`
&& \\
	echo "export
PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars
&& \\
	chown -R lfs \$(MOUNT_PT)\$(SRC)/\$\$ROOT
EOF
) >> $MKFILE.tmp
}


##### NEW functions #####

#----------------------------------#
wrt_remove_existing_dirs() {       #
#----------------------------------#
   local PKG_NAME=$1
(
cat << EOF
	ROOT=\`tar -tf \$(MOUNT_PT)\$(SRC)/$ |
head -n1 | sed -e 
's^./;s/.*'\` && \\
	rm -rf \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\
	if [ -e \$(MOUNT_PT)\$(SRC)/${PKG_NAME%%-*}-build ]; then
\\
		rm -rf \$(MOUNT_PT)\$(SRC)/${PKG_NAME%%-*}-build; \\
	fi;
EOF
) >> $MKFILE.tmp
}

#----------------------------------#
wrt_remove_existing_dirs2() {      #
#----------------------------------#
   local PKG_NAME=$1
(
cat << EOF
	ROOT=\`tar -tf \$(SRC)/$ | head -n1 | sed
-e 
's^./;s/.*'\` && \\
	rm -rf \$(SRC)/\$\$ROOT && \\
	if [ -e \$(SRC)/${PKG_NAME%%-*}-build ]; then \\
		rm -rf \$(SRC)/${PKG_NAME%%-*}-build; \\
	fi;
EOF
) >> $MKFILE.tmp
}
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discu
ss
FAQ: http://www.linux
fromscratch.org/faq/
Unsubscribe: See the above information page
jhalfs - delete old package dirs upon restart
user name
2006-05-31 21:59:59
George Boudreau wrote:
> then this method will fail. The books do not keep any
directories 
> hanging around between passes or phases do they?

Not anymore at the moment.

But, it has happened before. The need for it may come again.
I would 
prepare for this and allow an override to be added to a
package so the 
function does not delete anything when it is called.

If it's developed now, you're all set for the future. It
shouldn't be 
hard to do so. You can go as far as create a file somewhere
and if it 
exists, don't delete the dir.

The file would have to be called something like
dontdelete-packagedir.

-- 
Gerard Beekmans

/* If Linux doesn't have the solution, you have the wrong
problem */

-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discu
ss
FAQ: http://www.linux
fromscratch.org/faq/
Unsubscribe: See the above information page
jhalfs - delete old package dirs upon restart
user name
2006-05-31 22:08:36
El Miércoles, 31 de Mayo de 2006 23:54, George Boudreau
escribió:

>
>    This may not be the cleanest method but it seems to
do the job. 

Looks enough clean to me 

>    The 
> only issue I see is if we *WANT* to keep the
directories ( binutils? )
> then this method will fail. The books do not keep any
directories
> hanging around between passes or phases do they?

I don't see an issue. IMHO, the flow is:

We keep the directories after a suscefful build of the
package. 

That new function remove it when resumming make after a
failed build of the 
package. If the new build is suscessfull, the directories
are retained until 
be used.

Some next fail/resume don't will delete the keeped
directories due that don't 
mach the new failed package name.


-- 
Manuel Canales Esparcia
Usuario de LFS nº2886:       http://www.linuxfroms
cratch.org
LFS en castellano: http://www.escomp
oslinux.org/lfs-es http://www.lfs-es.com
TLDP-ES:                           http://es.tldp.org
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discu
ss
FAQ: http://www.linux
fromscratch.org/faq/
Unsubscribe: See the above information page
jhalfs - delete old package dirs upon restart
user name
2006-05-31 22:22:32
M.Canales.es wrote:
> That new function remove it when resumming make after a
failed build of the 
> package. If the new build is suscessfull, the
directories are retained until 
> be used.

Don't forget to remove the dir after a successful build as
well. Else 
you're going to have all the build dirs around consuming a
lot of 
diskspace (maybe too much and fill up a partition).



-- 
Gerard Beekmans

/* If Linux doesn't have the solution, you have the wrong
problem */

-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discu
ss
FAQ: http://www.linux
fromscratch.org/faq/
Unsubscribe: See the above information page
jhalfs - delete old package dirs upon restart
user name
2006-05-31 22:20:32

Gerard Beekmans wrote:
> George Boudreau wrote:
>> then this method will fail. The books do not keep
any directories 
>> hanging around between passes or phases do they?
> 
> Not anymore at the moment.
> 
> But, it has happened before. The need for it may come
again. I would 
> prepare for this and allow an override to be added to a
package so the 
> function does not delete anything when it is called.
> 
> If it's developed now, you're all set for the future.
It shouldn't be 
> hard to do so. You can go as far as create a file
somewhere and if it 
> exists, don't delete the dir.
> 
> The file would have to be called something like
dontdelete-packagedir.

   Modified the wrt_unpack routines to accept a flag--
optSAVE_PREVIOUS.

   If a value is passed and it is '1' then the deletion
routine will not 
be included in the makefile for that package. Existing
'master.sh' code 
does not need to be touched as the default action is to
delete any 
existing package directories. (your requested action)
   G
> 
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discu
ss
FAQ: http://www.linux
fromscratch.org/faq/
Unsubscribe: See the above information page
jhalfs - delete old package dirs upon restart
user name
2006-05-31 22:28:42
El Jueves, 1 de Junio de 2006 00:22, Gerard Beekmans
escribió:

> Don't forget to remove the dir after a successful
build as well. Else
> you're going to have all the build dirs around
consuming a lot of
> diskspace (maybe too much and fill up a partition).

Yes, the build directories are deleted by default after a
successful build.

When someone need be retained (like previously binutils or
tcl) they are 
removed after be used by the package/commands that depend
on.

What we are now try to implement is to let make delete
failed build 
directories, instead to force the user to delete it before
rerun make.

To me looks that are separate features and one don't should
to interfere the 
other.


-- 
Manuel Canales Esparcia
Usuario de LFS nº2886:       http://www.linuxfroms
cratch.org
LFS en castellano: http://www.escomp
oslinux.org/lfs-es http://www.lfs-es.com
TLDP-ES:                           http://es.tldp.org
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discu
ss
FAQ: http://www.linux
fromscratch.org/faq/
Unsubscribe: See the above information page
jhalfs - delete old package dirs upon restart
user name
2006-05-31 22:57:08

M.Canales.es wrote:
> El Jueves, 1 de Junio de 2006 00:22, Gerard Beekmans
escribió:
> 
>> Don't forget to remove the dir after a successful
build as well. Else
>> you're going to have all the build dirs around
consuming a lot of
>> diskspace (maybe too much and fill up a partition).
> 
> Yes, the build directories are deleted by default after
a successful build.
> 
> When someone need be retained (like previously binutils
or tcl) they are 
> removed after be used by the package/commands that
depend on.
> 
> What we are now try to implement is to let make delete
failed build 
> directories, instead to force the user to delete it
before rerun make.
> 
> To me looks that are separate features and one don't
should to interfere the 
> other.
   oh.. there is a cute flaw in my code..  If the requested
package file 
does not exist in the <sources> directory it
conveniently deletes the 
sources directory so you won't be bothered with all those
other files.. 
< feature or flaw..  >
   Back to the drawing board
> 
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discu
ss
FAQ: http://www.linux
fromscratch.org/faq/
Unsubscribe: See the above information page
jhalfs - delete old package dirs upon restart
user name
2006-06-01 16:17:11

George Boudreau wrote:
> 
> 
> M.Canales.es wrote:
>> El Jueves, 1 de Junio de 2006 00:22, Gerard
Beekmans escribió:
>>
>>> Don't forget to remove the dir after a
successful build as well. Else
>>> you're going to have all the build dirs around
consuming a lot of
>>> diskspace (maybe too much and fill up a
partition).
>>
>> Yes, the build directories are deleted by default
after a successful 
>> build.
>>
>> When someone need be retained (like previously
binutils or tcl) they 
>> are removed after be used by the package/commands
that depend on.
>>
>> What we are now try to implement is to let make
delete failed build 
>> directories, instead to force the user to delete it
before rerun make.
>>
>> To me looks that are separate features and one
don't should to 
>> interfere the other.
>   oh.. there is a cute flaw in my code..  If the
requested package file 
> does not exist in the <sources> directory it
conveniently deletes the 
> sources directory so you won't be bothered with all
those other files.. 
> < feature or flaw..  >
>   Back to the drawing board
   corrected the problem, will now 'delete before unpack'
unless 
specifically told not to.
   G
>>
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discu
ss
FAQ: http://www.linux
fromscratch.org/faq/
Unsubscribe: See the above information page
jhalfs - delete old package dirs upon restart
user name
2006-06-01 16:54:07
George Boudreau wrote:
>   corrected the problem, will now 'delete before
unpack' unless 
> specifically told not to.

Perfect. I'll be sure to try it out soon.

-- 
Gerard Beekmans

/* If Linux doesn't have the solution, you have the wrong
problem */

-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discu
ss
FAQ: http://www.linux
fromscratch.org/faq/
Unsubscribe: See the above information page
[1-9]

about | contact  Other archives ( Real Estate discussion Medical topics )