Cleanup, fix issue with package being removed after being updated with the same ver
the build failed
Details
the build failed
Details
This commit is contained in:
parent
face5e5029
commit
b0e3d80022
|
@ -1,88 +0,0 @@
|
|||
image: git.meow.tf:4567/tyler/golang-glide:1.8
|
||||
|
||||
before_script:
|
||||
- export VERSION=`grep "VERSION" src/meow.tf/deb-simple/server.go | head -n 1 | awk '{print $5}' | sed -e 's/^"//' -e 's/"$//' | tr -d '\n'`
|
||||
- chmod +x packaging/build-package.sh packaging/package-upload.sh
|
||||
- export GOPATH=`pwd`
|
||||
|
||||
stages:
|
||||
- init
|
||||
- build
|
||||
- package
|
||||
|
||||
glide-install:
|
||||
stage: init
|
||||
script:
|
||||
- cd $CI_PROJECT_DIR/src/meow.tf/deb-simple
|
||||
- glide install
|
||||
- cd $CI_PROJECT_DIR
|
||||
- mkdir -p build/i386 build/amd64 build/armv7
|
||||
- tar -zcf cache.tgz src/meow.tf/deb-simple/vendor
|
||||
cache:
|
||||
key: "pipeline-$CI_PIPELINE_ID"
|
||||
policy: push
|
||||
paths:
|
||||
- cache.tgz
|
||||
|
||||
build-i386:
|
||||
stage: build
|
||||
script:
|
||||
- echo "Extracting vendor files..."
|
||||
- tar -xf cache.tgz
|
||||
- echo "Building i386 binary..."
|
||||
- mkdir -p build/i386
|
||||
- GOOS=linux GOARCH=386 go build -o build/i386/deb-simple
|
||||
artifacts:
|
||||
paths:
|
||||
- build/i386
|
||||
cache:
|
||||
key: "pipeline-$CI_PIPELINE_ID"
|
||||
policy: pull
|
||||
paths:
|
||||
- cache.tgz
|
||||
|
||||
build-amd64:
|
||||
stage: build
|
||||
script:
|
||||
- echo "Extracting vendor files..."
|
||||
- tar -xf cache.tgz
|
||||
- echo "Building amd64 binary..."
|
||||
- mkdir -p build/amd64
|
||||
- go build -o build/amd64/deb-simple
|
||||
artifacts:
|
||||
paths:
|
||||
- build/amd64
|
||||
cache:
|
||||
key: "pipeline-$CI_PIPELINE_ID"
|
||||
policy: pull
|
||||
paths:
|
||||
- cache.tgz
|
||||
|
||||
build-armv7:
|
||||
stage: build
|
||||
script:
|
||||
- echo "Extracting vendor files..."
|
||||
- tar -xf cache.tgz
|
||||
- echo "Building armv7 binary..."
|
||||
- mkdir -p build/armv7
|
||||
- GOOS=linux GOARCH=arm GOARM=7 go build -o build/armv7/deb-simple
|
||||
artifacts:
|
||||
paths:
|
||||
- build/armv7
|
||||
cache:
|
||||
key: "pipeline-$CI_PIPELINE_ID"
|
||||
policy: pull
|
||||
paths:
|
||||
- cache.tgz
|
||||
|
||||
package:
|
||||
stage: package
|
||||
image: tystuyfzand/fpm
|
||||
script:
|
||||
- ARCH=i386 packaging/build-package.sh
|
||||
- ARCH=amd64 packaging/build-package.sh
|
||||
- ARCH=armv7 packaging/build-package.sh
|
||||
- packaging/package-upload.sh
|
||||
artifacts:
|
||||
paths:
|
||||
- build
|
14
apt.go
14
apt.go
|
@ -1,19 +1,19 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
"crypto/md5"
|
||||
"crypto/sha1"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"golang.org/x/crypto/openpgp"
|
||||
"time"
|
||||
"fmt"
|
||||
"gitea.meow.tf/tyler/deb-simple/deb/release"
|
||||
"golang.org/x/crypto/openpgp"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"path"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Conf struct {
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package archive
|
||||
|
||||
import (
|
||||
"os"
|
||||
"archive/tar"
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"fmt"
|
||||
"github.com/blakesmith/ar"
|
||||
"bytes"
|
||||
"io"
|
||||
"strings"
|
||||
"compress/gzip"
|
||||
"archive/tar"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func InspectPackage(filename string) (string, error) {
|
||||
|
@ -21,7 +21,6 @@ func InspectPackage(filename string) (string, error) {
|
|||
|
||||
arReader := ar.NewReader(f)
|
||||
defer f.Close()
|
||||
var controlBuf bytes.Buffer
|
||||
|
||||
for {
|
||||
header, err := arReader.Next()
|
||||
|
@ -35,15 +34,14 @@ func InspectPackage(filename string) (string, error) {
|
|||
}
|
||||
|
||||
if strings.Trim(header.Name, "/") == "control.tar.gz" {
|
||||
io.Copy(&controlBuf, arReader)
|
||||
return InspectPackageControl(controlBuf)
|
||||
return InspectPackageControl(arReader)
|
||||
}
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func InspectPackageControl(filename bytes.Buffer) (string, error) {
|
||||
gzf, err := gzip.NewReader(bytes.NewReader(filename.Bytes()))
|
||||
func InspectPackageControl(reader io.Reader) (string, error) {
|
||||
gzf, err := gzip.NewReader(reader)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("error creating gzip reader: %s", err)
|
||||
}
|
||||
|
|
19
http.go
19
http.go
|
@ -1,15 +1,15 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"io"
|
||||
"os"
|
||||
"log"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/blang/semver"
|
||||
"strings"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func rescanHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
@ -199,9 +199,12 @@ func uploadHandler(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
oldPath := path.Join(conf.Repo.Root, p.Path)
|
||||
|
||||
if err := os.Remove(oldPath); err != nil && !os.IsNotExist(err) {
|
||||
httpErrorf(w, "Unable to remove old package: %s", err)
|
||||
continue
|
||||
// If oldPath == newPath then we already overwrote it
|
||||
if oldPath != newPath {
|
||||
if err := os.Remove(oldPath); err != nil && !os.IsNotExist(err) {
|
||||
httpErrorf(w, "Unable to remove old package: %s", err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
20
packages.go
20
packages.go
|
@ -1,23 +1,23 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"fmt"
|
||||
"strings"
|
||||
"os"
|
||||
"bytes"
|
||||
"bufio"
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"encoding/hex"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"crypto/md5"
|
||||
"crypto/sha1"
|
||||
"crypto/sha256"
|
||||
"github.com/blang/semver"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"gitea.meow.tf/tyler/deb-simple/deb/archive"
|
||||
"github.com/blang/semver"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -64,7 +64,7 @@ type Distro struct {
|
|||
}
|
||||
|
||||
var (
|
||||
distros map[string]*Distro = make(map[string]*Distro)
|
||||
distros = make(map[string]*Distro)
|
||||
)
|
||||
|
||||
func loadCache(dist string) error {
|
||||
|
|
14
server.go
14
server.go
|
@ -1,22 +1,22 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/go-ini/ini"
|
||||
"golang.org/x/crypto/openpgp"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"sync"
|
||||
"strings"
|
||||
"golang.org/x/crypto/openpgp"
|
||||
"runtime"
|
||||
"errors"
|
||||
"github.com/go-ini/ini"
|
||||
"io"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var VERSION string = "1.3.7"
|
||||
var VERSION = "1.3.8"
|
||||
|
||||
func packageName(name string) string {
|
||||
if index := strings.Index(name, "_"); index != -1 {
|
||||
|
|
Loading…
Reference in New Issue