uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
12
pkgs/tools/security/enpass/data.json
Normal file
12
pkgs/tools/security/enpass/data.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"amd64": {
|
||||
"path": "pool/main/e/enpass/enpass_6.6.1.809_amd64.deb",
|
||||
"sha256": "b1b9bd67653c3163bd80b340150ecf123552cbe4af23c350fbadea8ffd7939ba",
|
||||
"version": "6.6.1.809"
|
||||
},
|
||||
"i386": {
|
||||
"path": "pool/main/e/enpass/enpass_5.6.9_i386.deb",
|
||||
"sha256": "3f699ac3e2ecfd4afee1505d8d364d4f6b6b94c55ba989d0a80bd678ff66cb2c",
|
||||
"version": "5.6.9"
|
||||
}
|
||||
}
|
||||
99
pkgs/tools/security/enpass/default.nix
Normal file
99
pkgs/tools/security/enpass/default.nix
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
{ stdenv, fetchurl, dpkg, xorg
|
||||
, glib, libGLU, libGL, libpulseaudio, zlib, dbus, fontconfig, freetype
|
||||
, gtk3, pango
|
||||
, makeWrapper , python3Packages, lib
|
||||
, lsof, curl, libuuid, cups, mesa, xz, libxkbcommon
|
||||
}:
|
||||
|
||||
let
|
||||
all_data = lib.importJSON ./data.json;
|
||||
system_map = {
|
||||
# i686-linux = "i386"; Uncomment if enpass 6 becomes available on i386
|
||||
x86_64-linux = "amd64";
|
||||
};
|
||||
|
||||
data = all_data.${system_map.${stdenv.hostPlatform.system} or (throw "Unsupported platform")};
|
||||
|
||||
baseUrl = "http://repo.sinew.in";
|
||||
|
||||
# used of both wrappers and libpath
|
||||
libPath = lib.makeLibraryPath (with xorg; [
|
||||
mesa.drivers
|
||||
libGLU libGL
|
||||
fontconfig
|
||||
freetype
|
||||
libpulseaudio
|
||||
zlib
|
||||
dbus
|
||||
libX11
|
||||
libXi
|
||||
libSM
|
||||
libICE
|
||||
libXrender
|
||||
libXScrnSaver
|
||||
libxcb
|
||||
glib
|
||||
gtk3
|
||||
pango
|
||||
curl
|
||||
libuuid
|
||||
cups
|
||||
xz
|
||||
libxkbcommon
|
||||
]);
|
||||
package = stdenv.mkDerivation {
|
||||
|
||||
inherit (data) version;
|
||||
pname = "enpass";
|
||||
|
||||
src = fetchurl {
|
||||
inherit (data) sha256;
|
||||
url = "${baseUrl}/${data.path}";
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "A well known password manager";
|
||||
homepage = "https://www.enpass.io/";
|
||||
license = licenses.unfree;
|
||||
platforms = [ "x86_64-linux" "i686-linux"];
|
||||
maintainers = with maintainers; [ ewok ];
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
buildInputs = [dpkg];
|
||||
|
||||
unpackPhase = "dpkg -X $src .";
|
||||
installPhase=''
|
||||
mkdir -p $out/bin
|
||||
cp -r opt/enpass/* $out/bin
|
||||
cp -r usr/* $out
|
||||
|
||||
sed \
|
||||
-i s@/opt/enpass/Enpass@$out/bin/Enpass@ \
|
||||
$out/share/applications/enpass.desktop
|
||||
|
||||
for i in $out/bin/{Enpass,importer_enpass}; do
|
||||
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $i
|
||||
done
|
||||
|
||||
# lsof must be in PATH for proper operation
|
||||
wrapProgram $out/bin/Enpass \
|
||||
--set LD_LIBRARY_PATH "${libPath}" \
|
||||
--prefix PATH : ${lsof}/bin \
|
||||
--unset QML2_IMPORT_PATH \
|
||||
--unset QT_PLUGIN_PATH
|
||||
'';
|
||||
};
|
||||
updater = {
|
||||
update = stdenv.mkDerivation {
|
||||
name = "enpass-update-script";
|
||||
SCRIPT =./update_script.py;
|
||||
|
||||
buildInputs = with python3Packages; [python requests pathlib2 six attrs ];
|
||||
shellHook = ''
|
||||
exec python $SCRIPT --target pkgs/tools/security/enpass/data.json --repo ${baseUrl}
|
||||
'';
|
||||
|
||||
};
|
||||
};
|
||||
in (package // {refresh = updater;})
|
||||
95
pkgs/tools/security/enpass/update_script.py
Normal file
95
pkgs/tools/security/enpass/update_script.py
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
from __future__ import print_function
|
||||
|
||||
|
||||
import argparse
|
||||
import bz2
|
||||
import email
|
||||
import json
|
||||
import logging
|
||||
|
||||
from itertools import product
|
||||
from operator import itemgetter
|
||||
|
||||
import attr
|
||||
import pkg_resources
|
||||
|
||||
from pathlib2 import Path
|
||||
from requests import Session
|
||||
from six.moves.urllib_parse import urljoin
|
||||
|
||||
|
||||
@attr.s
|
||||
class ReleaseElement(object):
|
||||
sha256 = attr.ib(repr=False)
|
||||
size = attr.ib(convert=int)
|
||||
path = attr.ib()
|
||||
|
||||
log = logging.getLogger('enpass.updater')
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--repo')
|
||||
parser.add_argument('--target', type=Path)
|
||||
|
||||
|
||||
session = Session()
|
||||
|
||||
|
||||
def parse_bz2_msg(msg):
|
||||
msg = bz2.decompress(msg)
|
||||
if '\n\n' in msg:
|
||||
parts = msg.split('\n\n')
|
||||
return list(map(email.message_from_string, parts))
|
||||
return email.message_from_string(msg)
|
||||
|
||||
|
||||
def fetch_meta(repo, name, parse=email.message_from_string, split=False):
|
||||
url = urljoin(repo, 'dists/stable', name)
|
||||
response = session.get("{repo}/dists/stable/{name}".format(**locals()))
|
||||
return parse(response.content)
|
||||
|
||||
|
||||
def fetch_filehashes(repo, path):
|
||||
meta = fetch_meta(repo, path, parse=parse_bz2_msg)
|
||||
for item in meta:
|
||||
yield {
|
||||
'version': pkg_resources.parse_version(str(item['Version'])),
|
||||
'path': item['Filename'],
|
||||
'sha256': item['sha256'],
|
||||
}
|
||||
|
||||
|
||||
def fetch_archs(repo):
|
||||
m = fetch_meta(repo, 'Release')
|
||||
|
||||
architectures = m['Architectures'].split()
|
||||
elements = [ReleaseElement(*x.split()) for x in m['SHA256'].splitlines()]
|
||||
elements = [x for x in elements if x.path.endswith('bz2')]
|
||||
|
||||
for arch, elem in product(architectures, elements):
|
||||
if arch in elem.path:
|
||||
yield arch, max(fetch_filehashes(repo, elem.path),
|
||||
key=itemgetter('version'))
|
||||
|
||||
|
||||
class OurVersionEncoder(json.JSONEncoder):
|
||||
def default(self, obj):
|
||||
# the other way around to avoid issues with
|
||||
# newer setuptools having strict/legacy versions
|
||||
if not isinstance(obj, (dict, str)):
|
||||
return str(obj)
|
||||
return json.JSONEncoder.default(self, obj)
|
||||
|
||||
|
||||
def main(repo, target):
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
with target.open(mode='wb') as fp:
|
||||
json.dump(
|
||||
dict(fetch_archs(repo)), fp,
|
||||
cls=OurVersionEncoder,
|
||||
indent=2,
|
||||
sort_keys=True)
|
||||
|
||||
|
||||
opts = parser.parse_args()
|
||||
main(opts.repo, opts.target)
|
||||
Loading…
Add table
Add a link
Reference in a new issue