pkgbuild OSX, Enforce installation failure in case of downgrade - macos

I'd made a package that include 2 components according to --component-plist file. on the plist file I've added the following flag to prevent downgrade :
BundleIsVersionChecked: Don't install bundle if newer version on disk? (bool)
when I perform downgrade scenario, I get the following message :
Sep 15 11:42:49 os-x-10 installd[284]: PackageKit: Skipping component \
"com.my.driverAE21E" (<current_version>) because the version \
<new_version> is already installed at <my_component>
This is expected, but unfortunately, the installation goes on, and the other component is being properly installed, and so does the preinstall and postintsall scripts - so I get a mixture of both versions.
Is there any way to enforce component version validation prior to any attempt to actually install them, and stop the installation process in case the validation wasn't pass.
UPDATE :
Another approach that can help me is to prevent the running of preinstall and postinstall scripts in case an attempt to downgrade is made.
I've seen reference to unanswered question about this issue here.

What you need to do is add version-check to your distribution.xml for product archive, and then perform whatever check you want in JavaScript code. This will allow you to prevent installation from starting as early as possible by returning false from the check function. Can't give you an example as I never did custom version check myself, but using my.target.receiptForIdentifier() and system.compareVersions() should get you going.
More info on the matter: https://developer.apple.com/reference/installerjs (follow "Distribution Definition XML Schema Reference" link there for distribution.xml description).

Related

How to update my Windows application package in wingetcreate

I have a little problem while I want to update my package. I'll explain this: I published my package. After that, I waited for 2-3 hours for my packages be in the microsoft/winget-pkgs in GitHub. My branch merged successfully, It works on any Windows devices but, I created a new version of my application: v3.6.2. The version that I released it was v3.5.7. So now, I can't publish that version because this error is showing when I execute this cmd command: wingetcreate update <packageIdentifier> -u https://github.com/YourUsername/yourrepository/releases/download/3.6.2/yourapp.exe --version 3.6.2 -t ghp_YourGithubPersonalAccessTokenWith_public_repo_setting.
If you want an image, i'll show you the image (My Windows is French btw): Here the image. But as you can see, the red is the error and I tried everything, I searched on Google and didn't find anything that fixed my problem, I tried the examples showed above when you only execute this command: wingetcreate.exe update but still the same error message that you can see on the image.
So I decided to take the third example but same, without success. Is there a way that could update my WinGet package? Thanks!
I don't know if this could help but I can give you some info: it's inno, the achitecture is Neutral.
IMPORTANT NOTE:
FIX HERE
The last answer works but if you type the command winget search <YourApp>, it will keep the previous version and if you install, it would install the previous one... How to fix that because it is litteraly NOT updating but doing nothing.
It's hard for me to know exactly what the issue is without knowing the contents of the manifest or the metadata of the installer. My gut feeling is that there is an architecture mismatch when trying to match the installer you provided with the existing installer that is currently specified in the existing manifest. To override the detected architecture you can use the '|' symbol followed by the desired architecture. Here is an example:
wingetcreate update <packageIdentifier> -u "https://github.com/YourUsername/yourrepository/releases/download/3.6.2/yourapp.exe|x64" --version 3.6.2 -t <githubToken>
If that doesn't work for you, I would encourage you to post an issue on the GitHub repository so we can help you further.
Okay, I found the way: You take the code that the previous answer contains, and add -s:
wingetcreate update -s <packageIdentifier> -u "https://github.com/YourUsername/yourrepository/releases/download/3.6.2/yourapp.exe|x64" --version 3.6.2 -t <githubToken>
It will publish the application on GitHub for verification, in the command prompt you put (replace the sentence in the quotes with your current manifest file):
winget validate --manifest "PathToYourManifestShowedInGreenAfterPublishing"
When the validation on GitHub is done, it's done and normally it should work.
NOTE: Verification on GitHub can take 2 to 3 hours or even 4 hours. Be patient! (I hope)

Update previously patched package with Yarn Berry

I'm using Yarn#3.0.2 in my project.
I have patched a package (#pkg/pkg) with the command yarn patch #pkg/pkg and I am using it as a devDependency with the patch: protocol.
Now I need to make another patch to the same package - but when I run the same command I get Multiple candidate packages found [...].
It works when trying to target the original package (using yarn patch #pkg/pkg#x.x.x), but I can't seem to find a way to target the patched project.
Any skilled yarn developer out there?
(Possibly useful information: I cannot use the resolutions field for the patch since #pkg/pkg is a CLI which does not seem to work with this approach)
The solution was choose the patch suggested with the error and encapsule it in qoutes such as:
yarn patch "patch:..."

Why can't SnowSQL 1.2.2 find a version to download?

First thing I do after unpacking the SnowSQL Linux client is try to upgrade it. This has worked very well through at least v1.1.84. Today I downloaded v1.2.2, installed it, and got an error:
$ ~/bin/snowsql -Uv
No snowsql is available for download: url=https://sfc-repo.snowflakecomputing.com/snowsql, version=1.2
The error comes from this download. Has something changed? I get the same error even when I just try to use it with no options at all, or trying to connect by passing my account code and username.
The curl above was missing https and hence gave the wrong impression of 403 forbidden.
Some times due to a caching issue with the downloads it will not autoupgrade. There are two main components, one being bootstrap and the other one being the main snowsql component. The one you see the issue with is the main component (it is auto-downloaded when you run snowsql).
You can force new version download using snowsql -v 1.2.2 as an exmaple.
You can delete/move the .snowsql directory (~/.snowsql or ~/bin/.snowsql) to ensure a new main component version is downloaded by the new bootstrap.
You may also try using the newer versions for which the rpm is available at
https://sfc-repo.snowflakecomputing.com/snowsql/bootstrap/1.2/linux_x86_64/index.html
I noticed Snowflake has some weird firewall configs and similar errors can either happen consistently or intermittently.
The only option I'm aware of that can help if it happens consistently is to use --noup flag with your commands. This will not check for snowsql updates of course, but you can always manually download a newer version via your browser(with VPN is needed).

How to solve "VisibleDeprecationWarning: zmq.eventloop.minitornado is deprecated"?

When I use iPython to run some scripts, I've got the following warning message in iTerm:
/Users/###/anaconda3/lib/python3.6/site-packages/ipykernel/displayhook.py:12:
VisibleDeprecationWarning: zmq.eventloop.minitornado is deprecated in pyzmq 14.0 and will be removed.
Install tornado itself to use zmq with the tornado IOLoop.
When I try to run my code in Visual Studio Code, I've got the following error message:
Error message in VSCode
I have already tried to update Anaconda, I have already tried to install nomkl with conda as well, without any success.
iTerm and VisualStudio on Mac OS 10.14.6, Anaconda up to date (4.7.12)
Remedy Option A)
Use anaconda-tools to separate an environment, say aLastWorkingENV, where you make use of anaconda-tooling to roll-back all components to a last working state, which does not whine about future deprecations. In such aLastWorkingENV environment, all thus synchronised programs will work smooth (as they did before a first component update, that has moved the stick)
Remedy Option B)
Use anaconda-tools to update all current components and all their supporting modules and all packages versions [ python, ipython, pyzmq, jupyter, ..., ] to their most recent versions, where products QA coverage ought either confirm the PASS, or provide a remedy or workaround or the last-trouble-free version ( to eventually downgrade one such package, based on such exception, if present and relevant )
Either way, your code would stop throwing the soft-warnings and remain in such state, until any un-coordinated package update takes place.

Using -verbosity and -version in the nuget command tool suppresses verbose output

So I am trying to use both the -verbosity and -version option together on the nuget command line. I need to use both and then parse the output of the verbosity log (this will determine other behaviors). So it is important that I get the verbose log. But for version control and making sure I can download the necessary packages again if need be I need to be able to specify -version.
Here is my commands and outputs:
(with only verbosity)
[C:\Users\C\Downloads]nuget install prism.PubSubEvents -verbosity detailed
GET https://www.nuget.org/api/v2/FindPackagesById()?$filter=IsLatestVersion&$orderby=Version desc&$top=1&id='prism.PubSubEvents'
GET https://www.nuget.org/api/v2/Packages(Id='prism.PubSubEvents',Version='1.1.2')
Installing 'Prism.PubSubEvents 1.1.2'.
Successfully installed 'Prism.PubSubEvents 1.1.2'.
(with both, after deleting the folder I just downloaded)
[C:\Users\C\Downloads]nuget install prism.PubSubEvents -verbosity detailed -version 1.0.0
Installing 'Prism.PubSubEvents 1.0.0'.
Successfully installed 'Prism.PubSubEvents 1.0.0'.
Switching the order of the options around and also it doesn't matter if I specify and older version or even the newest version.
Any help would be greatly appreciated.
I am returning to answer this in case anyone else finds it.
As it turns out, nuget caches all packages which are downloaded in %APPDATA%Local\NuGet\Cache and looks there first before going to download any packages from the web. That is why no output was coming out, because it doesn't say that is is looking in the cache and just picks them up from there without going to the web.
However, you can choose to ignore the cache with the -nocache option. This will always give you some kind of verbose output (although it is a little unpredictable)

Resources