Git Product home page Git Product logo

libpacstall's Introduction

LibPacstall

Backend API library for Pacstall

python 3.8+ Codecov code style: 3.8+ Codacy branch grade bash v5
join discord Mastodon Follow join matrix

What is this

LibPacstall is a backend API library for Pacstall.

Installation

To install the latest release run:

$ pip install libpacstall

To install the latest development build run:

$ pip install git+https://github.com/pacstall/libpacstall@develop

Stats

Repobeats analytics image

License

GPL-3.0-or-later

    __    _ __    ____                  __        ____
   / /   (_) /_  / __ \____ ___________/ /_____ _/ / /
  / /   / / __ \/ /_/ / __ `/ ___/ ___/ __/ __ `/ / /
 / /___/ / /_/ / ____/ /_/ / /__(__  ) /_/ /_/ / / /
/_____/_/_.___/_/    \__,_/\___/____/\__/\__,_/_/_/

Copyright (C) 2022-present

This file is part of LibPacstall.

LibPacstall is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.

LibPacstall is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
LibPacstall. If not, see <https://www.gnu.org/licenses/>.

libpacstall's People

Contributors

d-brox avatar dependabot[bot] avatar pre-commit-ci[bot] avatar wizard-28 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

libpacstall's Issues

PACBUILD spec

pkgname='potato'
pkgver='1.0.0'   # this is the variable pkgver, can also be a function that will return dynamic version, but both are required for VCS packages
pkgrel=2         # If a PACBUILD is modified that could affect the resulting package but no package update
epoch='0'        # force package to be seen as newer no matter what
pkgdesc='Pretty obvious
Long description'
url='https://potato.com'
license="Apache-2.0 OR MIT"
arch=('any' 'x86_64' 'x86') # Valid arches defined here: https://doc.rust-lang.org/std/env/consts/constant.ARCH.html. `any` and the other arches are mutually exclusive.
maintainer='Elsie19 <[email protected]>'
repology=("project: ${pkgname}")
source=(
  "https://potato.com/${pkgver}.tar.gz"
  "potato.tar.gz::https://potato.com/${pkgver}.tar.gz"                                                    # with a forced download name
  "${pkgname}::git+https://github.com/pacstall/pacstall"                                                  # git repo
  "${pkgname}::https://github.com/pacstall/pacstall/releases/download/2.0.1/pacstall-2.0.1.deb::repology" # use changelog with repology
  "${pkgname}::git+https://github.com/pacstall/pacstall#branch=master"                                    # git repo with branch
  "${pkgname}::git+file://home/henry/pacstall/pacstall"                                                   # local git repo
  "patch-me-harder.patch::https://potato.com/patch-me.patch"
) # also source_amd64=(), source_i386=()

noextract=(
  "${pkgver}.tar.gz"
)

sha256sums=(
  'e69fcf51c211772d4f193f3dc59b1e91607bea7e53999f1d5e03ba401e5da969'
  'SKIP'
  'SKIP'
  'etc'
) # can also do sha256sums_amd64=(), repeat for sha384, sha512, and b2

optdepends=(
  'same as pacstall: yes'
) # rince and repeat optdepends_$arch=()

depends=(
  'hashbrowns: >=1.8.0'
  'mashed-potatos: ^1.9.0'
  'gravy: ~2.3.0'
  'applesauce: >3.*'
  'chicken: <2.0.0'
  'libappleslices.so'
  'libdeepfryer.so: 3'
)

makedepends=(
  'whisk'
  'onions'
)

checkdepends=(
  'customer_satisfaction'
)

ppa=('mcdonalds/ppa')

provides=(
  'mashed-potatos'
  'aaaaaaaaaaaaaaaaaaaaaaaaaa'
)

conflicts=(
  'KFC'
  'potato_rights'
) # can also do conflicts_$arch=()

replaces=(
  'kidney_beans'
)

backup=(
  'etc/potato/prepare.conf'
  'r:etc/mashed_potato/prepare.conf'
)

options=(
  '!strip'
  '!docs'
  'etc'
)

groups=('potato-clan')

incompatible=('debian::jessy' 'ubuntu::20.04')

prepare() {
  cd "${pkgname}-${pkgver}"
  patch -p1 -i "${srcdir}/patch-me-harder.patch"
}

build() {
  cd "${pkgname}-${pkgver}"
  ./configure --prefix=/usr
  make
}

check() {
  cd "${pkgname}-${pkgver}"
  make -k check
}

package() {
  cd "${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}/" install
}

pre_install() {
  echo "potato"
}

post_install() {
  echo "potato"
}

pre_upgrade() {
  echo "potato"
}

post_upgrade() {
  echo "potato"
}

pre_remove() {
  echo "potato"
}

post_remove() {
  echo "potato"
}

pre_purge() {
  echo "potato"
}

post_purge() {
  echo "potato"
}

Key changes from PKGBUILD

  • license is now a license expression that can be used to better describe software licenses.
  • pkgdesc allows for long descriptions.
  • maintainer is now a variable.
  • repology array exists.
  • {make,check,}depends have more complex version specifiers
  • ppa array exists.
  • backup array can have r: specifier to remove stale config files on install/upgrade. Those denoted with r: cannot be in the final deb.
  • incompatible array exists.
  • All postscripts are moved from install=file to main file.

Common code in both Pacscripts and PACBUILDs

  • maintainer, we don't need to do much to convert if we end up using a variable instead of array.
  • repology, nothing to be changed.
  • ppa, nothing to be changed.
  • backup, nothing to be changed.
  • incompatible, add extra : to align with PACBUILD style.
  • optdepends, nothing to be changed.
  • depends, nothing to be changed.
  • build_depends -> makedepends.

Full list of stuff we need to implement from PKGBUILDs

https://wiki.archlinux.org/title/PKGBUILD

  1. pkgbase
  2. pkgname
  3. pkgver
  4. pkgver()
  5. pkgrel
  6. epoch
  7. pkgdesc
  8. arch
  9. url
  10. license
  11. groups
  12. depends
  13. makedepends
  14. checkdepends
  15. optdepends
  16. provides
  17. conflicts
  18. replaces
  19. backup
  20. options
  21. source
  22. noextract
  23. sha256sums

Separate modules into features

Rust enables us to separate modules into features, this enables people to conditionally compile code that they use and can in certain situations enable developers to use this library in environments where it's not possible to use otherwise (example: This library won't be able to compile on a non-Debian based distro due to the future system binding with libapt, but if we separate modules into features, that will enable developers on other distros to compile and use the features that don't depend on libapt).

Helpful Resources

Post Script

Remember to update the README, telling the users that this library is "modular" and cool.

Implement `sources` table in the config parser

Here's the last agreed upon template of the table:

[sources.official]
url = "https://github.com/pacstall/pacstall-programs"
aliases = ["main", "etc"]
preference = 1

[sources.custom1]
url = "customUrl1"
aliases = ["hydra", "custom alias 2"]
preference = 2

Here's how the raw parsed dictionary looks like:

{
│   'sources': {
│   │   'official': {'url': 'https://github.com/pacstall/pacstall-programs', 'aliases': ['main', 'etc'], 'preference': 1},
│   │   'custom1': {'url': 'customUrl1', 'aliases': ['hydra', 'custom alias 2'], 'preference': 2}
│   }
}

Write config parser

The config file should be in the toml format, and should be stored in /etc/pacstall/config.toml (allow this location to be customized).

Progress:

Implement a flexible cache system

Cache system should also be flexible for it's use in Pacstall's debug mode.

Database requirements

  • Repo information including:
    • URL
    • Last update
    • List of packages
    • Preference order
  • Pacscript information, including:
    • Name
    • Description
    • Homepage
    • Repology
    • Repository version (from last update)
    • Installed version
    • Auto/Manual
    • Dependencies (both apt's and pacstall's)
    • Optional dependencies (both apt's and pacstall's)
    • License (Requested here by @henryws)

Other requirements

  • Source x Installed correlation
  • Methods for safely adding and updating entries

Add a `jobs` variable to config's settings

This integer would be used instead of relying on nproc for operations such as make (or any internal python operation). So that people can configure the core count themselves. If it's not set then default to nproc.

Example:

[settings]
jobs = 4

Implement a config validation function

Validates the following data in the config:

  • Valid toml
  • Data types
  • Correct placement of keys (so no jobs key in repository table for example)
  • The values (validates urls etc)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.