Specifically, the --transform option is not supported in the version of tar that ships with OS X Snow Leopard.

I also added the --work-tree parameter to the tag checkout git command. Patch to be included below.

Comments

jeffam’s picture

StatusFileSize
new1007 bytes

Here's the patch. I tested with tar on Snow Leopard 10.6.7, but not with GNU tar. I did confirm that GNU tar has the -C switch, however, so I'm hoping someone can test and confirm that it works.

eugenmayer’s picture

Title: Creation of Packages from Git Doesn't Work on Snow Leopard » Creation of packages from git doesn't work on OSX(snow-leopard)

Interesting, thank you for your contribution!. Well we need both, linux testers and unix testers to be sure we dont play bug-ping-pong here.

I will take care about the Linux ( Debian ) part, and test your patch there.
And additional question here is, how far do those things depend on a specific git verion? If there are limitation, which version is minimal.

jeffam’s picture

Good question about the git version. I suspect that the way you're using it is fine for several versions back.

I was looking at the git deploy module the other day, and they seem to use something called GLIP (Git Library in PHP) that might also be of use to this project.

danepowell’s picture

Status: Needs review » Needs work

In Ubuntu, this patch does break existing functionality- the files are placed into the tarball without a root directory, creating a nice little tarbomb.

eugenmayer’s picture

Thank you Dane for testing. Patch did not get applied to 1.1, so it still to be reviewd.

jeffam’s picture

Status: Needs work » Needs review
StatusFileSize
new1.41 KB

Good catch, Dane. Here's a reworked version that doesn't create a tarbomb. Again, it was only tested on OS X 10.6.7 with bsdtar.

eugenmayer’s picture

So we will need to have a linux tester also. Iam not sure about my hight workload, but maybe i happen to test it. Over all, thank you guys for all your work, finally the fserver gets some attention and care :)

danepowell’s picture

Status: Needs review » Needs work

I'm not sure about that patch. If you modify FserverProject_git->path, then when the destructor is called, it's not going to properly clean up is it? i.e., the parent folder created by mkdir($this->path); will still remain...

randallknutson’s picture

Just ran into this on CentOs. The version of tar that comes by default on CentOs is 1.15.1 which does not include the --transform option. It was added in GNU tar 1.20 in August 2008. To fix this I am recompiling tar on my server to get the latest version. Perhaps we should add a message somewhere saying that tar --version must be greater than 1.20 for fserver-package to work until we are sure this works on all systems.

eugenmayer’s picture

that is a very handy information randallknutson! Thank you very much. I guess including that informatin would at least give the admin a clue, whats wrong

jeffam’s picture

Another option is git archive.

Something like:

git archive [tag|commit] --prefix=[project]/ | gzip > /tmp/[project]-[version].tar.gz

git archive has been around since 2006, and the above command works on Snow Leopard with its bsdtar, so maybe it will work on the old version of tar in CentOS, too.

lendude’s picture

Ran into this problem on a OSX 10.7 server (but same problem still exists on 10.8 and 10.9 ), just want to add my solution.

The tar command is a simlink to bsdtar on OSX and the version shipped with OSX doesn't support --transform. However GNU tar is also shipped with OSX. So I changed the tar simlink to GNU tar. That got transform to work, but added the resource fork to the tar archive.

So changed the tar command to set a env

drush_op('drush_shell_exec', "COPYFILE_DISABLE=1 tar -Pcf - --exclude='.git' --transform='s,{$this->path},{$this->FserverProject->name},' {$this->path} | gzip > {$file_path}/{$base}.tgz");

This excludes the resource fork. So works perfectly now.

Just wanted to add my workaround, in case other people run into the same problems

Len