Major changes to not depend on cksum and db from NetBSD.
Two new utilities in C have been created: - xbps-digest: shows the SHA256 hash for a file. - xbps-pkgdb: handles dependency stuff via proplib. Templates should use now $build_depends and change $checksum to be a SHA256 hash. That means that I'm currently using xbps on Linux and I lost interest on NetBSD, perhaps I'll add support for it in the future. Only git and its dependencies have been converted, as well as vim. --HG-- extra : convert_revision : 53a7e030ca6b6d02bb6cd3e51d42b7d5702c1b57
This commit is contained in:
parent
a5c39c58aa
commit
99d5350b30
19 changed files with 851 additions and 126 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@ depot/
|
|||
packages/
|
||||
srcdistdir/
|
||||
builddir/
|
||||
utils/
|
||||
|
|
8
Makefile
Normal file
8
Makefile
Normal file
|
@ -0,0 +1,8 @@
|
|||
all:
|
||||
mkdir -p utils
|
||||
cd xbps-digest && make
|
||||
cp -f xbps-digest/xbps-digest utils/
|
||||
cd xbps-pkgdb && make
|
||||
cp -f xbps-pkgdb/xbps-pkgdb utils/
|
||||
cd xbps-digest && make clean
|
||||
cd xbps-pkgdb && make clean
|
10
README
10
README
|
@ -7,10 +7,20 @@ Multiple versions of a package can be installed, because they can be enabled
|
|||
or disabled at the master directory anytime, to e.g allow testing different
|
||||
versions of the same package by "stowning" or "unstowning" them.
|
||||
|
||||
xbps uses proplib, a property container object library and it's almost the
|
||||
same one available for NetBSD. Be sure to have it installed before using
|
||||
xbps. You can get it at:
|
||||
|
||||
http://code.google.com/p/portableproplib/
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
HOW TO USE IT
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Before using xbps, some required utilities need to be built and installed into
|
||||
the utils/ directory. You can do this by issuing a "make" command in the
|
||||
top level directory.
|
||||
|
||||
Once you download it, you should edit the configuration file located at the
|
||||
xbps directory. By default it uses the xbps directory in your $HOME.
|
||||
|
||||
|
|
BIN
dependencies/build-depends.db
vendored
BIN
dependencies/build-depends.db
vendored
Binary file not shown.
|
@ -7,7 +7,7 @@ configure_args="--enable-ldaps"
|
|||
pkgconfig_override="libcurl.pc"
|
||||
short_desc="Client that groks URLs"
|
||||
maintainer="Juan RP <xtraeme@gmail.com>"
|
||||
checksum=2849e82496eb19bd75792d64f42eaa196e1ebac3
|
||||
checksum=a0e28b019f022942650ffa4bdf46e4c09bd8ec18e6ca5f08ad273668115f51f7
|
||||
long_desc="
|
||||
Curl is a command line tool for transferring files with URL syntax, supporting
|
||||
FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE and LDAP. Curl supports
|
||||
|
@ -15,3 +15,5 @@ long_desc="
|
|||
proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate,
|
||||
kerberos...), file transfer resume, proxy tunneling and a busload of other
|
||||
useful tricks."
|
||||
|
||||
build_depends="libidn-1.9"
|
||||
|
|
|
@ -6,8 +6,10 @@ http://kent.dl.sourceforge.net/sourceforge/expat/$pkgname-$version@.tar.gz"
|
|||
build_style=gnu_configure
|
||||
short_desc="XML parser library written in C"
|
||||
maintainer="Juan RP <xtraeme@gmail.com>"
|
||||
checksum=d31bcb152adaff9e358968be1ea901e1b4ed3b2f
|
||||
checksum=847660b4df86e707c9150e33cd8c25bc5cd828f708c7418e765e3e983a2e5e93
|
||||
long_desc="
|
||||
This is James Clark's expat XML parser library in C. It is a stream
|
||||
oriented parser that requires setting handlers to deal with the
|
||||
structure that the parser discovers in the document."
|
||||
|
||||
build_depends="libtool-2.2.6a"
|
||||
|
|
|
@ -6,13 +6,13 @@ distfiles="
|
|||
http://www.kernel.org/pub/software/scm/git/$pkgname-$version@.tar.bz2"
|
||||
build_style=gnu_configure
|
||||
configure_env="CURLDIR=$XBPS_MASTERDIR"
|
||||
make_env="CURLDIR=$XBPS_MASTERDIR THREADED_DELTA_SEARCH=1"
|
||||
configure_args="--with-shell=/bin/sh --with-perl=$XBPS_MASTERDIR/bin/perl
|
||||
--with-curl --without-tcltk --with-expat"
|
||||
make_cmd="$XBPS_MASTERDIR/bin/gmake"
|
||||
make_env="CURLDIR=$XBPS_MASTERDIR"
|
||||
short_desc="GIT Tree History Storage Tool"
|
||||
maintainer="Daniel Horecki <morr@morr.pl>"
|
||||
checksum=eb91ca256d0fbcc956f91ad02da659d9b322261d
|
||||
checksum=a332fbcb1c9cf8b1dc224135d5b14e99da4720fc8b082e595b4f20eaf640dad8
|
||||
long_desc="
|
||||
GIT is a \"directory content manager\" designed to handle absolutely massive
|
||||
projects with speed and efficiency, and the release of the 2.6.12 (and later)
|
||||
|
@ -23,3 +23,5 @@ long_desc="
|
|||
to e.g. GNU Arch or Monotone (or, in the commercial world, BitKeeper). Every
|
||||
GIT working directory is a full-fledged repository with full revision tracking
|
||||
capabilities, not dependent on network access to a central server."
|
||||
|
||||
build_depends="curl-7.18.0 expat-2.0.1 perl-5.10.0"
|
||||
|
|
|
@ -8,7 +8,7 @@ configure_env="EMACS=/bin/false"
|
|||
configure_args="--disable-csharp --disable-java"
|
||||
short_desc="Internationalized Domain Names command line tool"
|
||||
maintainer="Juan RP <xtraeme@gmail.com>"
|
||||
checksum=e112eeb5340c8ded1e0aef8096432451a03351bb
|
||||
checksum=30887522c8f495f6c8e24e84e60acc2863cea2ca5da70b92297e57160ad4b038
|
||||
long_desc="
|
||||
GNU Libidn is an implementation of the Stringprep, Punycode, and IDNA
|
||||
specifications defined by the IETF Internationalized Domain Names (IDN)
|
||||
|
@ -22,3 +22,5 @@ long_desc="
|
|||
bidirectional character handling. Profiles for iSCSI, Kerberos 5, Nameprep,
|
||||
SASL, and XMPP are included. Punycode and ASCII Compatible Encoding (ACE) via
|
||||
IDNA are supported."
|
||||
|
||||
build_depends="perl-5.10.0 pkg-config-0.23 libtool-2.2.6a"
|
||||
|
|
|
@ -7,7 +7,7 @@ distfiles="http://ftp.gnu.org/pub/gnu/libtool/$pkgname-$version@.tar.gz"
|
|||
build_style=gnu_configure
|
||||
short_desc="Generic library support"
|
||||
maintainer="Juan RP <xtraeme@gmail.com>"
|
||||
checksum=f8862338e2c6ea04332fd5aad4aad5bc35d0e152
|
||||
checksum=eb6b8f8272c5a5cad0c7c6b949aa75632f45c295f09b2e1e90b6bce15b32b796
|
||||
long_desc="
|
||||
This is GNU libtool, a generic library support script. Libtool hides
|
||||
the complexity of generating special library types (such as shared
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
perl_arch=$(uname -m)
|
||||
perl_libdir=$XBPS_DESTDIR/$pkgname-$version/lib/perl5
|
||||
config_pm=$perl_libdir/$version/$perl_arch-netbsd-thread-multi/Config.pm
|
||||
config_pm=$perl_libdir/$version/$perl_arch-linux-thread-multi/Config.pm
|
||||
|
||||
$sed_cmd -e "s|$XBPS_DESTDIR\/$pkgname-$version|$XBPS_MASTERDIR|g" \
|
||||
$config_pm > $config_pm.in
|
||||
|
|
|
@ -9,7 +9,7 @@ configure_args="-Dusethreads -des -Dprefix=$XBPS_DESTDIR/$pkgname-$version
|
|||
build_style=configure
|
||||
short_desc="Practical Extraction and Report Language"
|
||||
maintainer="Juan RP <xtraeme@gmail.com>"
|
||||
checksum=c6614fc99a162790a703f91085b24a60af903ba2
|
||||
checksum=94464a0d374fa63226eee56e0bb3d35564f9d8391a1a8d9f0055805ec25f3b2e
|
||||
long_desc="
|
||||
Perl is a general-purpose programming language originally developed
|
||||
for text manipulation and now used for a wide range of tasks including
|
||||
|
|
|
@ -7,7 +7,7 @@ build_style=gnu_configure
|
|||
configure_args="--disable-threads --with-pc-path=$XBPS_MASTERDIR/lib/pkgconfig"
|
||||
short_desc="System for managing library compile/link flags"
|
||||
maintainer="Juan RP <xtraeme@gmail.com>"
|
||||
checksum=0aa5565430d609319917ac2c8ffeaa5e4a509489
|
||||
checksum=08a0e072d6a05419a58124db864f0685e6ac96e71b2875bf15ac12714e983b53
|
||||
long_desc="
|
||||
pkg-config is a system for managing library compile/link flags that
|
||||
works with automake and autoconf. It replaces the ubiquitous
|
||||
|
|
|
@ -6,7 +6,7 @@ distfiles="ftp://ftp.vim.org/pub/vim/unix/$pkgname-$version@.tar.bz2"
|
|||
build_style=gnu_configure
|
||||
short_desc="Vim editor (vi clone)"
|
||||
maintainer="Juan RP <xtraeme@gmail.com>"
|
||||
checksum=eaff64d0fec09d725addf8de569f508b80a5766e
|
||||
checksum=914db0f2205ebd6f02878295ec2506036ea7500399db112c61a01491cd9a1d86
|
||||
long_desc="
|
||||
Vim is an almost compatible version of the UNIX editor Vi. Many new features
|
||||
have been added: multi level undo, syntax highlighting, command line history,
|
||||
|
|
|
@ -6,7 +6,7 @@ http://kent.dl.sourceforge.net/sourceforge/xstow/$pkgname-$version@.tar.bz2"
|
|||
build_style=gnu_configure
|
||||
short_desc="Replacement of GNU Stow written in C++"
|
||||
maintainer="Juan RP <xtraeme@gmail.com>"
|
||||
checksum=9b99bd9affe9a841503970e903555ce340fcf296
|
||||
checksum=f1872c10eccca3b3b4202e2e0f4c7f10833bc941e02f3f17776d5ddb192f68f5
|
||||
long_desc="
|
||||
XStow as GNU Stow, are programs for managing the installation of
|
||||
software packages, keeping them separate (/usr/local/stow/emacs vs.
|
||||
|
|
10
xbps-digest/Makefile
Normal file
10
xbps-digest/Makefile
Normal file
|
@ -0,0 +1,10 @@
|
|||
CFLAGS += -Wall -Werror -O3 -funroll-all-loops -ftree-loop-linear
|
||||
|
||||
all: xbps-digest
|
||||
|
||||
xbps-digest: xbps-digest.o
|
||||
$(CC) $(CFLAGS) $< -o $@
|
||||
|
||||
clean:
|
||||
-rm -rf *.o xbps-digest
|
||||
|
453
xbps-digest/xbps-digest.c
Normal file
453
xbps-digest/xbps-digest.c
Normal file
|
@ -0,0 +1,453 @@
|
|||
/*
|
||||
* Written by Aaron D. Gifford <me@aarongifford.com>
|
||||
*
|
||||
* Copyright 2000 Aaron D. Gifford. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTOR(S) ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTOR(S) BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
typedef uint8_t sha2_byte; /* Exactly 1 byte */
|
||||
typedef uint32_t sha2_word32; /* Exactly 4 bytes */
|
||||
typedef uint64_t sha2_word64; /* Exactly 8 bytes */
|
||||
|
||||
/*** SHA-256 Various Length Definitions ***********************/
|
||||
#define SHA256_BLOCK_LENGTH 64
|
||||
#define SHA256_DIGEST_LENGTH 32
|
||||
#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1)
|
||||
|
||||
/*** SHA-256 Context Structures *******************************/
|
||||
typedef struct _SHA256_CTX {
|
||||
uint32_t state[8];
|
||||
uint64_t bitcount;
|
||||
uint8_t buffer[SHA256_BLOCK_LENGTH];
|
||||
} SHA256_CTX;
|
||||
|
||||
static void SHA256_Init(SHA256_CTX *);
|
||||
static void SHA256_Update(SHA256_CTX*, const uint8_t*, size_t);
|
||||
static void SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*);
|
||||
static char *SHA256_End(SHA256_CTX*, uint8_t[SHA256_DIGEST_STRING_LENGTH]);
|
||||
static void SHA256_Transform(SHA256_CTX*, const sha2_word32*);
|
||||
|
||||
/*** SHA-256 Machine Architecture Definitions *****************/
|
||||
|
||||
/*** SHA-256 Various Length Definitions ***********************/
|
||||
/* NOTE: Most of these are in sha2.h */
|
||||
#define SHA256_SHORT_BLOCK_LENGTH (SHA256_BLOCK_LENGTH - 8)
|
||||
|
||||
/*** ENDIAN REVERSAL MACROS *******************************************/
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
#define REVERSE32(w,x) { \
|
||||
sha2_word32 tmp = (w); \
|
||||
tmp = (tmp >> 16) | (tmp << 16); \
|
||||
(x) = ((tmp & 0xff00ff00UL) >> 8) | ((tmp & 0x00ff00ffUL) << 8); \
|
||||
}
|
||||
#define REVERSE64(w,x) { \
|
||||
sha2_word64 tmp = (w); \
|
||||
tmp = (tmp >> 32) | (tmp << 32); \
|
||||
tmp = ((tmp & 0xff00ff00ff00ff00ULL) >> 8) | \
|
||||
((tmp & 0x00ff00ff00ff00ffULL) << 8); \
|
||||
(x) = ((tmp & 0xffff0000ffff0000ULL) >> 16) | \
|
||||
((tmp & 0x0000ffff0000ffffULL) << 16); \
|
||||
}
|
||||
#endif /* WORDS_BIGENDIAN */
|
||||
|
||||
/*
|
||||
* Macro for incrementally adding the unsigned 64-bit integer n to the
|
||||
* unsigned 128-bit integer (represented using a two-element array of
|
||||
* 64-bit words):
|
||||
*/
|
||||
#define ADDINC128(w,n) { \
|
||||
(w)[0] += (sha2_word64)(n); \
|
||||
if ((w)[0] < (n)) { \
|
||||
(w)[1]++; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*** THE SIX LOGICAL FUNCTIONS ****************************************/
|
||||
/*
|
||||
* Bit shifting and rotation (used by the six SHA-XYZ logical functions:
|
||||
*
|
||||
* NOTE: The naming of R and S appears backwards here (R is a SHIFT and
|
||||
* S is a ROTATION) because the SHA-256/384/512 description document
|
||||
* (see http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf) uses this
|
||||
* same "backwards" definition.
|
||||
*/
|
||||
/* Shift-right (used in SHA-256, SHA-384, and SHA-512): */
|
||||
#define R(b,x) ((x) >> (b))
|
||||
/* 32-bit Rotate-right (used in SHA-256): */
|
||||
#define S32(b,x) (((x) >> (b)) | ((x) << (32 - (b))))
|
||||
|
||||
/* Two of six logical functions used in SHA-256, SHA-384, and SHA-512: */
|
||||
#define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z)))
|
||||
#define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
|
||||
|
||||
/* Four of six logical functions used in SHA-256: */
|
||||
#define Sigma0_256(x) (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x)))
|
||||
#define Sigma1_256(x) (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x)))
|
||||
#define sigma0_256(x) (S32(7, (x)) ^ S32(18, (x)) ^ R(3 , (x)))
|
||||
#define sigma1_256(x) (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x)))
|
||||
|
||||
/*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/
|
||||
/* Hash constant words K for SHA-256: */
|
||||
const static sha2_word32 K256[64] = {
|
||||
0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
|
||||
0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
|
||||
0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL,
|
||||
0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL,
|
||||
0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
|
||||
0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL,
|
||||
0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL,
|
||||
0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL,
|
||||
0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL,
|
||||
0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
|
||||
0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL,
|
||||
0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL,
|
||||
0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL,
|
||||
0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL,
|
||||
0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
|
||||
0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL
|
||||
};
|
||||
|
||||
/* Initial hash value H for SHA-256: */
|
||||
const static sha2_word32 sha256_initial_hash_value[8] = {
|
||||
0x6a09e667UL,
|
||||
0xbb67ae85UL,
|
||||
0x3c6ef372UL,
|
||||
0xa54ff53aUL,
|
||||
0x510e527fUL,
|
||||
0x9b05688cUL,
|
||||
0x1f83d9abUL,
|
||||
0x5be0cd19UL
|
||||
};
|
||||
|
||||
/*** SHA-256: *********************************************************/
|
||||
static void SHA256_Init(SHA256_CTX* context)
|
||||
{
|
||||
if (context == (SHA256_CTX*)0) {
|
||||
return;
|
||||
}
|
||||
memcpy(context->state, sha256_initial_hash_value, SHA256_DIGEST_LENGTH);
|
||||
memset(context->buffer, 0, SHA256_BLOCK_LENGTH);
|
||||
context->bitcount = 0;
|
||||
}
|
||||
|
||||
/* Unrolled SHA-256 round macros: */
|
||||
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
|
||||
#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \
|
||||
REVERSE32(*data++, W256[j]); \
|
||||
T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \
|
||||
K256[j] + W256[j]; \
|
||||
(d) += T1; \
|
||||
(h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
|
||||
j++
|
||||
|
||||
|
||||
#else /* WORDS__BIGENDIAN */
|
||||
|
||||
#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \
|
||||
T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \
|
||||
K256[j] + (W256[j] = *data++); \
|
||||
(d) += T1; \
|
||||
(h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
|
||||
j++
|
||||
|
||||
#endif /* WORDS_BIGENDIAN */
|
||||
|
||||
#define ROUND256(a,b,c,d,e,f,g,h) \
|
||||
s0 = W256[(j+1)&0x0f]; \
|
||||
s0 = sigma0_256(s0); \
|
||||
s1 = W256[(j+14)&0x0f]; \
|
||||
s1 = sigma1_256(s1); \
|
||||
T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + K256[j] + \
|
||||
(W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); \
|
||||
(d) += T1; \
|
||||
(h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
|
||||
j++
|
||||
|
||||
static void
|
||||
SHA256_Transform(SHA256_CTX* context, const sha2_word32* data)
|
||||
{
|
||||
sha2_word32 a, b, c, d, e, f, g, h, s0, s1;
|
||||
sha2_word32 T1, *W256;
|
||||
int j;
|
||||
|
||||
W256 = (sha2_word32*)context->buffer;
|
||||
|
||||
/* Initialize registers with the prev. intermediate value */
|
||||
a = context->state[0];
|
||||
b = context->state[1];
|
||||
c = context->state[2];
|
||||
d = context->state[3];
|
||||
e = context->state[4];
|
||||
f = context->state[5];
|
||||
g = context->state[6];
|
||||
h = context->state[7];
|
||||
|
||||
j = 0;
|
||||
do {
|
||||
/* Rounds 0 to 15 (unrolled): */
|
||||
ROUND256_0_TO_15(a,b,c,d,e,f,g,h);
|
||||
ROUND256_0_TO_15(h,a,b,c,d,e,f,g);
|
||||
ROUND256_0_TO_15(g,h,a,b,c,d,e,f);
|
||||
ROUND256_0_TO_15(f,g,h,a,b,c,d,e);
|
||||
ROUND256_0_TO_15(e,f,g,h,a,b,c,d);
|
||||
ROUND256_0_TO_15(d,e,f,g,h,a,b,c);
|
||||
ROUND256_0_TO_15(c,d,e,f,g,h,a,b);
|
||||
ROUND256_0_TO_15(b,c,d,e,f,g,h,a);
|
||||
} while (j < 16);
|
||||
|
||||
/* Now for the remaining rounds to 64: */
|
||||
do {
|
||||
ROUND256(a,b,c,d,e,f,g,h);
|
||||
ROUND256(h,a,b,c,d,e,f,g);
|
||||
ROUND256(g,h,a,b,c,d,e,f);
|
||||
ROUND256(f,g,h,a,b,c,d,e);
|
||||
ROUND256(e,f,g,h,a,b,c,d);
|
||||
ROUND256(d,e,f,g,h,a,b,c);
|
||||
ROUND256(c,d,e,f,g,h,a,b);
|
||||
ROUND256(b,c,d,e,f,g,h,a);
|
||||
} while (j < 64);
|
||||
|
||||
/* Compute the current intermediate hash value */
|
||||
context->state[0] += a;
|
||||
context->state[1] += b;
|
||||
context->state[2] += c;
|
||||
context->state[3] += d;
|
||||
context->state[4] += e;
|
||||
context->state[5] += f;
|
||||
context->state[6] += g;
|
||||
context->state[7] += h;
|
||||
|
||||
/* Clean up */
|
||||
a = b = c = d = e = f = g = h = T1 = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
SHA256_Update(SHA256_CTX* context, const uint8_t *data, size_t len)
|
||||
{
|
||||
unsigned int freespace, usedspace;
|
||||
|
||||
if (len == 0) {
|
||||
/* Calling with no data is valid - we do nothing */
|
||||
return;
|
||||
}
|
||||
|
||||
/* Sanity check: */
|
||||
assert(context != NULL && data != NULL);
|
||||
|
||||
usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
|
||||
if (usedspace > 0) {
|
||||
/* Calculate how much free space is available in the buffer */
|
||||
freespace = SHA256_BLOCK_LENGTH - usedspace;
|
||||
|
||||
if (len >= freespace) {
|
||||
/* Fill the buffer completely and process it */
|
||||
memcpy(&context->buffer[usedspace], data, freespace);
|
||||
context->bitcount += freespace << 3;
|
||||
len -= freespace;
|
||||
data += freespace;
|
||||
SHA256_Transform(context,
|
||||
(sha2_word32*)context->buffer);
|
||||
} else {
|
||||
/* The buffer is not yet full */
|
||||
memcpy(&context->buffer[usedspace], data, len);
|
||||
context->bitcount += len << 3;
|
||||
/* Clean up: */
|
||||
usedspace = freespace = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
while (len >= SHA256_BLOCK_LENGTH) {
|
||||
/* Process as many complete blocks as we can */
|
||||
SHA256_Transform(context, (const sha2_word32*)data);
|
||||
context->bitcount += SHA256_BLOCK_LENGTH << 3;
|
||||
len -= SHA256_BLOCK_LENGTH;
|
||||
data += SHA256_BLOCK_LENGTH;
|
||||
}
|
||||
if (len > 0) {
|
||||
/* There's left-overs, so save 'em */
|
||||
memcpy(context->buffer, data, len);
|
||||
context->bitcount += len << 3;
|
||||
}
|
||||
/* Clean up: */
|
||||
usedspace = freespace = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
SHA256_Final(sha2_byte digest[], SHA256_CTX* context)
|
||||
{
|
||||
sha2_word32 *d = (sha2_word32*)digest;
|
||||
unsigned int usedspace;
|
||||
|
||||
/* Sanity check: */
|
||||
assert(context != NULL);
|
||||
|
||||
/* If no digest buffer is passed, we don't bother doing this: */
|
||||
if (digest != (sha2_byte*)0) {
|
||||
usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
/* Convert FROM host byte order */
|
||||
REVERSE64(context->bitcount,context->bitcount);
|
||||
#endif
|
||||
if (usedspace > 0) {
|
||||
/* Begin padding with a 1 bit: */
|
||||
context->buffer[usedspace++] = 0x80;
|
||||
|
||||
if (usedspace <= SHA256_SHORT_BLOCK_LENGTH) {
|
||||
/* Set-up for the last transform: */
|
||||
memset(&context->buffer[usedspace], 0,
|
||||
SHA256_SHORT_BLOCK_LENGTH - usedspace);
|
||||
} else {
|
||||
if (usedspace < SHA256_BLOCK_LENGTH) {
|
||||
memset(&context->buffer[usedspace], 0,
|
||||
SHA256_BLOCK_LENGTH - usedspace);
|
||||
}
|
||||
/* Do second-to-last transform: */
|
||||
SHA256_Transform(context,
|
||||
(sha2_word32*)context->buffer);
|
||||
|
||||
/* And set-up for the last transform: */
|
||||
memset(context->buffer, 0,
|
||||
SHA256_SHORT_BLOCK_LENGTH);
|
||||
}
|
||||
} else {
|
||||
/* Set-up for the last transform: */
|
||||
memset(context->buffer, 0, SHA256_SHORT_BLOCK_LENGTH);
|
||||
|
||||
/* Begin padding with a 1 bit: */
|
||||
*context->buffer = 0x80;
|
||||
}
|
||||
/* Set the bit count: */
|
||||
*(sha2_word64*)&context->buffer[SHA256_SHORT_BLOCK_LENGTH] =
|
||||
context->bitcount;
|
||||
|
||||
/* Final transform: */
|
||||
SHA256_Transform(context, (sha2_word32*)context->buffer);
|
||||
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
{
|
||||
/* Convert TO host byte order */
|
||||
int j;
|
||||
for (j = 0; j < 8; j++) {
|
||||
REVERSE32(context->state[j],context->state[j]);
|
||||
*d++ = context->state[j];
|
||||
}
|
||||
}
|
||||
#else
|
||||
memcpy(d, context->state, SHA256_DIGEST_LENGTH);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Clean up state data: */
|
||||
memset(context, 0, sizeof(SHA256_CTX));
|
||||
usedspace = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Constant used by SHA256/384/512_End() functions for converting the
|
||||
* digest to a readable hexadecimal character string:
|
||||
*/
|
||||
static const char sha2_hex_digits[] = "0123456789abcdef";
|
||||
|
||||
static char *
|
||||
SHA256_End(SHA256_CTX *ctx, uint8_t *buffer)
|
||||
{
|
||||
uint8_t digest[SHA256_DIGEST_LENGTH], *d = digest;
|
||||
uint8_t *ret;
|
||||
int i;
|
||||
|
||||
/* Sanity check: */
|
||||
assert(ctx != NULL);
|
||||
|
||||
if ((ret = buffer) != NULL) {
|
||||
SHA256_Final(digest, ctx);
|
||||
|
||||
for (i = 0; i < SHA256_DIGEST_LENGTH; i++) {
|
||||
*buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
|
||||
*buffer++ = sha2_hex_digits[*d & 0x0f];
|
||||
d++;
|
||||
}
|
||||
*buffer = (char) 0;
|
||||
} else {
|
||||
(void)memset(ctx, 0, sizeof(SHA256_CTX));
|
||||
}
|
||||
(void)memset(digest, 0, SHA256_DIGEST_LENGTH);
|
||||
return (char *)ret;
|
||||
}
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr, "usage: xbps-digest <file>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
SHA256_CTX ctx;
|
||||
uint8_t buffer[BUFSIZ * 20], *digest;
|
||||
ssize_t bytes;
|
||||
int fd;
|
||||
|
||||
if (argc != 2)
|
||||
usage();
|
||||
|
||||
if ((fd = open(argv[1], O_RDONLY)) == -1) {
|
||||
printf("xbps-digest: cannot open %s (%s)\n", argv[1],
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
digest = malloc(SHA256_DIGEST_LENGTH * 2 + 1);
|
||||
if (digest == NULL) {
|
||||
printf("xbps-digest: malloc failed (%s)\n", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
SHA256_Init(&ctx);
|
||||
while ((bytes = read(fd, buffer, sizeof(buffer))) > 0)
|
||||
SHA256_Update(&ctx, buffer, (size_t)bytes);
|
||||
|
||||
printf("%s\n", SHA256_End(&ctx, digest));
|
||||
free(digest);
|
||||
close(fd);
|
||||
|
||||
exit(0);
|
||||
}
|
13
xbps-pkgdb/Makefile
Normal file
13
xbps-pkgdb/Makefile
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Override PREFIX to look in correct path.
|
||||
#
|
||||
PREFIX ?= /usr/local
|
||||
CFLAGS += -Wall -Werror -I$(PREFIX)/include
|
||||
LDFLAGS += -L$(PREFIX)/lib -Wl,-R$(PREFIX)/lib -lprop
|
||||
|
||||
all: xbps-pkgdb
|
||||
|
||||
xbps-pkgdb: xbps-pkgdb.o
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
|
||||
|
||||
clean:
|
||||
-rm -f *.o *.core xbps-pkgdb
|
197
xbps-pkgdb/xbps-pkgdb.c
Normal file
197
xbps-pkgdb/xbps-pkgdb.c
Normal file
|
@ -0,0 +1,197 @@
|
|||
/*-
|
||||
* Copyright (c) 2008 Juan Romero Pardines.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <prop/proplib.h>
|
||||
|
||||
#define _XBPS_PKGDB_DEFPATH "/usr/local/packages/.xbps-pkgdb.plist"
|
||||
|
||||
static void usage(void);
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
printf("usage: xbps-pkgdb <action> [<pkgname> <version>]\n");
|
||||
printf("\n");
|
||||
printf(" Available actions:\n");
|
||||
printf(" installed, list, register, unregister, version\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
prop_dictionary_t dbdict;
|
||||
prop_object_iterator_t dbditer;
|
||||
prop_object_t obj, obj2;
|
||||
prop_string_t pkg;
|
||||
char dbfile[PATH_MAX], *dbfileenv, *tmppath;
|
||||
|
||||
if (argc < 2)
|
||||
usage();
|
||||
|
||||
if ((dbfileenv = getenv("XBPS_PKGDB_FPATH")) != NULL) {
|
||||
/* Use path as defined by XBPS_PKGDB_FPATH env var */
|
||||
tmppath = strncpy(dbfile, dbfileenv, sizeof(dbfile));
|
||||
if (sizeof(*tmppath) >= sizeof(dbfile))
|
||||
exit(1);
|
||||
} else {
|
||||
/* Use default path */
|
||||
tmppath =
|
||||
strncpy(dbfile, _XBPS_PKGDB_DEFPATH, sizeof(dbfile));
|
||||
if (sizeof(*tmppath) >= sizeof(dbfile))
|
||||
exit(1);
|
||||
}
|
||||
/* nul terminate string */
|
||||
dbfile[sizeof(dbfile) - 1] = '\0';
|
||||
|
||||
if (strcmp(argv[1], "installed") == 0) {
|
||||
/* Returns 0 if pkg is installed, 1 otherwise */
|
||||
if (argc != 3)
|
||||
usage();
|
||||
|
||||
dbdict = prop_dictionary_internalize_from_file(dbfile);
|
||||
if (dbdict == NULL) {
|
||||
perror("ERROR: couldn't read database file");
|
||||
exit(1);
|
||||
}
|
||||
obj = prop_dictionary_get(dbdict, argv[2]);
|
||||
if (obj == NULL)
|
||||
exit(1);
|
||||
|
||||
} else if (strcmp(argv[1], "register") == 0) {
|
||||
/* Registers a package into the database */
|
||||
if (argc != 4)
|
||||
usage();
|
||||
|
||||
dbdict = prop_dictionary_internalize_from_file(dbfile);
|
||||
if (dbdict == NULL) {
|
||||
/* create db file and register pkg */
|
||||
dbdict = prop_dictionary_create();
|
||||
if (dbdict == NULL) {
|
||||
perror("ERROR");
|
||||
exit(1);
|
||||
}
|
||||
prop_dictionary_set_cstring_nocopy(dbdict, argv[2], argv[3]);
|
||||
if (!prop_dictionary_externalize_to_file(dbdict, dbfile)) {
|
||||
perror("ERROR: couldn't write database file");
|
||||
exit(1);
|
||||
}
|
||||
printf("==> Package database file not found, "
|
||||
"creating it.\n");
|
||||
prop_object_release(dbdict);
|
||||
} else {
|
||||
/* register pkg if it's not registered already */
|
||||
pkg = prop_dictionary_get(dbdict, argv[2]);
|
||||
if (pkg && prop_object_type(pkg) == PROP_TYPE_STRING) {
|
||||
printf("==> Package `%s' already registered.\n", argv[2]);
|
||||
exit(0);
|
||||
}
|
||||
prop_dictionary_set_cstring_nocopy(dbdict, argv[2], argv[3]);
|
||||
if (!prop_dictionary_externalize_to_file(dbdict, dbfile)) {
|
||||
perror(" ERROR: couldn't write database file");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
printf("==> %s-%s registered successfully.\n", argv[2], argv[3]);
|
||||
|
||||
} else if (strcmp(argv[1], "unregister") == 0) {
|
||||
/* Unregisters a package from the database */
|
||||
if (argc != 4)
|
||||
usage();
|
||||
|
||||
dbdict = prop_dictionary_internalize_from_file(dbfile);
|
||||
if (dbdict == NULL) {
|
||||
perror("ERROR: couldn't read database file");
|
||||
exit(1);
|
||||
}
|
||||
obj = prop_dictionary_get(dbdict, argv[2]);
|
||||
if (obj == NULL) {
|
||||
printf("ERROR: package `%s' not registered in database.\n",
|
||||
argv[2]);
|
||||
exit(1);
|
||||
}
|
||||
prop_dictionary_remove(dbdict, argv[2]);
|
||||
if (!prop_dictionary_externalize_to_file(dbdict, dbfile)) {
|
||||
perror("ERROR: couldn't write database file");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("==> %s-%s unregistered successfully.\n", argv[2], argv[3]);
|
||||
|
||||
} else if (strcmp(argv[1], "list") == 0) {
|
||||
/* Lists packages currently registered in database */
|
||||
if (argc != 2)
|
||||
usage();
|
||||
|
||||
dbdict = prop_dictionary_internalize_from_file(dbfile);
|
||||
if (dbdict == NULL) {
|
||||
perror("ERROR: couldn't read database file");
|
||||
exit(1);
|
||||
}
|
||||
dbditer = prop_dictionary_iterator(dbdict);
|
||||
if (dbditer == NULL) {
|
||||
perror("ERROR");
|
||||
exit(1);
|
||||
}
|
||||
while ((obj = prop_object_iterator_next(dbditer)) != NULL) {
|
||||
obj2 = prop_dictionary_get_keysym(dbdict, obj);
|
||||
if (obj2 != NULL) {
|
||||
printf("%s", prop_dictionary_keysym_cstring_nocopy(obj));
|
||||
printf("-%s\n", prop_string_cstring_nocopy(obj2));
|
||||
}
|
||||
}
|
||||
prop_object_iterator_release(dbditer);
|
||||
|
||||
} else if (strcmp(argv[1], "version") == 0) {
|
||||
/* Prints version of an installed package */
|
||||
if (argc != 3)
|
||||
usage();
|
||||
|
||||
dbdict = prop_dictionary_internalize_from_file(dbfile);
|
||||
if (dbdict == NULL) {
|
||||
perror("ERROR: couldn't read database file");
|
||||
exit(1);
|
||||
}
|
||||
obj = prop_dictionary_get(dbdict, argv[2]);
|
||||
if (obj == NULL) {
|
||||
printf("ERROR: package `%s' not registered in database.\n",
|
||||
argv[2]);
|
||||
exit(1);
|
||||
}
|
||||
printf("%s\n", prop_string_cstring_nocopy(obj));
|
||||
|
||||
} else {
|
||||
usage();
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
255
xbps.sh
255
xbps.sh
|
@ -41,27 +41,26 @@
|
|||
: ${XBPS_CONFIG_FILE:=/usr/local/etc/xbps.conf}
|
||||
|
||||
: ${progname:=$(basename $0)}
|
||||
: ${topdir:=$(/bin/pwd -P 2>/dev/null)}
|
||||
: ${fetch_cmd:=/usr/bin/ftp -a}
|
||||
: ${cksum_cmd:=/usr/bin/cksum -a rmd160}
|
||||
: ${topdir:=$(/bin/pwd 2>/dev/null)}
|
||||
: ${fetch_cmd:=/usr/bin/wget}
|
||||
: ${awk_cmd:=/usr/bin/awk}
|
||||
: ${mkdir_cmd:=/bin/mkdir -p}
|
||||
: ${tar_cmd:=/usr/bin/tar}
|
||||
: ${mkdir_cmd:=/bin/mkdir}
|
||||
: ${tar_cmd:=/bin/tar}
|
||||
: ${rm_cmd:=/bin/rm}
|
||||
: ${mv_cmd:=/bin/mv}
|
||||
: ${cp_cmd:=/bin/cp}
|
||||
: ${sed_cmd=/usr/bin/sed}
|
||||
: ${grep_cmd=/usr/bin/grep}
|
||||
: ${gunzip_cmd:=/usr/bin/gunzip}
|
||||
: ${bunzip2_cmd:=/usr/bin/bunzip2}
|
||||
: ${sed_cmd=/bin/sed}
|
||||
: ${grep_cmd=/bin/grep}
|
||||
: ${gunzip_cmd:=/bin/gunzip}
|
||||
: ${bunzip2_cmd:=/bin/bunzip2}
|
||||
: ${patch_cmd:=/usr/bin/patch}
|
||||
: ${find_cmd:=/usr/bin/find}
|
||||
: ${file_cmd:=/usr/bin/file}
|
||||
: ${ln_cmd:=/bin/ln}
|
||||
: ${chmod_cmd:=/bin/chmod}
|
||||
: ${db_cmd:=/usr/bin/db -q}
|
||||
: ${chmod_cmd:=/bin/chmod}
|
||||
: ${touch_cmd:=/usr/bin/touch}
|
||||
: ${env_cmd:=/usr/bin/env}
|
||||
|
||||
: ${xstow_args:=-ap}
|
||||
: ${xstow_ignore_files:=perllocal.pod} # XXX For now ignore them.
|
||||
|
@ -70,12 +69,13 @@ set_defvars()
|
|||
{
|
||||
# Directories
|
||||
: ${XBPS_TEMPLATESDIR:=$XBPS_DISTRIBUTIONDIR/templates}
|
||||
: ${XBPS_DEPSDIR:=$XBPS_DISTRIBUTIONDIR/dependencies}
|
||||
: ${XBPS_BUILD_DEPS_DB:=$XBPS_DEPSDIR/build-depends.db}
|
||||
: ${XBPS_TMPLHELPDIR:=$XBPS_DISTRIBUTIONDIR/helper-templates}
|
||||
: ${XBPS_REGPKG_DB:=$XBPS_DESTDIR/.xbps-registered-pkgs.db}
|
||||
: ${XBPS_PKGDB_FPATH:=$XBPS_DESTDIR/.xbps-pkgdb.plist}
|
||||
: ${XBPS_UTILSDIR:=$XBPS_DISTRIBUTIONDIR/utils}
|
||||
: ${XBPS_DIGEST_CMD:=$XBPS_UTILSDIR/xbps-digest}
|
||||
: ${XBPS_PKGDB_CMD:=$XBPS_UTILSDIR/xbps-pkgdb}
|
||||
|
||||
local DDIRS="XBPS_DEPSDIR XBPS_TEMPLATESDIR XBPS_TMPLHELPDIR"
|
||||
local DDIRS="XBPS_TEMPLATESDIR XBPS_TMPLHELPDIR XBPS_UTILSDIR"
|
||||
for i in ${DDIRS}; do
|
||||
eval val="\$$i"
|
||||
if [ ! -d "$val" ]; then
|
||||
|
@ -83,6 +83,20 @@ set_defvars()
|
|||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
local CMDS="fetch_cmd awk_cmd mkdir_cmd tar_cmd rm_cmd mv_cmd \
|
||||
cp_cmd sed_cmd grep_cmd gunzip_cmd bunzip2_cmd patch_cmd find_cmd \
|
||||
file_cmd ln_cmd chmod_cmd chmod_cmd touch_cmd XBPS_DIGEST_CMD \
|
||||
XBPS_PKGDB_CMD"
|
||||
for f in ${CMDS}; do
|
||||
eval val="\$$f"
|
||||
if [ ! -x "$val" ]; then
|
||||
echo "*** ERROR: cannot find $f command, aborting ***"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
XBPS_PKGDB_CMD="$env_cmd XBPS_PKGDB_FPATH=$XBPS_PKGDB_FPATH $XBPS_PKGDB_CMD"
|
||||
}
|
||||
|
||||
usage()
|
||||
|
@ -97,8 +111,8 @@ Targets:
|
|||
fetch Download distribution file(s).
|
||||
info Show information about <package_name>.
|
||||
install-destdir build + configure + install into destdir.
|
||||
install Same than \`install-destdir´ but also stows package.
|
||||
list Lists all currently \`stowned´ packages.
|
||||
install Same than 'install-destdir' but also stows package.
|
||||
list Lists all currently 'stowned' packages.
|
||||
remove Remove package completely (unstow + remove data)
|
||||
listfiles Lists files installed from <package_name>.
|
||||
stow Create links in master directory.
|
||||
|
@ -171,19 +185,19 @@ info_tmpl()
|
|||
echo "pkgname: $pkgname"
|
||||
echo "version: $version"
|
||||
for i in "${distfiles}"; do
|
||||
[ -n "$i" ] && i=$(echo $i|$sed_cmd s'|@||g') && echo "distfile: $i"
|
||||
[ -n "$i" ] && i=$(echo $i|$sed_cmd s'|@||g') && \
|
||||
echo "distfile: $i"
|
||||
done
|
||||
echo "maintainer: $maintainer"
|
||||
[ -n $checksum ] && echo "checksum: $checksum"
|
||||
echo "maintainer: $maintainer"
|
||||
echo "build_style: $build_style"
|
||||
echo "short_desc: $short_desc"
|
||||
echo "$long_desc"
|
||||
echo
|
||||
check_build_depends_pkg $pkgname-$version
|
||||
if [ $? -eq 0 ]; then
|
||||
local list="$($db_cmd -V btree $XBPS_BUILD_DEPS_DB $pkgname)"
|
||||
echo "This package requires the following dependencies to be built:"
|
||||
for i in ${list}; do
|
||||
for i in ${build_depends}; do
|
||||
echo " $i"
|
||||
done
|
||||
fi
|
||||
|
@ -220,7 +234,7 @@ check_config_vars()
|
|||
fi
|
||||
|
||||
local XBPS_VARS="XBPS_MASTERDIR XBPS_DESTDIR XBPS_BUILDDIR \
|
||||
XBPS_SRCDISTDIR XBPS_SYSCONFDIR"
|
||||
XBPS_SRCDISTDIR XBPS_SYSCONFDIR"
|
||||
|
||||
for f in ${XBPS_VARS}; do
|
||||
eval val="\$$f"
|
||||
|
@ -255,7 +269,7 @@ reset_tmpl_vars()
|
|||
run_stuff_before_install_cmd run_stuff_after_install_cmd \
|
||||
make_install_target postinstall_helpers version \
|
||||
ignore_files tar_override_cmd xml_entries sgml_entries \
|
||||
make_install_prefix \
|
||||
make_install_prefix build_depends \
|
||||
XBPS_EXTRACT_DONE XBPS_CONFIGURE_DONE \
|
||||
XBPS_BUILD_DONE XBPS_INSTALL_DONE"
|
||||
|
||||
|
@ -279,7 +293,7 @@ setup_tmpl()
|
|||
fi
|
||||
prepare_tmpl
|
||||
else
|
||||
echo "*** ERROR: cannot find \`$pkg´ template file ***"
|
||||
echo "*** ERROR: cannot find $pkg template file ***"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
@ -300,7 +314,7 @@ prepare_tmpl()
|
|||
for i in ${REQ_VARS}; do
|
||||
eval val="\$$i"
|
||||
if [ -z "$val" -o -z "$i" ]; then
|
||||
echo -n "*** ERROR: \"$i\" not set on \`$pkgname' "
|
||||
echo -n "*** ERROR: \"$i\" not set on $pkgname "
|
||||
echo "template ***"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -318,7 +332,7 @@ prepare_tmpl()
|
|||
XBPS_BUILD_DONE="$wrksrc/.xbps_build_done"
|
||||
XBPS_INSTALL_DONE="$wrksrc/.xbps_install_done"
|
||||
|
||||
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:$XBPS_MASTERDIR/bin:$XBPS_MASTERDIR/sbin"
|
||||
export PATH="$XBPS_MASTERDIR/bin:$XBPS_MASTERDIR/sbin:/bin:/sbin:/usr/bin:/usr/sbin"
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -377,18 +391,26 @@ extract_distfiles()
|
|||
fi
|
||||
|
||||
case ${cursufx} in
|
||||
.tar.bz2|.tar.gz|.tgz|.tbz)
|
||||
.tar.bz2|.tbz)
|
||||
$ltar_cmd xfj $XBPS_SRCDISTDIR/$curfile -C $lwrksrc
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -n "*** ERROR extracting $curfile into "
|
||||
echo "$lwrksrc ***"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
.tar.gz|.tgz)
|
||||
$ltar_cmd xfz $XBPS_SRCDISTDIR/$curfile -C $lwrksrc
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -n "*** ERROR extracting \`$curfile' into "
|
||||
echo "$lwrksrc ***"
|
||||
echo -n "*** ERROR extracting $curfile into "
|
||||
echo "$lwrksrc ***"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
.tar)
|
||||
$ltar_cmd xf $XBPS_SRCDISTDIR/$curfile -C $lwrksrc
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -n "*** ERROR extracting \`$curfile' into "
|
||||
echo -n "*** ERROR extracting $curfile into "
|
||||
echo "$lwrksrc ***"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -412,13 +434,13 @@ extract_distfiles()
|
|||
|
||||
extract_unzip $XBPS_SRCDISTDIR/$curfile $lwrksrc
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -n "*** ERROR extracting \`$curfile' into "
|
||||
echo -n "*** ERROR extracting $curfile into "
|
||||
echo "$lwrksrc ***"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo -n "*** ERROR: cannot guess \`$curfile' extract "
|
||||
echo -n "*** ERROR: cannot guess $curfile extract "
|
||||
echo "suffix ***"
|
||||
exit 1
|
||||
;;
|
||||
|
@ -432,20 +454,20 @@ extract_distfiles()
|
|||
# Verifies that file's checksum downloaded matches what it's specified
|
||||
# in template file.
|
||||
#
|
||||
verify_rmd160_cksum()
|
||||
verify_sha256_cksum()
|
||||
{
|
||||
local file="$1"
|
||||
local origsum="$2"
|
||||
|
||||
[ -z "$file" -o -z "$cksum" ] && return 1
|
||||
|
||||
filesum="$($cksum_cmd $XBPS_SRCDISTDIR/$file | $awk_cmd '{print $4}')"
|
||||
filesum=$($XBPS_DIGEST_CMD $XBPS_SRCDISTDIR/$file)
|
||||
if [ "$origsum" != "$filesum" ]; then
|
||||
echo "*** ERROR: RMD160 checksum doesn't match for \`$file' ***"
|
||||
echo "*** ERROR: SHA256 checksum doesn't match for $file ***"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "=> checksum (RMD160) OK for \`$file'."
|
||||
echo "=> SHA256 checksum OK for $file."
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -487,7 +509,7 @@ fetch_distfiles()
|
|||
exit 1
|
||||
fi
|
||||
|
||||
verify_rmd160_cksum $curfile $cksum
|
||||
verify_sha256_cksum $curfile $cksum
|
||||
if [ $? -eq 0 ]; then
|
||||
unset cksum found
|
||||
ckcount=0
|
||||
|
@ -537,7 +559,7 @@ fetch_distfiles()
|
|||
exit 1
|
||||
fi
|
||||
|
||||
verify_rmd160_cksum $curfile $cksum
|
||||
verify_sha256_cksum $curfile $cksum
|
||||
if [ $? -eq 0 ]; then
|
||||
unset cksum found
|
||||
ckcount=0
|
||||
|
@ -565,7 +587,7 @@ fixup_tmpl_libtool()
|
|||
$ln_cmd -s $XBPS_MASTERDIR/bin/libtool $wrksrc/libtool
|
||||
fi
|
||||
|
||||
for f in $($find_cmd $wrksrc -type f -name libtool\*); do
|
||||
for f in $($find_cmd $wrksrc -type f -name libtool); do
|
||||
if [ -f $f ]; then
|
||||
$rm_cmd -f $f
|
||||
$ln_cmd -s $XBPS_MASTERDIR/bin/libtool $f
|
||||
|
@ -606,7 +628,7 @@ apply_tmpl_patches()
|
|||
for i in ${patch_files}; do
|
||||
patch="$XBPS_TEMPLATESDIR/$i"
|
||||
if [ ! -f "$patch" ]; then
|
||||
echo "*** WARNING: unexistent patch '$i' ***"
|
||||
echo "*** WARNING: unexistent patch: $i ***"
|
||||
continue
|
||||
fi
|
||||
|
||||
|
@ -622,16 +644,15 @@ apply_tmpl_patches()
|
|||
elif $(echo $patch|$grep_cmd -q .diff); then
|
||||
patch=$i
|
||||
else
|
||||
echo "*** WARNING: unknown patch type '$i' ***"
|
||||
echo "*** WARNING: unknown patch type: $i ***"
|
||||
continue
|
||||
fi
|
||||
|
||||
cd $wrksrc && $patch_cmd < $patch 2>/dev/null
|
||||
cd $wrksrc && $patch_cmd -p0 < $patch 2>/dev/null
|
||||
if [ "$?" -eq 0 ]; then
|
||||
echo "=> Patch applied: \`$i'."
|
||||
echo "=> Patch applied: $i."
|
||||
else
|
||||
echo -n "*** ERROR: couldn't apply patch '$i',"
|
||||
echo " aborting ***"
|
||||
echo "*** ERROR: couldn't apply patch: $i."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
@ -656,14 +677,14 @@ configure_src_phase()
|
|||
[ "$build_style" = "meta-template" ] && return 0
|
||||
|
||||
if [ ! -d $wrksrc ]; then
|
||||
echo "*** ERROR: unexistent build directory \`$wrksrc' ***"
|
||||
echo "*** ERROR: unexistent build directory $wrksrc ***"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Apply patches if requested by template file
|
||||
[ ! -f $XBPS_APPLYPATCHES_DONE ] && apply_tmpl_patches
|
||||
|
||||
echo "=> Running \`\`configure´´ phase for \`$pkgname-$version'."
|
||||
echo "=> Running configure phase for $pkgname-$version."
|
||||
|
||||
# Run stuff before configure.
|
||||
local rbcf="$XBPS_TEMPLATESDIR/$pkgname-runstuff-before-configure.sh"
|
||||
|
@ -723,12 +744,12 @@ configure_src_phase()
|
|||
# Unknown build_style type won't work :-)
|
||||
#
|
||||
else
|
||||
echo "*** ERROR unknown build_style \`$build_style' ***"
|
||||
echo "*** ERROR unknown build_style: $build_style ***"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$build_style" != "perl_module" -a "$?" -ne 0 ]; then
|
||||
echo "*** ERROR building (configure state) \`$pkg' ***"
|
||||
echo "*** ERROR building (configure state) $pkg ***"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -760,13 +781,13 @@ build_src_phase()
|
|||
[ "$build_style" = "meta-template" ] && return 0
|
||||
|
||||
if [ ! -d $wrksrc ]; then
|
||||
echo "*** ERROR: unexistent build directory \`$wrksrc' ***"
|
||||
echo "*** ERROR: unexistent build directory: $wrksrc ***"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $wrksrc || exit 1
|
||||
|
||||
echo "=> Running \`\`build´´ phase for \`$pkg'."
|
||||
echo "=> Running build phase for $pkg."
|
||||
|
||||
#
|
||||
# Assume BSD make if make_cmd not set in template.
|
||||
|
@ -796,7 +817,7 @@ build_src_phase()
|
|||
#
|
||||
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo "*** ERROR building (make stage) \`$pkg' ***"
|
||||
echo "*** ERROR building (make stage) $pkg ***"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -832,16 +853,16 @@ install_src_phase()
|
|||
[ "$build_style" = "meta-template" ] && return 0
|
||||
|
||||
if [ ! -d $wrksrc ]; then
|
||||
echo "*** ERROR: unexistent build directory \`$wrksrc' ***"
|
||||
echo "*** ERROR: unexistent build directory: $wrksrc ***"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $wrksrc || exit 1
|
||||
|
||||
echo "=> Running \`\`install´´ phase for: \`$pkgname-$version´."
|
||||
echo "=> Running install phase for: $pkgname-$version."
|
||||
|
||||
[ -z "$make_install_prefix" ] && \
|
||||
make_install_prefix="prefix=\"$XBPS_DESTDIR/$pkgname-$version\""
|
||||
make_install_prefix="prefix=$XBPS_DESTDIR/$pkgname-$version"
|
||||
|
||||
#
|
||||
# Install package via make.
|
||||
|
@ -849,7 +870,7 @@ install_src_phase()
|
|||
${make_cmd} ${make_install_args} ${make_install_target} \
|
||||
${make_install_prefix}
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo "*** ERROR instaling \`$pkgname-$version' ***"
|
||||
echo "*** ERROR installing $pkgname-$version ***"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -880,7 +901,7 @@ install_src_phase()
|
|||
# Unset build vars.
|
||||
unset_build_vars
|
||||
|
||||
echo "==> Installed \`$pkgname-$version' into $XBPS_DESTDIR."
|
||||
echo "==> Installed $pkgname-$version into $XBPS_DESTDIR."
|
||||
|
||||
$touch_cmd -f $XBPS_INSTALL_DONE
|
||||
|
||||
|
@ -890,7 +911,7 @@ install_src_phase()
|
|||
if [ -d "$wrksrc" -a -z "$dontrm_builddir" ]; then
|
||||
$rm_cmd -rf $wrksrc
|
||||
[ "$?" -eq 0 ] && \
|
||||
echo "=> Removed \`$pkgname-$version' build directory."
|
||||
echo "=> Removed $pkgname-$version build directory."
|
||||
fi
|
||||
|
||||
cd $XBPS_BUILDDIR
|
||||
|
@ -908,19 +929,11 @@ register_pkg_handler()
|
|||
[ -z "$action" -o -z "$pkg" -o -z "$version" ] && return 1
|
||||
|
||||
if [ "$action" = "register" ]; then
|
||||
$db_cmd -w btree $XBPS_REGPKG_DB $pkg $version 2>&1 >/dev/null
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo -n "*** ERROR: couldn't register \`$pkg'"
|
||||
echo " in db file ***"
|
||||
exit 1
|
||||
fi
|
||||
$XBPS_PKGDB_CMD register $pkg $version
|
||||
[ $? -ne 0 ] && exit 1
|
||||
elif [ "$action" = "unregister" ]; then
|
||||
$db_cmd -d btree $XBPS_REGPKG_DB $pkg 2>&1 >/dev/null
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo -n "*** ERROR: \`$pkg' not registered "
|
||||
echo "in db file? ***"
|
||||
exit 1
|
||||
fi
|
||||
$XBPS_PKGDB_CMD unregister $pkg $version
|
||||
[ $? -ne 0 ] && exit 1
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
|
@ -937,32 +950,32 @@ add_dependency_tolist()
|
|||
[ -z "$curpkg" ] && return 1
|
||||
[ -n "$prev_pkg" ] && curpkg=$prev_pkg
|
||||
|
||||
for i in $($db_cmd -V btree $XBPS_BUILD_DEPS_DB ${curpkg%-[0-9]*.*}); do
|
||||
reset_tmpl_vars
|
||||
run_file $XBPS_TEMPLATESDIR/${curpkg%-[0-9]*.*}.tmpl
|
||||
for i in ${build_depends}; do
|
||||
#
|
||||
# Check if dep already installed.
|
||||
#
|
||||
if [ -r "$XBPS_REGPKG_DB" ]; then
|
||||
check_installed_pkg $i ${i##[aA-zZ]*-}
|
||||
#
|
||||
# If dep is already installed, check one more time
|
||||
# if all its deps are there and continue.
|
||||
#
|
||||
if [ $? -eq 0 ]; then
|
||||
install_builddeps_required_pkg $i
|
||||
installed_deps_list="$i $installed_deps_list"
|
||||
continue
|
||||
fi
|
||||
check_installed_pkg $i ${i##[aA-zZ]*-}
|
||||
#
|
||||
# If dep is already installed, check one more time
|
||||
# if all its deps are there and continue.
|
||||
#
|
||||
if [ $? -eq 0 ]; then
|
||||
install_builddeps_required_pkg $i
|
||||
installed_deps_list="$i $installed_deps_list"
|
||||
continue
|
||||
fi
|
||||
|
||||
deps_list="$i $deps_list"
|
||||
[ -n "$prev_pkg" ] && unset prev_pkg
|
||||
#
|
||||
# Check if dependency needs more deps.
|
||||
#
|
||||
check_build_depends_pkg ${i%-[0-9]*.*}
|
||||
if [ $? -eq 0 ]; then
|
||||
add_dependency_tolist $i
|
||||
prev_pkg="$i"
|
||||
fi
|
||||
deps_list="$i $deps_list"
|
||||
[ -n "$prev_pkg" ] && unset prev_pkg
|
||||
#
|
||||
# Check if dependency needs more deps.
|
||||
#
|
||||
check_build_depends_pkg ${i%-[0-9]*.*}
|
||||
if [ $? -eq 0 ]; then
|
||||
add_dependency_tolist $i
|
||||
prev_pkg="$i"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -1029,7 +1042,7 @@ install_dependencies_pkg()
|
|||
|
||||
doing_deps=true
|
||||
|
||||
echo -n "=> Calculating dependency list for '$pkgname-$version'... "
|
||||
echo -n "=> Calculating dependency list for $pkgname-$version... "
|
||||
add_dependency_tolist $pkg
|
||||
find_dupdeps_inlist installed
|
||||
find_dupdeps_inlist notinstalled
|
||||
|
@ -1039,7 +1052,7 @@ install_dependencies_pkg()
|
|||
|
||||
echo "==> Required dependencies for $(basename $pkg):"
|
||||
for i in ${installed_deps_list}; do
|
||||
fpkg="$($db_cmd -O '-' btree $XBPS_REGPKG_DB ${i%-[0-9]*.*})"
|
||||
fpkg="$($XBPS_PKGDB_CMD list|$grep_cmd ${i%-[0-9]*.*})"
|
||||
echo " $i: found $fpkg."
|
||||
done
|
||||
|
||||
|
@ -1052,7 +1065,7 @@ install_dependencies_pkg()
|
|||
check_installed_pkg $i ${i##[aA-zZ]*-}
|
||||
[ $? -eq 0 ] && continue
|
||||
# continue installing deps
|
||||
echo "==> Installing \`$pkg´ dependency: \`$i´."
|
||||
echo "==> Installing $pkg dependency: $i."
|
||||
install_pkg ${i%-[0-9]*.*}
|
||||
done
|
||||
|
||||
|
@ -1066,10 +1079,14 @@ install_builddeps_required_pkg()
|
|||
|
||||
[ -z "$pkg" ] && return 1
|
||||
|
||||
for dep in $($db_cmd -V btree $XBPS_BUILD_DEPS_DB ${pkg%-[0-9]*.*}); do
|
||||
if [ "$pkgname" != "${pkg%-[0-9]*.*}" ]; then
|
||||
run_file $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
||||
fi
|
||||
|
||||
for dep in ${build_depends}; do
|
||||
check_installed_pkg $dep ${dep##[aA-zZ]*-}
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "==> Installing \`$pkg´ dependency: $dep."
|
||||
echo "==> Installing $pkg dependency: $dep."
|
||||
install_pkg ${dep%-[0-9]*.*}
|
||||
fi
|
||||
done
|
||||
|
@ -1085,7 +1102,7 @@ check_installed_pkg()
|
|||
local reqver="$2"
|
||||
local iver=
|
||||
|
||||
[ -z "$pkg" -o -z "$reqver" -o ! -r $XBPS_REGPKG_DB ] && return 1
|
||||
[ -z "$pkg" -o -z "$reqver" -o ! -r $XBPS_PKGDB_FPATH ] && return 1
|
||||
|
||||
if [ "$pkgname" != "${pkg%-[0-9]*.*}" ]; then
|
||||
run_file $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
||||
|
@ -1093,12 +1110,12 @@ check_installed_pkg()
|
|||
|
||||
reqver="$(echo $reqver | $sed_cmd 's|[[:punct:]]||g;s|[[:alpha:]]||g')"
|
||||
|
||||
$db_cmd -K btree $XBPS_REGPKG_DB $pkgname 2>&1 >/dev/null
|
||||
$XBPS_PKGDB_CMD installed $pkgname
|
||||
if [ $? -eq 0 ]; then
|
||||
#
|
||||
# Package is installed, let's check the version.
|
||||
#
|
||||
iver="$($db_cmd -V btree $XBPS_REGPKG_DB $pkgname)"
|
||||
iver="$($XBPS_PKGDB_CMD version $pkgname)"
|
||||
if [ -n "$iver" ]; then
|
||||
#
|
||||
# As shell only supports decimal arith expressions,
|
||||
|
@ -1125,10 +1142,18 @@ check_build_depends_pkg()
|
|||
{
|
||||
local pkg="$1"
|
||||
|
||||
[ -z $pkg -o ! -r $XBPS_BUILD_DEPS_DB ] && return 1
|
||||
[ -z $pkg ] && return 1
|
||||
|
||||
$db_cmd -V btree $XBPS_BUILD_DEPS_DB ${pkg%-[0-9]*.*} 2>&1 >/dev/null
|
||||
return $?
|
||||
if [ "$pkgname" != "${pkg%-[0-9]*.*}" ]; then
|
||||
reset_tmpl_vars
|
||||
run_file $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
||||
fi
|
||||
|
||||
if [ -n "$build_depends" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -1141,7 +1166,7 @@ install_pkg()
|
|||
|
||||
local cur_tmpl="$XBPS_TEMPLATESDIR/$curpkgn.tmpl"
|
||||
if [ -z $cur_tmpl -o ! -f $cur_tmpl ]; then
|
||||
echo "*** ERROR: cannot find \`$cur_tmpl´ template file ***"
|
||||
echo "*** ERROR: cannot find $cur_tmpl template file ***"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -1203,7 +1228,7 @@ install_pkg()
|
|||
#
|
||||
if [ "$build_style" = "meta-template" ]; then
|
||||
register_pkg_handler register $pkgname $version
|
||||
echo "==> Installed meta-template \`$pkg'."
|
||||
echo "==> Installed meta-template: $pkg."
|
||||
return 0
|
||||
fi
|
||||
|
||||
|
@ -1254,15 +1279,15 @@ install_xstow_pkg()
|
|||
#
|
||||
list_pkgs()
|
||||
{
|
||||
if [ ! -r "$XBPS_REGPKG_DB" ]; then
|
||||
if [ ! -r "$XBPS_PKGDB_FPATH" ]; then
|
||||
echo "=> No packages registered or missing register db file."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for i in $($db_cmd -K btree $XBPS_REGPKG_DB); do
|
||||
for i in $($XBPS_PKGDB_CMD list); do
|
||||
# Run file to get short_desc and print something useful
|
||||
run_file $XBPS_TEMPLATESDIR/$i.tmpl
|
||||
echo "$i-$version $short_desc"
|
||||
run_file $XBPS_TEMPLATESDIR/${i%-[0-9]*.*}.tmpl
|
||||
echo "$i $short_desc"
|
||||
reset_tmpl_vars
|
||||
done
|
||||
}
|
||||
|
@ -1280,7 +1305,7 @@ list_pkg_files()
|
|||
fi
|
||||
|
||||
if [ ! -d "$XBPS_DESTDIR/$pkg" ]; then
|
||||
echo "*** ERROR: cannot find \`$pkg' in $XBPS_DESTDIR ***"
|
||||
echo "*** ERROR: cannot find $pkg in $XBPS_DESTDIR ***"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -1314,7 +1339,7 @@ remove_pkg()
|
|||
if [ "$build_style" = "meta-template" ]; then
|
||||
register_pkg_handler unregister $pkgname $version
|
||||
[ $? -eq 0 ] && \
|
||||
echo "=> Removed meta-template \`$pkg'."
|
||||
echo "=> Removed meta-template: $pkg."
|
||||
return $?
|
||||
fi
|
||||
|
||||
|
@ -1372,10 +1397,10 @@ stow_pkg()
|
|||
-dir $XBPS_DESTDIR -target $XBPS_MASTERDIR \
|
||||
$XBPS_DESTDIR/$pkg
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo "*** ERROR: couldn't create symlinks for \`$pkg' ***"
|
||||
echo "*** ERROR: couldn't create symlinks for $pkg ***"
|
||||
exit 1
|
||||
else
|
||||
echo "==> Created \`$pkg' symlinks into master directory."
|
||||
echo "==> Created $pkg symlinks into master directory."
|
||||
fi
|
||||
|
||||
register_pkg_handler register $pkgname $version
|
||||
|
@ -1411,7 +1436,7 @@ unstow_pkg()
|
|||
fi
|
||||
|
||||
if [ "$pkg" = "xstow" ]; then
|
||||
echo "*** INFO: You aren't allowed to unstow \`$pkg'."
|
||||
echo "*** INFO: You aren't allowed to unstow $pkg."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -1446,7 +1471,7 @@ unstow_pkg()
|
|||
#
|
||||
# main()
|
||||
#
|
||||
args=$(getopt Cc $*)
|
||||
args=$(getopt Cc: $*)
|
||||
[ "$?" -ne 0 ] && usage
|
||||
|
||||
set -- $args
|
||||
|
@ -1543,7 +1568,7 @@ unstow)
|
|||
unstow_pkg $2
|
||||
;;
|
||||
*)
|
||||
echo "*** ERROR: invalid target \`$target' ***"
|
||||
echo "*** ERROR: invalid target: $target ***"
|
||||
usage
|
||||
esac
|
||||
|
||||
|
|
Loading…
Reference in a new issue