X-Original-To: alpine-devel@lists.alpinelinux.org Delivered-To: alpine-devel@mail.alpinelinux.org Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id BB18FDC03C0 for ; Mon, 2 Feb 2015 09:17:48 +0000 (UTC) Received: by mail-la0-f54.google.com with SMTP id hv19so38452665lab.13 for ; Mon, 02 Feb 2015 01:17:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=bPROdwzprmU23CaAPyOCe7QxEcHLuqB+bQacsZWlrJo=; b=Bzzwv1689Xq3/9FBf2JoX0fQuUVtmUjKbKcnS9jvuUsEJD3VwerZaJ+3MXv8kJLVFw IQdn7yuY9m2cHGAKImsMPwWFN1z083YLfSHMx6WqiQYNxBBjPTbsbivtEUcakRM8/K1l ECksQXVxXFspinRYmR53GLnKc0+HDsXTXaJo05bBIMdNierHFFmgBmzTAH3Dq1rsx6IU +SU4S/V18Hws8ofrt/d6/rO02U+zUdEcXytTEvvw+YIyt1VTDkoVR/coqSid4JykOouT BVSoZWmM9e/x2ayncuYgbjI9E9zHuCu6ITzf8IevxwwY9GsSaGJCZj7A8CruXiLO1xAJ UVFA== X-Received: by 10.112.167.136 with SMTP id zo8mr18636933lbb.17.1422868666661; Mon, 02 Feb 2015 01:17:46 -0800 (PST) Received: from vostro ([2001:1bc8:101:f402:21a:9fff:fe0c:4022]) by mx.google.com with ESMTPSA id rm3sm1864273lbb.47.2015.02.02.01.17.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Feb 2015 01:17:46 -0800 (PST) Sender: =?UTF-8?Q?Timo_Ter=C3=A4s?= Date: Mon, 2 Feb 2015 11:17:18 +0200 From: Timo Teras To: Orion Cc: "alpine-devel@lists.alpinelinux.org" Subject: [alpine-devel] Re: apk-tools - In need of a minimal spec Message-ID: <20150202111718.66140f1d@vostro> In-Reply-To: <20150202003218.6209a4a2@twinpeaks.my.domain> References: <20150202003218.6209a4a2@twinpeaks.my.domain> X-Mailer: Claws Mail 3.11.0 (GTK+ 2.24.25; x86_64-alpine-linux-musl) X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 2 Feb 2015 00:32:18 -0800 Orion wrote: > I have began reading through the apk-tools source code with the goal > of teaching myself more about how package managers work by porting > it into go-lang. I would appreciate help compiling some minimally > sufficient specification for this. > > I ask for your help because I have had little luck finding any kind of > documentation, design thoughts, comments, or self describing > functions/variables. Let me know what the easiest means of discussion > would be. Yes, we should add some overview documentation. And specs of how the package format is handled. > # Stuff I Found Confusing > * blob.c > * memspn() > * memcspn() > * apk_blob_spn() > * apk_blob_cspn() It's basically similar to strspn() but with two differences: - it works with blobs, so the source string is not zero-terminated - the list of characters to accept or reject is a bitmap instead of zero-terminated string (see the header for apk_spn_match_def typedef) memspn() would probably be the libc name, but there is no such function. Use of that name is probably misleading. I wrote this earlier when I had tendency to micro-optimize things. If I'd write it now, I'd leave the memspn() stuff out, and keep only the C-versions. > * digitdecode & dx() > - is data taken, encoded with your own custom codec This is just a lookup-table based ASCII hexnumber to number conversion. Basically atoi() and strtol() equivalent, but it's hand written again, so we can work with "blobs" (length limited, not zero-terminated). > and then put into a blow? > * archive.c & gunzip.c > * is the tar and gzip code used custom or pulled from existing > implementations? gunzip.c ends up using libz. It's just glue for the internal abstractionlayer. archive.c contains full tar decoder and encoder. It's mostly custom code. And currently it is required due to how the .apk file is constructed. /Timo --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---