Compare commits
3 Commits
674cfe6b0d
...
a02a009b63
Author | SHA1 | Date |
---|---|---|
Elara | a02a009b63 | |
Elara | 74adb915fc | |
Elara | bdca0a5ffc |
14
README.md
14
README.md
|
@ -41,20 +41,6 @@ The documentation for LURE is in the [docs](docs) directory in this repo.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Cross-packaging for other Distributions
|
|
||||||
|
|
||||||
You can create packages for different distributions
|
|
||||||
setting the environment variables `LURE_DISTRO` and `LURE_PKG_FORMAT`.
|
|
||||||
|
|
||||||
```
|
|
||||||
LURE_DISTRO=arch LURE_PKG_FORMAT=archlinux lure build
|
|
||||||
LURE_DISTRO=alpine LURE_PKG_FORMAT=apk lure build
|
|
||||||
LURE_DISTRO=opensuse LURE_PKG_FORMAT=rpm lure build
|
|
||||||
LURE_DISTRO=debian LURE_PKG_FORMAT=deb lure build
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Repositories
|
## Repositories
|
||||||
|
|
||||||
Unlike the AUR, LURE supports using multiple repos. Also unlike the AUR, LURE's repos are a single git repo containing all the build scripts. Inside each LURE repo, there should be a separate directory for each package containing a `lure.sh` script, which is a PKGBUILD-like build script for LURE. The default repository is hosted on Github: https://github.com/Arsen6331/lure-repo.
|
Unlike the AUR, LURE supports using multiple repos. Also unlike the AUR, LURE's repos are a single git repo containing all the build scripts. Inside each LURE repo, there should be a separate directory for each package containing a `lure.sh` script, which is a PKGBUILD-like build script for LURE. The default repository is hosted on Github: https://github.com/Arsen6331/lure-repo.
|
||||||
|
|
8
build.go
8
build.go
|
@ -107,8 +107,10 @@ func buildPackage(ctx context.Context, script string, mgr manager.Manager) ([]st
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var distroChanged bool
|
||||||
if distID, ok := os.LookupEnv("LURE_DISTRO"); ok {
|
if distID, ok := os.LookupEnv("LURE_DISTRO"); ok {
|
||||||
info.ID = distID
|
info.ID = distID
|
||||||
|
distroChanged = true
|
||||||
}
|
}
|
||||||
|
|
||||||
fl, err := os.Open(script)
|
fl, err := os.Open(script)
|
||||||
|
@ -140,6 +142,12 @@ func buildPackage(ctx context.Context, script string, mgr manager.Manager) ([]st
|
||||||
|
|
||||||
dec := decoder.New(info, runner)
|
dec := decoder.New(info, runner)
|
||||||
|
|
||||||
|
// If distro was changed, the list of like distros
|
||||||
|
// no longer applies, so disable its use
|
||||||
|
if distroChanged {
|
||||||
|
dec.LikeDistros = false
|
||||||
|
}
|
||||||
|
|
||||||
var vars BuildVars
|
var vars BuildVars
|
||||||
err = dec.DecodeVars(&vars)
|
err = dec.DecodeVars(&vars)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -111,6 +111,8 @@ Example:
|
||||||
lure ref
|
lure ref
|
||||||
```
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Environment Variables
|
## Environment Variables
|
||||||
|
|
||||||
### LURE_DISTRO
|
### LURE_DISTRO
|
||||||
|
@ -137,4 +139,22 @@ The `LURE_ARM_VARIANT` environment variable dictates which ARM variant to build
|
||||||
|
|
||||||
- `arm5`
|
- `arm5`
|
||||||
- `arm6`
|
- `arm6`
|
||||||
- `arm7`
|
- `arm7`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Cross-packaging for other Distributions
|
||||||
|
|
||||||
|
You can create packages for different distributions
|
||||||
|
setting the environment variables `LURE_DISTRO` and `LURE_PKG_FORMAT` as mentioned above.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
```
|
||||||
|
LURE_DISTRO=arch LURE_PKG_FORMAT=archlinux lure build
|
||||||
|
LURE_DISTRO=alpine LURE_PKG_FORMAT=apk lure build
|
||||||
|
LURE_DISTRO=opensuse LURE_PKG_FORMAT=rpm lure build
|
||||||
|
LURE_DISTRO=debian LURE_PKG_FORMAT=deb lure build
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
|
@ -47,14 +47,17 @@ func (nfe VarNotFoundError) Error() string {
|
||||||
|
|
||||||
// Decoder provides methods for decoding variable values
|
// Decoder provides methods for decoding variable values
|
||||||
type Decoder struct {
|
type Decoder struct {
|
||||||
info *distro.OSRelease
|
info *distro.OSRelease
|
||||||
runner *interp.Runner
|
runner *interp.Runner
|
||||||
|
// Enable distro overrides (true by default)
|
||||||
Overrides bool
|
Overrides bool
|
||||||
|
// Enable using like distros for overrides (true by default)
|
||||||
|
LikeDistros bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// New creates a new variable decoder
|
// New creates a new variable decoder
|
||||||
func New(info *distro.OSRelease, runner *interp.Runner) *Decoder {
|
func New(info *distro.OSRelease, runner *interp.Runner) *Decoder {
|
||||||
return &Decoder{info, runner, true}
|
return &Decoder{info, runner, true, true}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecodeVar decodes a variable to val using reflection.
|
// DecodeVar decodes a variable to val using reflection.
|
||||||
|
@ -206,7 +209,9 @@ func (d *Decoder) genPossibleNames(name string) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
distros := []string{d.info.ID}
|
distros := []string{d.info.ID}
|
||||||
distros = append(distros, d.info.Like...)
|
if d.LikeDistros {
|
||||||
|
distros = append(distros, d.info.Like...)
|
||||||
|
}
|
||||||
|
|
||||||
var out []string
|
var out []string
|
||||||
for _, arch := range architectures {
|
for _, arch := range architectures {
|
||||||
|
|
Loading…
Reference in New Issue