Change repository directory layout
* Under the base URL there are supposed to be the repository files and a subdirectory "packages". * Fix the repository URL related confusion introduced earlier. The URL in the repository info (and thus in the repository file) is supposed to be the base URL for the repository. It is not a (potentially) different base URL for the package files. Package and repository files were supposed to live in the same directory. Now, by requiring the package files to live in a subdirectory -- which can also be a symlink -- we gain some flexibility. The URL in the repository config is usually the same as the in the repository info, unless it refers to a mirror site. This allows for mirrors to copy the original repository verbatim. * Remove the PackageURL rule and introduce a DownloadPackage rule instead. The URL for a package file cannot be computed in the jam parsing phase anymore, as it contains the hash value of the package list. * BRepositoryConfig: Add PackagesURL() for convenience.
This commit is contained in:
+10
-2
@@ -1006,6 +1006,8 @@ rule AddHaikuImagePackages packages : installationLocation
|
|||||||
# is either "system" or "common" (the default) and specifies where the
|
# is either "system" or "common" (the default) and specifies where the
|
||||||
# packages shall be installed.
|
# packages shall be installed.
|
||||||
|
|
||||||
|
installationLocation ?= common ;
|
||||||
|
|
||||||
local package ;
|
local package ;
|
||||||
for package in $(packages) {
|
for package in $(packages) {
|
||||||
if ! [ on $(package) return $(HAIKU_PACKAGE_ADDED) ] {
|
if ! [ on $(package) return $(HAIKU_PACKAGE_ADDED) ] {
|
||||||
@@ -1018,8 +1020,14 @@ rule AddHaikuImagePackages packages : installationLocation
|
|||||||
HAIKU_PACKAGE_ADDED on $(package) = 1 ;
|
HAIKU_PACKAGE_ADDED on $(package) = 1 ;
|
||||||
HAIKU_ADDED_PACKAGES += $(package) ;
|
HAIKU_ADDED_PACKAGES += $(package) ;
|
||||||
|
|
||||||
InstallOptionalHaikuImagePackage [ PackageURL $(package) ]
|
# download the package file and add it to the image
|
||||||
: $(installationLocation) ;
|
local file = [ DownloadPackage $(package) ] ;
|
||||||
|
|
||||||
|
if $(HAIKU_UPDATE_ALL_PACKAGES) {
|
||||||
|
HAIKU_INCLUDE_IN_IMAGE on $(file) = 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddPackageFilesToHaikuImage $(installationLocation) : $(file) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-4
@@ -695,12 +695,10 @@ rule ExtractBuildFeatureArchives feature : list
|
|||||||
}
|
}
|
||||||
|
|
||||||
local package = $(list[2]) ;
|
local package = $(list[2]) ;
|
||||||
local url = [ PackageURL $(list[3]) ] ;
|
local file = [ DownloadPackage $(list[3]) ] ;
|
||||||
local fileName = $(url:BS) ;
|
local fileName = $(file:BS) ;
|
||||||
list = $(list[4-]) ;
|
list = $(list[4-]) ;
|
||||||
|
|
||||||
local file = [ DownloadFile $(fileName) : $(url) ] ;
|
|
||||||
|
|
||||||
local directory = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
|
local directory = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
|
||||||
$(fileName:B) ] ;
|
$(fileName:B) ] ;
|
||||||
directory = $(directory:G=$(package)) ;
|
directory = $(directory:G=$(package)) ;
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ rule AddRepositoryPackages repository : architecture : packages : sourcePackages
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rule PackageRepository repository : architecture : repositoryUrl : packagesUrl
|
rule PackageRepository repository : architecture : repositoryUrl : anyPackages
|
||||||
: anyPackages : packages : sourcePackages
|
: packages : sourcePackages
|
||||||
{
|
{
|
||||||
repository = $(repository:G=repository) ;
|
repository = $(repository:G=repository) ;
|
||||||
|
|
||||||
@@ -50,7 +50,6 @@ rule PackageRepository repository : architecture : repositoryUrl : packagesUrl
|
|||||||
|
|
||||||
HAIKU_REPOSITORIES += $(repository) ;
|
HAIKU_REPOSITORIES += $(repository) ;
|
||||||
HAIKU_REPOSITORY_URL on $(repository) = $(repositoryUrl) ;
|
HAIKU_REPOSITORY_URL on $(repository) = $(repositoryUrl) ;
|
||||||
HAIKU_REPOSITORY_PACKAGES_URL on $(repository) = $(packagesUrl) ;
|
|
||||||
HAIKU_REPOSITORY_DEFINITION_FILE on $(repository)
|
HAIKU_REPOSITORY_DEFINITION_FILE on $(repository)
|
||||||
= $(HAIKU_REPOSITORY_JAMFILE) ;
|
= $(HAIKU_REPOSITORY_JAMFILE) ;
|
||||||
|
|
||||||
@@ -95,6 +94,8 @@ rule PackageRepository repository : architecture : repositoryUrl : packagesUrl
|
|||||||
|
|
||||||
HAIKU_REPOSITORY_CACHE_FILE on $(repository) = $(repositoryFile) ;
|
HAIKU_REPOSITORY_CACHE_FILE on $(repository) = $(repositoryFile) ;
|
||||||
HAIKU_REPOSITORY_CONFIG_FILE on $(repository) = $(repositoryConfig) ;
|
HAIKU_REPOSITORY_CONFIG_FILE on $(repository) = $(repositoryConfig) ;
|
||||||
|
HAIKU_REPOSITORY_PACKAGES_CHECKSUM_FILE on $(repository)
|
||||||
|
= $(packagesChecksumFile) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -156,10 +157,10 @@ rule IsPackageAvailable package
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rule PackageURL packageName
|
rule DownloadPackage packageName
|
||||||
{
|
{
|
||||||
if ! [ IsPackageAvailable $(packageName) ] {
|
if ! [ IsPackageAvailable $(packageName) ] {
|
||||||
Exit "PackageURL: package" $(packageName) "not available!" ;
|
Exit "DownloadPackage: package" $(packageName) "not available!" ;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,8 +172,16 @@ rule PackageURL packageName
|
|||||||
= [ on $(packageFamily) return $(HAIKU_PACKAGE_VERSIONS[1]) ] ;
|
= [ on $(packageFamily) return $(HAIKU_PACKAGE_VERSIONS[1]) ] ;
|
||||||
local fileName = [ on $(package) return $(HAIKU_PACKAGE_FILE_NAME) ] ;
|
local fileName = [ on $(package) return $(HAIKU_PACKAGE_FILE_NAME) ] ;
|
||||||
local repository = [ on $(package) return $(HAIKU_PACKAGE_REPOSITORY) ] ;
|
local repository = [ on $(package) return $(HAIKU_PACKAGE_REPOSITORY) ] ;
|
||||||
local baseUrl
|
local baseUrl = [ on $(repository) return $(HAIKU_REPOSITORY_URL) ] ;
|
||||||
= [ on $(repository) return $(HAIKU_REPOSITORY_PACKAGES_URL) ] ;
|
local packagesChecksumFile
|
||||||
|
= [ on $(repository)
|
||||||
|
return $(HAIKU_REPOSITORY_PACKAGES_CHECKSUM_FILE) ] ;
|
||||||
|
|
||||||
return $(baseUrl)/$(fileName) ;
|
local downloadedFile = [ DownloadFile $(fileName)
|
||||||
|
: "$(baseUrl)/`cat $source`/packages/$(fileName)"
|
||||||
|
: $(packagesChecksumFile) ] ;
|
||||||
|
NoUpdate $(downloadedFile) ;
|
||||||
|
# Don't download the file again when something in the repository
|
||||||
|
# changes. It is (supposed to be) still the same file.
|
||||||
|
return $(downloadedFile) ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
PackageRepository HaikuPorts
|
PackageRepository HaikuPorts
|
||||||
: x86_gcc2
|
: x86_gcc2
|
||||||
: http://haiku-files.org/files/repo
|
: http://haiku-files.org/files/repo
|
||||||
: http://haiku-files.org/files/hpkg
|
|
||||||
:
|
:
|
||||||
# architecture "any" packages
|
# architecture "any" packages
|
||||||
be_book-2008_10_26-1
|
be_book-2008_10_26-1
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ public:
|
|||||||
|
|
||||||
const BEntry& Entry() const;
|
const BEntry& Entry() const;
|
||||||
|
|
||||||
|
BString PackagesURL() const;
|
||||||
|
|
||||||
void SetName(const BString& name);
|
void SetName(const BString& name);
|
||||||
void SetBaseURL(const BString& url);
|
void SetBaseURL(const BString& url);
|
||||||
void SetPriority(uint8 priority);
|
void SetPriority(uint8 priority);
|
||||||
|
|||||||
@@ -398,7 +398,7 @@ PackageManager::_ApplyPackageChanges()
|
|||||||
// get package URL and target entry
|
// get package URL and target entry
|
||||||
Repository* repository
|
Repository* repository
|
||||||
= static_cast<Repository*>(package->Repository());
|
= static_cast<Repository*>(package->Repository());
|
||||||
BString url = repository->Config().BaseURL();
|
BString url = repository->Config().PackagesURL();
|
||||||
BString fileName(package->Info().CanonicalFileName());
|
BString fileName(package->Info().CanonicalFileName());
|
||||||
if (fileName.IsEmpty())
|
if (fileName.IsEmpty())
|
||||||
DIE(B_NO_MEMORY, "failed to allocate file name");
|
DIE(B_NO_MEMORY, "failed to allocate file name");
|
||||||
|
|||||||
@@ -160,6 +160,15 @@ BRepositoryConfig::Entry() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BString
|
||||||
|
BRepositoryConfig::PackagesURL() const
|
||||||
|
{
|
||||||
|
if (fBaseURL.IsEmpty())
|
||||||
|
return BString();
|
||||||
|
return BString().SetToFormat("%s/packages", fBaseURL.String());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BRepositoryConfig::SetName(const BString& name)
|
BRepositoryConfig::SetName(const BString& name)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ main(int argc, const char* const* argv)
|
|||||||
const BRepositoryInfo& info
|
const BRepositoryInfo& info
|
||||||
= repositoryInfos[package->Repository()];
|
= repositoryInfos[package->Repository()];
|
||||||
BString url = info.OriginalBaseURL();
|
BString url = info.OriginalBaseURL();
|
||||||
url << '/' << package->Info().CanonicalFileName();
|
url << "/packages/" << package->Info().CanonicalFileName();
|
||||||
printf("%s\n", url.String());
|
printf("%s\n", url.String());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user