auto upgrade packages on base opus update - github actions wip

This commit is contained in:
kepler155c@gmail.com 2020-04-30 18:51:36 -06:00
parent e116caf16e
commit 287adb1235
13 changed files with 77 additions and 47 deletions

33
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,33 @@
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ develop-1.8 ]
pull_request:
branches: [ develop-1.8 ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Runs a single command using the runners shell
- name: Run a one-line script
run: ls
# Runs a set of commands using the runners shell
- name: Run a multi-line script
run: |
date
echo test, and deploy your project.

View File

@ -17,7 +17,7 @@ local page = UI.Page {
UI:quit() UI:quit()
end end
return UI.FileSelect.eventHandler(self, event) return UI.Page.eventHandler(self, event)
end, end,
} }

View File

@ -16,9 +16,8 @@ local function makeSandbox()
end end
local function Syntax(msg) local function Syntax(msg)
_G.printError(msg) print('Syntax: package list | install [name] ... | update [name] | updateall | uninstall [name]\n')
print('\nSyntax: Package list | install [name] ... | update [name] | uninstall [name]') error(msg)
error(0)
end end
local function progress(max) local function progress(max)
@ -76,6 +75,11 @@ local function install(name, isUpdate, ignoreDeps)
local packageDir = fs.combine('packages', name) local packageDir = fs.combine('packages', name)
local list = Git.list(manifest.repository) local list = Git.list(manifest.repository)
-- clear out contents before install/update
-- TODO: figure out whether to run
-- install/uninstall for the package
fs.delete(packageDir)
local showProgress = progress(Util.size(list)) local showProgress = progress(Util.size(list))
local getList = { } local getList = { }
@ -151,7 +155,7 @@ if action == 'uninstall' then
runScript(manifest.uninstall) runScript(manifest.uninstall)
local packageDir = fs.combine('packages', name) local packageDir = fs.combine('packages', name)
fs.delete(fs.resolve(packageDir)) fs.delete(packageDir)
print('removed: ' .. packageDir) print('removed: ' .. packageDir)
return return
end end

View File

@ -12,7 +12,7 @@ for k,v in pairs(colors) do
end end
local allSettings = { } local allSettings = { }
for k,v in pairs(UI.colors) do for k,v in pairs(UI.theme.colors) do
allSettings[k] = { name = k, value = v } allSettings[k] = { name = k, value = v }
end end

View File

@ -1,24 +1,9 @@
local fs = _G.fs local fs = _G.fs
local shell = _ENV.shell
local function deleteIfExists(path) if fs.exists('.opus_upgrade') then
if fs.exists(path) then fs.delete('.opus_upgrade')
fs.delete(path) print('Updating packages')
print("Deleted outdated file at: "..path) shell.run('package updateall')
end os.reboot()
end end
-- cleanup outdated files
deleteIfExists('sys/apps/shell')
deleteIfExists('sys/etc/app.db')
deleteIfExists('sys/extensions')
deleteIfExists('sys/network')
deleteIfExists('startup')
deleteIfExists('sys/apps/system/turtle.lua')
deleteIfExists('sys/autorun/gps.lua')
deleteIfExists('sys/autorun/gpshost.lua')
deleteIfExists('sys/apps/network/redserver.lua')
deleteIfExists('sys/apis')
deleteIfExists('sys/autorun/apps.lua')
deleteIfExists('sys/init/6.tl3.lua')
-- remove this file
-- deleteIfExists('sys/autorun/upgraded.lua')

View File

@ -7,9 +7,10 @@ Shell usage:
> package list > package list
> package install <name> > package install <name>
> package update <name> > package update <name>
> package updateall
> package uninstall <name> > package uninstall <name>
Package definitions are located in usr/apps/packages. This file can be modified to add custom packages. Package definitions are located in usr/config/packages. This file can be modified to add custom packages.
Current stable packages Current stable packages
======================= =======================

View File

@ -47,13 +47,13 @@ function Entry:updateScroll()
self.scroll = 0 -- ?? self.scroll = 0 -- ??
end end
if self.pos - self.scroll > self.width then if self.pos - self.scroll > self.width then
self.scroll = self.pos - self.width self.scroll = math.max(0, self.pos - self.width)
elseif self.pos < self.scroll then elseif self.pos < self.scroll then
self.scroll = self.pos self.scroll = self.pos
end end
if self.scroll > 0 then if self.scroll > 0 then
if self.scroll + self.width > len then if self.scroll + self.width > len then
self.scroll = len - self.width self.scroll = math.max(0, len - self.width)
end end
end end
if ps ~= self.scroll then if ps ~= self.scroll then

View File

@ -37,13 +37,14 @@ local textutils = _G.textutils
local UI = { } local UI = { }
function UI:init() function UI:init()
self.devices = { } self.devices = { }
self.theme = { } self.theme = {
self.extChars = Util.getVersion() >= 1.76 colors = {
self.colors = { primary = colors.green,
primary = colors.green, secondary = colors.lightGray,
secondary = colors.lightGray, tertiary = colors.gray,
tertiary = colors.gray, }
} }
self.extChars = Util.getVersion() >= 1.76
local function keyFunction(event, code, held) local function keyFunction(event, code, held)
local ie = Input:translate(event, code, held) local ie = Input:translate(event, code, held)
@ -206,6 +207,10 @@ function UI:loadTheme(filename)
end end
Util.deepMerge(self.theme, theme) Util.deepMerge(self.theme, theme)
end end
for k,v in pairs(self.theme.colors) do
Canvas.colorPalette[k] = Canvas.colorPalette[v]
Canvas.grayscalePalette[k] = Canvas.grayscalePalette[v]
end
end end
function UI:generateTheme(filename) function UI:generateTheme(filename)
@ -920,6 +925,13 @@ function UI.Window:addTransition(effect, args, canvas)
self.parent:addTransition(effect, args, canvas or self) self.parent:addTransition(effect, args, canvas or self)
end end
UI.Window.docs.emit = [[emit(TABLE event)
Send an event to the element. The event handler for the element is called.
If the event handler returns true, then no further processing is done.
If the event handler does not return true, then the event is sent to the parent element
and continues up the element tree.
If an accelerator is defined, the accelerated event is processed in the same manner.
Accelerators are useful for making events unique.]]
function UI.Window:emit(event) function UI.Window:emit(event)
local parent = self local parent = self
while parent do while parent do
@ -1118,13 +1130,6 @@ end
loadComponents() loadComponents()
UI:loadTheme('usr/config/ui.theme') UI:loadTheme('usr/config/ui.theme')
Util.merge(UI.Window.defaults, UI.theme.Window)
Util.merge(UI.colors, UI.theme.colors)
UI:setDefaultDevice(UI.Device()) UI:setDefaultDevice(UI.Device())
for k,v in pairs(UI.colors) do
Canvas.colorPalette[k] = Canvas.colorPalette[v]
Canvas.grayscalePalette[k] = Canvas.grayscalePalette[v]
end
return UI return UI

View File

@ -40,7 +40,7 @@ function UI.Chooser:draw()
local value = choice and choice.name or self.nochoice local value = choice and choice.name or self.nochoice
self:write(1, 1, self.leftIndicator, self.backgroundColor, colors.black) self:write(1, 1, self.leftIndicator, self.backgroundColor, colors.black)
self:write(2, 1, ' ' .. Util.widthify(tostring(value), self.width-4) .. ' ', bg, fg) self:write(2, 1, ' ' .. Util.widthify(tostring(value), self.width - 4) .. ' ', bg, fg)
self:write(self.width, 1, self.rightIndicator, self.backgroundColor, colors.black) self:write(self.width, 1, self.rightIndicator, self.backgroundColor, colors.black)
end end
@ -54,7 +54,7 @@ function UI.Chooser:eventHandler(event)
local choice local choice
if not k then k = 0 end if not k then k = 0 end
if k and k < #self.choices then if k and k < #self.choices then
choice = self.choices[k+1] choice = self.choices[k + 1]
else else
choice = self.choices[1] choice = self.choices[1]
end end
@ -62,11 +62,12 @@ function UI.Chooser:eventHandler(event)
self:emit({ type = 'choice_change', value = self.value, element = self, choice = choice }) self:emit({ type = 'choice_change', value = self.value, element = self, choice = choice })
self:draw() self:draw()
return true return true
elseif event.type == 'choice_prev' then elseif event.type == 'choice_prev' then
local _,k = Util.find(self.choices, 'value', self.value) local _,k = Util.find(self.choices, 'value', self.value)
local choice local choice
if k and k > 1 then if k and k > 1 then
choice = self.choices[k-1] choice = self.choices[k - 1]
else else
choice = self.choices[#self.choices] choice = self.choices[#self.choices]
end end
@ -74,6 +75,7 @@ function UI.Chooser:eventHandler(event)
self:emit({ type = 'choice_change', value = self.value, element = self, choice = choice }) self:emit({ type = 'choice_change', value = self.value, element = self, choice = choice })
self:draw() self:draw()
return true return true
elseif event.type == 'mouse_click' or event.type == 'mouse_doubleclick' then elseif event.type == 'mouse_click' or event.type == 'mouse_doubleclick' then
if event.x == 1 then if event.x == 1 then
self:emit({ type = 'choice_prev' }) self:emit({ type = 'choice_prev' })