APT 1.6 introduces support for hooks that talk JSON-RPC 2.0. Hooks act as a server, and APT as a client.
APT communicates with hooks via a UNIX domain socket in file descriptor
$APT_HOOK_SOCKET. The transport is a byte stream (SOCK_STREAM).
| package main | |
| type Link struct { | |
| Href string `json:"href"` | |
| } | |
| type Links struct { | |
| First Link `json:"first"` | |
| Last Link `json:"last"` | |
| Next Link `json:"next"` | |
| Self Link `json:"self"` |
| #!/usr/bin/python | |
| import apt_pkg, sys | |
| apt_pkg.init() | |
| cache=apt_pkg.Cache(None) | |
| depcache=apt_pkg.DepCache(cache) | |
| def mark_stage(roots, width=1, allow_recommends=False): | |
| cont=False |
| WARNING: apt does not have a stable CLI interface. Use with caution in scripts. | |
| Reading package lists... | |
| Building dependency tree... | |
| Reading state information... | |
| Calculating upgrade...Starting pkgProblemResolver with broken count: 19 | |
| Starting 2 pkgProblemResolver with broken count: 19 | |
| Investigating (0) python3:amd64 < 3.5.1-4 @ii mK Ib > | |
| Broken python3:amd64 Depends on libpython3-stdlib:amd64 < 3.5.1-4 -> 3.5.3-1 @ii umU > (= 3.5.1-4) |
| #!/usr/bin/python | |
| import glob, os.path,collections, apt_pkg | |
| interpreters=["bash", "sh", "python", "perl"] | |
| _scale = {'kB': 1024.0, 'mB': 1024.0*1024.0, | |
| 'KB': 1024.0, 'MB': 1024.0*1024.0} | |
| def mem_usage(pid): |
| 03-01 02:26:31.977 3746-3788/org.jak_linux.dns66 W/System.err: [AdVpnThread] INFO org.pcap4j.packet.factory.PacketFactories - Succeeded in FactoryBinder.getInstance() | |
| 03-01 02:26:32.034 3746-3788/org.jak_linux.dns66 W/System.err: [AdVpnThread] WARN org.pcap4j.util.PropertiesLoader - [org/pcap4j/packet/factory/packet-factory.properties] Could not get value by org.pcap4j.packet.Packet.classFor.unknownNumber, use default value: class org.pcap4j.packet.UnknownPacket | |
| 03-01 02:26:32.035 3746-3788/org.jak_linux.dns66 W/System.err: [AdVpnThread] INFO org.pcap4j.util.PropertiesLoader - [org/pcap4j/packet/factory/packet-factory.properties] Got org.pcap4j.packet.IpV6Packet by org.pcap4j.packet.Packet.classFor.org.pcap4j.packet.namednumber.EtherType.0x86dd | |
| 03-01 02:26:32.041 3746-3788/org.jak_linux.dns66 W/System.err: [AdVpnThread] INFO org.pcap4j.util.PropertiesLoader - [org/pcap4j/packet/factory/packet-factory.properties] Got org.pcap4j.packet.factory.PropertiesBasedIpV6TrafficClassFactory by org.pcap4j.packet.IpV6Pack |
| # Boilerplate | |
| Options +Indexes | |
| RewriteEngine on | |
| ## Sample redirect rules for every section. | |
| # | |
| # This file assumes that the changelogs are exposed at /changelogs/pool/COMPONENT/..., like | |
| # on the Debian and Ubuntu servers, and that changelogs is a subdirectory of the document root. | |
| # | |
| # The first condition prevents infinite redirects (alternative: RewriteCond $1 !^main$) |
| #include <string.h> | |
| #include <stdio.h> | |
| #include <unistd.h> | |
| #define MIN(A, B) (((A) < (B)) ? (A) : (B)) | |
| struct buffered_fd { | |
| int fd; | |
| size_t bufstart; | |
| size_t bufused; |
| #include <string.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include "jkdiff.h" | |
| struct tar_header { | |
| char name[100]; | |
| char mode[8]; | |
| char uid[8]; | |
| char gid[8]; |
| # Edit this file to introduce tasks to be run by cron. | |
| # | |
| # Each task to run has to be defined through a single line | |
| # indicating with different fields when the task will be run | |
| # and what command to run for the task | |
| # | |
| # To define the time you can provide concrete values for | |
| # minute (m), hour (h), day of month (dom), month (mon), | |
| # and day of week (dow) or use '*' in these fields (for 'any').# | |
| # Notice that tasks will be started based on the cron's system |