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

Update timestamps each time a build is done #772

Merged
merged 2 commits into from
Nov 3, 2024

Conversation

modos189
Copy link
Contributor

@modos189 modos189 commented Oct 28, 2024

Found a way to avoid code duplication

Closes #740 #770

Copy link

github-actions bot commented Oct 28, 2024

🤖 Pull request artifacts

file commit
IITC_Mobile-test.apk dd3877b
test-0.39.1.20241103.111649.zip dd3877b

See build on website

@nexushoratio
Copy link
Contributor

What needs to be done to move this forward?

@modos189
Copy link
Contributor Author

modos189 commented Nov 2, 2024

What needs to be done to move this forward?

If you confirm that this PR works properly, I will merge it

@nexushoratio
Copy link
Contributor

If you confirm that this PR works properly, I will merge it

Ahh, sorry. Didn't realize this was up to me. :->

@nexushoratio
Copy link
Contributor

Embarrassing git novice question (I've not done this step before):

How do I get this locally using git instead of gh ?

From reading https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally, I thought I could something like:
git fetch origin pull/772/head:testing

But I just git an error:

fatal: couldn't find remote ref pull/772/head

@modos189
Copy link
Contributor Author

modos189 commented Nov 2, 2024

How do I get this locally using git instead of gh ?

This should work:

git fetch origin pull/772/head:fix/build-timestamps
git switch fix/build-timestamps

@nexushoratio
Copy link
Contributor

git fetch origin pull/772/head:fix/build-timestamps

That's what I was trying but got the couldn't find remove ref error. At least I was on the right track. I must have something misconfigured locally.

@xscreach
Copy link
Contributor

xscreach commented Nov 2, 2024

git fetch origin pull/772/head:fix/build-timestamps

That's what I was trying but got the couldn't find remove ref error. At least I was on the right track. I must have something misconfigured locally.

Thats because you are fetching from your fork, not the original repository.
For that you'd need to add the original remote and then do the fetching from that remote instead of "origin"

I'd really only suggest checking out the fix/build-timestamp branch.
Just make sure your branch is based on latest master

@nexushoratio
Copy link
Contributor

Thats because you are fetching from your fork, not the original repository.

I'd just figured that out. Like I said, novice. :-/

@xscreach
Copy link
Contributor

xscreach commented Nov 2, 2024

Maybe, catch us on telegram, we can discuss these things better/faster there...

https://t.me/screach

@nexushoratio
Copy link
Contributor

What needs to be done to move this forward?

If you confirm that this PR works properly, I will merge it

Looks good to me.

Thanks!

settings.py Outdated
)


def build_timestamp():
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be better or more readable to call these functions from the get_current_timestamp method and have the actual building here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you propose to get rid of get_current_timestamp(), move the code to build_timestamp() and build_date()?
Maybe. I like both options, there are pros and cons to both

Copy link
Contributor

Choose a reason for hiding this comment

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

Both have a race condition. If the second ticks over between the calls to gmtime(), the results will be different.

I don't know if there is any code that depends on those values being identical.

Copy link
Contributor

@xscreach xscreach Nov 2, 2024

Choose a reason for hiding this comment

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

Do you propose to get rid of get_current_timestamp(), move the code to build_timestamp() and build_date()?
Maybe. I like both options, there are pros and cons to both

Well, no... do not remove the get_current_timestamp.
Rather to have the time.strftime(...) inside of the "build" methods which would get called from get_current_timestamp with the same "time" parameter and have this parameter default to time.gmtime() in case its called separately.

The point is to not calculate both when we need only one of those.

(This is just about polishing the code, I'm quite ok with the current state, it just feels weird to call method to calculate several values and then use only one 🤷‍♂️)

Copy link
Contributor

Choose a reason for hiding this comment

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

No need to block the PR for this, but if it could be improved I'd be glad 😉

@modos189
Copy link
Contributor Author

modos189 commented Nov 3, 2024

I've updated the code to get rid of a possible time unsynchronization within the same build

Copy link
Contributor

@xscreach xscreach left a comment

Choose a reason for hiding this comment

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

Maybe just remove the return from generate timestamp, otherwise ok

settings.py Outdated Show resolved Hide resolved
@modos189 modos189 merged commit fb5b2b8 into IITC-CE:master Nov 3, 2024
4 checks passed
@modos189 modos189 deleted the fix/build-timestamps branch November 3, 2024 12:51
@nexushoratio
Copy link
Contributor

Thanks!

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.

Stale timestamps with build.py --watch
3 participants