3 Commits

Author SHA1 Message Date
d37f3c141a add link to styleguide
All checks were successful
continuous-integration/drone/push Build is passing
2024-12-09 02:56:18 +00:00
2717685619 update readme to conform with my new readme howto standards (#8)
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #8

manually approving because CI is offline rn for some reason
2024-12-09 02:50:57 +00:00
7df558d8d0 next (#5)
All checks were successful
continuous-integration/drone/push Build is passing
Co-authored-by: sneak <sneak@sneak.berlin>
Reviewed-on: #5
2022-12-09 00:02:33 +00:00
10 changed files with 99 additions and 25 deletions

View File

@@ -1,6 +1,3 @@
*.tzst
/buildimage
/dockerdeps
/tmp
*.docker.tzst
*.tmp *.tmp
*.dockerimage
.git

View File

@@ -7,8 +7,17 @@ steps:
network_mode: bridge network_mode: bridge
settings: settings:
repo: sneak/mfer repo: sneak/mfer
build_args_from_env: [ DRONE_COMMIT_SHA ]
dry_run: true dry_run: true
custom_dns: [ 116.202.204.30 ] custom_dns: [ 116.202.204.30 ]
tags: tags:
- ${DRONE_COMMIT_SHA} - ${DRONE_COMMIT_SHA:0:7}
- ${DRONE_BRANCH} - ${DRONE_BRANCH}
- latest
- name: notify
image: plugins/slack
settings:
webhook:
from_secret: SLACK_WEBHOOK_URL
when:
event: pull_request

4
.gitignore vendored
View File

@@ -2,7 +2,5 @@ mfer/*.pb.go
/mfer.cmd /mfer.cmd
/tmp /tmp
*.tmp *.tmp
*.docker.tzst *.dockerimage
*.tzst
/builddeps/modcache.tar
/vendor /vendor

View File

@@ -1,23 +1,30 @@
################################################################################ ################################################################################
#2345678911234567892123456789312345678941234567895123456789612345678971234567898 #2345678911234567892123456789312345678941234567895123456789612345678971234567898
################################################################################ ################################################################################
FROM sneak/builder:14e59af AS builder FROM sneak/builder:2022-12-08 AS builder
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
WORKDIR /build WORKDIR /build
COPY ./Makefile ./.golangci.yml ./go.mod ./go.sum . COPY ./Makefile ./.golangci.yml ./go.mod ./go.sum /build/
COPY ./vendor.tar /build/vendor.tar COPY ./vendor.tzst /build/vendor.tzst
COPY ./modcache.tzst /build/modcache.tzst
COPY ./internal ./internal COPY ./internal ./internal
COPY ./bin/gitrev.sh ./bin/gitrev.sh COPY ./bin/gitrev.sh ./bin/gitrev.sh
COPY ./mfer ./mfer COPY ./mfer ./mfer
COPY ./cmd ./cmd COPY ./cmd ./cmd
RUN find /build
ARG GITREV unknown ARG GITREV unknown
ARG DRONE_COMMIT_SHA unknown
RUN mkdir -p "$(go env GOMODCACHE)" && cd "$(go env GOMODCACHE)" && \
zstdmt -d --stdout /build/modcache.tzst | tar xf - && \
rm /build/modcache.tzst && cd /build
RUN \ RUN \
cd mfer && go generate . && cd .. && \ cd mfer && go generate . && cd .. && \
GOPACKAGESDEBUG=true golangci-lint run ./... && \ GOPACKAGESDEBUG=true golangci-lint run ./... && \
tar xf vendor.tar && rm vendor.tar && \ mkdir vendor && cd vendor && \
zstdmt -d --stdout /build/vendor.tzst | tar xf - && rm /build/vendor.tzst && \
cd .. && \
make mfer.cmd make mfer.cmd
RUN go mod vendor && tar -c . | zstdmt -19 > /src.tzst RUN rm -rf /build/vendor && go mod vendor && tar -c . | zstdmt -19 > /src.tzst
################################################################################ ################################################################################
#2345678911234567892123456789312345678941234567895123456789612345678971234567898 #2345678911234567892123456789312345678941234567895123456789612345678971234567898
################################################################################ ################################################################################

View File

@@ -44,9 +44,9 @@ mfer.cmd: $(SOURCEFILES) mfer/mf.pb.go
cd cmd/mfer && go build -tags urfave_cli_no_docs -o ../../mfer.cmd $(GOFLAGS) . cd cmd/mfer && go build -tags urfave_cli_no_docs -o ../../mfer.cmd $(GOFLAGS) .
clean: clean:
rm -rfv mfer/*.pb.go mfer.cmd cmd/mfer/mfer rm -rfv mfer/*.pb.go mfer.cmd cmd/mfer/mfer *.dockerimage
fmt: fmt: mfer/mf.pb.go
gofumpt -l -w mfer internal cmd gofumpt -l -w mfer internal cmd
golangci-lint run --fix golangci-lint run --fix
-prettier -w *.json -prettier -w *.json
@@ -56,9 +56,9 @@ lint:
golangci-lint run golangci-lint run
sh -c 'test -z "$$(gofmt -l .)"' sh -c 'test -z "$$(gofmt -l .)"'
docker: sneak-mfer.$(ARCH).docker.tzst docker: sneak-mfer.$(ARCH).tzst.dockerimage
sneak-mfer.$(ARCH).docker.tzst: $(SOURCEFILES) vendor.tar sneak-mfer.$(ARCH).tzst.dockerimage: $(SOURCEFILES) vendor.tzst modcache.tzst
docker build --progress plain --build-arg GITREV=$(GITREV_BUILD) -t sneak/mfer . docker build --progress plain --build-arg GITREV=$(GITREV_BUILD) -t sneak/mfer .
docker save sneak/mfer | pv | zstdmt -19 > $@ docker save sneak/mfer | pv | zstdmt -19 > $@
du -sh $@ du -sh $@
@@ -67,7 +67,16 @@ godoc:
open http://127.0.0.1:6060 open http://127.0.0.1:6060
godoc -http=:6060 godoc -http=:6060
vendor.tar: go.mod go.sum vendor.tzst: go.mod go.sum
go mod tidy
go mod vendor go mod vendor
tar -c vendor > $@ cd vendor && tar -c . | pv | zstdmt -19 > $(PWD)/$@.tmp
rm -rf vendor rm -rf vendor
mv $@.tmp $@
modcache.tzst: go.mod go.sum
go mod tidy
cd $(HOME)/go/pkg && chmod -R u+rw . && rm -rf mod sumdb
go mod download -x
cd $(shell go env GOMODCACHE) && tar -c . | pv | zstdmt -19 > $(PWD)/$@.tmp
mv $@.tmp $@

View File

@@ -1,11 +1,50 @@
# mfer # mfer
Manifest file generator and checker. [mfer](https://git.eeqj.de/sneak/mfer) is a reference implementation library
and thin wrapper command-line utility written in [Go](https://golang.org)
and first published in 2022 under the [WTFPL](https://wtfpl.net) (public
domain) license. It specifies and generates `.mf` manifest files over a
directory tree of files to encapsulate metadata about them (such as
cryptographic checksums or signatures over same) to aid in archiving,
downloading, and streaming, or mirroring. The manifest files' data is
serialized with Google's [protobuf serialization
format](https://developers.google.com/protocol-buffers). The structure of
these files can be found [in the format
specification](https://git.eeqj.de/sneak/mfer/src/branch/main/mfer/mf.proto)
which is included in the [project
repository](https://git.eeqj.de/sneak/mfer).
The current version is pre-1.0 and while the repo was published in 2022,
there has not yet been any versioned release. [SemVer](https://semver.org)
will be used for releases.
This project was started by [@sneak](https://sneak.berlin) to scratch an
itch in 2022 and is currently a one-person effort, though the goal is for
this to emerge as a de-facto standard and be incorporated into other
software. A compatible javascript library is planned.
# Build Status # Build Status
[![Build Status](https://drone.datavi.be/api/badges/sneak/mfer/status.svg)](https://drone.datavi.be/sneak/mfer) [![Build Status](https://drone.datavi.be/api/badges/sneak/mfer/status.svg)](https://drone.datavi.be/sneak/mfer)
# Participation
The community is as yet nonexistent so there are no defined policies or
norms yet. Primary development happens on a privately-run Gitea instance at
[https://git.eeqj.de/sneak/mfer](https://git.eeqj.de/sneak/mfer) and issues
are [tracked there](https://git.eeqj.de/sneak/mfer/issues).
Changes must always be formatted with a standard `go fmt`, syntactically
valid, and must pass the linting defined in the repository (presently only
the `golangci-lint` defaults), which can be run with a `make lint`. The
`main` branch is protected and all changes must be made via [pull
requests](https://git.eeqj.de/sneak/mfer/pulls) and pass CI to be merged.
Any changes submitted to this project must also be
[WTFPL-licensed](https://wtfpl.net) to be considered.
Ideally, contributions conform to @sneak's personal
[code styleguide](https://git.eeqj.de/sneak/styleguide).
# Problem Statement # Problem Statement
Given a plain URL, there is no standard way to safely and programmatically Given a plain URL, there is no standard way to safely and programmatically
@@ -170,6 +209,15 @@ regardless of filesystem format.
Please email [`sneak@sneak.berlin`](mailto:sneak@sneak.berlin) with your Please email [`sneak@sneak.berlin`](mailto:sneak@sneak.berlin) with your
desired username for an account on this Gitea instance. desired username for an account on this Gitea instance.
I am currently interested in hiring a contractor skilled with the Go ## Links
standard library interfaces to specify this tool in full and develop a
prototype implementation. * Repo: [https://git.eeqj.de/sneak/mfer](https://git.eeqj.de/sneak/mfer)
* Issues: [https://git.eeqj.de/sneak/mfer/issues](https://git.eeqj.de/sneak/mfer/issues)
# Authors
* [@sneak &lt;sneak@sneak.berlin&gt;](mailto:sneak@sneak.berlin)
# License
* [WTFPL](https://wtfpl.net)

View File

@@ -1,4 +1,10 @@
#!/bin/bash #!/bin/bash
#
if [[ ! -z "$DRONE_COMMIT_SHA" ]]; then
echo "${DRONE_COMMIT_SHA:0:7}"
exit 0
fi
if [[ ! -z "$GITREV" ]]; then if [[ ! -z "$GITREV" ]]; then
echo $GITREV echo $GITREV
else else

BIN
modcache.tzst Normal file

Binary file not shown.

Binary file not shown.

BIN
vendor.tzst Normal file

Binary file not shown.