mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-02 04:50:49 +00:00
Compare commits
54 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d31144b9ae | |||
| c7a3a10846 | |||
| 2be0b7859d | |||
| 65528fc357 | |||
| 5a713534c6 | |||
| f89e322ece | |||
| cd6075ba94 | |||
| 77033df27b | |||
| b8c5303fdb | |||
| eaab66da58 | |||
| 2a8aff9746 | |||
| 797b2dd996 | |||
| e65fff058c | |||
| 548dcdb242 | |||
| 9a65bbe12c | |||
| 72d741a9b7 | |||
| 2f5bf96fc9 | |||
| 4d3b42eb11 | |||
| 5b85522400 | |||
| 5f96abc271 | |||
| 0e6ee35942 | |||
| 14798b2063 | |||
| cef4fefc40 | |||
| 181806a9a2 | |||
| 99a205c716 | |||
| dd78c026c1 | |||
| 20516dbbc2 | |||
| ba80f377a9 | |||
| dc7bbf35eb | |||
| b3b0dbb217 | |||
| d76259496d | |||
| aa3a2ab595 | |||
| 0f1fd1bca6 | |||
| 581876df9a | |||
| d0101be955 | |||
| caa5433787 | |||
| 9125745416 | |||
| b893c0a7ca | |||
| 02ac416561 | |||
| 00bb0ca8f3 | |||
| 2d0baef3b1 | |||
| 3ea803e3bb | |||
| 2fa9d7402f | |||
| 3c04c56639 | |||
| 7cd4b7a908 | |||
| 9242ea4d72 | |||
| 58790dadc6 | |||
| 182fbdef50 | |||
| 4fb57f65fb | |||
| 12e2982362 | |||
| 60fb415150 | |||
| 75c4d6da3b | |||
| 1aa88701fb | |||
| 43ddcd27cb |
+1
-2
@@ -22,8 +22,7 @@ _testmain.go
|
||||
*.exe
|
||||
*.test
|
||||
|
||||
coverage.html
|
||||
coverage*.out
|
||||
coverage.txt
|
||||
|
||||
*.pyc
|
||||
|
||||
|
||||
+23
-14
@@ -3,13 +3,7 @@ sudo: required
|
||||
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.7.x
|
||||
- 1.8.x
|
||||
- 1.9.x
|
||||
- master
|
||||
|
||||
go_import_path: github.com/smira/aptly
|
||||
go_import_path: github.com/aptly-dev/aptly
|
||||
|
||||
addons:
|
||||
apt:
|
||||
@@ -19,9 +13,26 @@ addons:
|
||||
|
||||
env:
|
||||
global:
|
||||
- secure: "YSwtFrMqh4oUvdSQTXBXMHHLWeQgyNEL23ChIZwU0nuDGIcQZ65kipu0PzefedtUbK4ieC065YCUi4UDDh6gPotB/Wu1pnYg3dyQ7rFvhaVYAAUEpajAdXZhlx+7+J8a4FZMeC/kqiahxoRgLbthF9019ouIqhGB9zHKI6/yZwc="
|
||||
- secure: "V7OjWrfQ8UbktgT036jYQPb/7GJT3Ol9LObDr8FYlzsQ+F1uj2wLac6ePuxcOS4FwWOJinWGM1h+JiFkbxbyFqfRNJ0jj0O2p93QyDojxFVOn1mXqqvV66KFqAWR2Vzkny/gDvj8LTvdB1cgAIm2FNOkQc6E1BFnyWS2sN9ea5E="
|
||||
- secure: "EcCzJsqQ3HnIkprBPS1YHErsETcb7KQFBYEzVDE7RYDApWeapLq+r/twMtWMd/fkGeLzr3kWSg7nhSadeHMLYeMl9j+U7ncC5CWG5NMBOj/jowlb9cMCCDlmzMoZLAgR6jm1cJyrWCLsWVlv+D0ZiB0fx4xaBZP/gIr9g6nEwC8="
|
||||
- secure: "OxiVNmre2JzUszwPNNilKDgIqtfX2gnRSsVz6nuySB1uO2yQsOQmKWJ9cVYgH2IB5H8eWXKOhexcSE28kz6TPLRuEcU9fnqKY3uEkdwm7rJfz9lf+7C4bJEUdA1OIzJppjnWUiXxD7CEPL1DlnMZM24eDQYqa/4WKACAgkK53gE="
|
||||
- NO_FTP_ACCESS: "yes"
|
||||
- BOTO_CONFIG: /dev/null
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- go: master
|
||||
env: RUN_LONG_TESTS=no
|
||||
fast_finish: true
|
||||
include:
|
||||
- go: 1.8.x
|
||||
env: RUN_LONG_TESTS=no
|
||||
- go: 1.9.x
|
||||
env: RUN_LONG_TESTS=yes
|
||||
- go: 1.10.x
|
||||
env: RUN_LONG_TESTS=yes
|
||||
- go: master
|
||||
env: RUN_LONG_TESTS=no
|
||||
|
||||
before_install:
|
||||
- virtualenv system/env
|
||||
- . system/env/bin/activate
|
||||
@@ -29,14 +40,12 @@ before_install:
|
||||
- pip install -U pip setuptools
|
||||
- pip install -r system/requirements.txt
|
||||
- make version
|
||||
|
||||
install:
|
||||
- make prepare
|
||||
|
||||
script: make travis
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- go: master
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
notifications:
|
||||
webhooks:
|
||||
|
||||
@@ -30,3 +30,6 @@ List of contributors, in chronological order:
|
||||
* TJ Merritt (https://github.com/tjmerritt)
|
||||
* Matt Martyn (https://github.com/MMartyn)
|
||||
* Ludovico Cavedon (https://github.com/cavedon)
|
||||
* Petr Jediny (https://github.com/pjediny)
|
||||
* Maximilian Stein (https://github.com/steinymity)
|
||||
* Strajan Sebastian (https://github.com/strajansebastian)
|
||||
|
||||
+10
-9
@@ -15,7 +15,7 @@ Please report unacceptable behavior to [team@aptly.info](mailto:team@aptly.info)
|
||||
|
||||
### List of Repositories
|
||||
|
||||
* [smira/aptly](https://github.com/smira/aptly) - aptly source code, functional tests, man page
|
||||
* [aptly-dev/aptly](https://github.com/aptly-dev/aptly) - aptly source code, functional tests, man page
|
||||
* [apty-dev/aptly-dev.github.io](https://github.com/aptly-dev/aptly-dev.github.io) - aptly website (https://www.aptly.info/)
|
||||
* [aptly-dev/aptly-fixture-db](https://github.com/aptly-dev/aptly-fixture-db) & [aptly-dev/aptly-fixture-pool](https://github.com/aptly-dev/aptly-fixture-pool) provide
|
||||
fixtures for aptly functional tests
|
||||
@@ -24,15 +24,15 @@ Please report unacceptable behavior to [team@aptly.info](mailto:team@aptly.info)
|
||||
|
||||
### Reporting Bugs
|
||||
|
||||
1. Please search for similar bug report in [issue tracker](https://github.com/smira/aptly/issues)
|
||||
1. Please search for similar bug report in [issue tracker](https://github.com/aptly-dev/aptly/issues)
|
||||
2. Please verify that bug is not fixed in latest aptly nightly ([download information](https://www.aptly.info/download/))
|
||||
3. Steps to reproduce increases chances for bug to be fixed quickly. If possible, submit PR with new functional test which fails.
|
||||
4. If bug is reproducible with specific package, please provide link to package file.
|
||||
5. Open issue at [GitHub](https://github.com/smira/aptly/issues)
|
||||
5. Open issue at [GitHub](https://github.com/aptly-dev/aptly/issues)
|
||||
|
||||
### Suggesting Enhancements
|
||||
|
||||
1. Please search [issue tracker](https://github.com/smira/aptly/issues) for similar feature requests.
|
||||
1. Please search [issue tracker](https://github.com/aptly-dev/aptly/issues) for similar feature requests.
|
||||
2. Describe why enhancement is important to you.
|
||||
3. Include any additional details or implementation details.
|
||||
|
||||
@@ -45,7 +45,7 @@ There are two kinds of documentation:
|
||||
|
||||
Core content is mostly the same, but website contains more information, tutorials, examples.
|
||||
|
||||
If you want to update `man` page, please open PR to [main aptly repo](https://github.com/smira/aptly),
|
||||
If you want to update `man` page, please open PR to [main aptly repo](https://github.com/aptly-dev/aptly),
|
||||
details in [man page](#man-page) section.
|
||||
|
||||
If you want to update website, please follow steps below:
|
||||
@@ -88,7 +88,7 @@ As Go is using repository path in import paths, it's better to clone aptly repo
|
||||
|
||||
mkdir -p ~/go/src/github.com/smira
|
||||
cd ~/go/src/github.com/smira
|
||||
git clone git@github.com:smira/aptly.git
|
||||
git clone git@github.com:aptly-dev/aptly.git
|
||||
cd aptly
|
||||
|
||||
For main repo under your GitHub user and add it as another Git remote:
|
||||
@@ -206,12 +206,13 @@ template [man/aptly.1.ronn.tmpl](man/aptly.1.ronn.tmpl) is changed or any comman
|
||||
final rendered man page [man/aptly.1](man/aptly.1). In the end of the build, new man page is displayed for visual
|
||||
verification.
|
||||
|
||||
Man page is built with small helper [_man/gen.go](man/gen.go) which pulls in template, command-line help from [cmd/](cmd/) folder
|
||||
Man page is built with small helper [\_man/gen.go](man/gen.go) which pulls in template, command-line help from [cmd/](cmd/) folder
|
||||
and runs that through [forked copy](https://github.com/smira/ronn) of [ronn](https://github.com/rtomayko/ronn).
|
||||
|
||||
### Bash Completion
|
||||
### Bash and Zsh Completion
|
||||
|
||||
Bash completion for aptly resides in the same repo under in [bash_completion.d/aptly](bash_completion.d/aptly). It's all hand-crafted.
|
||||
Bash and Zsh completion for aptly reside in the same repo under in [completion.d/aptly](completion.d/aptly) and
|
||||
[completion.d/\_aptly](completion.d/_aptly), respectively. It's all hand-crafted.
|
||||
When new option or command is introduced, bash completion should be updated to reflect that change.
|
||||
|
||||
When aptly package is being built, it automatically pulls bash completion and man page into the package.
|
||||
|
||||
Generated
+92
-18
@@ -1,4 +1,5 @@
|
||||
memo = "57879f27cc9f82276b92ed638fbc04122c3793ed4a16bea668c9fbfda280c280"
|
||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/AlekSi/pointer"
|
||||
@@ -14,15 +15,49 @@ memo = "57879f27cc9f82276b92ed638fbc04122c3793ed4a16bea668c9fbfda280c280"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/awalterschulze/gographviz"
|
||||
packages = [".","ast","parser","scanner","token"]
|
||||
packages = [
|
||||
".",
|
||||
"ast",
|
||||
"parser",
|
||||
"scanner",
|
||||
"token"
|
||||
]
|
||||
revision = "761fd5fbb34e4c2c138c280395b65b48e4ff5a53"
|
||||
version = "v1.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/aws/aws-sdk-go"
|
||||
packages = ["aws","aws/awserr","aws/awsutil","aws/client","aws/client/metadata","aws/corehandlers","aws/credentials","aws/credentials/ec2rolecreds","aws/credentials/endpointcreds","aws/credentials/stscreds","aws/defaults","aws/ec2metadata","aws/endpoints","aws/request","aws/session","aws/signer/v4","internal/shareddefaults","private/protocol","private/protocol/query","private/protocol/query/queryutil","private/protocol/rest","private/protocol/restxml","private/protocol/xml/xmlutil","service/s3","service/sts"]
|
||||
revision = "c652f9369083515c3ddf1fbaf6df68da2c101545"
|
||||
version = "v1.12.1"
|
||||
packages = [
|
||||
"aws",
|
||||
"aws/awserr",
|
||||
"aws/awsutil",
|
||||
"aws/client",
|
||||
"aws/client/metadata",
|
||||
"aws/corehandlers",
|
||||
"aws/credentials",
|
||||
"aws/credentials/ec2rolecreds",
|
||||
"aws/credentials/endpointcreds",
|
||||
"aws/credentials/stscreds",
|
||||
"aws/defaults",
|
||||
"aws/ec2metadata",
|
||||
"aws/endpoints",
|
||||
"aws/request",
|
||||
"aws/session",
|
||||
"aws/signer/v4",
|
||||
"internal/sdkio",
|
||||
"internal/sdkrand",
|
||||
"internal/shareddefaults",
|
||||
"private/protocol",
|
||||
"private/protocol/query",
|
||||
"private/protocol/query/queryutil",
|
||||
"private/protocol/rest",
|
||||
"private/protocol/restxml",
|
||||
"private/protocol/xml/xmlutil",
|
||||
"service/s3",
|
||||
"service/sts"
|
||||
]
|
||||
revision = "a72204b9bf8d48230ee0fe8995613b394c66f2da"
|
||||
version = "v1.13.31"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/cheggaaa/pb"
|
||||
@@ -38,7 +73,11 @@ memo = "57879f27cc9f82276b92ed638fbc04122c3793ed4a16bea668c9fbfda280c280"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gin-gonic/gin"
|
||||
packages = [".","binding","render"]
|
||||
packages = [
|
||||
".",
|
||||
"binding",
|
||||
"render"
|
||||
]
|
||||
revision = "d459835d2b077e44f7c9b453505ee29881d5d12d"
|
||||
version = "v1.2"
|
||||
|
||||
@@ -61,22 +100,21 @@ memo = "57879f27cc9f82276b92ed638fbc04122c3793ed4a16bea668c9fbfda280c280"
|
||||
revision = "553a641470496b2327abcac10b36396bd98e45c9"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/h2non/filetype"
|
||||
packages = ["matchers"]
|
||||
revision = "0df83c38d14ff5f653d419d480eaac286ccbc823"
|
||||
revision = "cc14fdc9ca0e4c2bafad7458f6ff79fd3947cfbb"
|
||||
version = "v1.0.5"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/jlaffaye/ftp"
|
||||
packages = ["."]
|
||||
revision = "7b85eb4638a2c0473acefcfb929a98f879c15c86"
|
||||
revision = "2403248fa8cc9f7909862627aa7337f13f8e0bf1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/jmespath/go-jmespath"
|
||||
packages = ["."]
|
||||
revision = "3433f3ea46d9f8019119e7dd41274e112a2359a9"
|
||||
version = "0.2.2"
|
||||
revision = "0b12d6b5"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/mattn/go-isatty"
|
||||
@@ -111,7 +149,10 @@ memo = "57879f27cc9f82276b92ed638fbc04122c3793ed4a16bea668c9fbfda280c280"
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/ncw/swift"
|
||||
packages = [".","swifttest"]
|
||||
packages = [
|
||||
".",
|
||||
"swifttest"
|
||||
]
|
||||
revision = "8e9b10220613abdbc2896808ee6b43e411a4fa6c"
|
||||
|
||||
[[projects]]
|
||||
@@ -165,8 +206,21 @@ memo = "57879f27cc9f82276b92ed638fbc04122c3793ed4a16bea668c9fbfda280c280"
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/syndtr/goleveldb"
|
||||
packages = ["leveldb","leveldb/cache","leveldb/comparer","leveldb/errors","leveldb/filter","leveldb/iterator","leveldb/journal","leveldb/memdb","leveldb/opt","leveldb/storage","leveldb/table","leveldb/util"]
|
||||
revision = "549b6d6b1c0419617182954dd77770f2e2685ed5"
|
||||
packages = [
|
||||
"leveldb",
|
||||
"leveldb/cache",
|
||||
"leveldb/comparer",
|
||||
"leveldb/errors",
|
||||
"leveldb/filter",
|
||||
"leveldb/iterator",
|
||||
"leveldb/journal",
|
||||
"leveldb/memdb",
|
||||
"leveldb/opt",
|
||||
"leveldb/storage",
|
||||
"leveldb/table",
|
||||
"leveldb/util"
|
||||
]
|
||||
revision = "714f901b98fdb3aa954b4193d8cbd64a28d80cad"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/ugorji/go"
|
||||
@@ -182,14 +236,27 @@ memo = "57879f27cc9f82276b92ed638fbc04122c3793ed4a16bea668c9fbfda280c280"
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/crypto"
|
||||
packages = ["cast5","openpgp","openpgp/armor","openpgp/clearsign","openpgp/elgamal","openpgp/errors","openpgp/packet","openpgp/s2k","ssh/terminal"]
|
||||
revision = "459e26527287adbc2adcc5d0d49abff9a5f315a7"
|
||||
packages = [
|
||||
"cast5",
|
||||
"openpgp",
|
||||
"openpgp/armor",
|
||||
"openpgp/clearsign",
|
||||
"openpgp/elgamal",
|
||||
"openpgp/errors",
|
||||
"openpgp/packet",
|
||||
"openpgp/s2k",
|
||||
"ssh/terminal"
|
||||
]
|
||||
revision = "b2aa35443fbc700ab74c586ae79b81c171851023"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/sys"
|
||||
packages = ["unix"]
|
||||
revision = "99f16d856c9836c42d24e7ab64ea72916925fa97"
|
||||
packages = [
|
||||
"unix",
|
||||
"windows"
|
||||
]
|
||||
revision = "1d206c9fa8975fb4cf00df1dc8bf3283dc24ba0e"
|
||||
|
||||
[[projects]]
|
||||
branch = "v1"
|
||||
@@ -214,3 +281,10 @@ memo = "57879f27cc9f82276b92ed638fbc04122c3793ed4a16bea668c9fbfda280c280"
|
||||
name = "gopkg.in/yaml.v2"
|
||||
packages = ["."]
|
||||
revision = "eb3733d160e74a9c7e442f435eb3bea458e1d19f"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "5ab2b384766e62be84d3941971a1d8e99c637f80a2cb1482b3d9704c668b549f"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
||||
+7
-7
@@ -1,28 +1,28 @@
|
||||
|
||||
[[dependencies]]
|
||||
[[override]]
|
||||
branch = "master"
|
||||
name = "github.com/mkrautz/goar"
|
||||
|
||||
[[dependencies]]
|
||||
[[override]]
|
||||
branch = "master"
|
||||
name = "github.com/smira/go-uuid"
|
||||
|
||||
[[dependencies]]
|
||||
[[override]]
|
||||
branch = "master"
|
||||
name = "github.com/smira/go-xz"
|
||||
|
||||
[[dependencies]]
|
||||
[[override]]
|
||||
name = "github.com/ugorji/go"
|
||||
revision = "71c2886f5a673a35f909803f38ece5810165097b"
|
||||
|
||||
[[dependencies]]
|
||||
[[override]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/crypto"
|
||||
|
||||
[[dependencies]]
|
||||
[[override]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/sys"
|
||||
|
||||
[[dependencies]]
|
||||
[[override]]
|
||||
branch = "v1"
|
||||
name = "gopkg.in/check.v1"
|
||||
|
||||
@@ -4,19 +4,13 @@ PACKAGES=context database deb files gpg http query swift s3 utils
|
||||
PYTHON?=python
|
||||
TESTS?=
|
||||
BINPATH?=$(GOPATH)/bin
|
||||
RUN_LONG_TESTS?=yes
|
||||
|
||||
ifeq ($(GOVERSION), devel)
|
||||
TRAVIS_TARGET=coveralls
|
||||
else
|
||||
TRAVIS_TARGET=test
|
||||
endif
|
||||
GO_1_10_AND_HIGHER=$(shell (printf '%s\n' go1.10 $(GOVERSION) | sort -cV >/dev/null 2>&1) && echo "yes")
|
||||
|
||||
all: test check system-test
|
||||
|
||||
prepare:
|
||||
go get -u github.com/mattn/goveralls
|
||||
go get -u github.com/axw/gocov/gocov
|
||||
go get -u golang.org/x/tools/cmd/cover
|
||||
go get -u github.com/alecthomas/gometalinter
|
||||
gometalinter --install
|
||||
|
||||
@@ -24,45 +18,39 @@ dev:
|
||||
go get -u github.com/golang/dep/...
|
||||
go get -u github.com/laher/goxc
|
||||
|
||||
coverage.out:
|
||||
rm -f coverage.*.out
|
||||
for i in $(PACKAGES); do go test -coverprofile=coverage.$$i.out -covermode=count ./$$i; done
|
||||
echo "mode: count" > coverage.out
|
||||
grep -v -h "mode: count" coverage.*.out >> coverage.out
|
||||
rm -f coverage.*.out
|
||||
|
||||
coverage: coverage.out
|
||||
go tool cover -html=coverage.out
|
||||
rm -f coverage.out
|
||||
|
||||
check: system/env
|
||||
ifeq ($(RUN_LONG_TESTS), yes)
|
||||
if [ -x travis_wait ]; then \
|
||||
travis_wait gometalinter --config=linter.json ./...; \
|
||||
else \
|
||||
gometalinter --config=linter.json ./...; \
|
||||
fi
|
||||
. system/env/bin/activate && flake8 --max-line-length=200 --exclude=system/env/ system/
|
||||
endif
|
||||
|
||||
install:
|
||||
go install -v -ldflags "-X main.Version=$(VERSION)"
|
||||
|
||||
system/env: system/requirements.txt
|
||||
ifeq ($(RUN_LONG_TESTS), yes)
|
||||
rm -rf system/env
|
||||
virtualenv system/env
|
||||
system/env/bin/pip install -r system/requirements.txt
|
||||
endif
|
||||
|
||||
system-test: install system/env
|
||||
ifeq ($(RUN_LONG_TESTS), yes)
|
||||
if [ ! -e ~/aptly-fixture-db ]; then git clone https://github.com/aptly-dev/aptly-fixture-db.git ~/aptly-fixture-db/; fi
|
||||
if [ ! -e ~/aptly-fixture-pool ]; then git clone https://github.com/aptly-dev/aptly-fixture-pool.git ~/aptly-fixture-pool/; fi
|
||||
. system/env/bin/activate && APTLY_VERSION=$(VERSION) PATH=$(BINPATH)/:$(PATH) $(PYTHON) system/run.py --long $(TESTS)
|
||||
|
||||
travis: $(TRAVIS_TARGET) check system-test
|
||||
PATH=$(BINPATH)/:$(PATH) && . system/env/bin/activate && APTLY_VERSION=$(VERSION) $(PYTHON) system/run.py --long $(TESTS)
|
||||
endif
|
||||
|
||||
test:
|
||||
ifeq ($(GO_1_10_AND_HIGHER), yes)
|
||||
go test -v ./... -gocheck.v=true -race -coverprofile=coverage.txt -covermode=atomic
|
||||
else
|
||||
go test -v `go list ./... | grep -v vendor/` -gocheck.v=true
|
||||
|
||||
coveralls: coverage.out
|
||||
$(BINPATH)/goveralls -service travis-ci.org -coverprofile=coverage.out -repotoken=$(COVERALLS_TOKEN)
|
||||
endif
|
||||
|
||||
mem.png: mem.dat mem.gp
|
||||
gnuplot mem.gp
|
||||
@@ -70,9 +58,10 @@ mem.png: mem.dat mem.gp
|
||||
|
||||
goxc:
|
||||
rm -rf root/
|
||||
mkdir -p root/usr/share/man/man1/ root/etc/bash_completion.d
|
||||
mkdir -p root/usr/share/man/man1/ root/etc/bash_completion.d/ root/usr/share/zsh/vendor-completions/
|
||||
cp man/aptly.1 root/usr/share/man/man1
|
||||
cp bash_completion.d/aptly root/etc/bash_completion.d
|
||||
cp completion.d/aptly root/etc/bash_completion.d/
|
||||
cp completion.d/_aptly root/usr/share/zsh/vendor-completions/
|
||||
gzip root/usr/share/man/man1/aptly.1
|
||||
goxc -pv=$(VERSION) -max-processors=4 $(GOXC_OPTS)
|
||||
|
||||
@@ -82,4 +71,4 @@ man:
|
||||
version:
|
||||
@echo $(VERSION)
|
||||
|
||||
.PHONY: coverage.out man version
|
||||
.PHONY: man version
|
||||
|
||||
+16
-12
@@ -2,17 +2,17 @@
|
||||
aptly
|
||||
=====
|
||||
|
||||
.. image:: https://api.travis-ci.org/smira/aptly.svg?branch=master
|
||||
:target: https://travis-ci.org/smira/aptly
|
||||
.. image:: https://api.travis-ci.org/aptly-dev/aptly.svg?branch=master
|
||||
:target: https://travis-ci.org/aptly-dev/aptly
|
||||
|
||||
.. image:: https://coveralls.io/repos/smira/aptly/badge.svg?branch=master
|
||||
:target: https://coveralls.io/r/smira/aptly?branch=master
|
||||
.. image:: https://codecov.io/gh/aptly-dev/aptly/branch/master/graph/badge.svg
|
||||
:target: https://codecov.io/gh/aptly-dev/aptly
|
||||
|
||||
.. image:: https://badges.gitter.im/Join Chat.svg
|
||||
:target: https://gitter.im/smira/aptly?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
|
||||
:target: https://gitter.im/aptly-dev/aptly?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
|
||||
|
||||
.. image:: http://goreportcard.com/badge/smira/aptly
|
||||
:target: http://goreportcard.com/report/smira/aptly
|
||||
.. image:: http://goreportcard.com/badge/aptly-dev/aptly
|
||||
:target: http://goreportcard.com/report/aptly-dev/aptly
|
||||
|
||||
Aptly is a swiss army knife for Debian repository management.
|
||||
|
||||
@@ -48,7 +48,7 @@ To install aptly on Debian/Ubuntu, add new repository to ``/etc/apt/sources.list
|
||||
|
||||
And import key that is used to sign the release::
|
||||
|
||||
$ apt-key adv --keyserver keys.gnupg.net --recv-keys 9E3E53F19C7DE460
|
||||
$ apt-key adv --keyserver pool.sks-keyservers.net --recv-keys ED75B5A4483DA07C
|
||||
|
||||
After that you can install aptly as any other software package::
|
||||
|
||||
@@ -64,11 +64,11 @@ If you would like to use nightly builds (unstable), please use following reposit
|
||||
|
||||
Binary executables (depends almost only on libc) are available for download from `Bintray <http://dl.bintray.com/smira/aptly/>`_.
|
||||
|
||||
If you have Go environment set up, you can build aptly from source by running (go 1.7+ required)::
|
||||
If you have Go environment set up, you can build aptly from source by running (go 1.8+ required)::
|
||||
|
||||
mkdir -p $GOPATH/src/github.com/smira/aptly
|
||||
git clone https://github.com/smira/aptly $GOPATH/src/github.com/smira/aptly
|
||||
cd $GOPATH/src/github.com/smira/aptly
|
||||
mkdir -p $GOPATH/src/github.com/aptly-dev/aptly
|
||||
git clone https://github.com/aptly-dev/aptly $GOPATH/src/github.com/aptly-dev/aptly
|
||||
cd $GOPATH/src/github.com/aptly-dev/aptly
|
||||
make install
|
||||
|
||||
Binary would be installed to ```$GOPATH/bin/aptly``.
|
||||
@@ -109,6 +109,10 @@ CLI for aptly API:
|
||||
- `Ruby aptly CLI/library <https://github.com/sepulworld/aptly_cli>`_ by Zane Williamson
|
||||
- `Python aptly CLI (good for CI) <https://github.com/TimSusa/aptly_api_cli>`_ by Tim Susa
|
||||
|
||||
GUI for aptly API:
|
||||
|
||||
- `Python aptly GUI (via pyqt5) <https://github.com/chnyda/python-aptly-gui>`_ by Cedric Hnyda
|
||||
|
||||
Scala sbt:
|
||||
|
||||
- `sbt aptly plugin <https://github.com/amalakar/sbt-aptly>`_ by Arup Malakar
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import (
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
"github.com/smira/aptly/cmd"
|
||||
"github.com/aptly-dev/aptly/cmd"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
+3
-3
@@ -6,10 +6,10 @@ import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/query"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/query"
|
||||
)
|
||||
|
||||
// Lock order acquisition (canonical):
|
||||
|
||||
+9
-9
@@ -8,8 +8,8 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/smira/aptly/deb"
|
||||
)
|
||||
|
||||
// GET /api/graph.:ext?layout=[vertical|horizontal(default)]
|
||||
@@ -24,14 +24,14 @@ func apiGraph(c *gin.Context) {
|
||||
|
||||
factory := context.CollectionFactory()
|
||||
|
||||
factory.RemoteRepoCollection().RLock()
|
||||
defer factory.RemoteRepoCollection().RUnlock()
|
||||
factory.LocalRepoCollection().RLock()
|
||||
defer factory.LocalRepoCollection().RUnlock()
|
||||
factory.SnapshotCollection().RLock()
|
||||
defer factory.SnapshotCollection().RUnlock()
|
||||
factory.PublishedRepoCollection().RLock()
|
||||
defer factory.PublishedRepoCollection().RUnlock()
|
||||
factory.RemoteRepoCollection().Lock()
|
||||
defer factory.RemoteRepoCollection().Unlock()
|
||||
factory.LocalRepoCollection().Lock()
|
||||
defer factory.LocalRepoCollection().Unlock()
|
||||
factory.SnapshotCollection().Lock()
|
||||
defer factory.SnapshotCollection().Unlock()
|
||||
factory.PublishedRepoCollection().Lock()
|
||||
defer factory.PublishedRepoCollection().Unlock()
|
||||
|
||||
graph, err := deb.BuildGraph(factory, layout)
|
||||
if err != nil {
|
||||
|
||||
+20
-15
@@ -4,10 +4,10 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/pgp"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/pgp"
|
||||
"github.com/smira/aptly/utils"
|
||||
)
|
||||
|
||||
// SigningOptions is a shared between publish API GPG options structure
|
||||
@@ -60,8 +60,8 @@ func apiPublishList(c *gin.Context) {
|
||||
defer snapshotCollection.RUnlock()
|
||||
|
||||
collection := context.CollectionFactory().PublishedRepoCollection()
|
||||
collection.RLock()
|
||||
defer collection.RUnlock()
|
||||
collection.Lock()
|
||||
defer collection.Unlock()
|
||||
|
||||
result := make([]*deb.PublishedRepo, 0, collection.Len())
|
||||
|
||||
@@ -104,6 +104,7 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
|
||||
SkipContents *bool
|
||||
Architectures []string
|
||||
Signing SigningOptions
|
||||
AcquireByHash *bool
|
||||
}
|
||||
|
||||
if c.Bind(&b) != nil {
|
||||
@@ -128,8 +129,8 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
|
||||
var snapshot *deb.Snapshot
|
||||
|
||||
snapshotCollection := context.CollectionFactory().SnapshotCollection()
|
||||
snapshotCollection.RLock()
|
||||
defer snapshotCollection.RUnlock()
|
||||
snapshotCollection.Lock()
|
||||
defer snapshotCollection.Unlock()
|
||||
|
||||
for _, source := range b.Sources {
|
||||
components = append(components, source.Component)
|
||||
@@ -152,8 +153,8 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
|
||||
var localRepo *deb.LocalRepo
|
||||
|
||||
localCollection := context.CollectionFactory().LocalRepoCollection()
|
||||
localCollection.RLock()
|
||||
defer localCollection.RUnlock()
|
||||
localCollection.Lock()
|
||||
defer localCollection.Unlock()
|
||||
|
||||
for _, source := range b.Sources {
|
||||
components = append(components, source.Component)
|
||||
@@ -201,6 +202,10 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
|
||||
published.SkipContents = *b.SkipContents
|
||||
}
|
||||
|
||||
if b.AcquireByHash != nil {
|
||||
published.AcquireByHash = *b.AcquireByHash
|
||||
}
|
||||
|
||||
duplicate := collection.CheckDuplicate(published)
|
||||
if duplicate != nil {
|
||||
context.CollectionFactory().PublishedRepoCollection().LoadComplete(duplicate, context.CollectionFactory())
|
||||
@@ -253,12 +258,12 @@ func apiPublishUpdateSwitch(c *gin.Context) {
|
||||
|
||||
// published.LoadComplete would touch local repo collection
|
||||
localRepoCollection := context.CollectionFactory().LocalRepoCollection()
|
||||
localRepoCollection.RLock()
|
||||
defer localRepoCollection.RUnlock()
|
||||
localRepoCollection.Lock()
|
||||
defer localRepoCollection.Unlock()
|
||||
|
||||
snapshotCollection := context.CollectionFactory().SnapshotCollection()
|
||||
snapshotCollection.RLock()
|
||||
defer snapshotCollection.RUnlock()
|
||||
snapshotCollection.Lock()
|
||||
defer snapshotCollection.Unlock()
|
||||
|
||||
collection := context.CollectionFactory().PublishedRepoCollection()
|
||||
collection.Lock()
|
||||
@@ -357,8 +362,8 @@ func apiPublishDrop(c *gin.Context) {
|
||||
|
||||
// published.LoadComplete would touch local repo collection
|
||||
localRepoCollection := context.CollectionFactory().LocalRepoCollection()
|
||||
localRepoCollection.RLock()
|
||||
defer localRepoCollection.RUnlock()
|
||||
localRepoCollection.Lock()
|
||||
defer localRepoCollection.Unlock()
|
||||
|
||||
collection := context.CollectionFactory().PublishedRepoCollection()
|
||||
collection.Lock()
|
||||
|
||||
+6
-6
@@ -5,11 +5,11 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/utils"
|
||||
)
|
||||
|
||||
// GET /api/repos
|
||||
@@ -162,8 +162,8 @@ func apiReposDrop(c *gin.Context) {
|
||||
// GET /api/repos/:name/packages
|
||||
func apiReposPackagesShow(c *gin.Context) {
|
||||
collection := context.CollectionFactory().LocalRepoCollection()
|
||||
collection.RLock()
|
||||
defer collection.RUnlock()
|
||||
collection.Lock()
|
||||
defer collection.Unlock()
|
||||
|
||||
repo, err := collection.ByName(c.Params.ByName("name"))
|
||||
if err != nil {
|
||||
|
||||
+1
-1
@@ -3,8 +3,8 @@ package api
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
ctx "github.com/aptly-dev/aptly/context"
|
||||
"github.com/gin-gonic/gin"
|
||||
ctx "github.com/smira/aptly/context"
|
||||
)
|
||||
|
||||
var context *ctx.AptlyContext
|
||||
|
||||
+12
-12
@@ -3,9 +3,9 @@ package api
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/smira/aptly/deb"
|
||||
)
|
||||
|
||||
// GET /api/snapshots
|
||||
@@ -47,8 +47,8 @@ func apiSnapshotsCreateFromMirror(c *gin.Context) {
|
||||
}
|
||||
|
||||
collection := context.CollectionFactory().RemoteRepoCollection()
|
||||
collection.RLock()
|
||||
defer collection.RUnlock()
|
||||
collection.Lock()
|
||||
defer collection.Unlock()
|
||||
|
||||
snapshotCollection := context.CollectionFactory().SnapshotCollection()
|
||||
snapshotCollection.Lock()
|
||||
@@ -186,8 +186,8 @@ func apiSnapshotsCreateFromRepository(c *gin.Context) {
|
||||
}
|
||||
|
||||
collection := context.CollectionFactory().LocalRepoCollection()
|
||||
collection.RLock()
|
||||
defer collection.RUnlock()
|
||||
collection.Lock()
|
||||
defer collection.Unlock()
|
||||
|
||||
snapshotCollection := context.CollectionFactory().SnapshotCollection()
|
||||
snapshotCollection.Lock()
|
||||
@@ -276,8 +276,8 @@ func apiSnapshotsUpdate(c *gin.Context) {
|
||||
// GET /api/snapshots/:name
|
||||
func apiSnapshotsShow(c *gin.Context) {
|
||||
collection := context.CollectionFactory().SnapshotCollection()
|
||||
collection.RLock()
|
||||
defer collection.RUnlock()
|
||||
collection.Lock()
|
||||
defer collection.Unlock()
|
||||
|
||||
snapshot, err := collection.ByName(c.Params.ByName("name"))
|
||||
if err != nil {
|
||||
@@ -342,8 +342,8 @@ func apiSnapshotsDiff(c *gin.Context) {
|
||||
onlyMatching := c.Request.URL.Query().Get("onlyMatching") == "1"
|
||||
|
||||
collection := context.CollectionFactory().SnapshotCollection()
|
||||
collection.RLock()
|
||||
defer collection.RUnlock()
|
||||
collection.Lock()
|
||||
defer collection.Unlock()
|
||||
|
||||
snapshotA, err := collection.ByName(c.Params.ByName("name"))
|
||||
if err != nil {
|
||||
@@ -392,8 +392,8 @@ func apiSnapshotsDiff(c *gin.Context) {
|
||||
// GET /api/snapshots/:name/packages
|
||||
func apiSnapshotsSearchPackages(c *gin.Context) {
|
||||
collection := context.CollectionFactory().SnapshotCollection()
|
||||
collection.RLock()
|
||||
defer collection.RUnlock()
|
||||
collection.Lock()
|
||||
defer collection.Unlock()
|
||||
|
||||
snapshot, err := collection.ByName(c.Params.ByName("name"))
|
||||
if err != nil {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=APT repository API
|
||||
After=network.target
|
||||
Documentation=man:aptly(1)
|
||||
Documentation=https://www.aptly.info/doc/api/
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/aptly serve api -no-lock -listen=127.0.0.1:8081
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=APT repository server
|
||||
After=network.target
|
||||
Documentation=man:aptly(1)
|
||||
Documentation=https://www.aptly.info/doc/commands/
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/aptly serve -listen=127.0.0.1:8080
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
)
|
||||
|
||||
// ReadSeekerCloser = ReadSeeker + Closer
|
||||
|
||||
+3
-3
@@ -7,9 +7,9 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"github.com/smira/aptly/api"
|
||||
"github.com/smira/aptly/systemd/activation"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/api"
|
||||
"github.com/aptly-dev/aptly/systemd/activation"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@ import (
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
ctx "github.com/smira/aptly/context"
|
||||
ctx "github.com/aptly-dev/aptly/context"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/smira/commander"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
"github.com/smira/commander"
|
||||
)
|
||||
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/smira/commander"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package cmd
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/smira/aptly/pgp"
|
||||
"github.com/aptly-dev/aptly/pgp"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/query"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/query"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/smira/aptly/pgp"
|
||||
"github.com/smira/aptly/query"
|
||||
"github.com/aptly-dev/aptly/pgp"
|
||||
"github.com/aptly-dev/aptly/query"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/smira/commander"
|
||||
)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/smira/commander"
|
||||
)
|
||||
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
@@ -5,10 +5,10 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/query"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/query"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
@@ -3,8 +3,8 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/query"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/query"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
+3
-3
@@ -5,9 +5,9 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/query"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/query"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/smira/aptly/pgp"
|
||||
"github.com/aptly-dev/aptly/pgp"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/smira/commander"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/smira/commander"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/smira/commander"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
+3
-3
@@ -4,9 +4,9 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/AlekSi/pointer"
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
+4
-4
@@ -7,10 +7,10 @@ import (
|
||||
"path/filepath"
|
||||
"text/template"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/query"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/query"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/smira/commander"
|
||||
)
|
||||
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@ import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/query"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/query"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/query"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/query"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/smira/commander"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
ctx "github.com/smira/aptly/context"
|
||||
ctx "github.com/aptly-dev/aptly/context"
|
||||
"github.com/smira/commander"
|
||||
)
|
||||
|
||||
|
||||
+3
-3
@@ -8,9 +8,9 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/smira/commander"
|
||||
)
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/query"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/query"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/smira/commander"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/smira/commander"
|
||||
)
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/query"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/query"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/smira/commander"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/query"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/query"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/smira/commander"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/smira/commander"
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
# aptly-zsh
|
||||
zsh completion for aptly
|
||||
|
||||
The zsh completion function and this README were imported from
|
||||
[steinymity's repository](https://github.com/steinymity/aptly-zsh).
|
||||
|
||||
[Aptly](https://www.aptly.info/) is a great tool to setup Debian APT repositories
|
||||
and mirrors. However, it's sometimes hard to remember all the command line
|
||||
syntax and names of all options. Therefore I wrote this zsh completion modules
|
||||
for aptly.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the terms of the MIT license. See file `LICENSE`
|
||||
for details.
|
||||
|
||||
## Installation
|
||||
|
||||
Clone/copy the file `_aptly` to a place in your `$fpath` (show with
|
||||
`echo $fpath`), or create a new directory and extend the fpath:
|
||||
|
||||
mkdir -p ~/.zsh/functions
|
||||
fpath=(~/.zsh/functions $fpath)
|
||||
editor ~/.zsh/functions/_aptly
|
||||
|
||||
To profit most from the provided help messages and completions, make sure that
|
||||
your zsh is setup properly. I have tested with the grml-zsh configuration that
|
||||
is [available on Github](https://github.com/grml/grml-etc-core/) and on the
|
||||
[grml homepage](http://grml.org/zsh/).
|
||||
|
||||
## Compatibility
|
||||
|
||||
The command line completion was developed based on the manpage of aptly 1.2.0
|
||||
(currently in Debian Testing). However, most completions will work on older
|
||||
versions (e.g., 0.9.7 in Debian Stable), too.
|
||||
|
||||
The completion function completes most arguments and options that can be passed
|
||||
to aptly, including mirror/repository/snapshot/publish names. However, not all
|
||||
arguments are handled yet. See the next section for known limitations.
|
||||
|
||||
## Known Bugs and Limitation
|
||||
|
||||
* Boolean options are always completed with an explicit value `true` or
|
||||
`false`, although omitting the value is implicitly interpreted as `true`.
|
||||
* The source and destination names of copy and move operations must not be the
|
||||
same. This is currently not enforced.
|
||||
* The package query and display format strings are currently not completed.
|
||||
* Endpoints are not completed.
|
||||
* In `publish snapshot` there is no connection between the number of
|
||||
components passed to `-component` and the number of given snapshots to
|
||||
publish. Furthermore, the help text for `endpoint:prefix` disappears
|
||||
after its first possible location.
|
||||
* In `publish switch` the distribution can be set independently of the
|
||||
`endpoint:prefix` (i.e., all published distributions can be combined with
|
||||
all published `endpoint:prefix`).
|
||||
* Neither `publish switch` nor `publish update` check if publish was created
|
||||
from a snapshot or directly from a local repo.
|
||||
* Task commands are not completed. There are no commas added.
|
||||
* `help` won't complete after a sub command (i.e., `aptly mirror list help`).
|
||||
* Probably more, feel free to open issues, and submit patches/merge requests.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Maximilian Stein <m@steiny.biz>
|
||||
2018-02-03
|
||||
@@ -0,0 +1,617 @@
|
||||
#compdef aptly
|
||||
################################################################################
|
||||
# Copyright (C) 2018 Maximilian Stein <m@steiny.biz>
|
||||
# Acknowledgement: Many texts where copied from aptly(1)
|
||||
#
|
||||
# This project is licensed under the terms of the MIT license.
|
||||
# See file LICENSE for details.
|
||||
################################################################################
|
||||
# zsh completion script for Aptly (http://aptly.info/)
|
||||
################################################################################
|
||||
|
||||
# see https://man.cx/aptly
|
||||
|
||||
local curcontext="$curcontext" state line cmd subcmd ret=1
|
||||
|
||||
local arch_list=(amd64 arm64 armel armhf i386 mips mipsel mips64el ppc64el s390x)
|
||||
local bool="bool:{_wanted -V values expl 'bool' compadd true false}"
|
||||
local dists=({wheezy,jessie,stretch}{,-updates,-backports,-backports-sloopy} buster sid experimental)
|
||||
local components=(main contrib non-free)
|
||||
local aptly_query="aptly package query: "
|
||||
local aptly_format="aptly package display format: "
|
||||
local aptly_uploaders="-uploaders-file=[uploaders.json to be used when including .changes into this repository]:uploaders file:_files -g '*.json'"
|
||||
local keyring="*-keyring=[gpg keyring to use when verifying Release file (could be specified multiple times)]:keyring file:_files -g '*.gpg'"
|
||||
|
||||
# complete command
|
||||
(( $+functions[_aptly-cmd] )) ||
|
||||
_aptly-cmd() {
|
||||
_values "aptly command category" \
|
||||
"mirror[manage, update mirrors of remote repositories]" \
|
||||
"repo[manage local package repositories, add, remove, move, copy packages]" \
|
||||
"snapshot[create, merge, manage snapshots]" \
|
||||
"package[perform operation on the whole collection of packages]" \
|
||||
"publish[publish snapshot or local repository]" \
|
||||
"db[cleanup database and package pool, recover database after failure]" \
|
||||
"task[multi-command tasks]" \
|
||||
"serve[quickly serve published repositories via HTTP]" \
|
||||
"config[configuration management]" \
|
||||
"graph[generate dependency graph]" \
|
||||
"api[REST API service]"
|
||||
ret=0
|
||||
}
|
||||
|
||||
# complete subcommand
|
||||
(( $+functions[_aptly-subcmd] )) ||
|
||||
_aptly-subcmd() {
|
||||
local cmd=$1
|
||||
case $cmd in
|
||||
mirror)
|
||||
_values "mirror commands" \
|
||||
"create[create new mirror of remote repository]" \
|
||||
"list[show full list of mirrors]" \
|
||||
"show[show details about a mirror]" \
|
||||
"drop[delete a mirror]" \
|
||||
"update[update a mirror]" \
|
||||
"rename[change name of a mirror]" \
|
||||
"edit[change settings of a mirror]" \
|
||||
"search[search mirror for packages matching query]"
|
||||
ret=0 ;;
|
||||
repo)
|
||||
_values "repo commands" \
|
||||
"add[add packages to local repository]" \
|
||||
"copy[copy packages between local repositories]" \
|
||||
"create[create local repository]" \
|
||||
"drop[delete local repository]" \
|
||||
"edit[edit properties of local repository]" \
|
||||
"import[import packages from mirror to local repository]" \
|
||||
"list[list local repositories]" \
|
||||
"move[move packages between local repositories]" \
|
||||
"remove[remove packages from local repository]" \
|
||||
"show[show details about local repository]" \
|
||||
"rename[renames local repository]" \
|
||||
"search[search repo for packages matching query]" \
|
||||
"include[add packages to local repositories based on .changes files]"
|
||||
ret=0 ;;
|
||||
snapshot)
|
||||
_values "snapshot commands" \
|
||||
"create[create snapshot of mirror or local repository]" \
|
||||
"list[list snapshots]" \
|
||||
"show[show details about snapshot]" \
|
||||
"verify[verify dependencies in snapshot]" \
|
||||
"pull[pull packages from another snapshot]" \
|
||||
"diff[show difference between two snapshots]" \
|
||||
"merge[merge snapshots]" \
|
||||
"drop[delete snapshot]" \
|
||||
"rename[rename snapshot]" \
|
||||
"search[search snapshot for packages matching query]" \
|
||||
"filter[filter packages in snapshot producing another snapshot]"
|
||||
ret=0 ;;
|
||||
publish)
|
||||
_values "publish commands" \
|
||||
"drop[remove published repository]" \
|
||||
"list[list published repositories]" \
|
||||
"repo[publish local repository]" \
|
||||
"snapshot[publish snapshot]" \
|
||||
"switch[update published repository by switching to new snapshot]" \
|
||||
"update[update published local repository]" \
|
||||
"show[shows details of published repository]"
|
||||
ret=0 ;;
|
||||
package)
|
||||
_values "package commands" \
|
||||
"search[search for packages matching query]" \
|
||||
"show[show details about packages matching query]"
|
||||
ret=0 ;;
|
||||
db)
|
||||
_values "db commands" \
|
||||
"cleanup[cleanup db and package pool]" \
|
||||
"recover[recover db after crash]"
|
||||
ret=0 ;;
|
||||
serve)
|
||||
# no subcommand here
|
||||
_arguments '1:: :' \
|
||||
'-listen=[host:port for HTTP listening]:host\:port: '
|
||||
ret=0 ;;
|
||||
api)
|
||||
_values "api commands" \
|
||||
"serve[start api http service]"
|
||||
ret=0 ;;
|
||||
graph)
|
||||
# no subcommand here
|
||||
_arguments '*:' \
|
||||
'-format=[render graph to specified format]:image format:(png svg pdf)' \
|
||||
'-layout=[create a more vertical or more horizontal graph layout]:layout:(horizontal vertical)' \
|
||||
'-output=[specify output filename, default is to open result in viewer]:output file:_files'
|
||||
ret=0 ;;
|
||||
config)
|
||||
_values "config commands" \
|
||||
"show[show current aptly config]"
|
||||
ret=0 ;;
|
||||
task)
|
||||
_values "task commands" \
|
||||
"run[run aptly tasks]"
|
||||
ret=0 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# complete parameters
|
||||
(( $+functions[_aptly-param] )) ||
|
||||
_aptly-param() {
|
||||
local cmd=$1 subcmd=$2
|
||||
|
||||
local config=$opt_args[-config]
|
||||
[[ -n $config ]] && config="-config=$config"
|
||||
|
||||
# get list of mirrors, or ' ' if none
|
||||
get_mirrors() {
|
||||
# retrieve list of mirrors
|
||||
local mirrors=($(aptly $config mirror list -raw=true 2>/dev/null))
|
||||
# a single space causes just the help text to be shown
|
||||
[[ -z $mirrors ]] && mirrors=" " || mirrors="($mirrors)"
|
||||
echo $mirrors
|
||||
}
|
||||
# get lists of repos or ' ' if none
|
||||
get_repos() {
|
||||
# retrieve repo list
|
||||
local repos=($(aptly $config repo list -raw=true 2>/dev/null))
|
||||
[[ -z $repos ]] && repos=" " || repos="($repos)"
|
||||
echo $repos
|
||||
}
|
||||
# get list of snapshots or ' ' if none
|
||||
get_snapshots() {
|
||||
local snapshots=($(aptly $config snapshot list -raw=true 2>/dev/null))
|
||||
[[ -z $snapshots ]] && snapshots=" " || snapshots="($snapshots)"
|
||||
echo $snapshots
|
||||
}
|
||||
# get list of gpg keys or ' ' if none
|
||||
get_gpg_key_ids() {
|
||||
local gpg_keys=($(gpg --quiet --batch --keyid-format long --list-secret-keys --with-colons 2>/dev/null | grep '^sec' | cut -d ':' -f 5))
|
||||
[[ -z $gpg_keys ]] && gpg_keys=" " || gpg_keys="($gpg_keys)"
|
||||
echo $gpg_keys
|
||||
}
|
||||
|
||||
ret=0
|
||||
case $cmd in
|
||||
mirror)
|
||||
local mirrors=$(get_mirrors)
|
||||
|
||||
case $subcmd in
|
||||
create)
|
||||
_arguments \
|
||||
"-filter=[filter packages in mirror]:$aptly_query" \
|
||||
"-filter-with-deps=[when filtering, include dependencies of matching packages as well]:$bool" \
|
||||
"-force-architecture=[(only with architecture list) skip check that requested architectures are listed in Release file]:$bool" \
|
||||
"-force-components=[(only with component list) skip check that requested components are listed in Release file]:$bool" \
|
||||
"-ignore-signatures=[disable verification of Release file signatures]:$bool" \
|
||||
$keyring \
|
||||
"-with-sources=[download source packages in addition to binary packages]:$bool" \
|
||||
"-with-udebs=[download .udeb packages (Debian installer support)]:$bool" \
|
||||
"(-)2:new mirror name: " ":archive url:_urls" ":distribution:($dists)" "*:components:_values -s ' ' components $components"
|
||||
;;
|
||||
list)
|
||||
_arguments '1:: :' \
|
||||
"-raw=[display list in machine-readable format]:$bool"
|
||||
;;
|
||||
show)
|
||||
_arguments \
|
||||
"-with-packages=[show detailed list of packages and versions stored in the mirror]:$bool" \
|
||||
"(-)2:mirror name:$mirrors"
|
||||
;;
|
||||
drop)
|
||||
_arguments \
|
||||
"-force=[force mirror deletion even if used by snapshots]:$bool" \
|
||||
"(-)2:mirror name:$mirrors"
|
||||
;;
|
||||
update)
|
||||
_arguments \
|
||||
"-download-limit=[limit download speed (kB/s)]:kB/s: " \
|
||||
"-force=[force update mirror even if it is locked by another process]:$bool" \
|
||||
"-ignore-checksums=[ignore checksum mismatches while downloading package files and metadata]:$bool" \
|
||||
"-ignore-signatures=[disable verification of Release file signatures]:$bool" \
|
||||
$keyring \
|
||||
"-max-tries=[max download tries till process fails with download error]:number: " \
|
||||
"-skip-existing-packages=[do not check file existence for packages listed in the internal database of the mirror]:$bool" \
|
||||
"(-)2:mirror name:$mirrors"
|
||||
;;
|
||||
rename)
|
||||
_arguments \
|
||||
"2:old mirror name:$mirrors" ":new mirror name: "
|
||||
;;
|
||||
edit)
|
||||
_arguments \
|
||||
"-filter=[filter packages in mirror]:$aptly_query" \
|
||||
"-filter-with-deps=[when filtering, include dependencies of matching packages as well]:$bool" \
|
||||
"-with-sources=[download source packages in addition to binary packages]:$bool" \
|
||||
"-with-udebs=[download .udeb packages (Debian installer support)]:$bool" \
|
||||
"(-)2:mirror name:$mirrors"
|
||||
;;
|
||||
search)
|
||||
_arguments \
|
||||
"-format=[custom format for result printing]:$aptly_format" \
|
||||
"-with-deps=[include dependencies into search results]:$bool" \
|
||||
"(-)2:mirror name:$mirrors" ":$aptly_query"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
repo)
|
||||
|
||||
|
||||
local repos=$(get_repos)
|
||||
|
||||
local create_edit=("-comment=[any text that would be used to described local repository]:comment: "
|
||||
"-component=[default component when publishing]:component:($components)"
|
||||
"-distribution=[default distribution when publishing]:distribution:($dists)"
|
||||
$aptly_uploaders
|
||||
)
|
||||
|
||||
case $subcmd in
|
||||
add)
|
||||
_arguments \
|
||||
"-force-replace=[when adding package that conflicts with existing package, remove existing package]:$bool" \
|
||||
"-remove-files=[remove files that have been imported successfully into repository]:$bool" \
|
||||
"(-)2:repo name:$repos" "*:package files:_files -g '*.{udeb,deb,dsc}'"
|
||||
;;
|
||||
copy)
|
||||
_arguments \
|
||||
"-dry-run=[don’t copy, just show what would be copied]:$bool" \
|
||||
"-with-deps=[follow dependencies when processing package−spec]:$$bool" \
|
||||
"(-)2:src repo name:$repos" ":dest repo name:$repos" "*:$aptly_query"
|
||||
;;
|
||||
create)
|
||||
local snapshots=$(get_snapshots)
|
||||
|
||||
_arguments \
|
||||
${create_edit[@]} \
|
||||
"(-)2:new repo name: " \
|
||||
"3:::('from')" "4:::('snapshot')" "5::snapshot:$snapshots"
|
||||
;;
|
||||
drop)
|
||||
_arguments \
|
||||
"-force=[force local repo deletion even if used by snapshots]:$bool" \
|
||||
"(-)2:repo name:$repos"
|
||||
;;
|
||||
edit)
|
||||
_arguments \
|
||||
${create_edit[@]} \
|
||||
"(-)2:repo name:$repos"
|
||||
;;
|
||||
import)
|
||||
local mirrors=$(get_mirrors)
|
||||
|
||||
_arguments \
|
||||
"-dry-run=[don’t import, just show what would be imported]:$bool" \
|
||||
"-with-deps=[follow dependencies when processing package−spec]:$bool" \
|
||||
"(-)2:src mirror name:$mirrors" ":dest repo name:$repos" "*:$aptly_query"
|
||||
;;
|
||||
list)
|
||||
_arguments '1:: :' \
|
||||
"-raw=[display list in machine−readable format]:$bool"
|
||||
;;
|
||||
move)
|
||||
_arguments \
|
||||
"-dry-run=[don’t move, just show what would be moved]:$bool" \
|
||||
"-with-deps=[follow dependencies when processing package−spec]:$bool" \
|
||||
"(-)2:srv repo name:$repos" ":dest repo name:$repos" "*:$aptly_query"
|
||||
;;
|
||||
remove)
|
||||
_arguments \
|
||||
"-dry-run=[don’t remove, just show what would be removed]:$bool" \
|
||||
"(-)2:repo name:$repos" "*:$aptly_query"
|
||||
;;
|
||||
show)
|
||||
_arguments \
|
||||
"-with-packages=[show list of packages]:$bool" \
|
||||
"(-)2:repo name:$repos"
|
||||
;;
|
||||
rename)
|
||||
_arguments \
|
||||
"2:old repo name:$repos" ":new repo name: "
|
||||
;;
|
||||
search)
|
||||
_arguments \
|
||||
"-format=[custom format for result printing]:$aptly_format" \
|
||||
"-with-deps=[include dependencies into search results]:$bool" \
|
||||
"(-)2:repo name:$repos" ":$aptly_query"
|
||||
;;
|
||||
include)
|
||||
_arguments '1:: :' \
|
||||
"-accept-unsigned=[accept unsigned .changes files]:$bool" \
|
||||
"-force-replace=[when adding package that conflicts with existing package, remove existing package]:$bool" \
|
||||
"-ignore-signatures=[disable verification of .changes file signature]:$bool" \
|
||||
$keyring \
|
||||
"-no-remove-files=[don’t remove files that have been imported successfully into repository]:$bool" \
|
||||
"-repo=[which repo should files go to, defaults to Distribution field of .changes file]:repo name:$repos" \
|
||||
$aptly_uploaders \
|
||||
"(-)*:changes files/directories:_files -g '*.changes'"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
snapshot)
|
||||
local snapshots=$(get_snapshots)
|
||||
|
||||
case $subcmd in
|
||||
create)
|
||||
local mirrors=$(get_mirrors)
|
||||
local repos=$(get_repos)
|
||||
|
||||
_arguments -C \
|
||||
'(-)2:new snapshot name: ' \
|
||||
'3: :->src1' \
|
||||
'4:: :->src2' '5:: :->src3'
|
||||
|
||||
case $state in
|
||||
src1)
|
||||
_values 'snapshot src' 'from' 'empty' ;;
|
||||
src2)
|
||||
if [[ $line[3] == from ]]; then
|
||||
_values 'snapshot src' 'mirror' 'repo'
|
||||
fi
|
||||
;;
|
||||
src3)
|
||||
if [[ $line[3] == from ]]; then
|
||||
case $line[4] in
|
||||
mirror)
|
||||
_arguments "5:mirror name:$mirrors" ;;
|
||||
repo)
|
||||
_arguments "5:repo name:$repos" ;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
list)
|
||||
_arguments '1:: :' \
|
||||
"-raw=[display list in machine−readable format]:$bool" \
|
||||
"-sort=[display list in ’name’ or creation ’time’ order]:sort order:((name\:'alphabetical order' time\:'chronological order'))"
|
||||
;;
|
||||
show)
|
||||
_arguments \
|
||||
"-with-packages=[show list of packages]:$bool" \
|
||||
"(-)2:snapshot name:$snapshots"
|
||||
;;
|
||||
verify)
|
||||
_arguments '1:: :' \
|
||||
"(-)2:snapshot name:$snapshots" "*::more snapshots:$snapshots"
|
||||
;;
|
||||
pull)
|
||||
_arguments \
|
||||
"-all-matches=[pull all the packages that satisfy the dependency version requirements]:$bool" \
|
||||
"-dry-run=[don’t create destination snapshot, just show what would be pulled]:$bool" \
|
||||
"-no-deps=[don’t process dependencies, just pull listed packages]:$bool" \
|
||||
"-no-remove=[don’t remove other package versions when pulling package]:$bool" \
|
||||
"(-)2:to snapshot name:$snapshots" "3:src snapshot name:$snapshots" "4:new dest snapshot name: " \
|
||||
"*:$aptly_query"
|
||||
;;
|
||||
diff)
|
||||
_arguments \
|
||||
"-only-matching=[display diff only for matching packages (don’t display missing packages)]:$bool" \
|
||||
"(-)2:snapshot name a:$snapshots" "3:snapshot name b:$snapshots"
|
||||
;;
|
||||
merge)
|
||||
_arguments \
|
||||
"-latest=[use only the latest version of each package]:$bool" \
|
||||
"-no-remove=[don’t remove duplicate arch/name packages]:$bool" \
|
||||
"(-)2:new dest snapshot name: " "*:source snapshot name(s):$snapshots"
|
||||
;;
|
||||
drop)
|
||||
_arguments \
|
||||
"-force=[remove snapshot even if it was used as source for other snapshots]:$bool" \
|
||||
"(-)2:snapshot name:$snapshots"
|
||||
;;
|
||||
rename)
|
||||
_arguments '1:: :' \
|
||||
"2:old snapshot name:$snapshots" "3:new snapshot name: "
|
||||
;;
|
||||
search)
|
||||
_arguments \
|
||||
"-format=[custom format for result printing]:$aptly_format" \
|
||||
"-with-deps=[include dependencies into search results]:$bool" \
|
||||
"(-)2:snapshot name:$snapshots" ":$aptly_query"
|
||||
;;
|
||||
filter)
|
||||
_arguments \
|
||||
"-with-deps=[include dependent packages as well]:$bool" \
|
||||
"(-)2:src snapshot name:$snapshots" "3:new dest snapshot name: " "*:$aptly_query"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
publish)
|
||||
# read lines of output into
|
||||
# format of each item: <ep:prefix> <distribution>
|
||||
local -a publish_prefixes
|
||||
local -a publish_dists
|
||||
for line in ${(@f)"$(aptly $config publish list -raw=true 2>/dev/null)"}
|
||||
{
|
||||
publish_prefixes+=($line[(ws: :)1])
|
||||
publish_dists+=($line[(ws: :)2])
|
||||
}
|
||||
publish_prefixes_uniq=(${(@u)publish_prefixes})
|
||||
publish_dists_uniq=(${(@u)publish_dists})
|
||||
[[ -z $publish_prefixes_uniq ]] && publish_prefixes_uniq=" " || publish_prefixes_uniq="($publish_prefixes_uniq)"
|
||||
[[ -z $publish_dists_uniq ]] && publish_dists_uniq=" " || publish_dists_uniq="($publish_dists_uniq)"
|
||||
|
||||
local gpg_keys=$(get_gpg_key_ids)
|
||||
|
||||
# common options for publishing
|
||||
# TODO: is the keyring parameter correct?
|
||||
local publish_update_options=(
|
||||
"-batch=[run GPG with detached tty]:$bool"
|
||||
"-force-overwrite=[overwrite files in package pool in case of mismatch]:$bool"
|
||||
"-gpg-key=[GPG key ID to use when signing the release]:gpg key id:$gpg_keys"
|
||||
"-keyring=[GPG keyring to use (instead of default)]:keyring file:_files -g '*.gpg'"
|
||||
"-passphrase=[GPG passhprase for the key (warning: could be insecure)]:passphrase: "
|
||||
"-passphrase-file=[GPG passhprase−file for the key (warning: could be insecure)]:passphrase file:_files"
|
||||
"-secret-keyring=[GPG secret keyring to use (instead of default)]:secret-keyring:_files"
|
||||
"-skip-contents=[don’t generate Contents indexes]:$bool"
|
||||
"-skip-signing=[don’t sign Release files with GPG]:$bool"
|
||||
)
|
||||
local components_options=(
|
||||
"-component=[component name to publish (for multi−component publishing, separate components with commas)]:components:_values -s , components $components"
|
||||
)
|
||||
local publish_options=(
|
||||
"-butautomaticupgrades=[set value for ButAutomaticUpgrades field]:$bool"
|
||||
"-distribution=[distribution name to publish]:distribution:($dists)"
|
||||
"-label=[label to publish]:label: "
|
||||
"-notautomatic=[set value for NotAutomatic field]:notautomatic: "
|
||||
"-origin=[origin name to publish]:origin: "
|
||||
${components_options[@]}
|
||||
)
|
||||
|
||||
local endpoint_prefix="[endpoint\:]prefix"
|
||||
|
||||
case $subcmd in
|
||||
repo)
|
||||
local repos=$(get_repos)
|
||||
_arguments \
|
||||
${publish_options[@]} \
|
||||
${publish_update_options[@]} \
|
||||
"(-)2:repo name:$repos" "3::$endpoint_prefix: "
|
||||
;;
|
||||
snapshot)
|
||||
local snapshots=$(get_snapshots)
|
||||
_arguments '1:: :' \
|
||||
${publish_options[@]} \
|
||||
${publish_update_options[@]} \
|
||||
"(-)*:snapshot name:$snapshots" "3::$endpoint_prefix: "
|
||||
;;
|
||||
switch)
|
||||
local snapshots=$(get_snapshots)
|
||||
_arguments \
|
||||
${publish_update_options[@]} \
|
||||
${components_options[@]} \
|
||||
"(-)2:distribution:$publish_dists_uniq" "3::$endpoint_prefix:$publish_prefixes_uniq" \
|
||||
"*:new snapshot name:$snapshots"
|
||||
;;
|
||||
update)
|
||||
_arguments \
|
||||
${publish_update_options[@]} \
|
||||
"(-)2:distribution:$publish_dists_uniq" "3::$endpoint_prefix:$publish_prefixes_uniq"
|
||||
;;
|
||||
show)
|
||||
_arguments '1:: :' \
|
||||
"(-)2:distribution:$publish_dists_uniq" "3::$endpoint_prefix:$publish_prefixes_uniq"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
package)
|
||||
case $subcmd in
|
||||
search)
|
||||
_arguments \
|
||||
"-format=[custom format for result printing]:$aptly_format" \
|
||||
"(-)2:$aptly_query"
|
||||
;;
|
||||
show)
|
||||
_arguments \
|
||||
"-with-files=[display information about files from package pool]:$bool" \
|
||||
"-with-references=[display information about mirrors, snapshots and local repos referencing this package]:$bool" \
|
||||
"(-)2:$aptly_query"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
db)
|
||||
case $subcmd in
|
||||
cleanup)
|
||||
_arguments '1:: :' \
|
||||
"-dry-run=[don’t delete anything]:$bool" \
|
||||
"-verbose=[be verbose when loading objects/removing them]:$bool"
|
||||
;;
|
||||
recover)
|
||||
# nothing to complete...
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
serve)
|
||||
# completed in _aptly-subcmd
|
||||
;;
|
||||
api)
|
||||
case $subcmd in
|
||||
serve)
|
||||
_arguments '1:: :' \
|
||||
"-listen=[host:port for HTTP listening or unix://path to listen on a Unix domain socket]:host\:port or unix\://path: " \
|
||||
"-no-lock=[don’t lock the database]:$bool"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
graph)
|
||||
# completed in _aptly-subcmd
|
||||
;;
|
||||
config)
|
||||
case $subcmd in
|
||||
show)
|
||||
# nothing to do
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
task)
|
||||
case $subcmd in
|
||||
run)
|
||||
_arguments '1:: :' \
|
||||
"(2)-filename=[specifies the filename that contains the commands to run]:filename:_files" \
|
||||
"(-filename)*::comma-separated command list: "
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# main completion
|
||||
_arguments -C \
|
||||
"-architectures=[list of architectures to consider (comma−separated), default to all available]:architectures:_values -s , architectures $arch_list" \
|
||||
"-config=[location of configuration file]:file:_files -g '*.conf'" \
|
||||
"-db-open-attempts=[number of attempts to open DB if it’s locked by other instance]:number:()" \
|
||||
"-dep-follow-all-variants=[when processing dependencies, follow a & b if dependency is ’a|b’]:$bool" \
|
||||
"-dep-follow-recommends=[when processing dependencies, follow Recommends]:$bool" \
|
||||
"-dep-follow-source=[when processing dependencies, follow from binary to Source packages]:$bool" \
|
||||
"-dep-follow-suggests=[when processing dependencies, follow Suggests]:$bool" \
|
||||
"-dep-verbose-resolve=[when processing dependencies, print detailed logs]:$bool" \
|
||||
"-gpg-provider=[PGP implementation]:gpg provider:((gpg\:'external gpg' internal\:'Go internal implementation'))" \
|
||||
'(-)1: :->cmds' \
|
||||
'2: :->subcmd' \
|
||||
'*:: :->args' && ret=0
|
||||
|
||||
cmd=$line[1]
|
||||
subcmd=$line[2]
|
||||
|
||||
case $state in
|
||||
cmds)
|
||||
_aptly-cmd
|
||||
_arguments '(-)1:: :((help\:integrated\ command\ help))'
|
||||
;;
|
||||
subcmd)
|
||||
case $cmd in
|
||||
help)
|
||||
_aptly-cmd
|
||||
;;
|
||||
*)
|
||||
_aptly-subcmd $cmd
|
||||
_arguments '(-)2:: :((help\:integrated\ command\ help))'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
args)
|
||||
# help anywhere in line?
|
||||
if [[ ${line[(i)help]} -le ${#line} ]]; then
|
||||
if [[ ${#line} -le 3 ]]; then
|
||||
if [[ $line[1] == help ]]; then
|
||||
_aptly-subcmd $subcmd
|
||||
elif [[ $line[2] == help ]]; then
|
||||
_aptly-subcmd $cmd
|
||||
fi
|
||||
fi
|
||||
else
|
||||
_aptly-param $cmd $subcmd
|
||||
# this somehow destroys parameter completion, so disable it for now
|
||||
#_arguments '(-)3:: :((help\:integrated\ command\ help))'
|
||||
fi
|
||||
ret=0
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 4
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 4
|
||||
# End:
|
||||
# vim: ft=zsh sw=4 ts=4 et
|
||||
+1
-1
@@ -5,8 +5,8 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/cheggaaa/pb"
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/wsxiaoys/terminal/color"
|
||||
)
|
||||
|
||||
|
||||
+13
-13
@@ -14,16 +14,16 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/console"
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/smira/aptly/deb"
|
||||
"github.com/smira/aptly/files"
|
||||
"github.com/smira/aptly/http"
|
||||
"github.com/smira/aptly/pgp"
|
||||
"github.com/smira/aptly/s3"
|
||||
"github.com/smira/aptly/swift"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/console"
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/files"
|
||||
"github.com/aptly-dev/aptly/http"
|
||||
"github.com/aptly-dev/aptly/pgp"
|
||||
"github.com/aptly-dev/aptly/s3"
|
||||
"github.com/aptly-dev/aptly/swift"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/smira/commander"
|
||||
"github.com/smira/flag"
|
||||
)
|
||||
@@ -333,7 +333,7 @@ func (context *AptlyContext) GetPublishedStorage(name string) aptly.PublishedSto
|
||||
} else if strings.HasPrefix(name, "filesystem:") {
|
||||
params, ok := context.config().FileSystemPublishRoots[name[11:]]
|
||||
if !ok {
|
||||
Fatal(fmt.Errorf("published local storage %v not configured", name[6:]))
|
||||
Fatal(fmt.Errorf("published local storage %v not configured", name[11:]))
|
||||
}
|
||||
|
||||
publishedStorage = files.NewPublishedStorage(params.RootDir, params.LinkMethod, params.VerifyMethod)
|
||||
@@ -400,7 +400,7 @@ func (context *AptlyContext) GetSigner() pgp.Signer {
|
||||
defer context.Unlock()
|
||||
|
||||
if context.pgpProvider() == "gpg" { // nolint: goconst
|
||||
return &pgp.GpgSigner{}
|
||||
return pgp.NewGpgSigner()
|
||||
}
|
||||
|
||||
return &pgp.GoSigner{}
|
||||
@@ -412,7 +412,7 @@ func (context *AptlyContext) GetVerifier() pgp.Verifier {
|
||||
defer context.Unlock()
|
||||
|
||||
if context.pgpProvider() == "gpg" { // nolint: goconst
|
||||
return &pgp.GpgVerifier{}
|
||||
return pgp.NewGpgVerifier()
|
||||
}
|
||||
|
||||
return &pgp.GoVerifier{}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package context
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/smira/flag"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
func Test(t *testing.T) { TestingT(t) }
|
||||
|
||||
type fatalErrorPanicChecker struct {
|
||||
*CheckerInfo
|
||||
}
|
||||
|
||||
var FatalErrorPanicMatches Checker = &fatalErrorPanicChecker{
|
||||
&CheckerInfo{Name: "FatalErrorPanics", Params: []string{"function", "expected"}},
|
||||
}
|
||||
|
||||
func (checker *fatalErrorPanicChecker) Check(params []interface{}, names []string) (result bool, errmsg string) {
|
||||
f := reflect.ValueOf(params[0])
|
||||
if f.Kind() != reflect.Func || f.Type().NumIn() != 0 {
|
||||
return false, "Function must take zero arguments"
|
||||
}
|
||||
defer func() {
|
||||
if errmsg != "" {
|
||||
return
|
||||
}
|
||||
|
||||
obtained := recover()
|
||||
|
||||
names[0] = "panic"
|
||||
|
||||
var ok bool
|
||||
|
||||
var e1 *FatalError
|
||||
if e1, ok = obtained.(*FatalError); ok {
|
||||
params[0] = e1
|
||||
} else {
|
||||
errmsg = "Panic value is not FatalError"
|
||||
return
|
||||
}
|
||||
|
||||
var e2 *FatalError
|
||||
if e2, ok = params[1].(*FatalError); ok {
|
||||
params[1] = e2
|
||||
} else {
|
||||
errmsg = "Expected value is not FatalError"
|
||||
return
|
||||
}
|
||||
|
||||
if *e1 == *e2 {
|
||||
result = true
|
||||
} else {
|
||||
result = false
|
||||
errmsg = "Not equal"
|
||||
}
|
||||
}()
|
||||
f.Call(nil)
|
||||
return false, "Function has not panicked"
|
||||
}
|
||||
|
||||
type AptlyContextSuite struct {
|
||||
context *AptlyContext
|
||||
}
|
||||
|
||||
var _ = Suite(&AptlyContextSuite{})
|
||||
|
||||
func (s *AptlyContextSuite) SetUpTest(c *C) {
|
||||
flags := flag.NewFlagSet("fakeFlags", flag.ContinueOnError)
|
||||
flags.String("config", "", "")
|
||||
context, err := NewContext(flags)
|
||||
c.Assert(err, IsNil)
|
||||
s.context = context
|
||||
}
|
||||
|
||||
func (s *AptlyContextSuite) TestGetPublishedStorageBadFS(c *C) {
|
||||
// https://github.com/aptly-dev/aptly/issues/711
|
||||
// This will fail on account of us not having a config, so the
|
||||
// storage never exists.
|
||||
c.Assert(func() { s.context.GetPublishedStorage("filesystem:fuji") },
|
||||
FatalErrorPanicMatches,
|
||||
&FatalError{ReturnCode: 1, Message: "published local storage fuji not configured"})
|
||||
}
|
||||
+3
-3
@@ -9,9 +9,9 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/pgp"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/pgp"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
)
|
||||
|
||||
// Changes is a result of .changes file parsing
|
||||
|
||||
@@ -3,9 +3,9 @@ package deb
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/ugorji/go/codec"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package deb
|
||||
|
||||
import (
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package deb
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
)
|
||||
|
||||
// CollectionFactory is a single place to generate all desired collections
|
||||
|
||||
+2
-6
@@ -6,8 +6,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
"github.com/smira/go-uuid/uuid"
|
||||
)
|
||||
|
||||
@@ -26,10 +25,7 @@ func NewContentsIndex(db database.Storage) *ContentsIndex {
|
||||
}
|
||||
|
||||
// Push adds package to contents index, calculating package contents as required
|
||||
func (index *ContentsIndex) Push(p *Package, packagePool aptly.PackagePool, progress aptly.Progress) error {
|
||||
contents := p.Contents(packagePool, progress)
|
||||
qualifiedName := []byte(p.QualifiedName())
|
||||
|
||||
func (index *ContentsIndex) Push(qualifiedName []byte, contents []string) error {
|
||||
for _, path := range contents {
|
||||
// for performance reasons we only write to leveldb during push.
|
||||
// merging of qualified names per path will be done in WriteTo
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import (
|
||||
"github.com/mkrautz/goar"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/smira/aptly/pgp"
|
||||
"github.com/aptly-dev/aptly/pgp"
|
||||
"github.com/smira/go-xz"
|
||||
"github.com/smira/lzma"
|
||||
)
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
"github.com/smira/aptly/pgp"
|
||||
"github.com/aptly-dev/aptly/pgp"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
+7
-1
@@ -11,6 +11,9 @@ import (
|
||||
// Stanza or paragraph of Debian control file
|
||||
type Stanza map[string]string
|
||||
|
||||
// MaxFieldSize is maximum stanza field size in bytes
|
||||
const MaxFieldSize = 2 * 1024 * 1024
|
||||
|
||||
// Canonical order of fields in stanza
|
||||
// Taken from: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/vivid/apt/vivid/view/head:/apt-pkg/tagfile.cc#L504
|
||||
var (
|
||||
@@ -214,7 +217,10 @@ type ControlFileReader struct {
|
||||
|
||||
// NewControlFileReader creates ControlFileReader, it wraps with buffering
|
||||
func NewControlFileReader(r io.Reader) *ControlFileReader {
|
||||
return &ControlFileReader{scanner: bufio.NewScanner(bufio.NewReaderSize(r, 32768))}
|
||||
scnr := bufio.NewScanner(bufio.NewReaderSize(r, 32768))
|
||||
scnr.Buffer(nil, MaxFieldSize)
|
||||
|
||||
return &ControlFileReader{scanner: scnr}
|
||||
}
|
||||
|
||||
// ReadStanza reeads one stanza from control file
|
||||
|
||||
@@ -3,6 +3,7 @@ package deb
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
@@ -135,6 +136,17 @@ func (s *ControlFileSuite) TestCanonicalCase(c *C) {
|
||||
c.Check(canonicalCase("packaGe-lIst"), Equals, "Package-List")
|
||||
}
|
||||
|
||||
func (s *ControlFileSuite) TestLongFields(c *C) {
|
||||
f, err := os.Open("long.stanza")
|
||||
c.Assert(err, IsNil)
|
||||
defer f.Close()
|
||||
|
||||
r := NewControlFileReader(f)
|
||||
stanza, e := r.ReadStanza(false)
|
||||
c.Assert(e, IsNil)
|
||||
c.Assert(len(stanza["Provides"]), Equals, 586929)
|
||||
}
|
||||
|
||||
func (s *ControlFileSuite) BenchmarkReadStanza(c *C) {
|
||||
for i := 0; i < c.N; i++ {
|
||||
reader := bytes.NewBufferString(controlFile)
|
||||
|
||||
+3
-3
@@ -6,9 +6,9 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/pgp"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/pgp"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
)
|
||||
|
||||
// CollectPackageFiles walks filesystem collecting all candidates for package files
|
||||
|
||||
+47
-12
@@ -8,9 +8,9 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/pgp"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/pgp"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
)
|
||||
|
||||
type indexFiles struct {
|
||||
@@ -191,18 +191,22 @@ func packageIndexByHash(file *indexFile, ext string, hash string, sum string) er
|
||||
}
|
||||
|
||||
// if a previous index file already exists exists, backup symlink
|
||||
if exists, _ = file.parent.publishedStorage.FileExists(filepath.Join(dst, indexfile)); exists {
|
||||
indexPath := filepath.Join(dst, indexfile)
|
||||
oldIndexPath := filepath.Join(dst, indexfile+".old")
|
||||
if exists, _ = file.parent.publishedStorage.FileExists(indexPath); exists {
|
||||
// if exists, remove old symlink
|
||||
if exists, _ = file.parent.publishedStorage.FileExists(filepath.Join(dst, indexfile+".old")); exists {
|
||||
var link string
|
||||
link, err = file.parent.publishedStorage.ReadLink(filepath.Join(dst, indexfile+".old"))
|
||||
if err != nil {
|
||||
file.parent.publishedStorage.Remove(link)
|
||||
if exists, _ = file.parent.publishedStorage.FileExists(oldIndexPath); exists {
|
||||
var linkTarget string
|
||||
linkTarget, err = file.parent.publishedStorage.ReadLink(oldIndexPath)
|
||||
if err == nil {
|
||||
// If we managed to resolve the link target: delete it. This is the
|
||||
// oldest physical index file we no longer need. Once we drop our
|
||||
// old symlink we'll essentially forget about it existing at all.
|
||||
file.parent.publishedStorage.Remove(linkTarget)
|
||||
}
|
||||
file.parent.publishedStorage.Remove(filepath.Join(dst, indexfile+".old"))
|
||||
file.parent.publishedStorage.Remove(oldIndexPath)
|
||||
}
|
||||
file.parent.publishedStorage.RenameFile(filepath.Join(dst, indexfile),
|
||||
filepath.Join(dst, indexfile+".old"))
|
||||
file.parent.publishedStorage.RenameFile(indexPath, oldIndexPath)
|
||||
}
|
||||
|
||||
// create symlink
|
||||
@@ -325,6 +329,37 @@ func (files *indexFiles) ContentsIndex(component, arch string, udeb bool) *index
|
||||
return file
|
||||
}
|
||||
|
||||
func (files *indexFiles) LegacyContentsIndex(arch string, udeb bool) *indexFile {
|
||||
if arch == ArchitectureSource {
|
||||
udeb = false
|
||||
}
|
||||
key := fmt.Sprintf("lci-%s-%v", arch, udeb)
|
||||
file, ok := files.indexes[key]
|
||||
if !ok {
|
||||
var relativePath string
|
||||
|
||||
if udeb {
|
||||
relativePath = fmt.Sprintf("Contents-udeb-%s", arch)
|
||||
} else {
|
||||
relativePath = fmt.Sprintf("Contents-%s", arch)
|
||||
}
|
||||
|
||||
file = &indexFile{
|
||||
parent: files,
|
||||
discardable: true,
|
||||
compressable: true,
|
||||
onlyGzip: true,
|
||||
signable: false,
|
||||
acquireByHash: files.acquireByHash,
|
||||
relativePath: relativePath,
|
||||
}
|
||||
|
||||
files.indexes[key] = file
|
||||
}
|
||||
|
||||
return file
|
||||
}
|
||||
|
||||
func (files *indexFiles) ReleaseFile() *indexFile {
|
||||
return &indexFile{
|
||||
parent: files,
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
)
|
||||
|
||||
// Dependency options
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import (
|
||||
"log"
|
||||
"sync"
|
||||
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
"github.com/smira/go-uuid/uuid"
|
||||
"github.com/ugorji/go/codec"
|
||||
)
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package deb
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
File diff suppressed because one or more lines are too long
+2
-2
@@ -7,8 +7,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
)
|
||||
|
||||
// Package is single instance of Debian package
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
"github.com/ugorji/go/codec"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package deb
|
||||
|
||||
import (
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
)
|
||||
|
||||
// PackageFile is a single file entry in package
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/files"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/files"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import (
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
|
||||
"github.com/smira/aptly/files"
|
||||
"github.com/aptly-dev/aptly/files"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
)
|
||||
|
||||
var ppaRegexp = regexp.MustCompile("^ppa:([^/]+)/(.+)$")
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package deb
|
||||
|
||||
import (
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
+44
-10
@@ -17,10 +17,10 @@ import (
|
||||
"github.com/smira/go-uuid/uuid"
|
||||
"github.com/ugorji/go/codec"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/smira/aptly/pgp"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
"github.com/aptly-dev/aptly/pgp"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
)
|
||||
|
||||
type repoSourceItem struct {
|
||||
@@ -315,6 +315,7 @@ func (p *PublishedRepo) MarshalJSON() ([]byte, error) {
|
||||
"Sources": sources,
|
||||
"Storage": p.Storage,
|
||||
"SkipContents": p.SkipContents,
|
||||
"AcquireByHash": p.AcquireByHash,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -561,6 +562,8 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP
|
||||
|
||||
indexes := newIndexFiles(publishedStorage, basePath, tempDir, suffix, p.AcquireByHash)
|
||||
|
||||
legacyContentIndexes := map[string]*ContentsIndex{}
|
||||
|
||||
for component, list := range lists {
|
||||
hadUdebs := false
|
||||
|
||||
@@ -598,21 +601,32 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP
|
||||
}
|
||||
}
|
||||
|
||||
// Start a db batch. If we fill contents data we'll need
|
||||
// to push each path of the package into the database.
|
||||
// We'll want this batched so as to avoid an excessive
|
||||
// amount of write() calls.
|
||||
tempDB.StartBatch()
|
||||
defer tempDB.FinishBatch()
|
||||
|
||||
for _, arch := range p.Architectures {
|
||||
if pkg.MatchesArchitecture(arch) {
|
||||
var bufWriter *bufio.Writer
|
||||
|
||||
if !p.SkipContents {
|
||||
key := fmt.Sprintf("%s-%v", arch, pkg.IsUdeb)
|
||||
qualifiedName := []byte(pkg.QualifiedName())
|
||||
contents := pkg.Contents(packagePool, progress)
|
||||
|
||||
contentIndex := contentIndexes[key]
|
||||
for _, contentIndexesMap := range []map[string]*ContentsIndex{contentIndexes, legacyContentIndexes} {
|
||||
contentIndex := contentIndexesMap[key]
|
||||
|
||||
if contentIndex == nil {
|
||||
contentIndex = NewContentsIndex(tempDB)
|
||||
contentIndexes[key] = contentIndex
|
||||
if contentIndex == nil {
|
||||
contentIndex = NewContentsIndex(tempDB)
|
||||
contentIndexesMap[key] = contentIndex
|
||||
}
|
||||
|
||||
contentIndex.Push(qualifiedName, contents)
|
||||
}
|
||||
|
||||
contentIndex.Push(pkg, packagePool, progress)
|
||||
}
|
||||
|
||||
bufWriter, err = indexes.PackageIndex(component, arch, pkg.IsUdeb).BufWriter()
|
||||
@@ -704,6 +718,26 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP
|
||||
}
|
||||
}
|
||||
|
||||
for _, arch := range p.Architectures {
|
||||
for _, udeb := range []bool{true, false} {
|
||||
index := legacyContentIndexes[fmt.Sprintf("%s-%v", arch, udeb)]
|
||||
if index == nil || index.Empty() {
|
||||
continue
|
||||
}
|
||||
|
||||
var bufWriter *bufio.Writer
|
||||
bufWriter, err = indexes.LegacyContentsIndex(arch, udeb).BufWriter()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to generate contents index: %v", err)
|
||||
}
|
||||
|
||||
_, err = index.WriteTo(bufWriter)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to generate contents index: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if progress != nil {
|
||||
progress.Printf("Finalizing metadata files...\n")
|
||||
}
|
||||
|
||||
+3
-3
@@ -8,9 +8,9 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/smira/aptly/files"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
"github.com/aptly-dev/aptly/files"
|
||||
"github.com/ugorji/go/codec"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package deb
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
+5
-5
@@ -15,11 +15,11 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/smira/aptly/http"
|
||||
"github.com/smira/aptly/pgp"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
"github.com/aptly-dev/aptly/http"
|
||||
"github.com/aptly-dev/aptly/pgp"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/smira/go-uuid/uuid"
|
||||
"github.com/ugorji/go/codec"
|
||||
)
|
||||
|
||||
+7
-7
@@ -7,13 +7,13 @@ import (
|
||||
"os"
|
||||
"sort"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/console"
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/smira/aptly/files"
|
||||
"github.com/smira/aptly/http"
|
||||
"github.com/smira/aptly/pgp"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/console"
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
"github.com/aptly-dev/aptly/files"
|
||||
"github.com/aptly-dev/aptly/http"
|
||||
"github.com/aptly-dev/aptly/pgp"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
+2
-2
@@ -10,8 +10,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/smira/go-uuid/uuid"
|
||||
"github.com/ugorji/go/codec"
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ package deb
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/aptly-dev/aptly/database"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/DisposaBoy/JsonConfigReader"
|
||||
"github.com/smira/aptly/pgp"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/pgp"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
)
|
||||
|
||||
// UploadersRule is single rule of format: what packages can group or key upload
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package deb
|
||||
|
||||
import (
|
||||
"github.com/smira/aptly/pgp"
|
||||
"github.com/aptly-dev/aptly/pgp"
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package files
|
||||
|
||||
import (
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
)
|
||||
|
||||
type mockChecksumStorage struct {
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
|
||||
"github.com/smira/go-uuid/uuid"
|
||||
|
||||
"github.com/smira/aptly/aptly"
|
||||
"github.com/smira/aptly/utils"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
)
|
||||
|
||||
// PackagePool is deduplicated storage of package files on filesystem
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user