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

Account for hash in versioning #1293

Merged
merged 11 commits into from Mar 5, 2017

Conversation

Projects
None yet
3 participants
@dschaper
Copy link
Member

dschaper commented Mar 4, 2017

By submitting this pull request, I confirm the following (please check boxes, eg [X]) Failure to fill the template will close your PR:

Please submit all pull requests against the development branch. Failure to do so will delay or deny your request

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.

How familiar are you with the codebase?:

10


Versioning comparison using hashes.

This template was created based on the work of udemy-dl.

Get short hash of local and remote
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>

@dschaper dschaper added the WIP label Mar 4, 2017

@dschaper dschaper requested review from PromoFaux and DL6ER Mar 4, 2017

dschaper added some commits Mar 4, 2017

Always show something, even if it's just the short hash of the latest…
… commit.

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
Factor out variables from display.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
Optimize code, undoc flag for current hash.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
Prototype function for getting version of local repo
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
Functions for Core/Web version and hash. And only check first argumen…
…t in each section.

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
Awk for perl
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
Collapse duplicate functions, and take out argument loops.
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
Function...
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
@PromoFaux

This comment has been minimized.

Copy link
Member

PromoFaux commented Mar 4, 2017

Oh wow, this is a complete rewrite of the script! I will take a closer look later :)


piholeVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/pi-hole/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//')
webVersionLatest=$(curl -s https://api.github.com/repos/pi-hole/AdminLTE/releases/latest | grep -Po '"tag_name":.*?[^\\]",' | perl -pe 's/"tag_name": "//; s/^"//; s/",$//')
version=$(curl --silent --fail https://api.github.com/repos/pi-hole/${daemon}/releases/latest | \

This comment has been minimized.

Copy link
@DL6ER

DL6ER Mar 4, 2017

Member

I wonder if we should store the most recent tag somewhere on our servers, so that there is (a) no limit on how often you can query the latest version and (b) no effort necessary to parse it on the client side

@@ -89,14 +120,19 @@ EOM
exit 0
}

PHVERSION=$(getLocalVersion "${PHGITDIR}")

This comment has been minimized.

Copy link
@DL6ER

DL6ER Mar 4, 2017

Member

If we do

pihole -v -a -c; pihole -v -a -l; pihole -v -p -c; pihole -v -p -l

this does not only take a full six seconds of time, but also it queries the Github API 8 times (2x for each run), where it would only be necessary to do this twice!

Why do we process all of them always?

@DL6ER

This comment has been minimized.

Copy link
Member

DL6ER commented Mar 4, 2017

Increased speed and efficiency

pi@raspberrypi:/etc/.pihole# git checkout 0e8fd49
HEAD is now at 0e8fd49... Function...

pi@raspberrypi:/etc/.pihole# time $(pihole -v -a -c; pihole -v -a -l; pihole -v -p -c; pihole -v -p -l; pihole -v -a -h; pihole -v -p -h) &> /dev/null

real    0m7.543s
user    0m0.980s
sys     0m0.400s

pi@raspberrypi:/etc/.pihole# git checkout b85af50
Previous HEAD position was 0e8fd49... Function...
HEAD is now at b85af50... Generate only the information that is actually asked for

pi@raspberrypi:/etc/.pihole# time $(pihole -v -a -c; pihole -v -a -l; pihole -v -p -c; pihole -v -p -l; pihole -v -a -h; pihole -v -p -h) &> /dev/null

real    0m1.312s
user    0m0.230s
sys     0m0.070s
Optimize normalOutput
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
@PromoFaux

This comment has been minimized.

Copy link
Member

PromoFaux commented Mar 4, 2017

Approved

Approved with PullApprove

@dschaper dschaper merged commit 560af43 into development Mar 5, 2017

5 checks passed

codacy/pr Good work! A positive pull request.
Details
code-review/pullapprove Approved by dschaper, PromoFaux
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
licence/cla Contributor License Agreement is signed.
Details

@dschaper dschaper deleted the fix/version branch Mar 5, 2017

DL6ER added a commit that referenced this pull request Mar 10, 2017

Merge pull request #1293 from pi-hole/fix/version
Account for hash in versioning

@DL6ER DL6ER referenced this pull request Mar 10, 2017

Merged

Pi-hole Core v2.13.2 #1312

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.