409 Conflict while uploading to pypiserver - python-poetry

I have set-up a local pypiserver with repo myrepo. Managed to publish a package there fine with poetry. However, after changing some packages in my poetry environment I get:
poetry publish -r myrepo
Publishing mypackage (0.1.0) to myrepo
- Uploading mypackage-0.1.0-py3-none-any.whl 100%
UploadError
HTTP Error 409: Conflict
Obviously there is already a package mypackage (0.1.0) there, but should this not just overwrite it?

I missed that you need to explicitly specify that you can overwrite the package. Adding -o option does the trick.
docker run -p 8080:8080 -v ~/.htpasswd:/data/.htpasswd pypiserver/pypiserver:latest -o -P .htpasswd packages
See -o in https://pypi.org/project/pypiserver/

Related

go building error: lzma.h No such file or directory

I'm building payload-dumper-go, and I get this error,
❯ go build
# github.com/spencercw/go-xz
/home/ecarroll/go/pkg/mod/github.com/spencercw/go-xz#v0.0.0-20181128201811-c82a2123b492/compression.go:36:10: fatal error: lzma.h: No such file or directory
36 | #include <lzma.h>
| ^~~~~~~~
compilation terminated.
Here's an easier way for "next time".
github.com/ssut/payload-dumper-go uses Github Actions for building and testing.
Checking its .github/workflows/build.yml file:
...
steps:
- name: Install dependencies
run: |
sudo apt -y update
sudo apt -y install git golang liblzma-dev
...
The last quoted line contains the needed dependencies, namely git, golang and liblzma-dev.
I solve this by brute force trying all lzma stuff that Debian had. The actually packaged needed was,
sudo apt install liblzma-dev
packages that didn't work,
lzma-dev
golang-github-kjk-lzma-dev

Singularity v3.9.4 Installation - mconfig not inside a git repository and no VERSION file found

I'm trying to install Singularity after installing Go. I've confirmed that Go has been installed successfully:
$ go version
go version go1.17.6 linux/amd64
After that, I run the following commands:
$ export VERSION=3.9.4
$ wget https://github.com/sylabs/singularity/archive/refs/tags/v${VERSION}.tar.gz
$ tar -xzf v${VERSION}.tar.gz
$ cd singularity-${VERSION}
$ ./mconfig # This is where it fails
E: Not inside a git repository and no VERSION file found. Abort.
The tarball you are downloading is the one generated automatically for a tag, not the release tarball. From the release page:
Source Code
Please use the singularity-ce-3.9.4.tar.gz download below to obtain and install SingularityCE 3.9.4. The GitHub auto-generated 'Source Code' downloads do not include required dependencies etc.
Working snippet using the correct url:
export VERSION=3.9.4
wget https://github.com/sylabs/singularity/releases/download/v${VERSION}/singularity-ce-${VERSION}.tar.gz && \
tar xf singularity-ce-${VERSION}.tar.gz && \
cd singularity-ce-${VERSION} && \
./mconfig

How do I add a Python library dependency for a Lambda function in CodeBuild

I have a CodePipline that grabs code out of CodeCommit bundles it up in CodeBuild and then publishes it via CloudFormation.
I want to use the Python package gspread and because it's not part of the standard AWS Linux image I need to install it.
Currently when the code is run I get the error:
[ERROR] Runtime.ImportModuleError: Unable to import module 'index': No module named 'gspread'
Code structure
- buildspec.yml
- template.yml
package/
- gspread/
- gspread-3.6.0.dist-info/
- (37 other python packages)
source/
- index.py
buildspec.yml -- EDITED
version: 0.2
phases:
install:
commands:
# Use Install phase to install packages or any pre-reqs you may need throughout the build (e.g. dev deps, security checks, etc.)
- echo "[Install phase]"
- pip install --upgrade pip
- pip install --upgrade aws-sam-cli
- sam --version
- cd source
- ls
- pip install --target . gspread oauth2client
# consider using pipenv to install everything in the environement and then copy the files installed into the /source folder
- ls
runtime-versions:
python: 3.8
pre_build:
commands:
# Use Pre-Build phase to run tests, install any code deps or any other customization before build
# - echo "[Pre-Build phase]"
build:
commands:
- cd ..
- sam build
post_build:
commands:
# Use Post Build for notifications, git tags and any further customization after build
- echo "[Post-Build phase]"
- export BUCKET=property-tax-invoice-publisher-deployment
- sam package --template-file template.yml --s3-bucket $BUCKET --output-template-file outputtemplate.yml
- echo "SAM packaging completed on `date`"
##################################
# Build Artifacts to be uploaded #
##################################
artifacts:
files:
- outputtemplate.yml
discard-paths: yes
cache:
paths:
# List of path that CodeBuild will upload to S3 Bucket and use in subsequent runs to speed up Builds
- '/root/.cache/pip'
The index.py file has more in it than this. But to show the offending line.
-- index.py --
import os
import boto3
import io
import sys
import csv
import json
import smtplib
import gspread #**<--- Right here**
def lambda_handler(event, context):
print("In lambda_handler")
What I've tried
Creating the /package folder and committing the gspread and other packages
Running "pip install gspread" in the CodeBuild builds: commands:
At the moment, I'm installing it everywhere and seeing what sticks. (nothing is currently sticking)
Version: Python 3.8
I think you may need to do the following steps :
Use virtual env to install the packages locally.
Create requirements.txt to let code build know of the package requirement.
In CodeBuild buildspec.xml , include commands to install virutal env and then supply requirements.txt.
pre_build:
commands:
pip install virtualenv
virtualenv env
. env/bin/activate
pip install -r requirements.txt
Detailed steps here for reference :
https://adrian.tengamnuay.me/programming/2018/07/01/continuous-deployment-with-aws-lambda/

Missing Git command when calling `go get`

My Dockerfile
FROM golang:1.10.2-alpine3.7 AS build
RUN apk --no-cache add gcc g++ make ca-certificates
RUN apk add git
WORKDIR /go/src/github.com/meower
COPY Gopkg.lock Gopkg.toml ./
COPY util util
COPY event event
COPY db db
COPY search search
COPY schema schema
COPY meow-service meow-service
COPY query-service query-service
COPY pusher-service pusher-service
RUN go get -d -v ./...
RUN go install ./...
FROM alpine:3.7
WORKDIR /usr/bin
COPY --from=build /go/bin .
I added apk add git line.Without this line my docker-compose up produced
Step 13/17 : RUN go get -d -v ./...
---> Running in d917adba00cd
github.com/lib/pq (download)
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/lib/pq: exec: "git": executable file not found in $PATH
github.com/nats-io/go-nats (download)
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/nats-io/go-nats: exec: "git": executable file not found in $PATH
github.com/gorilla/mux (download)
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/gorilla/mux: exec: "git": executable file not found in $PATH
github.com/kelseyhightower/envconfig (download)
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/kelseyhightower/envconfig: exec: "git": executable file not found in $PATH
package github.com/retry: invalid github.com/ import path "github.com/retry"
github.com/segmentio/ksuid (download)
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/segmentio/ksuid: exec: "git": executable file not found in $PATH
github.com/gorilla/websocket (download)
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/gorilla/websocket: exec: "git": executable file not found in $PATH
github.com/olivere/elastic (download)
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/olivere/elastic: exec: "git": executable file not found in $PATH
With git line,other problems are still there
docker-compose up
Building pusher
Step 1/18 : FROM golang:1.10.2-alpine3.7 AS build
---> 44ccce322b34
Step 2/18 : RUN apk --no-cache add gcc g++ make ca-certificates
---> Using cache
---> 088fa5ba19a9
Step 3/18 : RUN apk add git
---> Running in 01022f57861b
WARNING: Ignoring APKINDEX.70c88391.tar.gz: No such file or directory
WARNING: Ignoring APKINDEX.5022a8a2.tar.gz: No such file or directory
ERROR: unsatisfiable constraints:
git (missing):
What does this mean?
go get internally calls the "reference" client-side tool of the particular VCS used to host the package to be fetched. In other words, go get by itself does not know how to interact with VCS servers.
So yes, in order to go get a package which is hosted by Git, you need the working Git installation providing a callable git binary.
As to your second problem, it does not appear to have anything related to Go, so I suggest you to do a bit of research and then ask a separate question tagged alpine if that fails.

dpkg error: contains ununderstood data member

I'm trying to install a jailbreak tweak using make package install but I'm receiving this error from dpkg:
dpkg-deb: file `/tmp/_theos_install.deb' contains ununderstood data member data.tar.xz , giving up
dpkg: error processing /tmp/_theos_install.deb (--install):
subprocess dpkg-deb --fsys-tarfile returned error exit status 2
Errors were encountered while processing:
/tmp/_theos_install.deb
make: *** [internal-install] Error 1
So as far as I can tell it isn't able to understand the .xz extension, but I'm not sure why that file is being created. Thanks for the help.
I found out how to fix it. In $THEOS/makefiles/package/deb.mk replace this line:
$(ECHO_NOTHING)COPYFILE_DISABLE=1 $(FAKEROOT) -r dpkg-deb -b "$(THEOS_STAGING_DIR)" "$(_THEOS_DEB_PACKAGE_FILENAME)" $(STDERR_NULL_REDIRECT)$(ECHO_END)
with this line:
$(ECHO_NOTHING)COPYFILE_DISABLE=1 $(FAKEROOT) -r dpkg-deb -Zgzip -b "$(THEOS_STAGING_DIR)" "$(_THEOS_DEB_PACKAGE_FILENAME)" $(STDERR_NULL_REDIRECT)$(ECHO_END)
The .deb file is created because you told Theos build system to do that. The package install rule of the Makefile is creating the Debian package using xz compression. Now, this kind of compression is supported by versions of dpkg equal or higher than 1.15.6.
So, in order to solve your problem, you should update dpkg to a newer version or install Theos without packaging support. Probably a simple make install will do it.
In case that updating dpkg isn't possible and you don't want to install the program without package management support, the other (more painful) method is to change the algorithm in which the package is compressed. Here you have good information about how to do this.
In my case I was building a package on Ubuntu 18.04 and trying to install that package on Debian 7 (airgapped). I had to change the line in the Makefile that read:
dpkg --build $(DESTDIR)
..to:
dpkg-deb --build -Zgzip $(DESTDIR)
Thanks Connor!
Other option that you can try is to unpack the .deb that you where triying to install and repack with no XZ compression.
Unpack:
mkdir package/ && dpkg -x package.deb package/
Pack:
dpkg-deb --build -Zgzip package/
You can rename the resulting package with:
dpkg-name -o package.deb
Or simply name the package dir with the name of your package.
Important: In orther to perform this, you need to install dpkg-dev package:
sudo apt update
sudo apt install dpkg-dev

Resources