SaltMine

Hi Matthias,
I was finally successful in packaging everything and putting it on a file server on our intranet. I can neatly access it via the package manager now. I see that as soon as I change the version number, it will flag as an update - which is neat - but only if the user actually opens the package manager and checks. Is there a way of pushing a notification when Klayout starts that there is a new version of an installed package available ? I assume that would only occur due to some built-in mechanism that checks everything. In the worst case, I figure I could add an icon in the menu bar that runs a code at app startup that checks the grain.xml's of anything in the local SALT and compares it to the remote SALT ... but that's clumsy.

Also, I assume that there is not a way of having multiple repositories for the package manager, is there ? I would love for it to be also pulling in your regular packages. I suppose I could add them on to our internal repository, but that would then be decoupled from additions later ?

Thanks.

Thomas.

Comments

  • Hi Thomas,

    I'm a bit cautious with that. There is no active push to client applications. Instead, the application has to poll the server regularly. This needs to happen through a TCP/IP connection and HTTP requests.

    KLayout is frequently used in sensitive environments and I know that IT admins to not like to have applications establishing outbound connections. They do have reasons to mistrust software they bring into their network. I'd rather like not to give them a headache and simply don't do that, except on explicit request.

    Matthias

  • That sounds reasonable. For our little setup, we use a mapped network drive, so all internal. I couldn't resist, and wrote an updater that checks both grain.xml every 10min. It shows a blinking icon in the toolbar when the versions don't match.

        def checkForAvailableUpdates()
            if !@firstUpdateCheckDone
                puts "first update check done, switching to 10min interval"
                @timer.setInterval(1000 * 60 * 10)
                @firstUpdateCheckDone  = true
            else
                puts "10min update check"
            end
            parts = @root.split("/")
            home_dir = ""
            retVal = false
            (0..(parts.length-1)).each do |i|
                if i==0
                    home_dir = parts[i]
                else
                    home_dir = home_dir + "/" + parts[i]
                    if home_dir.end_with?("/KLayout/salt/UDATER_FUNCTIONS")
                        local_version = getGrainVersion(home_dir)
                        remote_dir = ENV["KLAYOUT_SALT_MINE"]
                        if remote_dir.length>0
                            remote_version = getGrainVersion(remote_dir.gsub("repository.xml","/salt/UDPDATER_FUNCTIONS"))
                            if local_version==remote_version 
                                stopBlinker()
                                @menu.delete_item("@toolbar.UPDATER_Action")
                                @action.icon  = @icon_file_ok
                                @action.title = "UPDATER NoUpdate"
                                retVal = false
                            else
                                if remote_version.length>0
                                    @menu.insert_item("@toolbar.end","UPDATER_Action",@action)
                                    @action.icon  = @icon_file_notok_r
                                    @action.title = "UPDATER Update Available"
                                    startBlinker()
                                    retVal = true
                                else
                                    stopBlinker()
                                    @menu.delete_item("@toolbar.UPDATER_Action")
                                    @action.icon  = @icon_file_ok
                                    @action.title = "UPDATER NoUpdate"
                                    retVal = false                                  
                                end
                            end
                        end
                        break;
                    end
                end
            end
            return retVal
        end
    
    
        def getGrainVersion(dir)
            file = dir + "/grain.xml"
            begin
                tLines = File.readlines(file)
            rescue => ex
                tLines = nil
                puts ex.to_s
            end
            version = ""
            if tLines != nil
                tLines.each do |line|
                    line.strip!
                    if line.start_with?('<version>') &&  line.end_with?('</version>')       
                        version = line.gsub("<version>", "").gsub("</version>", "").strip
                        break
                    end
                end
            end
            return version
        end
    
  • You can add the default repository of KLayout to your own respository.xml if you add <include>http://sami.klayout.org/repository.xml</include> to the <salt-min>...</salt-mine> in your repository.

    Also, I tried to use my own repository and somewhat managed. I did it with an apache and mod_dav_svn. How did you do it? I am wondering, because I tried to do it with a pure WebDAV server, but that didn't work ( I suspect due to klayout identifiying as "SVN" user-agent ). Maybe also @Matthias could help out because I think according to documentation a pure WebDAV should be sufficient.

  • We have mapped network drives, so I am hosting it as a "file:". No WedDAV needed.

  • Thanks for commenting on this.

    And yes, the "..." statement is my recommendation too. "file" as mentioned works - you can use that for example for the entry point which then provides the to forward to one or multiple servers. I personally try to avoid network drives as I experience them as unstable under (COVID-19) home office conditions with VPN.

    "SVN" user agent is the way how GitHub plays with KLayout - The SVN bridge of GitHub is delivering WebDAV then. I'm using KLayout with SVN myself (through Apache/mod_dav_svn as you mentioned). To be frank, I have not tried pure WebDAV myself - maybe there are some nifty details that escaped me. There is also the issue of authentication and currently there is only "Basic".

    Finally, I'm not sure how long GitHub will maintain the SVN port. Maybe it's time to support another protocol. I don't want to use ancient ftp. Maybe you have a suggestion. There is also the option to generalize the access protocol, so other protocols can be plugged in using a Python or Ruby extension.

    Best regards,

    Matthias

  • I think as for the protocol, I would like it a lot to have it open so that it can be managed through python or ruby.

    I agree about ftp, that seems just outdated. My favorites would be http(s) with recursive download of a folder (i.e. the saltmine is pointed at https://example.com/extension1 and the downloader just downloads everything https://example.com/extension1/**/*) like a recursive wget. Second best would be allowing to get a gzip/tarball from a server (i.e. https://example.com/extension1.gzip) and then unpack it into the salt folder.

    If it should be something more heavy weight, git would be awesome of course ^^, but that wouldn't be super compatible with the current manager as far as I can tell.

    I already tried to use git with a python extension, but it feels very sluggish because it needs a new Qt window and it will be blocked while doing a git pull/fetch.

    Best,
    Sebastian

Sign In or Register to comment.