Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speedup php7 source retrieval #11

Closed
wants to merge 1 commit into from
Closed

Conversation

halfa
Copy link
Contributor

@halfa halfa commented Dec 7, 2015

It is an install process, so we don't need the whole tree.
Clone only the latest level of the repository.

Fix: Properly retrieve targeted branch
I didn't remove the checkout and pull, but it should be ok to do so.

I got a little too fast this morning, and I tested it improperly on a half-downloaded repo.
Thanks to the git pull, I worked anyway but I missed any warnings on the branch retrieval process.

Sorry for the mess :'(

It is an install process, so we don't need the whole tree.
Clone only the latest level of the repository.

Fix: Properly retrieve targeted branch
@ghost
Copy link

ghost commented Jan 8, 2016

+1

@@ -23,7 +23,7 @@ sudo apt-get install -y \

sudo mkdir /usr/local/php7

git clone https://github.com/php/php-src.git
git clone -b PHP-7.0.0 --depth=1 https://github.com/php/php-src.git
cd php-src
git checkout PHP-7.0.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHP-7.0.2 is the latest and with -b within the clone the checkout isn't important anymore

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seffenberg-naspers The issue here is that the user can't checkout a different branch in the future if --depth=1 is specified. I think we need to also specify --no-single-branch.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in my case it works fine:

Cloning into 'php-src'...
remote: Counting objects: 18090, done.
remote: Compressing objects: 100% (15095/15095), done.
remote: Total 18090 (delta 3610), reused 10643 (delta 2841), pack-reused 0
Receiving objects: 100% (18090/18090), 19.48 MiB | 1.00 MiB/s, done.
Resolving deltas: 100% (3610/3610), done.
Checking connectivity... done.
On branch PHP-7.0.2
Your branch is up-to-date with 'origin/PHP-7.0.2'.
nothing to commit, working directory clean

with this command line:

git clone -b PHP-7.0.2 --depth=1 https://github.com/php/php-src.git
cd php-src
git status

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seffenberg-naspers Now try running git checkout PHP-7.0.1 there.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kasparsd you see already from before that I'm on the correct branch already (so no need for a checkout) but here it is:

root@625f399b0f83:~# git clone -b PHP-7.0.2 --depth=1 https://github.com/php/php-src.git
Cloning into 'php-src'...
remote: Counting objects: 18090, done.
remote: Compressing objects: 100% (15095/15095), done.
remote: Total 18090 (delta 3610), reused 10643 (delta 2841), pack-reused 0
Receiving objects: 100% (18090/18090), 19.48 MiB | 1004.00 KiB/s, done.
Resolving deltas: 100% (3610/3610), done.
Checking connectivity... done.
root@625f399b0f83:~# cd php-src/
root@625f399b0f83:~/php-src# git status
gOn branch PHP-7.0.2
Your branch is up-to-date with 'origin/PHP-7.0.2'.
nothing to commit, working directory clean
root@625f399b0f83:~/php-src# git branch -vla
* PHP-7.0.2                038c63c sync NEWS
  remotes/origin/PHP-7.0.2 038c63c sync NEWS
root@625f399b0f83:~/php-src# git checkout PHP-7.0.2
Already on 'PHP-7.0.2'
Your branch is up-to-date with 'origin/PHP-7.0.2'.

I'm using git version

root@625f399b0f83:~/php-src# git --version
git version 2.1.4

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah wait, are you talking about re-using the git clone stuff? is this what most of the users will do?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing --depth=1 would require deleting the local repo whenever the version number is updated in the build script. A workaround is to use --no-single-branch but that results in a 108.04 MiB transfer instead of 19.47 MiB (for single branch). Or we could delete the existing php-src before every build. The whole repo is 249.70 MiB.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, but the version is hard coded in the script, so it looks natural to me to only get the version (maybe even downloading the .zip would be faster)..

git clone --depth=1 took 23s in my case, without --depth=1 it is 5mins .. so for some time, deleting/re-fetching is a good decision ;)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally don't delete the php-src directory so every time the build script bumps the PHP version it just simply fetches the new changes. It could be 5 minutes during the first build but only a few seconds during all the subsequent builds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like @kasparsd said, it is all about the purpose of this repository.

Like he said, the goal here is to use the repo as an update channel for future upgrades, so you can suffer the ~250 MiB of the initial download because it's easier/faster when updating.

My point when I wrote this PR was that 90% of people will not update frequently, and that the other 10% would just git remote set-branches origin '*' to get the full repo.

@iksaku
Copy link

iksaku commented Jan 13, 2016

Instead of using git sources, why not use the official tarballs now?

SDKiller added a commit to SDKiller/php-7-debian that referenced this pull request Mar 18, 2016
@halfa halfa closed this Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants