forked from vieter-v/vieter
Each repo now has its own subdir in pkg_dir
parent
ebe01c2d44
commit
cec5ecce7f
|
@ -5,8 +5,8 @@ import env
|
||||||
|
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub:
|
pub:
|
||||||
api_key string
|
api_key string
|
||||||
address string
|
address string
|
||||||
base_image string = 'archlinux:base-devel'
|
base_image string = 'archlinux:base-devel'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ mut:
|
||||||
pub:
|
pub:
|
||||||
// Where to store repositories' files
|
// Where to store repositories' files
|
||||||
repos_dir string [required]
|
repos_dir string [required]
|
||||||
// Where packages are stored; each architecture gets its own subdirectory
|
// Where packages are stored; each repository gets its own subdirectory
|
||||||
pkg_dir string [required]
|
pkg_dir string [required]
|
||||||
// The default architecture to use for a repository. In reality, this value
|
// The default architecture to use for a repository. In reality, this value
|
||||||
// is only required when a package with architecture "any" is added as the
|
// is only required when a package with architecture "any" is added as the
|
||||||
|
@ -56,10 +56,12 @@ pub fn (r &RepoGroupManager) add_pkg_from_path(repo string, pkg_path string) ?Re
|
||||||
|
|
||||||
// If the add was successful, we move the file to the packages directory
|
// If the add was successful, we move the file to the packages directory
|
||||||
if added {
|
if added {
|
||||||
dest_path := os.real_path(os.join_path_single(r.pkg_dir, pkg.filename()))
|
repo_pkg_path := os.real_path(os.join_path_single(r.pkg_dir, repo))
|
||||||
|
dest_path := os.join_path_single(repo_pkg_path, pkg.filename())
|
||||||
|
|
||||||
// Only move the file if it's not already in the package directory
|
// Only move the file if it's not already in the package directory
|
||||||
if dest_path != os.real_path(pkg_path) {
|
if dest_path != os.real_path(pkg_path) {
|
||||||
|
os.mkdir_all(repo_pkg_path) ?
|
||||||
os.mv(pkg_path, dest_path) ?
|
os.mv(pkg_path, dest_path) ?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,11 +33,11 @@ fn (mut app App) get_repo_file(repo string, arch string, filename string) web.Re
|
||||||
full_path += '.tar.gz'
|
full_path += '.tar.gz'
|
||||||
}
|
}
|
||||||
} else if filename.contains('.pkg') {
|
} else if filename.contains('.pkg') {
|
||||||
full_path = os.join_path_single(app.repo.pkg_dir, filename)
|
full_path = os.join_path(app.repo.pkg_dir, repo, filename)
|
||||||
|
|
||||||
// Default behavior is to return the desc file for the package, if present.
|
// Default behavior is to return the desc file for the package, if present.
|
||||||
// This can then also be used by the build system to properly check whether
|
// This can then also be used by the build system to properly check whether
|
||||||
// a package is present in an arch-repo.
|
// a package is present in an arch-repo.
|
||||||
} else {
|
} else {
|
||||||
full_path = os.join_path(app.repo.repos_dir, repo, arch, filename, 'desc')
|
full_path = os.join_path(app.repo.repos_dir, repo, arch, filename, 'desc')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue