C++ front-end package manager for embedding and redistributing with native applications

Related tags

Miscellaneous pacm
Overview

Pacm

Simple C++ package manager

Circle CI Doxygen

Homepage: https://sourcey.com/pacm
Documentation: https://sourcey.com/libsourcey/api-pacm/
Dependencies: LibSourcey (base, uv, net, json, crypto, archo, http)
Licence: LGPL

Pacm is your solution for a simple C++ package manager that can be embedded and redistributed with native applications. Pacm is designed to make short work of the following tasks:

  • Auto-Updates
  • Front-end Package Management
  • Version Constrained Package Management
  • Dependency Management
  • Remote Plugin Management

Pacm should be familiar territory if you've ever used rubygems in Ruby, or npm in NodeJS. Basically, a package list is downloaded from the server in JSON format, and the client then issues commands to manage packages installed on the local system. You can work with the API one of two ways; by embedding Pacm and compiling it with your application; or by redistributing it with your application and calling the Pacm command line tool directly.

The Pacm code base is kept small and readable thanks to LibSourcey, which abstracts and handles complex cross-platform tasks such as networking, filesystem and cryptography. LibSourcey is built on to of libuv, NodeJS's super fast networking layer, and provides a modern C++ interface for the native Pacm API.

There are a lot of open source package managers out there, but there has been great need of a simple embeddable package manager in C++ for some time. For this reason we built Pacm, and we're pleased to contribute it to the open source community.

Embedding Pacm

Pacm is written in simple and readable C++11 code, so if you have some basic coding nouse then you'll be all over it like Barry White on a waterbed covered in hamburgers.

The example below shows how to use the C++ API to query, list, install and uninstall packages:

pacm::PackageManager::Options options;
// configuration options go here...
pacm::PackageManager pm(options);
pm.initialize();

// query the server for the latest packages
pm.queryRemotePackages();                

// list local (installed) packages
for (auto& kv : pm.localPackages().map()) {            
    std::cout << "Local package: "
    << kv.first << "\n"
    << kv.second->toString() << std::endl;
}

// list remote (available) packages
for (auto& kv : pm.remotePackages().map()) {            
    std::cout << "Local package: "
    << kv.first << "\n"
    << kv.second->toString() << std::endl;
}              

// install a package
pm.installPackage("SomePackageName");

// update a package (will install if it doesn't exist)
pm.updatePackage("SomePackageName");

// update / install a list of packages.
// package states are available via callback events
std::vector<std::string> packages;
packages.push_back("SomePackageName");
packages.push_back("SomeOtherPackage");        
pm.installPackages(packages);

// update all packages
pm.updateAllPackages();

// uninstall a package.
// uninstallPackages() can also be used for multiple packages.
pm.uninstallPackage("SomePackageName");

If you're planning on using the native API then the best place to start is the source code of the Pacm command line tool, which can be easily reverse engineered and modified for your own purposes.

For all method definitions and further documentation the source code is always the best reference.

Redistributable Command Line Tool

Pacm comes with a redistributable command-line tool which can be compiled and redistributed with your existing applications. In many ways this is preferable to embedding Pacm as it allows you to decouple complex version management code from your main application, but depending on which platforms you are targeting there may also be security limitations to consider.

Examples

Print help:

pacm -help

Install the Anionu surveillancemodeplugin:

pacm -endpoint https://anionu.com -uri /packages.json -print -install surveillancemodeplugin

Uninstall the Anionu surveillancemodeplugin:

pacm -endpoint https://anionu.com -uri /packages.json -print -install surveillancemodeplugin

Update all installed packages to the latest version:

pacm -endpoint https://anionu.com -uri /packages.json -print -update

Supported Commands

The following commands are currently supported by the Pacm console application:

General commands:
  -help           Print help
  -logfile        Log file output path

Server commands:
  -endpoint       HTTP server endpoint
  -uri            HTTP server package JSON index URI

Package commands:
  -install        Packages to install (comma separated)
  -uninstall      Packages to uninstall (comma separated)
  -update         Update all packages
  -print          Print all local and remote packages on exit
  -checksum-alg   Checksum algorithm for verifying packages (MDS/SHA1)

Filesystem commands:
  -install-dir    Directory where packages will be installed
  -data-dir       Directory where package manifests will be stored
  -temp-dir       Directory where intermediate package files will be stored

Client-Server Protocol

The Pacm repository does not currently include a server module, but since everything is in JSON it should be a sinch to implement using your existing web framework. All that is required on the server-side is to list packages and facilitate downloads.

A server response to a Pacm query is illustrated below, and remember that since everything is in JSON you can easily add your own metadata as required.

Pacm will send a HTTP GET request to the server:

GET /packages.json HTTP/1.1

The server responds with an array of packages and available file assets in JSON format like so:

[{
    "id": "surveillancemodeplugin",
    "type": "Plugin",
    "name": "Surveillance Mode Plugin",
    "author": "Sourcey",
    "description": "Surveillance mode provides Spot with real-time motion detection capabilities. Surveillance mode is ideal for when you are away from the surveilled premises, and want to protect yourself against unwanted intruders. You can also configure SMS alerts and record videos during intervals of motion.",
    "assets": [{
        "version": "0.9.3",
        "sdk-version": "0.6.2",
        "platform": "win32",
        "checksum": "e4d909c290d0fb1ca068ffaddf22cbd0",
        "file-name": "surveillancemodeplugin-0.9.4-sdk-0.6.2-win32.zip",
        "file-size": 432321,
        "mirrors": [{
            "url": "https://anionu.com/packages/surveillancemodeplugin/download/surveillancemodeplugin-0.9.4-sdk-0.6.2-win32.zip"
        }]
    }, {
        "version": "0.9.3",
        "sdk-version": "0.6.0",
        "platform": "win32",
        "checksum": "c290d0fb1ca068ffaddf22cbd0e4d909",
        "file-name": "surveillancemodeplugin-0.9.3-sdk-0.6.0-win32-debug.zip",
        "file-size": 432221,
        "mirrors": [{
            "url": "https://anionu.com/packages/surveillancemodeplugin/download/surveillancemodeplugin-0.9.3-sdk-0.6.0-win32-debug.zip"
        }]
    }]
}, {
    "id": "mediaplugin",
    "type": "Plugin",
    "name": "Media Plugin",
    "author": "Sourcey",
    "description": "The Media Plugin implements audio and video encoders for recording and real-time media streaming. If you want to enable different media formats in Spot, you can do so by modifying this plugin.",
    "assets": [{
        "version": "0.8.9",
        "sdk-version": "0.6.2",
        "platform": "win32",
        "checksum": "fb1ca068ffaddf22cbd0e4d909c290d0",
        "file-name": "mediaplugin-0.8.9-sdk-0.6.2-win32.zip",
        "file-size": 1352888,
        "mirrors": [{
            "url": "https://anionu.com/packages/mediaplugin/download/mediaplugin-0.8.9-sdk-0.6.2-win32.zip"
        }]
    }, {
        "version": "0.8.8",
        "sdk-version": "0.6.0",
        "platform": "win32",
        "checksum": "068ffaddf22cbd0e4d909c290d0fb1ca",
        "file-name": "mediaplugin-0.8.8-sdk-0.6.0-win32-debug.zip",
        "file-size": 1352818,
        "mirrors": [{
            "url": "https://anionu.com/packages/mediaplugin/download/mediaplugin-0.8.8-sdk-0.6.0-win32-debug.zip"
        }]
    }]
}, {
    "id": "webrtcplugin",
    "type": "Plugin",
    "name": "WebRTC Plugin",
    "author": "Sourcey",
    "description": "This plugin provides Spot with WebRTC support, so you can view high quality video surveillance streams in a modern web browser.",
    "assets": [{
        "version": "0.1.1",
        "sdk-version": "0.6.2",
        "platform": "win32",
        "checksum": "068ffaddc290d0fb1caf22cbd0e4d909",
        "file-name": "webrtcplugin-0.1.1-sdk-0.6.2-win32.zip",
        "file-size": 0,
        "mirrors": [{
            "url": "https://anionu.com/packages/webrtcplugin/download/webrtcplugin-0.1.1-sdk-0.6.2-win32.zip"
        }]
    }, {
        "version": "0.1.0",
        "sdk-version": "0.6.0",
        "platform": "win32",
        "checksum": "addc290d0fb1caf22cbd0e4d909068ff",
        "file-name": "webrtcplugin-0.1.0-sdk-0.6.0-win32-debug.zip",
        "file-size": 3888157,
        "mirrors": [{
            "url": "https://anionu.com/packages/webrtcplugin/download/webrtcplugin-0.1.0-sdk-0.6.0-win32-debug.zip"
        }]
    }]
}]

Contributing

If you improve on the code base and want to contribute to the project then pull requests are always very welcome.

  1. Fork Pacm on Github
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Issues

If you find any bugs or issues please use the new Github issue tracker.

You might also like...
C/C++ Package Manager
C/C++ Package Manager

CPM/CPPM C/C++ Package Manager Explore the docs » Report Bug · Request Feature Table of Contents About the Project Built With Getting Started Prerequi

Plays native alert sound and shows native dialogs/alerts in your Flutter app.
Plays native alert sound and shows native dialogs/alerts in your Flutter app.

flutter_platform_alert 2021 © Weizhong Yang a.k.a zonble. A simple plugin to present native alerts, including playing alert sounds and showing alert d

A Dart package to send native 💬 toasts on Windows. Based on WinToast.
A Dart package to send native 💬 toasts on Windows. Based on WinToast.

desktoasts A Dart package to send native 💬 toasts on Windows. Installation For Flutter dependencies: ... desktoasts: ^0.0.2 For Dart CLI here Sup

Simple Software Application Package Installer for CachyOS which helps setting up & installing applications

cachyos-packageinstaller Simple Software Application Package Installer. Requirements C++20 feature required (tested with GCC 11.1.0 and Clang 13(clang

Cloud Native Data Plane (CNDP) is a collection of user space libraries to accelerate packet processing for cloud applications.

CNDP - Cloud Native Data Plane Overview Cloud Native Data Plane (CNDP) is a collection of userspace libraries for accelerating packet processing for c

LoRaWAN end node built from scratch using CubeMX for WLE5x in the LoRa-E5
LoRaWAN end node built from scratch using CubeMX for WLE5x in the LoRa-E5

Seeed-LoRa-E5 LoRaWAN end node built from scratch using STM32CubeIDE/CubeMX for the LoRa-E5 WLE5x This assumes a general familiarity with STM32CubeIDE

The Poco X3 Pro (codenamed
The Poco X3 Pro (codenamed "vayu") is a high-end smartphone from POCO

Copyright (C) 2021 Android Open Source Project Device configuration for Poco X3 Pro The Poco X3 Pro (codenamed "vayu") is a high-end smartphone from P

dwm is an extremely fast, small, and dynamic window manager for X.

dwm - dynamic window manager dwm is an extremely fast, small, and dynamic window manager for X. My Patches This is in the order that I patched everyth

A fast and fun layout manager for FLTK
A fast and fun layout manager for FLTK

Fl_Flow A fast and fun layout manager for FLTK Fl_Flow is a layout manager for FLTK which works in a largely different manner to existing systems you

Comments
  • sourcey.com links are dead

    sourcey.com links are dead

    http://sourcey.com/pacm and others mentioned are dead (404)

    Suggested action: either: since domain is alive - repopulate the server with data or: move content to github (wiki and/or source tree)

    opened by MariuszXC 0
  • bad example : https://sourcey.com/articles/comparing-version-strings-in-cpp

    bad example : https://sourcey.com/articles/comparing-version-strings-in-cpp

    https://sourcey.com/articles/comparing-version-strings-in-cpp

    There is only one place to say, so I'm posting it here.

    This code is completely shit. It seems to only give confusion to beginners. For example, it doesn't even compare 2.0 and 1.2 versions properly.

    opened by bemaru 0
  • Build failed on Cmake 3.5.1

    Build failed on Cmake 3.5.1

    How to build pacm? This is what I got after running cmake:

    $ git clone https://github.com/sourcey/pacm.git
    $ cd pacm
    $ cmake .
    -- The C compiler identification is GNU 5.4.1
    -- The CXX compiler identification is GNU 5.4.1
    -- Check for working C compiler: /usr/bin/cc
    -- Check for working C compiler: /usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Check for working CXX compiler: /usr/bin/c++
    -- Check for working CXX compiler: /usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    CMake Error at CMakeLists.txt:1 (ask_build_sourcey_module):
      Unknown CMake command "ask_build_sourcey_module".
    
    
    CMake Warning (dev) in CMakeLists.txt:
      No cmake_minimum_required command is present.  A line of code such as
    
        cmake_minimum_required(VERSION 3.5)
    
      should be added at the top of the file.  The version specified may be lower
      if you wish to support older CMake versions for this project.  For more
      information run "cmake --help-policy CMP0000".
    This warning is for project developers.  Use -Wno-dev to suppress it.
    
    -- Configuring incomplete, errors occurred!
    See also "CMakeOutput.log".
    

    I am using Ubuntu 16.04

    opened by vkotovv 3
LLVM IR and optimizer for shaders, including front-end adapters for GLSL and SPIR-V and back-end adapter for GLSL

Licensing LunarGLASS is available via a three clause BSD-style open source license. Goals The primary goals of the LunarGLASS project are: Reduce the

LunarG, Inc. 153 Dec 8, 2022
Projeto pessoal: Obter a temperatura ambiente e através de um termistor ligado a um arduino e disponibilizar esses dados em tempo real via API NodeJS. No front-end os dados são acessados por uma interface em React JS.

INTEGRAÇÃO DA API COM OS DADOS DO ARDUINO FORNECIDOS PELO TERMISTOR Código Desenvolvido por Lucas Muffato. MATERIAIS 1 Placa de Arduino; 1 Cabo de con

Lucas Muffato 35 Aug 16, 2022
Visual Studio native debugger extension to help debug native applications using Mono.

Unity Mixed Callstack UnityMixedCallstack is a Visual Studio 2017/2019 extension to help debug native applications embedding Mono, like Unity. If you

Unity Technologies 83 Nov 28, 2022
The Rumor is pure, nasty growling bass fuzz pedal, with bold out-front presence, and cutting articulation.

Rumor.lv2 The Rumor is pure, nasty growling bass fuzz pedal, with bold out-front presence, and cutting articulation. Features Nasty FUZZ simulation. D

Hermann 12 Feb 28, 2022
"Sigma File Manager" is a free, open-source, quickly evolving, modern file manager (explorer / finder) app for Windows, MacOS, and Linux.

"Sigma File Manager" is a free, open-source, quickly evolving, modern file manager (explorer / finder) app for Windows, MacOS, and Linux.

Aleksey Hoffman 1.1k Dec 31, 2022
A simple and straightforward package manager for games.

SimplyPack v1.0 by: Wassimulator A very simple and straightforward package manager for games, written in C. Use SimplyPack.exe or compile sim

Wassim Alhajomar 10 Jan 5, 2023
ZPM - The C++ package manager based on premake5

ZPM ZPM is the C++ package manager built for everyone who uses premake! We designed it to make it easy to use libraries, modules and assets. PLEASE NO

Zefiros Software 26 Oct 10, 2022
Example of downloading/installing dependencies using Hunter package manager.

Linux/OSX Windows Example of downloading/installing dependencies using Hunter package manager. Requirements CMake version 3.0 Usage Set HUNTER_ROOT en

null 46 Dec 30, 2022
A package manager for C++, like Cargo for Rust.

Description Poac is a package manager for C++ users. Poac can download project's dependencies and compile a project. Please see poac.pm, installation

Poac 593 Jan 2, 2023
BSCXX (for BootStrap CXX project) is a C++ package manager.

bscxx bscxx (for bootstrap CXX project) is a very light utility software, written in C++ 17, to help you starting quickly a new C++ project using cmak

Victor Gallet 1 Sep 21, 2019