[gobolinux-devel] Re: Placement of UnmanagedFiles
Hisham Muhammad
hisham.hm at gmail.com
Mon Aug 7 11:42:37 GMT 2006
On 8/6/06, Jonas Karlsson <jonka750 at student.liu.se> wrote:
> On Sun, 06 Aug 2006 06:21:55 +0200, Hisham Muhammad <hisham.hm at gmail.com>
> wrote:
>
> > On 8/5/06, Jonas Karlsson <jonka750 at student.liu.se> wrote:
> >> Making use of unmanaged files I noticed that, in recipes, one has to
> >> specify the unmanaged files in a variable, unmanaged_files, in the
> >> recipe
> >> instead of a file, Resources/UnmanagedFiles, in the recipe directory. I
> >> think the latter is more natural as it follows the same layout as
> >> packages.
> >
> > Sounds like a good idea, but on the other hand having them listed in
> > the text of the recipe makes it easier to inspect it and not forget
> > about it (I can understand Dependencies being "meta" information
> > enough to warrant being listed in a separate file but I'm not sure
> > about this.) What I mean is: I do see your point but I'm undecided
> > about it. More voices are welcome. :)
> >
> Well, one always inspects the Dependencies file before submitting a
> recipe/package, right? ;)
> Anyhow as UnmanagedFiles is manually created, it's no need to inspect it
> as recipe author (because you created it) and if one are to inspect the
> recipe as third person one can cat the UnmanagedFiles file. Besides having
> it as an file becuase beeing consistant with package layout, you can look
> on lukas' recipe on SVGAlib. He has 10 files as unmanaged, which is a bit
> much, imo, to have listed as a variable.
>
> Just came to think about recipes made with NewVersion, if the file list
> changes. How about adding a suffix to the UnmanagedFiles file and if that
> suffix exists one gets a warning when one compiles and the files installed
> out of sandbox differs from the files listed in UnmanagedFiles, so that
> one can check the file list for newly created recipes. If the list in
> UnmanagedFiles is correct the suffix should be removed.
Ouch, in my head I thought it already did this check, but I just
looked at the implementation and realized it doesn't. Unlisted files
installed out of sandbox should be checked (and even the opposite, if
expected out-of-sandbox files are not created) and generate Compile
errors every time.
Here's a tentative implementation, also using the UnmanagedFiles file
instead of the unmanaged_files array. Well, the code does look
cleaner. Caveat emptor: untested.
Index: bin/Compile
===================================================================
RCS file: /cvsroot/goboscripts/tools/Compile/bin/Compile,v
retrieving revision 1.101
diff -u -r1.101 Compile
--- bin/Compile 2 Aug 2006 19:07:36 -0000 1.101
+++ bin/Compile 7 Aug 2006 11:38:43 -0000
@@ -108,17 +108,14 @@
if ! [ "$nomake" = "yes" ]
then
unset allowleftovers
- [ "${unmanaged_files[*]}" ] && allowleftovers=--allow-leftovers
+ [ -f "$unmanagedfiles" ] && allowleftovers=--allow-leftovers
SandboxInstall $allowleftovers ${sandboxopts[@]} -f $makefile
-t "$install_target" "$1" "$2" -- "${installmerged[@]}" || wrap_fail
"Installation step failed."
install_extras
- if [ "${unmanaged_files[*]}" ]
- then
- mkdir -p "$target/Resources/Unmanaged/"
- cp -a "$target/.SandboxInstall_Root"/* "$target/Resources/Unmanaged/"
- fi
+ Install_Unmanaged_Files --move "$unmanagedfiles"
"$target/.SandboxInstall_Root" "$target/Resources/Unmanaged/"
+ [ `ls -A "$target/.SandboxInstall_Root" 2> /dev/null` ] && Die
"Unexpected left-over files in sandbox."
fi
if ! Boolean "no-strip"
@@ -184,14 +181,7 @@
Quiet mkdir -p $target/Resources
- if [ "${unmanaged_files[*]}" ]
- then
- rm -f -- $target/Resources/UnmanagedFiles
- for file in "${unmanaged_files[@]}"
- do echo $file >> $target/Resources/UnmanagedFiles
- done
- Install_Unmanaged_Files "$target/Resources/UnmanagedFiles"
"$target/Resources/Unmanaged"
- fi
+ Install_Unmanaged_Files "$unmanagedfiles"
"$target/Resources/Unmanaged" "$goboPrefix"
Log_Normal "Generating package's build information..."
GenBuildInformation "$appname" "$versionnumber" >
"$target/Resources/BuildInformation"
@@ -431,6 +421,7 @@
recipedir="$bakedrecipedir"
reciperesources="$recipedir/Resources"
+unmanagedfiles="$recipedir/Resources/UnmanagedFiles"
if ! Boolean "no-dependencies" && ! Boolean "no-build"
then
Index: Functions/GoboLinux
===================================================================
RCS file: /cvsroot/goboscripts/tools/Scripts/Functions/GoboLinux,v
retrieving revision 1.18
@@ -587,14 +587,25 @@
}
function Install_Unmanaged_Files() {
- Parameters "$@" unmanagedfilesfile sourcedir
+ local movefiles=no
+ if [ "$1" == "--move" ]
+ then
+ movefiles=yes
+ shift
+ fi
+ Parameters "$@" unmanagedfilesfile sourcedir destdir
if [ -f "$unmanagedfilesfile" ]
then
cat "$unmanagedfilesfile" | grep -E -v "^(\./|/|)Programs" |
while read line
do
- local dname=$(dirname "${goboPrefix}/$line")
- mkdir -p "${dname}"
- cp -a "${sourcedir}/${line}" "${dname}/"
+ local dname=$(dirname "$$line")
+ mkdir -p "${destdir}/${dname}"
+ cp -a "${sourcedir}/${line}" "${destdir}/${dname}/"
+ if [ "$movefiles" = "yes" ]
+ then
+ rm -rf "${sourcedir}/${line}"
+ rmdir -p "${sourcedir}/${dname}"
+ fi
done
fi
}
Index: bin/InstallPackage
===================================================================
RCS file: /cvsroot/goboscripts/tools/Scripts/bin/InstallPackage,v
retrieving revision 1.21
diff -u -r1.21 InstallPackage
--- bin/InstallPackage 30 Jul 2006 19:45:03 -0000 1.21
+++ bin/InstallPackage 7 Aug 2006 11:40:00 -0000
@@ -297,7 +297,7 @@
if ! Boolean "no-unmanaged" && [ -f "Current/Resources/UnmanagedFiles" ]
then
Log_Normal "Installing UnmanagedFiles"
- Install_Unmanaged_Files "Current/Resources/UnmanagedFiles"
"Current/Resources/Unmanaged"
+ Install_Unmanaged_Files "Current/Resources/UnmanagedFiles"
"Current/Resources/Unmanaged" "$goboPrefix"
fi
Quiet cd -
-- Hisham
More information about the gobolinux-devel
mailing list