Home » Developing U++ » U++ Developers corner » Things we want from Linux/FreeBSD release archives
| Things we want from Linux/FreeBSD release archives [message #53378] |
Tue, 31 March 2020 17:52  |
 |
mirek
Messages: 14291 Registered: November 2005
|
Ultimate Member |
|
|
I am starting this new thread to gather ideas about how to improve current Linux tarballs.
Here is my list:
- automatic dependencies installation - detect existence of apt-get / yum / zypper / pacman, perhaps even distro, install things during setup. If that fails, make user aware and ask if script should continue
- use 7z (or at least zip), stop changing the name, just single "upp" folder
- stop moving things around, stop writing outside "upp" folder - basically same behaviour as Win32 and MacOS. theide will get generated inside unpacked archive and will stay there. I think users can and will move it where they want later. (That said, I am not quite sure at this point about ~/.upp. Easy to do for theide, not so sure about compiled apps).
- ship with umks and use it if possible. If not, use Makefile to create umk
|
|
|
|
| Re: Things we want from Linux/FreeBSD release archives [message #53381 is a reply to message #53378] |
Tue, 31 March 2020 20:46   |
|
|
Hi Mirek,
Quote:detect existence of apt-get / yum / zypper / pacman
Good idea, but there should also be a simple way to disable this. This will be appreciated by packagers who would like to create deb/rpm/PKGBUILD/... because in that case the tooling has its own ways to install prerequisites.
Quote:- use 7z (or at least zip), stop changing the name, just single "upp" folder
What's wrong with *.tar.gz? Or *.tar.xz which is actually what every major distro starts to use lately... The 7z extractor is not installed by default on many distributions (checked on Arch and Debian), so it is not really linux friendly...
Also I'm not sure what you mean by changing the name, but I'm pretty sure that the "x11" should be dropped from the filename.
Quote:- stop moving things around, stop writing outside "upp" folder - basically same behaviour as Win32 and MacOS. theide will get generated inside unpacked archive and will stay there. I think users can and will move it where they want later. (That said, I am not quite sure at this point about ~/.upp. Easy to do for theide, not so sure about compiled apps).
Definitely a good idea. I think the proper place for the things currently written in ~/.upp is actually in ~/.config. Also, TheIDE should store compiled object in ~/.cache, since they ca be easily rebuilt. It should be possible to configure it, since U++ already uses XDG Base Directory specification. So the Makefile in the source package should set the necessary XDG_* environment variables to some local directory, e.g. upp/build/.
Quote:- ship with umks and use it if possible. If not, use Makefile to create umk
Better not put it directly into the source package. Downloading it during the process if needed is IMHO better. The Makefile could also optionally support to use already existing umk (autodetecting it's presence on $PATH or by explicit configuration option).
Few more points I would like to suggest:
- Clean the files a bit, before packaging. I think the archive is pretty big and it wouldn't hurt to only include necessary files. E.g. 32MB of tppi could be omitted, as those are automatically created by TheIDE (if I understand it correctly). Perhaps they should not even be in the repository... There also might be some packages, that are no longer needed or maintained, or could be in separate nest, since they are not needed by regular users (yes TCore, I'm looking at you and your friends ).
- Follow common conventions as much as possible. It should be possible to build it just by running ./configure # this might not even be needed
make
make install
This is what most experienced user will try even before reading the README file. Which reminds me: there should be a README file Also, the "make install" part should honour the standard $DESTDIR and $PREFIX variables, to make it easier for packagers.
Best regards,
Honza
|
|
|
|
| Re: Things we want from Linux/FreeBSD release archives [message #53386 is a reply to message #53381] |
Tue, 31 March 2020 23:24   |
 |
mirek
Messages: 14291 Registered: November 2005
|
Ultimate Member |
|
|
dolik.rce wrote on Tue, 31 March 2020 20:46Hi Mirek,
Quote:detect existence of apt-get / yum / zypper / pacman
Good idea, but there should also be a simple way to disable this. This will be appreciated by packagers who would like to create deb/rpm/PKGBUILD/... because in that case the tooling has its own ways to install prerequisites.
Well, in general, I just mean there should be quick and easy way to get U++ running.
There should still be Makefile and "normal" way.
Quote:- use 7z (or at least zip), stop changing the name, just single "upp" folder
What's wrong with *.tar.gz? Or *.tar.xz which is actually what every major distro starts to use lately... The 7z extractor is not installed by default on many distributions (checked on Arch and Debian), so it is not really linux friendly...
[/quote]
tar.gz compression sucks. LZMA seems to produce archives that are about 50% of size. But tar.xz is probably better than 7z.
Quote:
Also I'm not sure what you mean by changing the name, but I'm pretty sure that the "x11" should be dropped from the filename.
I mean that file name can be basically the same (withou x11), but after unpacking, it should be just upp
Quote:
Definitely a good idea. I think the proper place for the things currently written in ~/.upp is actually in ~/.config. Also, TheIDE should store compiled object in ~/.cache, since they ca be easily rebuilt. It should be possible to configure it, since U++ already
By not moving around I am actually thinking about putting everything to that "upp" folder after unpacking. Keep it "sandboxed", no writes outside that dir.
Quote:
- Clean the files a bit, before packaging. I think the archive is pretty big and it wouldn't hurt to only include necessary files. E.g. 32MB of tppi could be omitted, as those are automatically created by TheIDE (if I understand it correctly).
Well, they are needed during make unfortunately... The logic would need to move to compile phase.
I think most of those MB are screenshot in documentation. Perhaps redoing them with "Gray" theme would help. Or using jpg compression.
Quote:
Perhaps they should not even be in the repository... There also might be some packages, that are no longer needed or maintained, or could be in separate nest, since they are not needed by regular users (yes TCore, I'm looking at you and your friends ).
TCore is not present for a long time now...
Quote:
- Follow common conventions as much as possible. It should be possible to build it just by running [code]./configure # this might not even be needed
make
make install
Well, after changes I am planning I do not even know not only what ./configure would do, but even what make install is supposed to do.
After make, you get theide. Start theide and it configures itself.
Also, not really about release archive, but I think I will add nightly scrip that will add Makefile to svn so that it is buildable from git page.
Mirek
|
|
|
|
| Re: Things we want from Linux/FreeBSD release archives [message #53390 is a reply to message #53381] |
Wed, 01 April 2020 06:30   |
Novo
Messages: 1433 Registered: December 2006
|
Ultimate Contributor |
|
|
dolik.rce wrote on Tue, 31 March 2020 14:46since U++ already uses XDG Base Directory specification.
A quick question. Since when U++ is using XDG Base Directory specification?
In my local build all configuration files are located in ~/.upp
I vote for the XDG-Based directory structure.
It would be also great if ".upp" (or .config/upp) directory would be changeable. This should allow to create company/project specific configuration directories.
Regards,
Novo
|
|
|
|
| Re: Things we want from Linux/FreeBSD release archives [message #53391 is a reply to message #53390] |
Wed, 01 April 2020 07:32   |
|
|
Novo wrote on Wed, 01 April 2020 06:30A quick question. Since when U++ is using XDG Base Directory specification?
In my local build all configuration files are located in ~/.upp
Since about 2010 Unfortunately it is only used in some functions, e.g. GetDesktopFolder(). See Core/App.cpp for more examples... It should be relatively easy to use it also in GetHomeDirectory(), ConfigFile() and other functions.
Honza
|
|
|
|
| Re: Things we want from Linux/FreeBSD release archives [message #53399 is a reply to message #53391] |
Wed, 01 April 2020 11:07   |
 |
mirek
Messages: 14291 Registered: November 2005
|
Ultimate Member |
|
|
So I would like this:
static String sConfigFolder;
void SetConfigDirectory(const String& s)
{
sConfigFolder = s;
}
String ConfigFile(const char *file) {
if(sConfigFolder.GetCount())
return AppendFileName(sConfigFolder, file);
#if defined(PLATFORM_WIN32)
if(sHomecfg) {
String p = GetHomeDirFile(GetExeTitle());
ONCELOCK
RealizeDirectory(p);
return AppendFileName(p, file);
}
return GetExeDirFile(file);
#elif defined(PLATFORM_POSIX)
static String cfgdir;
ONCELOCK {
String h = GetExeFolder();
if(!sHomecfg)
while(h.GetCount() > 1 && DirectoryExists(h)) {
String pp = AppendFileName(h, ".config");
if(DirectoryExists(pp)) {
cfgdir = pp;
break;
}
h = GetFileFolder(h);
}
if(IsNull(cfgdir))
cfgdir = GetEnv("XDG_CONFIG_HOME");
if(IsNull(cfgdir) || !DirectoryExists(cfgdir))
cfgdir = GetHomeDirFile(".config");
}
String pp = AppendFileName(cfgdir, GetAppName());
RealizeDirectory(pp);
return AppendFileName(pp, file);
#else
NEVER();
return file;
#endif//PLATFORM
}
[Updated on: Wed, 01 April 2020 11:21] Report message to a moderator
|
|
|
|
| Re: Things we want from Linux/FreeBSD release archives [message #53407 is a reply to message #53399] |
Wed, 01 April 2020 18:17   |
Novo
Messages: 1433 Registered: December 2006
|
Ultimate Contributor |
|
|
Is it possible to add "static String sAppName" in addition to sConfigFolder?
In this case for PLATFORM_WIN32 we will get
String p = GetHomeDirFile(Nvl(sAppName, GetExeTitle()));
And for PLATFORM_POSIX
String pp = AppendFileName(cfgdir, Nvl(sAppName, GetAppName()));
Otherwise we are limited by a name of an executable.
Regards,
Novo
|
|
|
|
|
|
|
|
|
|
|
|
| Re: Things we want from Linux/FreeBSD release archives [message #53425 is a reply to message #53411] |
Thu, 02 April 2020 19:10   |
Novo
Messages: 1433 Registered: December 2006
|
Ultimate Contributor |
|
|
My ~/.config gets quickly littered by dozens of my dev apps.
Another problem is conflicting names. ~/.config is a system-wide namespace.
I propose to add a sAppNamePrefix variable in addition to the sAppName.
If it ends with the slash, then it will be a folder. (I propose to make it "upp/" by default)
Without the slash this will be a regular prefix. "upp" -> "upptheide", for example.
If I'm shipping several apps, I can put all configs in one folder, and name it after a company, for example.
Regards,
Novo
|
|
|
|
|
|
|
|
| Re: Things we want from Linux/FreeBSD release archives [message #53433 is a reply to message #53428] |
Fri, 03 April 2020 00:32   |
Novo
Messages: 1433 Registered: December 2006
|
Ultimate Contributor |
|
|
mirek wrote on Thu, 02 April 2020 14:45Novo wrote on Thu, 02 April 2020 19:33I just realized that I can create my local .config folder, but I still think that it would be useful to have the sAppNamePrefix variable ...
Maybe we can just allow slash in AppName and default to ".upp/" + GetExeTitle().
Anyway, I would like more opinions on this. After all, I have moved to .config based on suggestions here... 
Mirek
GetAppName() is used in many places. I haven't check all of them, but this doesn't seem to be a good idea.
Situation with Mac is slightly different. Apps have to be installed into the /Applications, otherwise they won't work correctly, AFAIK.
So, .config has to go somewhere in /Applications/XXX.app/Contents/MacOS/, but in this case ide and umk won't share configuration.
If we want to share stuff, it will go into ~/.config, and this will litter this folder ...
Regards,
Novo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: Things we want from Linux/FreeBSD release archives [message #53477 is a reply to message #53475] |
Sun, 05 April 2020 13:07   |
 |
mirek
Messages: 14291 Registered: November 2005
|
Ultimate Member |
|
|
amrein wrote on Sun, 05 April 2020 11:46Hi
I don't understand why we use ~/.config and ~/.cache and not directories in the current source directory when U++ is inside user home directory.
I mean, the main idea of sandboxing is to keep everything in the same directory, right? 
You have missed the description of the process. It is quite more complicated then just using ~/.config / ~.cache.
String ConfigFile(const char *file) {
if(sConfigFolder.GetCount())
return AppendFileName(sConfigFolder, file);
#if defined(PLATFORM_WIN32)
if(sHomecfg) {
String p = GetHomeDirFile(GetAppName());
ONCELOCK
RealizeDirectory(p);
return AppendFileName(p, file);
}
return GetExeDirFile(file);
#elif defined(PLATFORM_POSIX)
static String cfgdir;
ONCELOCK {
String h = GetExeFolder();
if(!sHomecfg)
while(h.GetCount() > 1 && DirectoryExists(h)) {
String pp = AppendFileName(h, ".config");
FindFile ff(pp);
if(ff && ff.IsFolder() && ff.CanWrite()) {
cfgdir = pp;
break;
}
h = GetFileFolder(h);
}
if(IsNull(cfgdir))
cfgdir = GetEnv("XDG_CONFIG_HOME");
if(IsNull(cfgdir) || !DirectoryExists(cfgdir))
cfgdir = GetHomeDirFile(".config");
if(sConfigGroup.GetCount())
cfgdir = AppendFileName(cfgdir, sConfigGroup);
}
String pp = AppendFileName(cfgdir, GetAppName());
RealizeDirectory(pp);
return AppendFileName(pp, file);
#else
NEVER();
return GetExeDirFile(file);
#endif//PLATFORM
}
|
|
|
|
|
|
| Re: Things we want from Linux/FreeBSD release archives [message #53481 is a reply to message #53478] |
Sun, 05 April 2020 13:22   |
|
|
mirek wrote on Sun, 05 April 2020 13:10Zbych wrote on Sun, 05 April 2020 11:12Novo wrote on Sun, 05 April 2020 00:49This does affect Mac and Linux apps.
What is technical reason of this change?
To be honest I pissed off by changes like this. I have many embedded apps that keep their settings in .upp directory and the last thing I need is to loose their settings, because default ConfigFile() has changed.
Thinking about it... I can actually change ConfigFile further so that it will use ~/.upp config if it finds it instead of ~/.config.
Do we want that?
Mirek
Well, it would solve the backwards compatibility issue, quite smoothly. Only new apps or new installations of existing apps would start to use the old directory. Possible alternative would be to make the code migrate the files from ~/.upp to ~/.config, but that seems quite invasive and could result in some broken apps, e.g. when both new and older version would be run on same machine.
Honza
|
|
|
|
|
|
|
|
|
|
| Re: Things we want from Linux/FreeBSD release archives [message #53506 is a reply to message #53501] |
Tue, 07 April 2020 05:34   |
Novo
Messages: 1433 Registered: December 2006
|
Ultimate Contributor |
|
|
Another problem with Mac.
It looks like GetExeFolder() doesn't resolve links on Mac.
The way I check that: I created a link to umk in ~/.local/bin
~/.local/bin/umk -> ~/dvlp/cpp/upp/out/uppsrc/CLANG.Blitz.Shared/umk
Config dir is located in ~/dvlp/cpp/upp/
This perfectly works on Linux but Mac.
On Mac I need to create a link to config dir in ~/.local/
I guess the problem is with GetExeFolder() -> GetExeFilePath() ...
Not sure who is supposed to resolve links, OS or Upp ...
Debugger doesn't work on Mac, so, it is a little bit difficult to track an origin of the problem.
Regards,
Novo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Thu Sep 10 08:27:18 GMT+2 2026
Total time taken to generate the page: 0.01148 seconds
|