@@ -615,17 +615,10 @@ push_packages <- local({
615615version <- unclass(package_version(
616616desc :: desc_get(file = paths [1 ]," Version" )
617617 ))[[1 ]]
618- if (length(version )> = 4 && version [4 ]== 9999 ) {
619- # rc is also pushed to devel, as devel should be the latest
620- p1 <- push_packages(paths ," rc" ,keep_old ,dry_run ,cleanup )
621- p2 <- push_packages(paths ," devel" ,keep_old ,dry_run ,cleanup )
622- return (invisible (rbind(p1 ,p2 )))
623- }else if (length(version )> = 4 && version [4 ]> = 9000 ) {
618+ if (length(version )> = 4 && version [4 ]> = 9000 ) {
624619tag <- " devel"
625620 }else {
626- # stable is also pushed to rc
627621p1 <- push_packages(paths ," stable" ,keep_old ,dry_run ,cleanup )
628- p2 <- push_packages(paths ," rc" ,keep_old ,dry_run ,cleanup )
629622return (invisible (rbind(p1 ,p2 )))
630623 }
631624 }
@@ -682,7 +675,8 @@ create_pak_repo <- local({
682675read_metadata <- import_from(" push_packages" ," read_metadata" )
683676sha256 <- import_from(" push_packages" ," sha256" )
684677
685- tags <- c(" stable" ," rc" ," devel" )
678+ tags <- c(" stable" ," devel" )
679+ tag_aliases <- list (stable = c(" rc" ," dev" ),devel = character ())
686680
687681cpu_map <- c(
688682" arm64" = " aarch64" ,
@@ -1045,7 +1039,13 @@ create_pak_repo <- local({
10451039 }
10461040 }
10471041
1048- create_package_repo_tag <- function (root ,workdir ,tag ,dry_run = FALSE ) {
1042+ create_package_repo_tag <- function (
1043+ root ,
1044+ workdir ,
1045+ tag ,
1046+ tag_aliases ,
1047+ dry_run = FALSE
1048+ ) {
10491049data <- read_metadata(workdir ,tag )
10501050plat <- parse_platform(data $ r.platform )
10511051cpu <- cpu_map [plat $ cpu ] %NA %plat $ cpu
@@ -1096,9 +1096,61 @@ create_pak_repo <- local({
10961096 create_packages_files(data ,root ,tag )
10971097
10981098 add_repo_links(root ,tag )
1099+ for (alias in tag_aliases ) {
1100+ add_repo_tag_alias(root ,tag ,alias )
1101+ }
1102+ }
1103+
1104+ add_repo_tag_alias <- function (root ,tag ,alias ) {
1105+ pkg_files <- dir(
1106+ file.path(root ,tag ),
1107+ pattern = " ^PACKAGES$" ,
1108+ recursive = TRUE
1109+ )
1110+ pkg_dirs <- dirname(pkg_files )
1111+ for (pkg_dir in pkg_dirs ) {
1112+ link <- file.path(root ,alias ,pkg_dir )
1113+ mkdirp(link )
1114+ origfile <- file.path(root ,tag ,pkg_dir ," PACKAGES" )
1115+ linkfile <- file.path(link ," PACKAGES" )
1116+ file.copy(origfile ,linkfile ,overwrite = TRUE )
1117+ lines <- readLines(origfile )
1118+ paths <- grepl(" ^Path:" ,lines )
1119+ if (sum(paths )> 0 ) {
1120+ lines [paths ]<- sub(
1121+ " [.][.]/(?=[a-z])" ,
1122+ paste0(" ../../" ,tag ," /" ),
1123+ lines [paths ],
1124+ perl = TRUE
1125+ )
1126+ }else {
1127+ lines <- c(lines ," " )
1128+ entry <- paste0(
1129+ " Path:" ,
1130+ strrep(" ../" , str_count(pkg_dir ," /" )+ 2 ),
1131+ tag ,
1132+ " /" ,
1133+ pkg_dir ,
1134+ " \n "
1135+ )
1136+ lines [nchar(lines )== 0 ]<- entry
1137+ }
1138+ writeLines(lines ,linkfile )
1139+ tab <- read.dcf(linkfile ,all = TRUE )
1140+ write_dcf(tab ,linkfile ,quiet = TRUE )
1141+ }
10991142 }
11001143
1101- create_pak_repo <- function (path = " repo" ,dry_run = FALSE ,cleanup = TRUE ) {
1144+ str_count <- function (str ,chr ) {
1145+ sum(charToRaw(str )== charToRaw(chr ))
1146+ }
1147+
1148+ create_pak_repo <- function (
1149+ path = " repo" ,
1150+ aliases = NULL ,
1151+ dry_run = FALSE ,
1152+ cleanup = TRUE
1153+ ) {
11021154workdir <- package_dir()
11031155if (! file.exists(workdir )) {
11041156 init_package_dir(workdir ,dry_run = dry_run )
@@ -1114,9 +1166,13 @@ create_pak_repo <- local({
11141166 cat(" \n " ,file = file.path(path ," .nojekyll" ))
11151167
11161168for (tag in tags ) {
1117- create_package_repo_tag(root ,workdir ,tag = tag ,dry_run = dry_run )
1169+ create_package_repo_tag(
1170+ root ,
1171+ workdir ,
1172+ tag = tag ,
1173+ tag_aliases = tag_aliases [[tag ]],
1174+ dry_run = dry_run
1175+ )
11181176 }
1119-
1120- file.symlink(" stable" , file.path(root ," dev" ))
11211177 }
11221178})