Update from server does not recognize new version of package

For Joomla! 3.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Locked
dakur
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Jul 18, 2018 8:22 am

Update from server does not recognize new version of package

Post by dakur » Fri Nov 02, 2018 3:40 pm

Hello everyone,

I've written my own package (consisting of component and template) and set up a deploy server according to docs with a big help of jEvents source code.

When I choose "Install from URL" in my Joomla administration and type there URL of my pkg_update.xml file, it installs correctly both component and template alongside with the package and everything works. But when I deploy a new version of this package, the pkg_update.xml is updated, but Joomla does not suggest any update notice, even when I hit the "Find updates" button.

Thank you for any tip what to do.

XML file sources:

pkg_update.xml:

Code: Select all

<updates>
	<update>
		<name>Example package</name>
		<description>...</description>
		<element>pkg_example</element>
		<type>package</type>
		<client>site</client>
		<version>a682bed2a</version>
		<downloads>
			<downloadurl type="full" format="zip">https://example.com/pkg_example-a682bed2a.zip</downloadurl>
			<downloadurl type="upgrade" format="zip">https://example.com/pkg_example-a682bed2a.zip</downloadurl>
		</downloads>
		<tags>
			<tag>stable</tag>
		</tags>
		<targetplatform name="joomla" version="3.*" />
	</update>
</updates>
pkg_example.xml:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<extension type="package" version="1.6" method="upgrade">
	<packagename>example</packagename>
	<name>Example package</name>
	<description>...</description>
	<creationDate>2018-11-02</creationDate>

	<version>a682bed2a</version>
	<files folder="packages">
		<file type="component" id="com_example">com_example.zip</file>
		<file type="template" id="tpl_example" client="site">tpl_example.zip</file>
	</files>

	<updateservers>
		<server type="extension" name="BrontoPackage update">https://example.com/pkg_update.xml</server>
	</updateservers>
</extension>

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30937
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Update from server does not recognize new version of package

Post by Per Yngve Berg » Fri Nov 02, 2018 8:08 pm

Mod. Note: Relocating the topic to the Coding Forum.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44093
Joined: Sat Apr 05, 2008 9:58 pm

Re: Update from server does not recognize new version of package

Post by Webdongle » Fri Nov 02, 2018 10:40 pm

http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

dakur
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Jul 18, 2018 8:22 am

Re: Update from server does not recognize new version of package

Post by dakur » Mon Nov 05, 2018 6:50 am

@Webdongle: I've linked to this page in my post already.

SharkyKZ
Joomla! Hero
Joomla! Hero
Posts: 2909
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: Update from server does not recognize new version of package

Post by SharkyKZ » Mon Nov 05, 2018 8:03 am

Code: Select all

<version>a682bed2a</version>
Your version format is not supported.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44093
Joined: Sat Apr 05, 2008 9:58 pm

Re: Update from server does not recognize new version of package

Post by Webdongle » Mon Nov 05, 2018 9:15 am

dakur wrote:
Mon Nov 05, 2018 6:50 am
@Webdongle: I've linked to this page in my post already.
I don't see where you linked to it. I see a link to github but not docs.joomla.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

dakur
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Jul 18, 2018 8:22 am

Re: Update from server does not recognize new version of package

Post by dakur » Mon Nov 05, 2018 10:32 am

@SharkyKZ It works and better fill my needs. Everything's correctly installed and when I run auto-update on not package, but single extensions, it auto-updates well.

@Webdongle: The word "docs" in this sentence "deploy server according to docs with a big help" goes there.

SharkyKZ
Joomla! Hero
Joomla! Hero
Posts: 2909
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: Update from server does not recognize new version of package

Post by SharkyKZ » Mon Nov 05, 2018 1:33 pm

Which version of the package do you currently have installed?

dakur
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Jul 18, 2018 8:22 am

Re: Update from server does not recognize new version of package

Post by dakur » Mon Nov 05, 2018 3:48 pm

@SharkyKZ What do you mean? My package version is generated from commit hash. So each time I deploy the package to my update server, last commit hash is taken as a version number. So the current installed is "40a317ff8b84c6b16437a00ff243a19bd39781aa". And the one to be installed but not recognized is "bdd5a3096a947c87abb66cf8f7ea547ba6cbbdd5".

Image

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44093
Joined: Sat Apr 05, 2008 9:58 pm

Re: Update from server does not recognize new version of package

Post by Webdongle » Mon Nov 05, 2018 3:58 pm

bdd5a3096a947c87abb66cf8f7ea547ba6cbbdd5 is not an increment of 40a317ff8b84c6b16437a00ff243a19bd39781aa

3.3 is an increment of 3.2

afaik the updated version number must be an increment of the original version number. I could be wrong and it may be that it is recognised as an update if it it is different but try using incremental version numbers.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

SharkyKZ
Joomla! Hero
Joomla! Hero
Posts: 2909
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: Update from server does not recognize new version of package

Post by SharkyKZ » Mon Nov 05, 2018 4:04 pm

My package version is generated from commit hash.
That's the problem. You need to use a versioning system compatible with PHP's version_compare().

dakur
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Jul 18, 2018 8:22 am

Re: Update from server does not recognize new version of package

Post by dakur » Mon Nov 05, 2018 4:13 pm

@SharkyKZ @Webdongle But I do not want to. I don't wanna generate new patch version (tag in git world) for every merge request of that package which I want to try first on my staging Joomla server before going to production. How would solve this, guys? Have you ever? Using version_compare() is kind of limiting in here...
As I am not making package for public, but for purpose of the organization I am doing website for, I do not really care about versions, just need an updating mechanism where user just hits "Update" and it updates without filling any URL or other stuff.

Plus I can not understand, why it works with component with the commit hash, but not with package. Component update does not use version_compare()?

SharkyKZ
Joomla! Hero
Joomla! Hero
Posts: 2909
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: Update from server does not recognize new version of package

Post by SharkyKZ » Tue Nov 06, 2018 8:24 am

Using version_compare() is kind of limiting in here...
It's not limiting. Using hashes is just not sensible. Their values end up being random so there's way of telling which one is supposed to be the newer version. No matter whether you use version_compare() or something else to compare.

dakur
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Jul 18, 2018 8:22 am

Re: Update from server does not recognize new version of package

Post by dakur » Tue Nov 06, 2018 8:36 am

@SharkyKZ According to docs "A separate <update> definition will be required for each version of your extension you release." which means that version order is guaranteed by order of <update> tags inside of update.xml file. At least I thought so. That is why I started experimented with commit hash version because it is more flexible for my use-case. Then I tried only one <update> tag rewrote each time with newer version and that worked as well. But all of these stuff worked only for component or template, not for package. I would it expect working for all or for none of them. I am really confused by this difference what Joomla (docs) says and what it does in reality.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44093
Joined: Sat Apr 05, 2008 9:58 pm

Re: Update from server does not recognize new version of package

Post by Webdongle » Tue Nov 06, 2018 9:55 am

@dakur
Please tell me which of the following is the newest version ?

hy773bg5mz
adG64Vnhw8
MluTwtW


And please explain to me how a computer program/script knows that bdd5a3096a947c87abb66cf8f7ea547ba6cbbdd5 is a newer version of 40a317ff8b84c6b16437a00ff243a19bd39781aa
???
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

dakur
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Jul 18, 2018 8:22 am

Re: Update from server does not recognize new version of package

Post by dakur » Tue Nov 06, 2018 10:00 am

@Webdongle If I follow docs then my update.xml file would look like this:

Code: Select all

<updates>
	<update>
		...
		<version>hy773bg5mz</version>
		...
	</update>

	<update>
		...
		<version>adG64Vnhw8</version>
		...
	</update>

	<update>
		...
		<version>MluTwtW</version>
		...
	</update>
</updates>
Then I can say that "hy773bg5mz" is the newest because it's on the top position. At least that's how I suppose it works. It would not make sense to list previous versions otherwise.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44093
Joined: Sat Apr 05, 2008 9:58 pm

Re: Update from server does not recognize new version of package

Post by Webdongle » Tue Nov 06, 2018 2:02 pm

dakur wrote:
Tue Nov 06, 2018 10:00 am
...
Then I can say that "hy773bg5mz" is the newest because it's on the top position. ...
And why do you presume the position defines the date order of the version ?


dakur wrote:
Tue Nov 06, 2018 10:00 am
...
At least that's how I suppose it works. It would not make sense to list previous versions otherwise.
Listing previous makes sense because make it makes sure all previous versions are updated
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

dakur
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Jul 18, 2018 8:22 am

Re: Update from server does not recognize new version of package

Post by dakur » Wed Nov 14, 2018 6:36 am

And why do you presume the position defines the date order of the version ?
Because it makes sense. When some items have an order and it depends one on another, I would guess that the order determines relationships among these dependencies. It is something I would call developer experience that tells one that it should work this way. And when it does not, you are confused. I think that APIs should be subordinated/subjected to this experience, just like web UIs should be subordinated to user's experience - not the opposite.

Anyway, finally I have written a "version faker" API https://gist.github.com/dakur/ae791a1a3 ... e7fd00bff0so that every feature branch in my repository during every deploy obtains a following version number so that Joomla version comparer is satisfied.

Thank you both @SharkyKZ and @Webdongle for your time and help.
Last edited by toivo on Wed Nov 14, 2018 9:43 am, edited 1 time in total.
Reason: mod note: made URL visible


Locked

Return to “Joomla! 3.x Coding”