Compare commits

..

10 Commits

Author SHA1 Message Date
Allan McRae
00d9837ff6 makepkg: implement alternative package splitting approach
The original package splitting approach in makepkg was aligned to the KDE
packaging approach (at the time) where each component had its own
"make install-foo" target.  In practice, distributions want to split a wider
variety of packages that do not fit this mould, and various hacks have arisen.

Implement a secondary approach to package splitting.  A PKGBUILD can provide
a 'stash()' function that is run between building and packaging.  This
function will typically do the full install of the built software into the
$stashdir directory.  I.e. run a command similar to
"make DESTDIR=$stashdir install".  Each 'package_foo()' function can then
include a list of files that are transferred from the stash into the package,
in addition to any other packaging commands.

For example:
filelist=('usr/bin/pacman'
          'usr/lib/*')

The filelist accepts glob patterns as understood by bash with extglob
enabled - including '*', '?' and '[]'.  Files can be excluded from the
filelist by prefixing with the '!' character.

Files are removed from the stash as they are included in packages.  This
allows makepkg to warn about any files that are not packaged.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-11-21 12:03:33 +10:00
Diego Viola
bdedf621ef Drop md5sum support from repo databases
repo-add removed md5sums in pacman-6.1.0. Remove reading support and the
validation option in favor of sha256sums.

Signed-off-by: Diego Viola <diego.viola@gmail.com>
2025-11-20 04:36:48 -03:00
Allan McRae
8a57308571 Provide generic sandbox status functions
The function alpm_option_set_disable_sandbox() was removed in favour of
the vairants that can enable/disable specific parts of the sandbox. This
removal was undocumented in the release notes, and the continued
inclusion of the more generic sandbox control functions is still useful.

Readd alpm_option_set_disable_sandbox() which now is a shortcut for
doing the combined alpm_option_set_disable_sandbox-{filesystem,syscalls}.
The alpm_option_get_disable_sandbox() function was readded, but adjusted
to return 0 if the sandbox is fully enabled, 1 if any component of the
sandbox is disabled, and 2 if all components are disabled.

Give the libalpm soname a minor level bump to indicated these interfaces
have been added since release, as this commit will be backorted to the
release branch.

Signed-off-by: Allan McRae <allan@archlinux.org>
2025-11-20 16:41:35 +10:00
Diego Viola
a0282cbfea libmakepkg: fix spelling of Overridden
Overriden -> Overridden

Signed-off-by: Diego Viola <diego.viola@gmail.com>
2025-11-20 16:37:39 +10:00
Diego Viola
a16d482b61 docs: remove PM_ERR_TRANS_COMMITTING
This constant is no longer defined in the source code. Removing its
reference cleans up the API documentation to match the actual code.

Signed-off-by: Diego Viola <diego.viola@gmail.com>
2025-11-19 02:31:05 -03:00
Allan McRae
8ebdccd4d6 Document that final hook match wins
Signed-off-by: Allan McRae <allan@archlinux.org>
2025-11-14 09:48:38 +10:00
Allan McRae
b5b79efe8b Remove deprecated File target for hook types
Signed-off-by: Allan McRae <allan@archlinux.org>
2025-11-14 09:48:38 +10:00
Diego Viola
9bfb7ace39 Remove MD5 from -Sii output
Signed-off-by: Diego Viola <diego.viola@gmail.com>
2025-11-13 08:15:31 -03:00
Diego Viola
0bd3a397c9 docs: trivial changes for consistency 2025-11-10 06:03:31 -03:00
Jelle van der Waa
f4bdb77470 lib: support reproducible install date
When building an Arch Linux image the install date would vary when
trying to reproduce it. Similar to building packages, respect
`SOURCE_DATE_EPOCH` when installing packages.
2025-11-09 01:16:53 +10:00
20 changed files with 161 additions and 102 deletions

30
NEWS
View File

@@ -1,7 +1,7 @@
VERSION DESCRIPTION VERSION DESCRIPTION
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
7.1.0 - Set default SigLevel for databases and packages to Required 7.1.0 - Set default SigLevel for databases and packages to Required
- Various improvements to the downloader sandbox - Various improvements to the downloader sandbox:
- Restrict syscalls - Restrict syscalls
- Use NO_NEW_PRIVS flag - Use NO_NEW_PRIVS flag
- Provide fine-grained control of sandboxing with options in - Provide fine-grained control of sandboxing with options in
@@ -780,7 +780,7 @@ VERSION DESCRIPTION
- add zsh completion - add zsh completion
4.0.3 - frontend database cleanup enhancements (FS#28714) 4.0.3 - frontend database cleanup enhancements (FS#28714)
- frontend package cleanup enhancements (FS#25166) - frontend package cleanup enhancements (FS#25166)
- back out changes related to SyncFirst in 4.0.0 - back out changes related to SyncFirst in 4.0.0:
- remove recursive/needed automatic flags on SyncFirst - remove recursive/needed automatic flags on SyncFirst
- remove poorly implemented `-S --recursive` option - remove poorly implemented `-S --recursive` option
- improve error messages on database locking failures - improve error messages on database locking failures
@@ -859,7 +859,7 @@ VERSION DESCRIPTION
- fix selection entry for long values (FS#25253) - fix selection entry for long values (FS#25253)
- make config parsing two-pass process, enhance error messages - make config parsing two-pass process, enhance error messages
- print helpful tips on -Qi <filename> or -S <filename> - print helpful tips on -Qi <filename> or -S <filename>
- replace libfetch with libcurl for backend download library - replace libfetch with libcurl for backend download library:
- timeout when mirror is not responding (FS#15369) - timeout when mirror is not responding (FS#15369)
- full HTTPS protocol support (FS#22435) - full HTTPS protocol support (FS#22435)
- support of non-traditional/redirected URLs (FS#22645) - support of non-traditional/redirected URLs (FS#22645)
@@ -965,24 +965,24 @@ VERSION DESCRIPTION
- build system: ensure libtool respects LDFLAGS (FS#23325) - build system: ensure libtool respects LDFLAGS (FS#23325)
3.5.0 - sync DBs read directly from the database tarball 3.5.0 - sync DBs read directly from the database tarball
(FS#8586, FS#20233) (FS#8586, FS#20233)
- local DB "depends" file has been merged into the "desc" file - local DB "depends" file has been merged into the "desc" file:
- pacman-db-upgrade script provided to update the local - pacman-db-upgrade script provided to update the local
database format database format
- sync database extension is .db (without compression suffix) - sync database extension is .db (without compression suffix):
- requires repo-add from pacman-3.4+ - requires repo-add from pacman-3.4+
- package versions can have an 'epoch' value defined that will - package versions can have an 'epoch' value defined that will
overrule any version comparison overrule any version comparison:
- this replaces the use of the "force" option in allowing for - this replaces the use of the "force" option in allowing for
package updates with versions that do not conform to the package updates with versions that do not conform to the
default version comparison operations default version comparison operations
- package versions have the format [epoch:]pkgver-pkgrel - package versions have the format [epoch:]pkgver-pkgrel
- check available disk space before installing packages (FS#11639) - check available disk space before installing packages (FS#11639):
- enabled by the "CheckSpace" option in pacman.conf - enabled by the "CheckSpace" option in pacman.conf
- attempt to stop install if we hit an extraction issue - attempt to stop install if we hit an extraction issue
(FS#7692, FS#22034) (FS#7692, FS#22034)
- improved interactive selection for groups/provides - improved interactive selection for groups/provides
(FS#19704, FS#19853) (FS#19704, FS#19853)
- finer grained control of ignoring dependency resolution - finer grained control of ignoring dependency resolution:
- -Sd to ignore dependency versions only - -Sd to ignore dependency versions only
- -Sdd to ignore all dependency information - -Sdd to ignore all dependency information
- clean-up of --help output (FS#19526) - clean-up of --help output (FS#19526)
@@ -994,7 +994,7 @@ VERSION DESCRIPTION
- use OpenSSL crypto functions if available - use OpenSSL crypto functions if available
- makepkg: - makepkg:
- add support for running testsuites in a check() function - add support for running testsuites in a check() function
(FS#15145) (FS#15145):
- controlled by BUILDENV option 'check' in makepkg.conf - controlled by BUILDENV option 'check' in makepkg.conf
which may be overridden by --check/--nocheck on the which may be overridden by --check/--nocheck on the
command-line command-line
@@ -1099,7 +1099,7 @@ VERSION DESCRIPTION
- add --skipinteg option (FS#15830) - add --skipinteg option (FS#15830)
- fix .PKGINFO creation with -R option (FS#15851) - fix .PKGINFO creation with -R option (FS#15851)
- always keep symlinks to sources when unpacking - always keep symlinks to sources when unpacking
3.3.0 - xdelta: many fixes and improvements 3.3.0 - xdelta: many fixes and improvements:
- new pkgdelta script to create deltas - new pkgdelta script to create deltas
- repo-add can add both deltas and packages to a database - repo-add can add both deltas and packages to a database
- xz archive format supported for packages and databases - xz archive format supported for packages and databases
@@ -1135,7 +1135,7 @@ VERSION DESCRIPTION
- check PKGBUILD for CRLF line endings - check PKGBUILD for CRLF line endings
- fix reading PKGBUILD from pipe - fix reading PKGBUILD from pipe
- increase compatibility with BSDs & Mac OSX - increase compatibility with BSDs & Mac OSX
- contrib - contrib:
- pacdiff - improvements and new -l flag for using locate - pacdiff - improvements and new -l flag for using locate
- pacscripts - print install scripts for a package - pacscripts - print install scripts for a package
3.2.2 - log pacsave warnings to pacman.log (FS#12531) 3.2.2 - log pacsave warnings to pacman.log (FS#12531)
@@ -1323,7 +1323,7 @@ VERSION DESCRIPTION
- allow multiple pacman cache directories - allow multiple pacman cache directories
- all manpages are now generated using Asciidoc (FS#7312) - all manpages are now generated using Asciidoc (FS#7312)
- moved parseconfig from backend library to frontend - moved parseconfig from backend library to frontend
- clean up and refactoring of the ENTIRE codebase - clean up and refactoring of the ENTIRE codebase:
- remove many useless #ifdefs - remove many useless #ifdefs
- split many too-long functions - split many too-long functions
- portability updates: compiles and passes tests on BSD and - portability updates: compiles and passes tests on BSD and
@@ -1516,7 +1516,7 @@ VERSION DESCRIPTION
- Added checks for additional hyphens in package versions - Added checks for additional hyphens in package versions
- mktemp was failing if %pmo_root%/tmp was missing -- fixed - mktemp was failing if %pmo_root%/tmp was missing -- fixed
2.8.4 - Added updatesync script from Jason Chu 2.8.4 - Added updatesync script from Jason Chu
- Changed the pacman binary to be dynamically linked - Changed the pacman binary to be dynamically linked:
- Included a pacman.static binary as well - Included a pacman.static binary as well
- Added fakeroot checks when seeing if we're root - Added fakeroot checks when seeing if we're root
- Fixed makepkg to use 'tail -n 1' instead of 'tail -1' - Fixed makepkg to use 'tail -n 1' instead of 'tail -1'
@@ -1577,10 +1577,10 @@ VERSION DESCRIPTION
- cleaned up the download progress bar a bit - cleaned up the download progress bar a bit
- added %o parameter to XferCommand so wget can resume properly - added %o parameter to XferCommand so wget can resume properly
- fixed a segfault in downloadfiles() (FS#787) - fixed a segfault in downloadfiles() (FS#787)
- patches from Oliver Burnett-Hall - patches from Oliver Burnett-Hall:
- gensync uses a better temp dir (FS#774) - gensync uses a better temp dir (FS#774)
- PKGDEST can be set in makepkg.conf (FS#783) - PKGDEST can be set in makepkg.conf (FS#783)
- patches from Aurelien Foret - patches from Aurelien Foret:
- segfault fix, couple memory leaks - segfault fix, couple memory leaks
- more sanity checks in "provides" searches - more sanity checks in "provides" searches
- fixed a little display bug in the progress bar - fixed a little display bug in the progress bar

2
README
View File

@@ -754,7 +754,7 @@ API CHANGES BETWEEN 7.0 AND 7.1
=============================== ===============================
[ADDED] [ADDED]
Fine-grained sandbox controls: - Fine-grained sandbox controls:
- alpm_option_get_disable_sandbox_filesystem() - alpm_option_get_disable_sandbox_filesystem()
- alpm_option_set_disable_sandbox_filesystem() - alpm_option_set_disable_sandbox_filesystem()
- alpm_option_get_disable_sandbox_syscalls() - alpm_option_get_disable_sandbox_syscalls()

View File

@@ -55,8 +55,7 @@ defined the hook will run if the transaction matches *any* of the triggers.
*Type =* Path|Package:: *Type =* Path|Package::
Select whether targets are matched against transaction packages or files. Select whether targets are matched against transaction packages or files.
See CAVEATS for special notes regarding Path triggers. 'File' is a deprecated See CAVEATS for special notes regarding Path triggers. Required.
alias for 'Path' and will be removed in a future release. Required.
*Target =* <path|package>:: *Target =* <path|package>::
The path or package name to match against the active transaction. The path or package name to match against the active transaction.

View File

@@ -412,6 +412,29 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
return errors; return errors;
} }
static time_t get_install_time(void)
{
time_t now;
char *source_date_epoch;
unsigned long long sde;
char *endptr;
source_date_epoch = getenv("SOURCE_DATE_EPOCH");
if (source_date_epoch) {
errno = 0;
sde = strtoull(source_date_epoch, &endptr, 10);
if (source_date_epoch == endptr || *endptr != '\0' || errno != 0) {
now = time(NULL);
} else {
now = sde;
}
} else {
now = time(NULL);
}
return now;
}
static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg, static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
size_t pkg_current, size_t pkg_count) size_t pkg_current, size_t pkg_count)
{ {
@@ -591,7 +614,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
} }
/* make an install date (in UTC) */ /* make an install date (in UTC) */
newpkg->installdate = time(NULL); newpkg->installdate = get_install_time();
_alpm_log(handle, ALPM_LOG_DEBUG, "updating database\n"); _alpm_log(handle, ALPM_LOG_DEBUG, "updating database\n");
_alpm_log(handle, ALPM_LOG_DEBUG, "adding database entry '%s'\n", newpkg->name); _alpm_log(handle, ALPM_LOG_DEBUG, "adding database entry '%s'\n", newpkg->name);

View File

@@ -2437,12 +2437,6 @@ alpm_pkg_t *alpm_pkg_find(alpm_list_t *haystack, const char *needle);
*/ */
int alpm_pkg_free(alpm_pkg_t *pkg); int alpm_pkg_free(alpm_pkg_t *pkg);
/** Check the integrity (with md5) of a package from the sync cache.
* @param pkg package pointer
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
int alpm_pkg_checkmd5sum(alpm_pkg_t *pkg);
/** Compare two version strings and determine which one is 'newer'. /** Compare two version strings and determine which one is 'newer'.
* Returns a value comparable to the way strcmp works. Returns 1 * Returns a value comparable to the way strcmp works. Returns 1
* if a is newer than b, 0 if a and b are the same version, or -1 * if a is newer than b, 0 if a and b are the same version, or -1
@@ -2561,13 +2555,6 @@ alpm_time_t alpm_pkg_get_installdate(alpm_pkg_t *pkg);
*/ */
const char *alpm_pkg_get_packager(alpm_pkg_t *pkg); const char *alpm_pkg_get_packager(alpm_pkg_t *pkg);
/** Returns the package's MD5 checksum as a string.
* The returned string is a sequence of 32 lowercase hexadecimal digits.
* @param pkg a pointer to package
* @return a reference to an internal string
*/
const char *alpm_pkg_get_md5sum(alpm_pkg_t *pkg);
/** Returns the package's SHA256 checksum as a string. /** Returns the package's SHA256 checksum as a string.
* The returned string is a sequence of 64 lowercase hexadecimal digits. * The returned string is a sequence of 64 lowercase hexadecimal digits.
* @param pkg a pointer to package * @param pkg a pointer to package

View File

@@ -795,8 +795,6 @@ static int local_db_read(alpm_pkg_t *info, int inforeq)
{ {
if(strcmp(i->data, "none") == 0) { if(strcmp(i->data, "none") == 0) {
info->validation |= ALPM_PKG_VALIDATION_NONE; info->validation |= ALPM_PKG_VALIDATION_NONE;
} else if(strcmp(i->data, "md5") == 0) {
info->validation |= ALPM_PKG_VALIDATION_MD5SUM;
} else if(strcmp(i->data, "sha256") == 0) { } else if(strcmp(i->data, "sha256") == 0) {
info->validation |= ALPM_PKG_VALIDATION_SHA256SUM; info->validation |= ALPM_PKG_VALIDATION_SHA256SUM;
} else if(strcmp(i->data, "pgp") == 0) { } else if(strcmp(i->data, "pgp") == 0) {
@@ -1060,9 +1058,6 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, int inforeq)
if(info->validation & ALPM_PKG_VALIDATION_NONE) { if(info->validation & ALPM_PKG_VALIDATION_NONE) {
fputs("none\n", fp); fputs("none\n", fp);
} }
if(info->validation & ALPM_PKG_VALIDATION_MD5SUM) {
fputs("md5\n", fp);
}
if(info->validation & ALPM_PKG_VALIDATION_SHA256SUM) { if(info->validation & ALPM_PKG_VALIDATION_SHA256SUM) {
fputs("sha256\n", fp); fputs("sha256\n", fp);
} }

View File

@@ -315,17 +315,6 @@ int _alpm_pkg_validate_internal(alpm_handle_t *handle,
} }
if(syncpkg && (!has_sig || !syncpkg->base64_sig)) { if(syncpkg && (!has_sig || !syncpkg->base64_sig)) {
if(syncpkg->md5sum && !syncpkg->sha256sum) {
_alpm_log(handle, ALPM_LOG_DEBUG, "md5sum: %s\n", syncpkg->md5sum);
_alpm_log(handle, ALPM_LOG_DEBUG, "checking md5sum for %s\n", pkgfile);
if(_alpm_test_checksum(pkgfile, syncpkg->md5sum, ALPM_PKG_VALIDATION_MD5SUM) != 0) {
RET_ERR(handle, ALPM_ERR_PKG_INVALID_CHECKSUM, -1);
}
if(validation) {
*validation |= ALPM_PKG_VALIDATION_MD5SUM;
}
}
if(syncpkg->sha256sum) { if(syncpkg->sha256sum) {
_alpm_log(handle, ALPM_LOG_DEBUG, "sha256sum: %s\n", syncpkg->sha256sum); _alpm_log(handle, ALPM_LOG_DEBUG, "sha256sum: %s\n", syncpkg->sha256sum);
_alpm_log(handle, ALPM_LOG_DEBUG, "checking sha256sum for %s\n", pkgfile); _alpm_log(handle, ALPM_LOG_DEBUG, "checking sha256sum for %s\n", pkgfile);

View File

@@ -284,9 +284,6 @@ static int _sync_get_validation(alpm_pkg_t *pkg)
return pkg->validation; return pkg->validation;
} }
if(pkg->md5sum) {
pkg->validation |= ALPM_PKG_VALIDATION_MD5SUM;
}
if(pkg->sha256sum) { if(pkg->sha256sum) {
pkg->validation |= ALPM_PKG_VALIDATION_SHA256SUM; pkg->validation |= ALPM_PKG_VALIDATION_SHA256SUM;
} }
@@ -646,7 +643,8 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
READ_NEXT(); READ_NEXT();
pkg->isize = _alpm_strtoofft(line); pkg->isize = _alpm_strtoofft(line);
} else if(strcmp(line, "%MD5SUM%") == 0) { } else if(strcmp(line, "%MD5SUM%") == 0) {
READ_AND_STORE(pkg->md5sum); /* Field is deprecated, skip */
READ_NEXT();
} else if(strcmp(line, "%SHA256SUM%") == 0) { } else if(strcmp(line, "%SHA256SUM%") == 0) {
READ_AND_STORE(pkg->sha256sum); READ_AND_STORE(pkg->sha256sum);
} else if(strcmp(line, "%PGPSIG%") == 0) { } else if(strcmp(line, "%PGPSIG%") == 0) {

View File

@@ -189,10 +189,6 @@ static int _alpm_hook_parse_cb(const char *file, int line,
} }
if(strcmp(value, "Package") == 0) { if(strcmp(value, "Package") == 0) {
t->type = ALPM_HOOK_TYPE_PACKAGE; t->type = ALPM_HOOK_TYPE_PACKAGE;
} else if(strcmp(value, "File") == 0) {
_alpm_log(handle, ALPM_LOG_DEBUG,
"File targets are deprecated, use Path instead\n");
t->type = ALPM_HOOK_TYPE_PATH;
} else if(strcmp(value, "Path") == 0) { } else if(strcmp(value, "Path") == 0) {
t->type = ALPM_HOOK_TYPE_PATH; t->type = ALPM_HOOK_TYPE_PATH;
} else { } else {

View File

@@ -47,31 +47,6 @@ int SYMEXPORT alpm_pkg_free(alpm_pkg_t *pkg)
return 0; return 0;
} }
int SYMEXPORT alpm_pkg_checkmd5sum(alpm_pkg_t *pkg)
{
char *fpath;
int retval;
ASSERT(pkg != NULL, return -1);
pkg->handle->pm_errno = ALPM_ERR_OK;
/* We only inspect packages from sync repositories */
ASSERT(pkg->origin == ALPM_PKG_FROM_SYNCDB,
RET_ERR(pkg->handle, ALPM_ERR_WRONG_ARGS, -1));
fpath = _alpm_filecache_find(pkg->handle, pkg->filename);
retval = _alpm_test_checksum(fpath, pkg->md5sum, ALPM_PKG_VALIDATION_MD5SUM);
FREE(fpath);
if(retval == 1) {
pkg->handle->pm_errno = ALPM_ERR_PKG_INVALID;
retval = -1;
}
return retval;
}
/* Default package accessor functions. These will get overridden by any /* Default package accessor functions. These will get overridden by any
* backend logic that needs lazy access, such as the local database through * backend logic that needs lazy access, such as the local database through
* a lazy-load cache. However, the defaults will work just fine for fully- * a lazy-load cache. However, the defaults will work just fine for fully-
@@ -256,13 +231,6 @@ const char SYMEXPORT *alpm_pkg_get_packager(alpm_pkg_t *pkg)
return pkg->ops->get_packager(pkg); return pkg->ops->get_packager(pkg);
} }
const char SYMEXPORT *alpm_pkg_get_md5sum(alpm_pkg_t *pkg)
{
ASSERT(pkg != NULL, return NULL);
pkg->handle->pm_errno = ALPM_ERR_OK;
return pkg->md5sum;
}
const char SYMEXPORT *alpm_pkg_get_sha256sum(alpm_pkg_t *pkg) const char SYMEXPORT *alpm_pkg_get_sha256sum(alpm_pkg_t *pkg)
{ {
ASSERT(pkg != NULL, return NULL); ASSERT(pkg != NULL, return NULL);
@@ -629,7 +597,6 @@ int _alpm_pkg_dup(alpm_pkg_t *pkg, alpm_pkg_t **new_ptr)
newpkg->builddate = pkg->builddate; newpkg->builddate = pkg->builddate;
newpkg->installdate = pkg->installdate; newpkg->installdate = pkg->installdate;
STRDUP(newpkg->packager, pkg->packager, goto cleanup); STRDUP(newpkg->packager, pkg->packager, goto cleanup);
STRDUP(newpkg->md5sum, pkg->md5sum, goto cleanup);
STRDUP(newpkg->sha256sum, pkg->sha256sum, goto cleanup); STRDUP(newpkg->sha256sum, pkg->sha256sum, goto cleanup);
STRDUP(newpkg->arch, pkg->arch, goto cleanup); STRDUP(newpkg->arch, pkg->arch, goto cleanup);
newpkg->size = pkg->size; newpkg->size = pkg->size;
@@ -724,7 +691,6 @@ void _alpm_pkg_free(alpm_pkg_t *pkg)
FREE(pkg->desc); FREE(pkg->desc);
FREE(pkg->url); FREE(pkg->url);
FREE(pkg->packager); FREE(pkg->packager);
FREE(pkg->md5sum);
FREE(pkg->sha256sum); FREE(pkg->sha256sum);
FREE(pkg->base64_sig); FREE(pkg->base64_sig);
FREE(pkg->arch); FREE(pkg->arch);

View File

@@ -96,7 +96,6 @@ struct _alpm_pkg_t {
char *desc; char *desc;
char *url; char *url;
char *packager; char *packager;
char *md5sum;
char *sha256sum; char *sha256sum;
char *base64_sig; char *base64_sig;
char *arch; char *arch;

View File

@@ -78,6 +78,7 @@ SKIPPGPCHECK=0
SIGNPKG='' SIGNPKG=''
SPLITPKG=0 SPLITPKG=0
SOURCEONLY=0 SOURCEONLY=0
STASHFUNC=0
VERIFYSOURCE=0 VERIFYSOURCE=0
MAKEPKG_LINT_PKGBUILD=${MAKEPKG_LINT_PKGBUILD:-1} MAKEPKG_LINT_PKGBUILD=${MAKEPKG_LINT_PKGBUILD:-1}
@@ -154,6 +155,9 @@ clean_up() {
if (( CHECKFUNC )); then if (( CHECKFUNC )); then
rm -f "${pkgbase}-${fullver}-${CARCH}-check.log"* rm -f "${pkgbase}-${fullver}-${CARCH}-check.log"*
fi fi
if (( STASHFUNC )); then
rm -f "${pkgbase}-${fullver}-${CARCH}-stash.log"*
fi
if (( PKGFUNC )); then if (( PKGFUNC )); then
rm -f "${pkgbase}-${fullver}-${CARCH}-package.log"* rm -f "${pkgbase}-${fullver}-${CARCH}-package.log"*
elif (( SPLITPKG )); then elif (( SPLITPKG )); then
@@ -465,6 +469,10 @@ run_check() {
run_function_safe "check" run_function_safe "check"
} }
run_stash() {
run_function_safe "stash"
}
run_package() { run_package() {
run_function_safe "package${1:+_$1}" run_function_safe "package${1:+_$1}"
} }
@@ -849,9 +857,84 @@ restore_package_variables() {
done done
} }
package_stashed_files() {
local package=$1
local filelist
get_pkgbuild_attribute "$package" 'filelist' 1 filelist
if (( ${#filelist[@]} == 0 )); then
return 0;
fi
cd $stashdir
mapfile -t stashfiles < <(find "$stashdir" -type d -exec sh -c 'printf "%s/\n" "$0"' {} \; -or -print)
stashfiles=("${stashfiles[@]#$stashdir/}")
# match inclusions
declare -a match
for m in "${stashfiles[@]}"; do
for ((i=${#filelist[@]}-1; i >= 0; i--)); do
f="${filelist[$i]}"
if [[ "$f" =~ ^!.* ]]; then
if [[ "$m" == "${f:1}" ]]; then
continue 2
fi
else
if [[ "$m" == "$f" ]]; then
match+=("$m")
continue 2
fi
fi
done
done
# gather a list of directories to be created in package
declare -a dirlist
for f in "${match[@]}"; do
if [[ "${f:-1}" == '/' ]]; then
dirlist+=("$f")
fi
while [[ "$f" =~ / ]]; do
f="${f%/*}"
dirlist+=("$f")
done
done
mapfile -t dirlist < <(printf "%s\n" "${dirlist[@]}" | LC_ALL=C sort -u)
# exclude directories from the filelist
mapfile -t filelist < <(
for f in ${match[@]}; do
[[ ! -d "$f" ]] && echo "$f"
done
)
# ensure directories are explicitly included so permissions are maintained
local tmptar=$(mktemp $pkgname.tar.XXXXXXXX)
for d in "${dirlist[@]}"; do
bsdtar --append -f "$tmptar" --exclude "$d\/*" $d/
done
bsdtar -xf "$tmptar" -C "$pkgdir"
rm "$tmptar"
# move files into package
for f in ${filelist[@]}; do
mv "$stashdir/$f" "$pkgdir/$f"
done
}
run_single_packaging() { run_single_packaging() {
local pkgdir="$pkgdirbase/$pkgname" local pkgdir="$pkgdirbase/$pkgname"
mkdir "$pkgdir" mkdir "$pkgdir"
if (( STASHFUNC )); then
package_stashed_files $1
fi
if [[ -n $1 ]] || (( PKGFUNC )); then if [[ -n $1 ]] || (( PKGFUNC )); then
run_package $1 run_package $1
fi fi
@@ -862,6 +945,10 @@ run_single_packaging() {
run_split_packaging() { run_split_packaging() {
local pkgname_backup=("${pkgname[@]}") local pkgname_backup=("${pkgname[@]}")
if (( STASHFUNC )); then
stashdir=$(mktemp -d $pkgdirbase/stash_XXXXXX)
run_stash
fi
# We might run this function when we only have package_pkgname # We might run this function when we only have package_pkgname
# and we don't want that marked as a split package # and we don't want that marked as a split package
(( ${#pkgname[@]} > 1 )) && pkgtype=split (( ${#pkgname[@]} > 1 )) && pkgtype=split
@@ -1176,7 +1263,6 @@ if [[ $BUILDDIR -ef "$startdir" ]]; then
else else
srcdir="$BUILDDIR/$pkgbase/src" srcdir="$BUILDDIR/$pkgbase/src"
pkgdirbase="$BUILDDIR/$pkgbase/pkg" pkgdirbase="$BUILDDIR/$pkgbase/pkg"
fi fi
# set pkgdir to something "sensible" for (not recommended) use during build() # set pkgdir to something "sensible" for (not recommended) use during build()
@@ -1221,6 +1307,9 @@ if have_function check; then
CHECKFUNC=1 CHECKFUNC=1
fi fi
fi fi
if have_function stash; then
STASHFUNC=1
fi
if have_function package; then if have_function package; then
PKGFUNC=1 PKGFUNC=1
fi fi
@@ -1258,6 +1347,14 @@ if (( INFAKEROOT )); then
create_debug_package create_debug_package
if (( STASHFUNC )); then
mapfile -t leftovers < <(find "$stashdir" ! -type d)
if (( ${#leftovers[@]} > 0 )); then
warning "$(gettext "Files in the stash area remain unpackaged")"
printf "%s\n" "${leftovers[@]#$stashdir/}"
fi
fi
msg "$(gettext "Leaving %s environment.")" "fakeroot" msg "$(gettext "Leaving %s environment.")" "fakeroot"
exit $E_OK exit $E_OK
fi fi

View File

@@ -56,7 +56,6 @@ enum {
T_INSTALL_SCRIPT, T_INSTALL_SCRIPT,
T_INSTALLED_SIZE, T_INSTALLED_SIZE,
T_LICENSES, T_LICENSES,
T_MD5_SUM,
T_NAME, T_NAME,
T_OPTIONAL_DEPS, T_OPTIONAL_DEPS,
T_OPTIONAL_FOR, T_OPTIONAL_FOR,
@@ -110,7 +109,6 @@ static void make_aligned_titles(void)
buf[T_INSTALL_SCRIPT] = _("Install Script"); buf[T_INSTALL_SCRIPT] = _("Install Script");
buf[T_INSTALLED_SIZE] = _("Installed Size"); buf[T_INSTALLED_SIZE] = _("Installed Size");
buf[T_LICENSES] = _("Licenses"); buf[T_LICENSES] = _("Licenses");
buf[T_MD5_SUM] = _("MD5 Sum");
buf[T_NAME] = _("Name"); buf[T_NAME] = _("Name");
buf[T_OPTIONAL_DEPS] = _("Optional Deps"); buf[T_OPTIONAL_DEPS] = _("Optional Deps");
buf[T_OPTIONAL_FOR] = _("Optional For"); buf[T_OPTIONAL_FOR] = _("Optional For");
@@ -235,9 +233,6 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra)
if(v & ALPM_PKG_VALIDATION_NONE) { if(v & ALPM_PKG_VALIDATION_NONE) {
validation = alpm_list_add(validation, _("None")); validation = alpm_list_add(validation, _("None"));
} else { } else {
if(v & ALPM_PKG_VALIDATION_MD5SUM) {
validation = alpm_list_add(validation, _("MD5 Sum"));
}
if(v & ALPM_PKG_VALIDATION_SHA256SUM) { if(v & ALPM_PKG_VALIDATION_SHA256SUM) {
validation = alpm_list_add(validation, _("SHA-256 Sum")); validation = alpm_list_add(validation, _("SHA-256 Sum"));
} }
@@ -321,7 +316,6 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra)
keys = alpm_list_add(keys, _("None")); keys = alpm_list_add(keys, _("None"));
} }
string_display(titles[T_MD5_SUM], alpm_pkg_get_md5sum(pkg), cols);
string_display(titles[T_SHA_256_SUM], alpm_pkg_get_sha256sum(pkg), cols); string_display(titles[T_SHA_256_SUM], alpm_pkg_get_sha256sum(pkg), cols);
list_display(titles[T_SIGNATURES], keys, cols); list_display(titles[T_SIGNATURES], keys, cols);

View File

@@ -1245,8 +1245,6 @@ void print_packages(const alpm_list_t *packages)
PRINT_FORMAT_STRING(temp, "%p", alpm_pkg_get_packager) PRINT_FORMAT_STRING(temp, "%p", alpm_pkg_get_packager)
/* %v : pkgver */ /* %v : pkgver */
PRINT_FORMAT_STRING(temp, "%v", alpm_pkg_get_version) PRINT_FORMAT_STRING(temp, "%v", alpm_pkg_get_version)
/* %m : md5sum */
PRINT_FORMAT_STRING(temp, "%m", alpm_pkg_get_md5sum)
/* %l : location */ /* %l : location */
if(strstr(temp, "%l")) { if(strstr(temp, "%l")) {
char *pkgloc = pkg_get_location(pkg); char *pkgloc = pkg_get_location(pkg);

View File

@@ -294,6 +294,7 @@ Possible rules are:
PKG_REASON=name|intvalue PKG_REASON=name|intvalue
PKG_FILES=name|filename PKG_FILES=name|filename
PKG_BACKUP=name|backupname PKG_BACKUP=name|backupname
PKG_INSTALLDATE=name|epoch
Example: Example:
PKG_DEPENDS=ncurses|glibc PKG_DEPENDS=ncurses|glibc

View File

@@ -277,6 +277,7 @@ pacman_tests = [
'tests/sync992.py', 'tests/sync992.py',
'tests/sync993.py', 'tests/sync993.py',
'tests/sync999.py', 'tests/sync999.py',
'tests/source_date_epoch_install.py',
'tests/trans001.py', 'tests/trans001.py',
'tests/type001.py', 'tests/type001.py',
'tests/unresolvable001.py', 'tests/unresolvable001.py',

View File

@@ -108,6 +108,9 @@ class pmrule(object):
if f.startswith(value + "\t"): if f.startswith(value + "\t"):
success = 1 success = 1
break; break;
elif case == "INSTALLDATE":
if newpkg.installdate != value:
success = 0
else: else:
tap.diag("PKG rule '%s' not found" % case) tap.diag("PKG rule '%s' not found" % case)
success = -1 success = -1

View File

@@ -92,6 +92,7 @@ class pmtest(object):
"fail": 0 "fail": 0
} }
self.args = "" self.args = ""
self.env = {}
self.retcode = 0 self.retcode = 0
self.db = { self.db = {
"local": pmdb.pmdb("local", self.root) "local": pmdb.pmdb("local", self.root)
@@ -299,7 +300,7 @@ class pmtest(object):
# archives are made available more easily. # archives are made available more easily.
time_start = time.time() time_start = time.time()
self.retcode = subprocess.call(cmd, stdout=output, stderr=output, self.retcode = subprocess.call(cmd, stdout=output, stderr=output,
cwd=os.path.join(self.root, util.TMPDIR), env={'LC_ALL': 'C'}) cwd=os.path.join(self.root, util.TMPDIR), env={'LC_ALL': 'C', **self.env})
time_end = time.time() time_end = time.time()
vprint("\ttime elapsed: %.2fs" % (time_end - time_start)) vprint("\ttime elapsed: %.2fs" % (time_end - time_start))

View File

@@ -3,7 +3,7 @@ self.description = "Print empty replacements when using -Rp"
p = pmpkg("a") p = pmpkg("a")
self.addpkg2db("local", p) self.addpkg2db("local", p)
self.args = "-Rp --print-format 'foo%%f%%g%%h%%m' %s" % p.name self.args = "-Rp --print-format 'foo%%f%%g%%h%%h' %s" % p.name
self.addrule("PACMAN_RETCODE=0") self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=^foo$") self.addrule("PACMAN_OUTPUT=^foo$")

View File

@@ -0,0 +1,12 @@
self.description = "Check that installing a package retains INSTALL DATE with SOURCE_DATE_EPOCH"
p = pmpkg("pkg1")
p.files = ["foo/file1",
"foo/file2"]
self.addpkg(p)
self.args = "-U %s" % p.filename()
self.env = {"SOURCE_DATE_EPOCH": "1662046009"}
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_INSTALLDATE=pkg1|1662046009")