Recent

Author Topic: BGRA Version Number  (Read 4330 times)

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: BGRA Version Number
« Reply #15 on: April 25, 2019, 01:01:17 pm »
As a matter of fact, I did the latest releases like this:
- update package and JSON file with new version (and merge with master branch)
- hope package manager does not read it in the next seconds
- make a release to get the zip file

I wonder if that could be a problem.

It's a classic synchronization problem, isn't it? you change something and pray it's not read until you change something else which depends on it :D

I think it's better to make the release first and announce it (in the json) last.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

circular

  • Hero Member
  • *****
  • Posts: 4181
    • Personal webpage
Re: BGRA Version Number
« Reply #16 on: April 25, 2019, 02:44:10 pm »
Indeed.
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4181
    • Personal webpage
Re: BGRA Version Number
« Reply #17 on: April 25, 2019, 02:57:31 pm »
Though there is a problem as well with doing the JSON afterwards.

When publishing the version on Github, it creates the zip file with the current content of the JSON file. So if the JSON has not been updated yet, then in the zip file to be downloaded the JSON file will not be up-to-date.
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: BGRA Version Number
« Reply #18 on: April 25, 2019, 04:30:24 pm »
What I do is using the zip file of the master branch. Not of specific release.

https://github.com/bgrabitmap/bgracontrols/blob/master/update_bgracontrols_force.json
So when I merge into master I update all package and json at the same time.

The problem can be that someone is downloading the zip file and I just update it at the same time...  That depends on how works the server of GitHub downloads.
« Last Edit: April 25, 2019, 04:42:23 pm by Lainz »

circular

  • Hero Member
  • *****
  • Posts: 4181
    • Personal webpage
Re: BGRA Version Number
« Reply #19 on: April 25, 2019, 05:20:31 pm »
I added the constant and did a program to update. It is on the dev branch of bgrabitmap.

In BGRABitmapTypes there is constant BGRABitmapVersion and function BGRABitmapVersionStr which formats it.
Code: Delphi  [Select][+][-]
  1. const
  2.   BGRABitmapVersion = 9090300;  // that means 9.09.03.00
  3.  
  4.   function BGRABitmapVersionStr: string;  // which returns 9.9.3

Releaser program
This program update the version of any library. It works with an input file (that I called a logic file) that specifies where version numbers are.

It will create the JSON file if it does not exist but is mentionned in the logic file.

The program is in dev/releaser and can be used as a command line.
https://github.com/bgrabitmap/bgrabitmap/tree/dev-bgrabitmap/dev/releaser

Here is the file bgrabitmap.logic for BGRABitmap:
Code: [Select]
cd ..\..
manager update_BGRABitmap.json
archive https://github.com/bgrabitmap/bgrabitmap/archive/v$(Version).zip
cd bgrabitmap
package bgrabitmappack.lpk
package bgrabitmappack4fpgui.lpk
package bgrabitmappack4nogui.lpk
const bgrabitmaptypes.pas BGRABitmapVersion

@lainz
If I understand, you use the same url for the zip file.

I suppose you're wondering if the transfer would be interrupted. That's a good question.

Alos I guess that could lead to following:
- package manager downloads the JSON
- you release a new version
- package manager downloads the new version but stores that the version number is older
Not sure if it matters


« Last Edit: April 25, 2019, 05:55:03 pm by circular »
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: BGRA Version Number
« Reply #20 on: April 25, 2019, 06:08:45 pm »
Thanks I will try to add to BGRAControls as well.

Edit: I try but seems that we have different JSON format, I asked GetMem here
https://forum.lazarus.freepascal.org/index.php/topic,34297.msg319004.html#msg319004
« Last Edit: April 25, 2019, 06:30:38 pm by Lainz »

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: BGRA Version Number
« Reply #21 on: April 25, 2019, 06:59:22 pm »
Though there is a problem as well with doing the JSON afterwards.

When publishing the version on Github, it creates the zip file with the current content of the JSON file. So if the JSON has not been updated yet, then in the zip file to be downloaded the JSON file will not be up-to-date.

Then update the JSON before zipping. :)

I'll have to give a look to that releaser: it may save me the time of writing my own if it can be adapted to my needs. I'm geting tired of clumsy, mostly ad-hoc scripts  ;)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

circular

  • Hero Member
  • *****
  • Posts: 4181
    • Personal webpage
Re: BGRA Version Number
« Reply #22 on: April 25, 2019, 07:22:35 pm »
Thanks I will try to add to BGRAControls as well.

Edit: I try but seems that we have different JSON format, I asked GetMem here
https://forum.lazarus.freepascal.org/index.php/topic,34297.msg319004.html#msg319004
I've added some code to handle both formats. Does it work for you now?
Conscience is the debugger of the mind

circular

  • Hero Member
  • *****
  • Posts: 4181
    • Personal webpage
Re: BGRA Version Number
« Reply #23 on: April 25, 2019, 07:26:09 pm »
Though there is a problem as well with doing the JSON afterwards.

When publishing the version on Github, it creates the zip file with the current content of the JSON file. So if the JSON has not been updated yet, then in the zip file to be downloaded the JSON file will not be up-to-date.

Then update the JSON before zipping. :)
The thing is the zip is done by GitHub when releasing the version, which is done on the master branch, which contains the JSON. So indeed I update the JSON before doing the release. So for a few seconds, the link to the zip file doesn't work.

Quote
I'll have to give a look to that releaser: it may save me the time of writing my own if it can be adapted to my needs. I'm geting tired of clumsy, mostly ad-hoc scripts  ;)
Ok. If you have some improvements, I will be happy to hear about it.
Conscience is the debugger of the mind

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: BGRA Version Number
« Reply #24 on: April 25, 2019, 09:15:32 pm »
Thanks, now it works fine =)

BGRAControlsInfo.pas is the unit for BGRAControls version number, exactly the same as in BGRABitmap.
« Last Edit: April 26, 2019, 01:22:14 am by Lainz »

circular

  • Hero Member
  • *****
  • Posts: 4181
    • Personal webpage
Re: BGRA Version Number
« Reply #25 on: May 16, 2019, 09:32:29 pm »
I've added support for projects (programs or libraries) to the releaser. Also the ($LogicDir) constant can be used, so that you can process the logic file from an current directory.

Here is for example the logic file for LazPaint:
Code: [Select]
cd ($LogicDir)/lazpaint
project lazpaint.lpi
package lazpaintembeddedpack.lpk
const lazpainttype.pas LazPaintVersion
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018