Author Topic: Revisit Chameleon's package builder  (Read 144468 times)

0 Members and 2 Guests are viewing this topic.

scorpius

  • Observer
  • Posts: 22
Re: Revisit Chameleon's package builder
« Reply #195 on: August 24, 2011, 06:03:23 PM »
Is the package/buildpkg.sh script broken, or is it just me? I can
successfully run make pkg only if I change line 295 from
 
mkdir -p "${1}/${theme}/Root/"

to

mkdir -p "${1}/${themes[$i]##*/}/Root/"


ErmaC

  • Resident
  • Posts: 134
Re: Revisit Chameleon's package builder
« Reply #196 on: August 24, 2011, 09:44:35 PM »
 :o

opss...
nice!

I will commit this change.

PS by the way... I can compile the pkg with or without this...
but of course now the syntax is correct.

Fabio
P6T Deluxe v1 i7 940 Quadro Fx 5600
P6T SE i7 920 GeForce GT 240

Azimutz

  • VoodooLabs
  • Posts: 420
  • Paranoid Android
Re: Revisit Chameleon's package builder
« Reply #197 on: August 26, 2011, 04:53:29 AM »
Is the package/buildpkg.sh script broken, or is it just me?...
Scorpius, i have no such problem; can you check this again please?... and post the error log...
I also have no problems building with the code changes, but they don't make much sense to me.
 System & Patches: http://goo.gl/i961
 Chameleon:
- trunk builds: http://goo.gl/9G1Hq
- pref pane: http://goo.gl/OL2UT

zhell

  • Member
  • Posts: 46
Re: Revisit Chameleon's package builder
« Reply #198 on: August 29, 2011, 01:47:28 AM »
Line 294 sets variable theme to the name of the theme at position i in the array themes, with a twist: it capitalizes the first letter of the theme name. Hence, if the array contains the entry "bullet", theme will be set to "Bullet".

The change by scorpius fixes a bug that may affect the execution of the subsequent rsync command (line 296) on case-sensitive file systems. The rsync command copies the theme into the directory created on line 295 and assumes that no capitalization has occurred, i.e. it uses "${1}/${themes[$i]##*/}/Root/", which matches the path used by "mkdir" on line 295.

The difference can be seen with this example:
Code: [Select]
% themes=($( find "${artwork%/*}/artwork/themes" -type d -depth 1 -not -name '.svn' ))
% echo $themes
/Software/Chameleon.svn/artwork/themes/bullet

% i=0
% set -- /Software/Chameleon.svn
% echo $1
/Software/Chameleon.svn

% echo "${1}/${themes[$i]}"
/Software/Chameleon.svn//Software/Chameleon.svn/artwork/themes/bullet

% echo "${1}/${themes[$i]##*/}/Root/"
/Software/Chameleon.svn/bullet/Root/

% echo "${1}/${theme}/Root/"
/Software/Chameleon.svn/Bullet/Root/
Note that the  ##*/ part in ${themes[$i]##*/} has the effect of stripping the all occurrences of "*/" from the variable ${themes[$i]}, corresponding to everything up to and including the last "/". An alternative would be the basename command.

Azimutz is right: the code is rather hard to understand and unnecessarily convoluted. The mkdir command is completely unnecessary. In fact, I believe that lines 295--301 could be done with a single call to rsync, using the --exclude and --chmod options.

scorpius

  • Observer
  • Posts: 22
Re: Revisit Chameleon's package builder
« Reply #199 on: August 31, 2011, 05:16:36 PM »
I forgot to mention that I use a case-sensitive file system (because it is a requirement for building Haiku). That's why I was the only one affected.

zhell is correct about using rsync -- and using the -C option skips the .svn directories as well.

Azimutz

  • VoodooLabs
  • Posts: 420
  • Paranoid Android
Re: Revisit Chameleon's package builder
« Reply #200 on: September 01, 2011, 12:14:26 AM »
Hi guys...
I forgot to mention that I use a case-sensitive file system (because it is a requirement for building Haiku). That's why I was the only one affected.

zhell is correct about using rsync -- and using the -C option skips the .svn directories as well.
And i was missing the point; Zell's post alerted me to it and to the fact that "verbosity is your friend!" :P
Did some changes related to this on my branch (r1474-->1489), check it out...
Basically, made sure we are "rsyncing" from e.g. trunk/artwork/themes/bullet to sym/package/Bullet/Root/Bullet and
used --exclude=.*; read about -C, but it doesn't handle .DS_store.

...
Azimutz is right: the code is rather hard to understand and unnecessarily convoluted. The mkdir command is completely unnecessary. In fact, I believe that lines 295--301 could be done with a single call to rsync, using the --exclude and --chmod options.
Zell, thanks for the explanation :)
About mkdir, i can't see a way of getting rid of it, at least doing it the way i'm doing; rsync needs sym/package/Bullet/Root/
preexisting to be able to create Bullet in it.
I also find no use for the chmod..?? The booter certainly has no need for it...
 System & Patches: http://goo.gl/i961
 Chameleon:
- trunk builds: http://goo.gl/9G1Hq
- pref pane: http://goo.gl/OL2UT

zhell

  • Member
  • Posts: 46
Re: Revisit Chameleon's package builder
« Reply #201 on: September 01, 2011, 10:50:23 AM »
Hi Azimutz,

Glad you were not put off by my lengthy post. Here's an example of how rsync could do all in one line -- I think:
Code: [Select]
cd /tmp
# Set up some directory and file structure to play with
  mkdir -p Chameleon/Themes/bullet
  touch Chameleon/Themes/bullet/icon.png
  chmod 777 Chameleon/Themes # Set weird permissions
  chmod 777 Chameleon/Themes/bullet/icon.png # Set weird permissions
  mkdir Chameleon/Themes/.svn
  touch Chameleon/.DS_Store
# Now copy it into another directory, preserving the path starting from "Chameleon":
rsync -av --exclude='.*' --chmod=Da=rx,u+w,Fa=r,u+w --relative Chameleon/Themes/bullet Chameleon-Root
# As you can see, the permissions are now 755 for the directories and 644 for the files.
ls -lAR Chameleon-Root
total 0
drwxr-xr-x  3 admin  wheel  102 Sep  1 10:47 Chameleon

Chameleon-Root/Chameleon:
total 0
drwxr-xr-x  3 admin  wheel  102 Sep  1 10:47 Themes

Chameleon-Root/Chameleon/Themes:
total 0
drwxr-xr-x  3 admin  wheel  102 Sep  1 10:47 bullet

Chameleon-Root/Chameleon/Themes/bullet:
total 0
-rw-r--r--  1 admin  wheel  0 Sep  1 10:47 icon.png

Regarding capitalization, just use
Code: [Select]
theme='bullet'
echo "$(echo ${theme:0:1}|tr '[:lower:]' '[:upper:]')${theme:1}"

Azimutz

  • VoodooLabs
  • Posts: 420
  • Paranoid Android
Re: Revisit Chameleon's package builder
« Reply #202 on: September 04, 2011, 10:55:41 AM »
Hi Azimutz,

Glad you were not put off by my lengthy post. Here's an example of how rsync could do all in one line -- I think:
...
Hi Zell... "au contraire", the post was in fact motivational and constructive... no reason to put me off.
I get what you explained, been doing some "man rsync" reading my self; but as i see, there's not much to "preserve"
for the "for" loop, just the theme's name and in this case, setting permissions doesn't make much sense to me...
unless i'm missing something?!
Anyway, been playing a bit more with the stuff (r1501) and i'm pleased for now :)
« Last Edit: September 04, 2011, 10:59:32 AM by Azimutz »
 System & Patches: http://goo.gl/i961
 Chameleon:
- trunk builds: http://goo.gl/9G1Hq
- pref pane: http://goo.gl/OL2UT

Azimutz

  • VoodooLabs
  • Posts: 420
  • Paranoid Android
Re: Revisit Chameleon's package builder
« Reply #203 on: September 06, 2011, 04:42:00 AM »
Ok.. this is what i came with for a quick fix to the main problems i found on the package.
I was to make some separate commits, but they ended up all in r1510 by distraction ::)
Since i already had planed to come here, not much was lost...
Focus on buildpkg.sh and postinstal's from EFI and Standard pkgs; resuming:
- fdisk440 and bdmesg are installed to /usr/local/* (just a preference of mine)
- made sure we find/use our fdisk440 for all boot0 installs using "bootresources" as var for the path
- the already commented Themes buildpkg code cleanup
- also made a quick test at moving files to the EFI partition

Still didn't made "live" tests, but so far all works as expected installing to external devices and mounted images,
both MBR and GPT. I will play a bit more with this, but don't know how much more :P
Anyway, if you guys like the solution i can commit the relevant parts to the trunk; if anyone has improvements
or a better solution just throw it to the table. To do better i need more time, reading, etc, etc, etc...
 System & Patches: http://goo.gl/i961
 Chameleon:
- trunk builds: http://goo.gl/9G1Hq
- pref pane: http://goo.gl/OL2UT

Blackosx

  • Forum Moderator
  • Posts: 1150
Re: Revisit Chameleon's package builder
« Reply #204 on: September 19, 2011, 12:53:13 PM »
Hi Fabio

Can I ask what the following are for?
/trunk/package/dmg/*
/trunk/package/Icons/*

Can they be removed?

Ok.. this is what i came with for a quick fix to the main problems i found on the package.
...
Hey Azi

I've just seen your post about the changes in your 'package' branch. I tested your branch on 1st September, before going away for a break, and found it suffered the same problems as the package in the trunk at that time (as reported here) but I see you've updated it since then. Sorry I didn't see the changes sooner. I'll have a look at it.

Only today I've been looking at these scripts too and have merged some of the work I had previously done (as discussed here) in to my branch. I've not included any of the scripts/methods I attempted back then for building the c.a.B.p (now o.c.B.p) so no fear with any rogue 'rm' commands. I need to run some more tests at my end before saying anymore, but for now my branch shows where I'm at.

EDIT:
I've only had a quick look through your 'package' branch and have mode some notes to your comments.

1) Standard install - Keep 'msdos' install option as user could select to install to a FAT32 USB flash drive.

2) Hiding the boot file (as you've said) is questionable and I prefer it visible, as you do. However, hiding it should be done with SetFile as it works on FAT32 as well as HFS. I agree that there's no point hiding it on he EFI System Partition.

3) EFI System Partition install - I never use it for real either, just for testing but I guess it's a feature which some users like to use.
3a) You say setting active partition for EFI system partition is not needed. I'll have to run a test to check.
3b) You're right by saying the default ESP is a special format and not msdos (I remember you posted somewhere with more details) but for checking purposes, sudo fstyp /dev/disk0s1 on my iMac returns msdos. This is fine for the checks the script uses as it uses the identification to choose which stage 1 file to use (boot1h or boot1f32) - The script does not format the partition.
« Last Edit: September 20, 2011, 06:15:40 PM by Blackosx »
10.10.5 / 10.11 GM1 | Asus Maximum IV Gene-Z | i7-2600 3.40GHz | 4GB | Radeon 5770 1GB

ErmaC

  • Resident
  • Posts: 134
Re: Revisit Chameleon's package builder
« Reply #205 on: September 19, 2011, 07:50:24 PM »
Hi Fabio

Can I ask what the following are for?
/trunk/package/dmg/*
/trunk/package/Icons/*

Can they be removed?

Hi Blackosx
the two dir are dedicated for store "icons" and "stuff" for the creation of the .dmg
At this time feel free to delete the dmg folder, but the Icon folder is needed..
I try to explain...
Into the buildpkg.sh I commented the part relate to the Icon for the package...
from:
Code: [Select]
...
popd >/dev/null

#   Here is the place for assign a Icon to the pkg
#   command use to generate the file:
#   ditto -c -k --sequesterRsrc --keepParent Icon.icns Icon.zip
# ----
#   ditto -xk "${pkgroot}/Icons/pkg.zip" "${pkgroot}/Icons/"
#   DeRez -only icns "${pkgroot}/Icons/Icons/pkg.icns" > tempicns.rsrc
#   Rez -append tempicns.rsrc -o "${1%/*}/$packagename-${version}-r$revision.pkg"
#   SetFile -a C "${1%/*}/$packagename-${version}-r$revision.pkg"
#   rm -f tempicns.rsrc
#   rm -rf "${pkgroot}/Icons/Icons"
# End

md5=$( md5 "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" | awk {'print $4'} )
...

to
Code: [Select]
...
popd >/dev/null

#   Here is the place for assign a Icon to the pkg
#   command use to generate the file:
#   ditto -c -k --sequesterRsrc --keepParent Icon.icns Icon.zip
# ----
    ditto -xk "${pkgroot}/Icons/pkg.zip" "${pkgroot}/Icons/"
    DeRez -only icns "${pkgroot}/Icons/Icons/pkg.icns" > tempicns.rsrc
    Rez -append tempicns.rsrc -o "${1%/*}/$packagename-${version}-r$revision.pkg"
    SetFile -a C "${1%/*}/$packagename-${version}-r$revision.pkg"
    rm -f tempicns.rsrc
    rm -rf "${pkgroot}/Icons/Icons"
# End

md5=$( md5 "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" | awk {'print $4'} )
...
If you un-comment that part and try build the pkg (make pkg) the pkg will be created with the beautiful icon, but that change is immediately lost by the tar compression (the compression eradicate that icon... strange but true), next if you uncompress the archive the pkg is w/o icon, probably this is a "feature" coming from the TAR command I really don't know...


Anyway I prefer not delete the Icon directory...

Fabio
« Last Edit: September 19, 2011, 08:04:51 PM by iFabio »
P6T Deluxe v1 i7 940 Quadro Fx 5600
P6T SE i7 920 GeForce GT 240

Blackosx

  • Forum Moderator
  • Posts: 1150
Re: Revisit Chameleon's package builder
« Reply #206 on: September 20, 2011, 06:21:19 PM »
Thanks for the reply Fabio.
So is there a grand plan to eventually distribute a Chameleon .dmg?
10.10.5 / 10.11 GM1 | Asus Maximum IV Gene-Z | i7-2600 3.40GHz | 4GB | Radeon 5770 1GB

ErmaC

  • Resident
  • Posts: 134
Re: Revisit Chameleon's package builder
« Reply #207 on: September 20, 2011, 11:38:43 PM »
The .dmg need some more correction, and now (in my branch...) it will create with make dmg, but I'm not to happy with the way I do it...
Is there a pre-maded image and is just a copy from the new file and overwrite on the old...
Is a unfinished work in progress...

Fabio
P6T Deluxe v1 i7 940 Quadro Fx 5600
P6T SE i7 920 GeForce GT 240

Blackosx

  • Forum Moderator
  • Posts: 1150
Re: Revisit Chameleon's package builder
« Reply #208 on: September 25, 2011, 10:18:16 AM »
Is a unfinished work in progress...
Thanks for letting me know :)

I see you've merged the package folder from my branch to yours. Please note that my branch is a work in progress too and I'm planning to change it even more in the coming weeks.

One thing I've noticed with your branch since the merge and your latest changes is that you will need to change the install location for the following added modules, from /Extra/modules to /tmpcham/Extra/modules in buildpkg.sh if you want to them to be placed correctly in the /Extra folder.
AMDGraphicsEnabler.dylib
ATiGraphicsEnabler.dylib
IntelGraphicsEnabler.dylib
NVIDIAGraphicsEnabler.dylib

So for example:
from:
Code: [Select]
buildpackage "${1}/AMDGraphicsEnabler" "/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1to
Code: [Select]
buildpackage "${1}/AMDGraphicsEnabler" "tmpcham/Extra/modules" "" "start_selected=\"false\"" >/dev/null 2>&1
« Last Edit: September 25, 2011, 10:19:53 AM by Blackosx »
10.10.5 / 10.11 GM1 | Asus Maximum IV Gene-Z | i7-2600 3.40GHz | 4GB | Radeon 5770 1GB

ErmaC

  • Resident
  • Posts: 134
Re: Revisit Chameleon's package builder
« Reply #209 on: September 25, 2011, 01:38:05 PM »
THX Blackosx.

I "correct" it.
I move the GraphicsEnabler to Module only for test the buildpkg & Localizable.strings "job" and works ;)

I commit also to the trunk code the UseKernelCache choice.

Fabio
P6T Deluxe v1 i7 940 Quadro Fx 5600
P6T SE i7 920 GeForce GT 240