Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions PublicGitArchive/pga-create/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#==========================
# Stage 1: build pga-create
#==========================
FROM golang:1.12.3-alpine3.9 AS builder
FROM golang:1.12.4-alpine3.9 AS builder

RUN apk add --no-cache dumb-init=1.2.2-r1 git

# build pga-create
ENV PGA_CREATE_REPO=github.com/src-d/datasets/PublicGitArchive/pga-create
ENV PGA_CREATE_PATH=$GOPATH/src/$PGA_CREATE_REPO
COPY . ${PGA_CREATE_PATH}

RUN go build -tags norwfs -o /bin/pga-create ${PGA_CREATE_PATH}/cmd/pga-create

RUN cp ${PGA_CREATE_PATH}/select-repos.sh /bin/select-repos && chmod +x /bin/select-repos
Expand All @@ -17,7 +18,7 @@ RUN cp ${PGA_CREATE_PATH}/index-repos.sh /bin/index-repos && chmod +x /bin/index
#=====================================================
# Stage 2: copy binaries and set environment variables
#=====================================================
FROM alpine:3.9.2
FROM alpine:3.9.3

COPY --from=builder /bin/pga-create /bin/*-repos /usr/bin/dumb-init /bin/

Expand Down
8 changes: 6 additions & 2 deletions PublicGitArchive/pga-create/cmd/pga-create/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,7 @@ func writeData(w io.Writer, stars map[uint32]uint32, reposPath string) {
})

cw := csv.NewWriter(w)
headers := []string{"repository", "stars"}
if err := cw.Write(headers); err != nil {
if err := writeCSVHeaders(cw); err != nil {
fail("writing to repositories file", err)
}

Expand All @@ -346,3 +345,8 @@ func writeData(w io.Writer, stars map[uint32]uint32, reposPath string) {
fail("writing to repositories file", err)
}
}

func writeCSVHeaders(w *csv.Writer) error {
headers := []string{"repository", "stars"}
return w.Write(headers)
}
3 changes: 3 additions & 0 deletions PublicGitArchive/pga-create/cmd/pga-create/select.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ func selectRepos(params selectionParameters) {
}()

idxw = csv.NewWriter(gzw)
if err := writeCSVHeaders(idxw); err != nil {
fail("writing csv headers", err)
}
}

r := csv.NewReader(gzf)
Expand Down
5 changes: 4 additions & 1 deletion PublicGitArchive/pga-create/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (

"github.com/erizocosmico/gocloc"
"github.com/sirupsen/logrus"

"gopkg.in/src-d/core-retrieval.v0"
"gopkg.in/src-d/core-retrieval.v0/model"
"gopkg.in/src-d/core-retrieval.v0/repository"
Expand Down Expand Up @@ -486,6 +487,8 @@ func sivaFiles(inits map[model.SHA1]struct{}) []string {
var regSivaDir = regexp.MustCompile(`\b([0-9a-f]{40})_[0-9]{19}\b`)

func sivaSize(init string) (int64, error) {
// siva's temporary files path looks like:
// /tmp/sourced/123456789/transactioner/7a80dfe1684664cefd2923bdbb329dcb9a48dc4f_1551878586555302343/siva
tmpFS := core.TemporaryFilesystem()
info, err := tmpFS.ReadDir("")
if err != nil {
Expand All @@ -496,7 +499,7 @@ func sivaSize(init string) (int64, error) {
return -1, fmt.Errorf("tmp directory wasn't in a clean status")
}

tmp := filepath.Join(info[0].Name(), "transactioner")
tmp := info[0].Name()
info, err = tmpFS.ReadDir(tmp)
if err != nil {
return -1, err
Expand Down